How I learned to not worry and love systemd (sort of)

I wrote this little piece originally on June 25, 2013 but did not push the publish button because I think it is incendiary, in more of one sense. But…

I’ve decided to continue adding to and editing this little piece: we’ll see how it ends up.

Systemd is truly a remarkable piece of technology (add sarcasm). In the beginning I was skeptic for two reasons:

a.) I tend to orthodoxy when it comes to the core. I started using old skool init more than 28 years ago and it was with *real UNIX®*; at some point I even deemed SysV init style startup scripts the work of the devil. Ha! Like I miss BSD 4.2 System 7 init scripts! Everything mashed up in one single 5000 line shell script, *shudder*. Before I go tangential into a rant that is truly for another day, let me say this: All those weenies that say “FreeBSD start up scripts are the simplest and coolest thing since sliced bread” are a bunch of Christmas geese[1].

b.) I’ve my share of battle scars with “advanced” init systems. Ever had to write a startup script for HP-UX? AIX? What about that horrid abomination Sun Microsystems (R.I.P.) invented for Solaris (their SysVR4/BSD FrankenUNIX)? Startup scripts written in a horrible dialect of XML? Honestly, I suspect SMF was written in the middle of a Colt 45 and crack brogrammer frat binge.

Then when Canonical pulled upstart out of the hat (or should I say, arse?), I certainly put attention. I was already a user of Ubuntu, though not a convert. I had the chance to exchange a couple of mails with Shuttleworth when the planning and design of the PPA system was in swing and he came across as a narcissistic know-it-all. In fact, I was vindicated some years later when the man had to do exactly what I told him: People need the option to have several PPAs under the same account, particularly if they are a project that hosts in Launchpad. There and then I decided I was not invested enough in Ubuntu nor would I be ever. I just kept using it because it was the best GNOME experience at the time. And I stuck until they moved to unity. After some time back with Debian (my first real comfortable desktop GNU/Linux in the 90’s after all the false starts with Slackware and its predecessors), I moved to Fedora but found it was inherently unstable in my hardware, due to the serial patching to all software, something that also breaks many things in Debian. So I ended up using Arch, clean not-patched source code, and there I met systemd close and personal.

I was happy with the simplicity of the original scripts Arch used to boot with SysV init although I was very aware of the ugliness of the back-end. When the developers announced that they were planning to replace it with systemd, I was not enthusiastic even for a moment; why change something that works even if it is half-broken? Luckily, they took their time to implement it. In the end it took the longest part of a year to replace the old init with the new. I was wary it would have a negative impact on me and the distro (in that order; I’m selfish, so what). I decided to plunge in and install the test packages to have a go while I still could fall back into the old init system.

At first I was totally astounded. It wasn’t as anything I’d seen yet, so naturally I was very unhappy. I didn’t understand the whole damned thing and even the man pages seemed to be written in classical Cantonese. But digging through the supplied service files while reading the manual pages and the articles published by the authors made my mind click and after some months I began to like and appreciate the simplicity and power of expression of the systemd configuration system.

But not everything is wine and roses, I was perplexed when the systemd project subsumed udev and the efforts of late that make the project the only source of basic parts of user-space plumbing. I wonder if this can create a single-point of failure considering the questionable quality of core parts of systemd’s source code (the parts written by the two main developers!). I can see why a few very shouty people make such ruckus, but to be honest, those making the most noise are the most ignorant, thus the most damaging. They drown in their noise the voices with valid concerns expressed by knowledgeable and reasonable people who don’t need to resort to violence to express their opinions and ideas. In the end if systemd becomes unmanageable and quality plummets, there is always the option of a fork. I stay open to change, but I am keeping an eye on Void Linux.

Why Void Linux? Well, because they are the first to have the cojones to go their own way and adopt a different init: runit. Now, runit has been around for 11 years, and there are other tools as old or older that try to address the init and the PID 1 problems, that is both the problem of being the first process that starts everything else and that of process supervision; problems that are to some extent orthogonal. Dan Bernstein’s daemontools or monit address the second problem; tools like OpenRC, runit and s6 address both. You can read about many more in this research paper.

These are interesting times in Linux land to live in. I am enjoying the show from the peanut gallery and to all those who shout madly and throw tantrums I have this to say: Go forth and create your own Linux distribution; why didn’t you do it 4 years ago when Poettering showed up with this thing you hate? The owner of Distrowatch will be grateful and perhaps the 5 fools that end up using it. But believe me, those 5 fools will be all a bunch of self-entitled ungrateful bastards that will make you consider suicide as an honorable exit. If you can’t create your own distribution that works as you see fit because of your technical inaneness, why don’t you try PC-BSD? Sorry, it doesn’t run in computers bought 2 years ago, but  who cares? ZFS is way cool!!

[1] If you lost the reference, it means they are full of shit.

Trolling Requires Quality

I’ve found “Things that BSD owes GNU/Linux | BSD, the truth” a most amusing read. Most of the write ups have the ring and weight of truth, but it is unfortunate that:

a.) The author enjoys personal attacks and character assassination, too much. It is immature and destroys whatever real arguments he/she may present in his/her rants.

b.) The author’s first language is not English and the command is poor. I suspect poor knowledge of his native language as well. Hey! Not all of us have a sound literary education. Unfortunately it shows in the incoherent expression of ideas. This removes credibility. A lot.

Static network IP with systemd

