Upstart: don’t mess with the rc job

Recently I’ve been fiddling a bit with Upstart, and in general I’m positive about the experience. Upstart offers a lot of flexibility and simple but very welcome features like real service supervision with respawning capabilities. There are a few downsides:

Relatively few SysV init scripts have been converted to Upstart jobs. This is logical since there are a lot of scripts to convert and all of them need testing before considering them production ready. That said, the progress over time in this area isn’t particularly overwhelming either.

Upstart is much harder to troubleshoot when unexpected things happen, this is to a degree inherent to Upstart’s parallel/event-based nature. Adding the following options to your kernel parameters does help a bit: ‘nosplash INIT_VERBOSE=yes init=/sbin/init noplymouth -v’.

As far as I know there is no way to have SysV init scripts depend on Upstart jobs. While this was to be expected since this is pretty hard to implement sensibly. But considering my first point (the fact that lots of SysV scripts still have be converted), this can be annoying. My advice, don’t fiddle with the the rc job! I did, and it gave me grief (Upstart hung on reboots), causing me to waste a day figuring out what went wrong. If you need a SysV script to depend on an Upstart job, remove the SysV script and convert it to an Upstart job yourself.

Preseed LDAP via Debconf on Ubuntu Lucid

As some of you may know configuring LDAP on Ubuntu Lucid can be a bit of a pain in the ass, especially getting it consistent throughout your infrastructure. So here’s way to relatively easily configure LDAP via Debconf preseeding.

First install debconf (it’s likely already installed, but doublecheck this):

# apt-get install debconf

Then put the following lines into debconf-ldap-preseed.txt so we can feed it to debconf later (obviously you need to adapt this configuration file to your own situation):

ldap-auth-config    ldap-auth-config/binddn    string    cn=proxyuser,dc=yourdomain,dc=com
ldap-auth-config    ldap-auth-config/bindpw    password    
ldap-auth-config    ldap-auth-config/dblogin    boolean    false
ldap-auth-config    ldap-auth-config/dbrootlogin    boolean    true
ldap-auth-config    ldap-auth-config/ldapns/base-dn    string    dc=yourdomain,dc=com
ldap-auth-config    ldap-auth-config/ldapns/ldap-server    string    ldap://10.10.10.10/
ldap-auth-config    ldap-auth-config/ldapns/ldap_version    select    3
ldap-auth-config    ldap-auth-config/move-to-debconf    boolean    true
ldap-auth-config    ldap-auth-config/override    boolean    true
ldap-auth-config    ldap-auth-config/pam_password    select    crypt
ldap-auth-config    ldap-auth-config/rootbinddn    string    cn=manager,dc=yourdomain,dc=com
ldap-auth-config    ldap-auth-config/rootbindpw    password    
libnss-ldap    libnss-ldap/binddn    string    cn=proxyuser,dc=yourdomain,dc=com
libnss-ldap    libnss-ldap/bindpw    password    
libnss-ldap    libnss-ldap/confperm    boolean    false
libnss-ldap    libnss-ldap/dblogin    boolean    false
libnss-ldap    libnss-ldap/dbrootlogin    boolean    true
libnss-ldap    libnss-ldap/nsswitch    note    
libnss-ldap    libnss-ldap/override    boolean    true
libnss-ldap    libnss-ldap/rootbinddn    string    cn=manager,dc=yourdomain,dc=com
libnss-ldap    libnss-ldap/rootbindpw    password    
libnss-ldap    shared/ldapns/base-dn    string    dc=yourdomain,dc=com
libnss-ldap    shared/ldapns/ldap-server    string    ldap://10.10.10.10/
libnss-ldap    shared/ldapns/ldap_version    select    3
libpam-ldap    libpam-ldap/binddn    string    cn=proxyuser,dc=yourdomain,dc=com
libpam-ldap    libpam-ldap/bindpw    password    
libpam-ldap    libpam-ldap/dblogin    boolean    false
libpam-ldap    libpam-ldap/dbrootlogin    boolean    false
libpam-ldap    libpam-ldap/override    boolean    true
libpam-ldap    libpam-ldap/pam_password    select    crypt
libpam-ldap    libpam-ldap/rootbinddn    string    cn=manager,dc=yourdomain,dc=com
libpam-ldap    libpam-ldap/rootbindpw    password    
libpam-ldap    shared/ldapns/base-dn    string    dc=yourdomain,dc=com
libpam-ldap    shared/ldapns/ldap-server    string    ldap://10.10.10.10/
libpam-ldap    shared/ldapns/ldap_version    select    3
libpam-runtime    libpam-runtime/profiles    multiselect    unix, ldap

