Centos Chroot
tags: centos chroot linux
12 Dec 2017 19:49
Let's say you want a chroot with CentOS with an older version of the system to test something.
Get the minimal root fs
- Check out Docker images for CentOS: https://hub.docker.com/_/centos/
- Follow the Dockerfile link for the version you're interested in, say 6.6: https://github.com/CentOS/sig-cloud-instance-images/blob/8911843d9a6cc71aadd81e491f94618aded94f30/docker/Dockerfile
- Go one level up in GitHub and locate the centos-*.tar.xz file, it's the archive with the mininal rootfs for CentOS: https://github.com/CentOS/sig-cloud-instance-images/blob/8911843d9a6cc71aadd81e491f94618aded94f30/docker/centos-6.6-20150304_1234-docker.tar.xz
- Click the download link
Prepare a directory, unpack the root fs
sudo mkdir -p /mnt/centos-chroot/
# You may need to uncompress the XZ file, but my tar could deal with it, so try yourself:
sudo tar -xf /path/to/centos-6.6-20150304_1234-docker.tar.xz
# Mount some pseudo filesystems:
cd /mnt/centos-chroot/
sudo mount --bind /sys sys
sudo mount --bind /dev dev
sudo mount -t proc proc proc
Enter your precious chroot:
sudo chroot /mnt/centos-chroot/ /bin/bash
. /etc/environment
Done!
Comments: 0
Getting Used To Mac (or not really)
tags: mac
11 Oct 2017 19:32
Starting October 3rd I've been using a Mac. This has been very challenging and here are a few reasons why (and how to fix it).
Touch Bar
The keyboard is equipped with the amazing piece of technology called Touch Bar. What is it? It's a replacement for the top row of the keys on the keyboard. What's wrong with this?
*Firstly*, the buttons on it are displayed. You need to touch them, not press. This means a lot of accidental actions done.
*Secondly*, the buttons displayed change depending on the application running. This means you need to LOOK at the keys before you can "press" them. Not sure about you guys, but I think looking at the keyboard is LAME.
*Thirdly*, when running some programs the things displayed on the bar change with every key press. This is very annoying. Example: iTerm.
How to solve: unfortunately you cannot disable Touch Bar, but you can configure it to only show the functional keys. You take away the customizability of it for the applications so the buttons shown are always the same.
Unfortunately this still means you press a lot of those keys accidentally, so to solve the other part of the problem: use an external keyboard.
Keyboard continued
Touch bar is just one thing that's wrong with the keyboard, there are more things.
This is highly subjective, but the keyboard is very unpleasant to type on. It feels very plasticky.
There are no "Home" and "End" buttons on the integrated keyboard. Even if your external keyboard has the Home and End buttons (and other useful stuff like Page Up/Down), which is better do, those work in a very weird way: Home takes you to the beginning of the document, End to the end, rather than to the first and last character of the line. There's a bit of trickery you can do to "fix" that thankfully, but the default behavior is just broken.
I treat my work and my health seriously. My work involves typing on a keyboard and that can involve serious injuries. That's why it's important to use ergonomic keyboards. Those keyboards tend to have PC layout rather than a Mac layout. What does it mean? The layout of the lowest row is like that: Ctrl, Win, Alt, Space, Alt, Menu, Ctrl. On Macs your layout is this: Ctrl, Option (alt), Command (win), space, Command (win), Option. On a PC the convention is the right Alt is for typing local characters, for example Alt+a = ą, while the left Alt is for shortcuts. On Macs both Options work the same way. The problem with this setup is you can't easily switch between keyboards, because you'll quickly start hitting Command+a instead of Option+a which selects everything in your text field. Super annoying, so what you need to do is to remap your internal keyboard to switch Command and Option keys. If you wanted to "fix" your external keyboard instead you're going to re-learn typing your local characters with your left Windows key, because there's no Windows key on the right side…
As some of you may know, I type on a keyboard using the Dvorak layout. On Macs this mean I can only type in English… There's no Polish Dvorak… Unless you load a custom keymap, which binds ź to Option-x instead of Option-w which is just next to Z… Thankfully you don't use ź that much.
Mouse / Touchpad
There's a controversial setting for your mouse and touchpad named "Natural" scrolling, which is really "reversed" scrolling, i.e. it reverses how the scroll used to work on both touchpad and mouse. While I agree the "Natural" scrolling makes sense for touchpad, and I'd like to use that, that setting also reverses the scroll behavior for your mouse. ANNOYING! You need a separate program running in the background to allow you to control both settings separately. It's called "Scroll reverser".
Playing with windows
A bunch of annoyances related to window positioning. There's a Command+Tab shortcut for switching applications and Control-Tab shortcut for switching tabs in a window. But how do you switch between windows of the same application? (Say you have a few browser windows). There's another keyboard shortcut for that. Don't worry. There's no setting to merge window and application switcher though.
I expect the application to hide when I click on the application icon in the dock. What happens? Nothing. Great. But hey, there's Command+h shortcut for this. (Also annoying if you're used to using Ctrl-h shortcut and also started "naturally" using Command instead of Ctrl for some shortcuts).
Slowness
Macs take forever to (re)boot. Even with SSD, ultra high performance CPU and software carefully trimmed to the hardware (or the other way round). It takes very long to reboot your computer. Thankfully you don't need to do that daily, but once you want to do this, you're gonna have a lot of waiting.
When I click my Terminal icon on an older Linux machine, my terminal window pops out and shows me my prompt sign immediately (I mean everything happens below 200ms from the click). On my Mac it may take 3 seconds from the window opening to showing the prompt. This depends on the system load, but it's definitely not as snappy as one would expect from a top-tier PRO computer.
Ports
Remember I needed to connect an external keyboard? It so happens it's a wireless keyboard with a very slim radio transmitter you put to your USB port and your laptop now has a very subtle bump. Well, that is, if your laptop has any USB-A ports. If you have a Mac, you'll need a 10-cm long adapter for your transmitter. Bravo! Obviously you also need an adapter if you want to connect your screen to a display, because the laptop doesn't have an HDMI port either.
Summary and some good things
Summing up, the machine needs a lots of customization to make it work sensibly. Switching from using Ctrl for most shortcuts to Command is not that bad and has one big up-side. In your terminal applications, you can use the same Command+c, Command+v for copy/paste as in the other applications and Ctrl+* for your regular in-command-line shortcuts (Ctrl+c, Ctrl+z, etc). There's no conflicts like in Linux (where the copy is done with Ctrl+Shift+c instead).
Also because the laptop is powered with USB-C, I can use my laptop charger to charge my USB-C phone!
Comments: 3
Server Commander
tags: automation cron jenkins linux travis
12 Jul 2017 04:46
Here's a problem I'd like was already solved:
Be able to manage and run "tasks" on a Linux server. More specifically:
- There should be a WEB interface where:
- I could define commands or tasks that the server is capable of doing
- I could schedule tasks to run at specific times (like cron)
- The tasks/commands should be (optionally) parametrized
- The tasks/commands should be (optionally) stored in GitHub and/or a database
- The task runs should not overlap with each other (i.e. when the previous run is still in progress don't start the new one) — configurable
- The task configuration should include:
- the command to run
- task timeout — the task should be killed after the specified time
- environment variables to set for the task
- max CPU/memory/disk to use (optional)
- number of times to retry on failure
- what to do on success and failure — e-mail, webhook and trigger another task
- directory to run the command in: I can specify one, or a temporary one is created for each run and cleared after the run
- user to run the command as: I can specify one, or a temporary user is created for each run and cleared after the run
- The task run view should include
- colored command output
- command exit code: OK/FAIL
- resources used by the task (optional)
- time the task took, time the task started and ended
- environment variables
- link to next/previous run and a button to re-run
- The code should be free and open and extremely easy to install
- There should be an error log in the UI to track all the jobs failures
- Misconfigured tasks should not take the machine down — there should be some level of monitoring — don't start new jobs when load is high or disk is almost full, etc
- One should be able to have a nice dashboard with selected tasks for easy launching
What I describe here is to some extent already covered by some of the following:
- Jenkins https://jenkins.io/
- Travis-CI https://travis-ci.com/
- Rundeck http://rundeck.org/
- Minicron https://github.com/jamesrwhite/minicron/
Here's what's wrong with them:
- Jenkins' UI is to complicated for simple tasks, also it feel very heavy
- in Travis-CI you specify the tasks in your code, not in Travis, also it's not software you run locally
- My experience with Rundeck is it doesn't work out of the box, I could debug it, but I didn't want to, also UI is a bit too complex
- Minicron is way too simple and (currently) only allows you to run jobs through ssh (not locally)
To reiterate I'd like:
- A web UI for cron, that's also
- a bit like Jenkins in a way you can see the output of each of the command runs
- and have ability to sandbox the processes it runs
- looks nice and is easy to install and doesn't require maintenance
Comments: 3
How To Disable Kinetic Scrolling On Linux
tags: geek linux
14 Feb 2017 04:44
I spent more time than I wished searching for how to disable kinetic scrolling on Linux. Here's the spell:
$ synclient CoastingSpeed=0