One of the few real hurdles I’ve found with systemd is setting up a static network configuration. This is a solution that cuts the middleman, be it ifupdown, netcfg, NetworkManager or wicd and uses systemd to do it. This comes originally from the Archlinux Wiki on systemd services, but it seems to be deleted and reinstated at the whim of some God entitled pedant so you may not find it there tomorrow.

Make sure that iputils2 are installed. Create a service file network-static.service and a confguration file network-static as shown below and install in the suggested places. Then enable the service with systemctl:

;; /etc/systemd/system/network-static.service
Description=Static Network Service

ExecStart=/usr/sbin/ip link set dev ${IF} up
ExecStart=/usr/sbin/ip address add ${ADDR}/${NM} broadcast ${BC} dev ${IF}
ExecStart=/usr/sbin/ip route add default via ${GW} dev ${IF}
ExecStop=/usr/sbin/ip addr flush dev ${IF}
ExecStop=/usr/sbin/ip link set dev ${IF} down

;; /etc/conf.d/network-static

And that’s all there is to it.

Creating a MPEG2 file with mencoder

Note to self: This is a reminder and follow up on the previous post of how I managed to reencode an AVC1/AC3 video in a Matroska container to a DVD-ready MPEG2 file with the original AC3 sound in a MPEG container (VOB), just like DVD authoring tools like their files (no sign of players supporting h.264 where I live yet, else…).

mencoder the_darned_movie.mkv -sub -utf8 -subfont-text-scale 3.3 -subpos 96 -oac copy -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=5000:mbd=2:trell=yes:gmc=yes:aspect=1.83/1:vpass=1 -of mpeg -mpegopts format=dvd:muxrate=24000:tsaf=yes:interleaving2=yes:vframerate=25 -noskip -o /dev/null

and then the actual encoding (make sure to copy the log file from the first pass somewhere safe just in case):

mencoder the_darned_movie.mkv -sub -utf8 -subfont-text-scale 3.3 -subpos 96 -oac copy -ovc lavc -lavcopts vcodec=mpeg2video:vbitrate=5000:mbd=2:trell=yes:gmc=yes:aspect=1.83/1:vpass=2 -of mpeg -mpegopts format=dvd:muxrate=24000:tsaf=yes:interleaving2=yes:vframerate=25 -noskip -o the_darned_movie.mpg

I made a couple of fix ups, such as converting the srt file to UTF-8, with gaupol. As well, lavf output doesn’t support VOB output as it was my first idea and to make things worse, it is broken as per program output (MPlayer SVN-r31918 a.k.a MPlayer 1.0.rc4). But, the MPEG muxer supports VOB, yay!

Creating a MPEG4 with subtitles using mencoder

Note to self: This is a reminder of how I managed to reencode an AVC1/AC3 video in a Matroska container to a low-profile MPEG-4 (aka “XViD” or “DivX”) video with the original AC3 sound in an AVI container, just like modern video players like their files (no sign of players supporting h.264 where I live yet).

mencoder the_darned_movie.mkv -sub -utf8 -subfont-text-scale 3.3 -subpos 96 -aspect 2 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell=yes:v4mv=yes:aspect=16/9:vbitrate=1200:vpass=1 -o /dev/null

and then the actual encoding (make sure to copy the log file from the first pass somewhere safe just in case):

mencoder the_darned_movie.mkv -sub -utf8 -subfont-text-scale 3.3 -subpos 96 -aspect 2 -oac copy -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell=yes:v4mv=yes:vbitrate=1200:aspect=16/9:vpass=2 -o the_darned_movie.avi

I made a couple of fix ups, such as converting the srt file to UTF-8, with gaupol.

Hacking Debian’s Desktop Default

Changing the desktop default after installing Debian without giving it a second thought is a pain if one is not very familiar with debconf (a.k.a., the spawn from hell, second only to Solaris’ SMF oh, how I loath thee —until I get close to some iron with AIX inside anyways.) You love The Debian Way(tm), and you strive to always use it despite all odds. And what odds! There is no easy and obvious way to change the default desktop in a Debian system[1], just the following:

echo "tasksel tasksel/desktop string xfce" | debconf-set-selections

[1] Yes, I’m bitching too much, but how do you expect a luser to do this without suffering a heart attack? Wait I use Debian, not Ubuntu. Thank you $DEITY!

Using Mozilla Weave, a.k.a. Firefox Sync with SELinux

Note to self: SELinux is a horrid kludge (not the idea, but the implementation) for the cold-war paranoid and it is time already for Torvalds to accept AppArmor into the main branch and for a major distribution’s developers to get their act together and at the very least provide TOMOYO, SMACK and AppArmor as first class alternatives with a working policy set and and not some sort of red-haired stepchildren a new user cannot use because they need to be integrated semi-automatically at best. Even if Debian provides ways of dealing with the kernel patching, it isn’t trivial. (I know this may not be possible because the original security subsystem design isn’t stackable; or it wasn’t the last time I checked).

In the meantime, and considering I use Fedora these days, I’ve run into  a problem using SELinux. When trying to use Firefox Sync, previously known as the artist called Mozilla Weave, SELinux blocks the cryptographic library bundled with the extension. The solution is to edit /etc/selinux/targeted/contexts/files/file_contexts.local and add the following line to the file (be careful, only do it if you know what you are doing):

/home(/.*)?/.mozilla(/.*)?/components/    system_u:object_r:textrel_shlib_t:s0