Now we feed the above file to debconf:

# cat debconf-ldap-preseed.txt | debconf-set-selections

And finally we need to switch nss to include LDAP lookups:

# auth-client-config -p lac_ldap -t nss

Optionally make sure homedirs are created on login:

# echo -e 'session required\t\t\tpam_mkhomedir.so' >> /etc/pam.d/common-session

One of the other advantages is that this may also benefit future upgrades, since all the settings are preseeded through debconf it’s less likely a future update/upgrade will break your setup. This is purely speculative since I haven’t done any actual upgrades yet.

 

lzma -2

When compressing data we all know we have several options, gzip most commonly used or bzip2 when we need better ratios. Recently we have also seen the introduction of lzma, which is horribly slow by default but gets us amazing ratios.

That said, when compressing your next file, you might want to consider trying lzma -2, it compresses slightly better than bzip2 –best, while still being approximately as fast as gzip –best… Seems like a nice trade off…

Gnoduino FTW

Recently I’ve been re-entering the world of electronics, and more particularly microcontrollers. Back in the day I had some introductory experience with Parallax’s BASIC Stamp, which wasn’t that great. Only recently I discovered the Arduino project, which is absolutely awesome.

The original Arduino IDE is written in Java however, and that makes for poor integration on the Linux platform, particularly with Ubuntu Unity. Luckily enough someone has been busy to do a simple rewrite of the original IDE in Python and GTK, making a fully Linux native IDE, and it’s called Gnoduino, and I even have a PPA for it.

I did a screencast on the general topic of Arduino and the differences between the original IDE and the Gnoduino IDE:


You can also download the video for offline viewing if you prefer.

SSSU for HP Command View EVA

So today I was migrating our HP SSSU utility from an x86 to an x86-64 machine, only to find our I couldn’t execute the utility anymore because it was on a x86-64 machine, I wanted to lookup the version number of the utility to find a matching x86-64 version. So I was too lazy to log onto the old machine, so I used strings to find it’s version number, only to find a crazy surprise:

SSSU for HP StorageWorks Command View EVA
9.2.0
Version: %s
Build: %s
Error closing https connection
Error closing https connection
Total regression differences = %u
Press return to exit
%.6d%c
                           oooo$$$$$$$$$$$$oooo
                      oo$$$$$$$$$$$$$$$$$$$$$$$$o
                   oo$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o         o$   $$ o$
   o $ oo        o$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$o       $$ $$ $$o$
oo $ $ '$      o$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$o       $$$o$$o$
'$$$$$$o$     o$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$o    $$$$$$$$
  $$$$$$$    $$$$$$$$$$$      $$$$$$$$$$$      $$$$$$$$$$$$$$$$$$$$$$$
  $$$$$$$$$$$$$$$$$$$$$$$    $$$$$$$$$$$$$    $$$$$$$$$$$$$$  '''$$$
   '$$$''''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$     '$$$
    $$$   o$$$$$$$$M$i$c$h$e$l$&$R$o$g$e$r$$$$$$$$$$$$$$$$$$$     '$$$o
   o$$'   $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$       $$$o
   $$$    $$$$$$$$$$$$$$$$$$w$e$r$e$$$$$$$$$$$$$$$$$$$$' '$$$$$$ooooo$$$$o
  o$$$oooo$$$$$  $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$   o$$$$$$$$$$$$$$$$$
  $$$$$$$$'$$$$   $$$$$$$$$$$$$$$h$e$r$e$$$$$$$$$$$$     $$$$''''''''
 ''''       $$$$    '$$$$$$$$$$$$$$$$$$$$$$$$$$$$'      o$$$
            '$$$o     '''$$$$$$$$$$$$$$$$$$'$$'         $$$
              $$$o          '$$''$$$$$$''''           o$$$
               $$$$o                                o$$$'
                '$$$$o      o$$$$$$o'$$$$o        o$$$$
                  '$$$$$oo     ''$$$$o$$$$$o   o$$$$''
                     ''$$$$$oooo  '$$$o$$$$$$$$$'''
                        ''$$$$$$$oo $$$$$$$$$$
                                ''''$$$$$$$$$$$
                                    $$$$$$$$$$$$
                                     $$$$$$$$$$'
                                      '$$$''

This is obviously a reference to The Hitchhiker’s Guide to the Galaxy (why?).

Pimping Unity Ever So Slightly

So like many I feared Unity, now having met it, and giving a seriously go I’m slowly starting to like it. And I’m sticking with it for at least a few weeks before passing final judgement. That said, here are a few small tips:

Currently by default the icons in the Launcher are all “backlit” with a background color, you can turn that off, to only have running programs backlit (to make that fact extra obvious). You can make this the system-wide default like so:

$ sudo  gconftool-2 --direct \
  --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
  --type int --set /apps/compiz-1/plugins/unityshell/screen0/options/backlight_mode 1

Next, the Launcher auto-hides whenever you move a window into it (for example maximize a window). I don’t really like that, since I have too much horizontal screen estate anyhow, so I’d like to Launcher to permanently claim it’s space (again as a system-wide default):

$ sudo  gconftool-2 --direct \
  --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \
  --type int --set /apps/compiz-1/plugins/unityshell/screen0/options/launcher_hide_mode 0

Some other tips, you might find handy:

If you want to move Launcher buttons around on the Launcher you need to drag button off before you can move it. This makes moving buttons around a very conscious action, preventing the mouse-challenged people from accidentally moving them around.

Also you might have noticed that left clicking a Launcher button will only start an application once. So for apps you might want to start multiple times like a Terminal you’d need to search for the app to start it a second time, which would be rather time consuming. Luckily the Unity designer thought about this, so left click will start an application once (prevent people from accidentally starting most apps twice). But if you do want to start an app twice or thrice you can just middle click the Launcher button.

And last but not least, this wallpaper may be of use to you.

Crispy Font Rendering On Ubuntu

Like others I’m not a stranger to useless ranting. So regardless of what’s default, some people like their font rendering nice and crispy. Usually you’d go the the Appearance dialog, the Fonts tab, click on Details and select Subpixel Smoothing and Full Hinting.

However, there are two caveats, since new users still get the default fuzzy rendering. Also some apps like to ignore your own font rendering settings to a degree, at times Firefox and OpenOffice.org have been guilty of this (IIRC). They actually seem to use use your system fontconfig settings.

So to change the system wide default font rendering settings for GNOME:

$ gconftool-2 --direct \
    --config-source xml:readwrite:/etc/gconf/gconf.xml.defaults \ 
    --type string --set /desktop/gnome/font_rendering/hinting full

You can change the system fontconfig settings like so:

$ sudo -s
# cd /etc/fonts/conf.d
# rm 10-hinting-slight.conf
# ln -s ../conf.avail/10-hinting-full.conf
# exit

 

Darktable and Ubuntu Natty

For the past few weeks people have been bothering me about when I’ll update my PPAs for Natty… So let me explain my intentions for my PPAs in general.

In general

I have three Darktable related PPAs:

The difference between the Release and Release-Plus PPAs, is that the Release PPA only has the latest Darktable release package plus any dependencies that aren’t in the meanstream repo’s (lcms2 ATM). The Release-Plus PPA has everything the Release PPA has, plus updated versions of Lensfun and Exiv2.

For both the Release and Release-Plus PPA I’ll try to always build Darktable packages for at least the latest Ubuntu release and the latest Ubuntu LTS (Long Term Support) release. Please do note the usage of the word release, I usually do not build for unreleased versions of Ubuntu. And even after a release I need a couple of days to catch up.

The Unstable PPA is more or less my personal (but public) playground. It has a git master build of Darktable for whatever version of Ubuntu I’m personally using. Building packages for multiple versions of Ubuntu that often is just too time consuming. Of course people will say “Why not automate nightly builds?”. First off I think it’s a bit abusive of the PPA build farm, since git doesn’t change every single day. And more importantly there is no quality control on automated builds. I try to keep up on changes in git, and sometimes consciously refrain to push a new unstable package to my Unstable PPA, simply because there is too much risk of breakage. Obviously I do get things wrong from time to time, so my Unstable PPA can break things occasionally.

Now what about Natty

As I started out, I’ve been asked a lot about Natty, often in private e-mail which is uncalled for, since we have darktable mailing lists on SourceForge.

Now, there are some pretty big changes in Natty, and it’s quite debatable if they are for the better. So it’s very likely I’ll skip a release for my own use, which implies the Unstable PPA will most likely continue to be exclusively built for Maverick.

So that leaves my Release and Release-Plus PPA, and there has been build breakage on Natty, which only recently has been resolved. So it’ll involve backporting some patches to the current stable release to make Darktable build at all. I’ll certainly give this a shot once Natty has been released, and if all goes well I’ll quite likely have packages available within a week after Natty’s release. However, if building the current stable release on Natty proves too difficult I might ditch the effort altogether at some point, at least until Darktable 0.9 has been released.

Update

Darktable packages for Ubuntu Natty have been pushed to all three PPAs.

Installing Debian Squeeze on a Yeeloong Netbook

As most of you have already noticed I have a Yeeloong netbook and I read that it’s actually possible to install Debian Squeeze on it, even though Squeeze officially doesn’t support the Yeeloong or the Loongson processor. Fortunately the install doesn’t involve anything too scary. The Debian mipsel binaries are o32 binaries not really optimized for a particular CPU, which means they will run on lots of CPUs (not unlike how the i386 binaries run on most x86 processors). The Loongson 2F processor has all instructions to be MIPS III compliant, which is enough for the Debian binaries. So where is the problem then? It’s with the kernel, Debian doesn’t provide any linux kernel images for the Loongson CPU and even more particularly the Yeeloong Netbook.

Basic Installation

I’ve built a kernel image and kernel package for general use on the Yeeloong which is also capable of booting the Malta Debian installer. To actually use them download all three, and put them in the root of an ext2 formatted USB stick. Then plug the USB stick into your Yeeloong and make sure it has wired Ethernet connectivity. Then start the Yeeloong and press Del during bootup to enter PMON (it’s BIOS alternative). In PMON you need to enter the following commands:

load /dev/fs/ext2@usb0/vmlinux-2.6.38.3
initrd /dev/fs/ext2@usb0/initrd.gz
g

If you use an older kernel you also need to pass the ‘console=tty’ and ‘no_auto_cmd’ parameters to the g command.

If all went well you’ll notice the Debian installer starting, and prompting you with it’s first questions. Select your preferred language, location, locale, keyboard layout, hostname, domainname, Debian archive mirror & proxy information.

If all went well, you’ll notice the Debian installer complaining it hasn’t found any (matching) kernel modules, and it’ll ask you if you want to proceed without. We’ll answer Yes, since everything critical has been monolithically compiled into my custom kernel.

Next, setup your root password and an initial user account.

Now we’re entering the partitioning tool, which will complain with a scary red dialog that my custom kernel is missing Software RAID and LVM support, which we really don’t need. Select continue for both warnings.

Now we’ve really entered the partition tool, and you’ll notice two devices the (probably) FUJITSU 160GB harddisk, and the USB stick, make sure you don’t touch the USB stick (sdc). Then select the FUJITSU (sda) harddisk and press enter, which will effectively erase the whole disk, and reinitialize the disk with a new partition table. The partitioning tool will complain that it does not know the partition table type for the Loongson architecture. Select the familiar msdos partition table type. Next create a new partition, 1GB, primary, beginning, make sure it’s used as the ext2 file system otherwise your yeeloong won’t boot, with a /boot mount point and relatime,sync mount options. When you’re done setting up the first “special” boot partition. We can create a new swap partition: 2GB, primary, beginning, use as swap area. With that done, we can create a new root partition: 17GB, primary, beginning, use as ext4 journaling file system, mount point / , mount options relatime. And last we can create a new home partition: 140GB, primary, beginning, use as ext4 journaling file system, mount point /home, mount options relatime. Now finish and write the changes to disk.

You’ll notice the Debian installer downloading packages and installing them. At some point it will complain no installable kernel was found, and if you want to continue without a kernel. Yes you do.

Now only a few things are left, software selection, where I usually unselect everything, and bootloader installation, where the installer will complain it can’t install any. We don’t care as the Yeeloong doesn’t need a bootloader at all. So we continue.

When we (next) get the “Finish the installation” dialog, we do not continue immediately. Instead we press Ctrl+Alt+F2 and Enter (to active the console). Now we need to manually install a kernel package, to do so enter the following commands:

mount /dev/sdc1 /mnt
cp /mnt/linux-image-2.6.38.3_2.6.38.3-0yeeloong0_mipsel.deb /target/root
umount /mnt
chroot /target /bin/bash
dpkg -i /root/linux-image-2.6.38.3_2.6.38.3-0yeeloong0_mipsel.deb
cp /boot/vmlinux-2.6.38.3 /boot/vmlinux
exit
exit

Then press Ctrl+Alt+F1 to return to the installer and finally press continue to reboot. During the reboot press Del to enter PMON once again, since we need to tell PMON about our new installation:

set ShowBootMenu "no"
set al "/dev/fs/ext2@wd0/vmlinux"
set arg "root=/dev/sda3"
reboot

Now you should see your Yeeloong reboot again, and booting into your new Debian Squeeze installation.

Installing extra utilities

Your new clean installed Debian system isn’t very useful yet, so you’ll need to add some extra software. One of the things I usually do is disable the installation of “Recommended” packages, these are a kind of soft dependancy, this is how packages pull along other packages which aren’t strictly required, but are usually nice to have but sometimes are utterly useless (and clutter up your system). So to disable the automatic installation of Recommends do the following as root:

echo 'APT::Install-Recommends "false";' > /etc/apt/apt.conf.d/99synaptic

Whenever you install a new package apt will tell you what it’s Recommends would have been, I highly recommend you to inspect the Recommended packages to see if they would be useful to you.

Now, let’s install a bunch of packages I always like to have handy:

apt-get install alsa-base alsa-utils autoconf automake build-essential \
                libncurses5-dev autotools-dev binutils bison \
                busybox-static bzip2 cdbs command-not-found coreutils \
                cpio curl debhelper devscripts dpkg-dev fakeroot file \
                findutils flex fortune-mod fortunes-debian-hints g++ \
                gcc gdb gfortran git-core gnupg gobjc grep gzip \
                iproute less lftp links lsof m4 make mtr-tiny nano \
                openssh-client patch pciutils usbutils procps psmisc \
                quilt rsync screen sharutils sl smartmontools splint \
                subversion sudo telnet tftp-hpa unzip util-linux wget \
                wpasupplicant xz-utils

This will take a while to install, but it’ll leave you with a very functional base system.

Installing Basic X11

Before installing X11 there are a couple of considerations. First I would highly recommend using my optimized pixman packages (though Debian’s own pixman will work). Next you’ll have to choose between an optimized SiliconMotion driver and using Xorg via the kernel framebuffer. If you need video playback you should use the optimized SiliconMotion driver, if you don’t you might want to consider sticking with the linux framebuffer driver, since with it, tty switching will be smoother, and you won’t need patched Xorg packages. And last but not least you’ll need to choose a login manager. I highly recommend SLiM, though Debian’s version is a tad buggy, I have a fixed package available as well (with GNOME Keyring integration for Network Manager).

My repository has the following mipsel components available: linux, pixman, slim, thinice, ufraw, xorg. To use my repository with the optimized pixman, fixed SLiM login manager, my customized ThinIce theme and updated ufraw, execute as root:

echo 'deb http://debian.pcode.nl/debian squeeze linux pixman slim thinice ufraw' > /etc/apt/sources.list.d/pcode.list
apt-get update
apt-get install xserver-xorg xserver-xorg-input-evdev \
                xserver-xorg-input-mouse xserver-xorg-video-fbdev \
                slim

Installing XFCE

Now we have a very basic X11 setup, we probably want a decent desktop environment as well. To get a basic but functional XFCE installation:

apt-get install xfce4-panel xfce4-session xfce4-settings xfce4-terminal \
                xfce4-utils xfdesktop4 xfwm4 xfwm4-themes thunar \
                network-manager-gnome libpam-gnome-keyring thinice-noble \
                gnome-noble-icon-theme gnome-keyring seahorse gtk2-engines \
                ttf-liberation ttf-dejavu-core gsfonts ghostscript

If you like my old school UNIX like ThinIce-Noble theme, you can download my skel files here, and install them to be used with newly created users:

cd /etc/skel
tar zxvf /root/xfce-thinice-noble-skel.tar.gz

Installating Applications

Obviously without applications your new desktop is useless, just some quick tips:

apt-get install iceweasel geany abiword xarchiver
apt-get install gimp gimp-plugin-registry gimp-resynthesizer gimp-ufraw
Have fun.

ThinIce Noble (Compact)

On my Yeeloong netbook I’m running XFCE because it’s a tad more lightweight than GNOME. Considering the Yeeloong’s resources, a lot of modern themes can be a bit heavy, so after some testing I went with the ThinIce theme. Out of the box the ThinIce theme isn’t so great. Firefox/Iceweasel don’t look so great with it (an issue with text field background colors). The scrollbars are too thin. The gray isn’t neutral (this is a personal pet-peeve). And the default blue selection color isn’t too my liking too. The main problem with the default blue selection color is that there is no matching icon theme. So I went with the GNOME Noble icon theme and took the icon’s theme’s base purple tint as as a selection color for ThinIce. The next problem which is true for pretty much all GTK themes is that they waste a lot of screen real-estate, which is actually a good thing is you have a big display, big buttons and lots of spacing makes things look good and easier to use. However on a netbook this isn’t soo great. So I had to shrink down my ThinIce theme a bit. The result:

If you like the theme, you can get the sources here, and a nice architecture independent Debian package here. I’ve even put the configuration files online here, which you can put in your /etc/skel to get everything configured by default for every new user which is added to your system.