DHCPd failover

Last week, I set up two dhcpd servers in a fail-over configuration. The goal is that when one DHCP server goes down, the other one takes over so that clients don’t lose their network connection. I read different tutorials on the web, such as this one of a fellow blogger and this documentation published by IBM.

Continue reading “DHCPd failover”

Server migration to Debian

Since this afternoon, this server is now running Debian GNU/Linux Squeeze. Just like the previous system, this is a KVM virtual machine running on a HP Proliant DL185G5 host. The host server has always been running Debian. This was my last production system still running Mandriva. I might have forgotten to move over a few things or there might be some breakage somewhere, so let me know if you encounter a problem.

Why prefer Debian GNU/Linux over another distribution

Quite some time ago I wrote a blog post explaining why I preferred Mandriva over other distributions. But I have now switched to Debian GNU/Linux, so it is time for an update. I will mostly compare with Mandriva because that is where I come from and what I know the best, although most points are rather universal.

So, these are some reasons why I prefer Debian GNU/Linux over other distributions:

  • All officially released Debian GNU/Linux stable versions are supported for a long time. Where most other free distributions are supported for about 1,5 year, this is much longer for Debian stable. For example, security updates for Debian Etch were published up to about 3 years after its release.
  • Debian is more stable than most other distributions. This is due to the large amount of testers and due to Debian’s unique development model: the “unstable” branch contains only software which is considered stable upstream (with a few generally accepted exceptions). When a package is in “unstable” for 10 days without new release critical bugs it gets moved to the “testing” distribution. The stable releases are a snapshot of the testing distribution after a freeze during which all release critical bugs are fixed. Releases of the stable distribution are not time driven: the stable distribution is only released when it is really ready.
  • By using apt pinning it is possible to easily mix and match packages from different repositories so that you can run the latest version of specific applications. Apt pinning can be used to pick packages from the extensive backports repository or to install packages from the testing, unstable and even the experimental repositories without having to update your whole system to the same release (unlike Mandriva for example, and as far as I know the same is true for other distributions like Fedora). Instead, carefully defined dependencies will make sure that all packages which need to be updated together are pulled in, resulting in a working system.
  • Due to Debian’s development model it is possible to run a pretty up to date system at any time without sacrificing stability by using the testing distribution. I am now running Debian Lenny testing different systems for more than a month, with software which is often more up to date than in Mandriva 2010.1, yet the system is much more stable in general than my systems which were running Mandriva 2010.1.
  • Debian is fast. Debian Squeeze boots up very fast without hacks like Mandriva’s speedboot, readahead or preload. Also application start up is very fast. I am not really sure why this is the case, but my guess is that this is due to Debian’s simplicity: it does not install too much daemons and boot up scripts by default. Also Debian uses dash instead of bash for /bin/sh, which also results in faster boot times. Shutdown also feels faster than what I was used to in Mandriva.
  • Debian is secure. Because stable versions are supported for about 3 years and because security updates get released very fast. Debian also plays a rather active role in fixing security problems. For example, Debian’s webkitgtk maintainer searched for all webkit security patches and ported them to the webkitgtk 1.2 branch. The fixes were included in Debian’s webkitgtk and then were also included upstream in webkitgtk 1.2.3.
  • Debian is available for lots of platforms. You have an old PowerPC based laptop, a GuruPlug or OpenRD system with ARM processor or a SUN UltraSPARC server? Debian will run on all these systems.
  • Debian values freedom. Debian allows me to use my GNOME system without PulseAudio without loosing my volume applet in the panel (like was the case in Mandriva). But of course, if you want PulseAudio it is available and you can install it. Debian is not exclusively tied to the Linux kernel: there exist versions with a FreeBSD or even HURD kernels. The choice is up to you. Debian uses the Exim MTA by default but if you do not like this, other MTA’s are available and are equally well maintained and integrated into the distribution. Debian does not include non-free software by default, so that you can safely use distribute and even modify the software in all possible situations without having to worry about the license. But if you want to use non-free software, it is available in the non-free repository.
  • Debian is very “standard“. It does not replace standard components by its own implementations like especially Ubuntu is doing. That means that Debian does not use non-standard things like Upstart, notify-osd or indicator-applet by default or does not move the window decoration buttons to the left side. Of course if you do want to use these csutomizations, they are all available (Debian values freedom!), but by default Debian prefers to use the standard upstream software. This ensures the best compatibility with upstream now and in the future, because all these non-standard Ubuntu things might cause conflicts later on with new upstream design decisions.
  • Debian is not owned by a commercial organization. The free distribution is not some kind of crippled version of a commercial product which has all features and software available. It ensures also that decisions are not taken based on commercial interests, but only in the interest of the community. If you do want commercial support, there are many companies supporting Debian all over the world.

Related to that: today is Debian’s 17th anniversary and Debian Appreciation Day. If you use Debian, let the Debian community know you appreciate their work http://thank.debian.net.

Debian on desktop systems

What I expected to happen some time ago, is finally becoming reality: Debian is now my favourite distribution for desktop systems.

First I installed Debian on my new Samsung N210 netbook and I was very pleased with the result. Shortly after that, my father experienced a bug while trying to print in Firefox on Mandriva 2010.1. It would fail to print and there were errors related to ps2ps (if I remember correctly) in the Cups log, hinting at some bug in Ghostscript. Actually it was not the first time this bug hit us, I had seen the same problem some weeks ago.

As analysing and having this bug fixed would likely take a lot of time and I needed a rather quick solution, I though it was the right time to reinstall this system with Debian Squeeze (testing). Debian has many additional bug fixes in its GhostScript package so there was a fair chance that printing would be working better. So I did the same as with my netbook last week: I set up PXE booting to start the Debian installer (easier than digging up a CD-R, downloading an ISO and burning it), and then I installed Debian on the disk, leaving the old /home logical volume intact.

Continue reading “Debian on desktop systems”

Samsung N210 netbook on Debian GNU/Linux

With the upcoming holidays in sight, I could not resist buying a netbook system to take along with me on my travel to Italy. So yesterday, I received a brand new Samsung N210.

I chose this system because it is not too expensive and it appeared about the best netbook in this price class according to many reviews. Especially the battery time, keyboard and matte screen are praised a lot. It also seemed to work nice in Linux, which was of course also an important requirement.

I have removed the Windows 7 Starter edition which was installed on this system and installed Debian GNU/Linux Squeeze (currently testing) on it. I decided to go for Debian because it is quickly becoming my favourite distribution, now that Mandriva has all kind of difficulties keeping up with innovation and I fear that its future does not seem too bright.

I booted the Debian installer using PXE. So on my DHCP server, I added this in dhcpd.conf:

group {
  allow bootp;
  next-server 192.168.100.1;
    filename "/pxelinux.0";
    host samsung-n210 {
        hardware ethernet xx:xx:xx:xx:xx:xx;
        fixed-address 192.168.100.10;
    }
}

With 192.168.100.1 being the address of the TFTP server (the same host as the dhcpd in my case).

I installed tftpd-hpa and xinetd, and created this tftpd file in /etc/xinetd.d:

service tftp
{
   socket_type   = dgram
   protocol   = udp
   wait      = yes
   user      = root
   server      = /usr/sbin/in.tftpd
   server_args   = -p -v -v -v -s /var/lib/tftpboot
   disable      = no
   flags        = IPv4
}

Then I dumped the contents of netboot.tar.gz of the Debian installer daily builds for AMD64 in /var/lib/tftpboot. Then set up the N210’s BIOS to enable PXE booting and set the network card as first boot device and you should get into the Debian installer.

I had some trouble with the network connection bailing out after some time, but after a few attempts at least I succeeded in installing the Debian base system without X and the system booted correctly. Maybe I was just using a bad network cable.

I installed the gnome-desktop-environment package with apt, which also pulled in X. The graphical environment was working perfectly fine out of the box without any manual configuration needed. Also the webcam was working fine out of the box with Cheese.

The wireless network card works fine once you install the firmware-linux-nonfree package from the non-free repository and to get a nice GUI to connect to wireless networks, I installed network-manager-gnome. Then connecting to my wifi AP protected by WPA2 was a piece of cake and the wireless connection works perfectly stable too.

Actually the only minor problem I met is that the brightness keys are not working. There is a documented solution available to change the brightness (execute # setpci -s 00:02.0 f4.b=ff for maximum brightness).

All in all, I am very happy with this system. Even though it has a 5400 RPM hard drive, which feels a bit slowish during the installation, and has only 1 GB RAM, the system is very fast during normal use in GNOME, especially if you use some more lightweight applications (for example Epiphany or Chromium as web browser). Also with a few adaptations to the desktop and application settings, the small resolution is not really a problem. But maybe I will write some more details about this in a later post.

Making your mixed KDE and GNOME desktop look cool

Most people use a mix of QT/KDE and GTK+/GNOME applications on their Linux system. Because both QT and GTK+ use their own widgets (which are all GUI elements, like buttons, toolbars, menus, checkboxes, etc…) and theme engine, QT and GTK+ applications look different from each other. This is especially bad if you use KDE in Debian: in that case by default no GTK+ theme is configured, making GTK+ applications, like Firefox, look like ugly Windows 95 applications. Mandriva on the contrary does use a common graphical theme for both GTK+ and KDE applications (called Ia Ora), but it’s not easy to change the GTK+ theme if you use KDE or the QT/KDE theme if you use GNOME.

Here’s a howto for Debian and Mandriva which explains how to make your desktop look nice if you’re using a mix of KDE and GTK+. Because Ubuntu is based on Debian, this howto might also apply to Ubuntu, but I have not verified this.

Pre-requisites

I assume that you are running either Debian Squeeze (testing) or Mandriva 2010.0 or a more recent version of these distributions. For Mandriva 2010.0, you also need to have activated the Backports repositories. You can activate them in the Mandriva Control Centre – Software Management – Configure media sources.

Using GTK+ applications in KDE

If you want to use a unified look for KDE and GTK+ applications, then I recommend using the QtCurve theme. Just like Mandriva’s Ia Ora, it consists of a theme engine for KDE and another one for GTK+ which looks exactly the same.

In Mandriva you install the kde4-style-qtcurve package. If you have urpmi’s “suggests” support enabled (it is by default), then this will automatically pull in both the KDE 4 and the GTK+ theme, and also systemsettings-qt-gtk, a tool which lets you choose the GTK+ theme to use in KDE.

In Debian you need the packages qtcurve and also system-config-gtk-kde to set up the GTK+ theme.

Once you have installed all packages, you can start KDE’s System Settings and go to Appearance. In the Style page, you can choose the theme to use in KDE applications, while in GTK+ Styles and Fonts, you select the theme used by GTK+ applications. If you choose QtCurve in both, KDE and GTK+ applications will look very similar and even use the same KDE icon set.

The QtCurve theme comes with different pre-defined styles. If you don’t like the default look of QtCurve, go to System Settings – Appearance – Style, and click on the Configure… button next to the QtCurve widget style box. Under the button Options there, you find the list of predefined styles.

Of course you can also further fine-tune the theme by going to the Colors and Windows pages in System Settings – Apperance, where you can choose a colour set and window manager theme to your liking (QtCurve has a matching colour set and window manager theme, but of course you can choose something else if you want).

Using QT/KDE applications in GNOME

If you are using GNOME and want to make QT and KDE applications look like all GNOME applications without using Ia Ora, you have to run the qtconfig application. In both Mandriva and Debian, you need to have the qt4-qtconfig package installed. Then in qtconfig you select GTK+ as the GUI style to use. If you run KDE applications, you will also need to set the KDE theme to GTK+. This can be done by running
$ kwriteconfig --file kdeglobals --group General --key widgetStyle gtk
in a terminal window. Before executing this command, you will need to have the kdebase4-runtime package installed in Mandriva or kdebase-runtime in Debian.

Debian Squeeze running KDE with the QtCurve theme.
Debian Squeeze KDE 4.3 running Dolphin and Iceweasel (Firefox) 3.5 with the QtCurve theme (Shiny Glass style), Slim Glow Plasma theme and desktop effects enabled.

Server migration

Since two days, I have merged the main servers used by two research laboratories at work. One server was an old Linux server which really needed a hardware upgrade, and the other one was a Mac Pro machine running a flaky OS X Leopard. The new server is of course running Linux: Debian Lenny.

It was a very interesting experience: working out procedures to migrate the mailboxes (from Dovecot on the Linux server and Cyrus on the Mac server to Cyrus on the new server), finding out how to set up one NIC in two different subnets (especially the routing is a little bit tricky), getting all services hooked up to LDAP and managed by GOSA, getting dhcpd to do exactly what we want in a shared-network set up, and much more.

The new server is a HP DL185 G5 with an AMD Opteron quad core CPU and 8 GB of RAM and hosts two KVM virtual machines, one for public services and another one running internal services. You can visit the two websites, which are also hosted on this machine of course, of the concerned research labs:

Maybe in the not too far away future, I should try to move the services hosted on the underpowered desktop machine running this website, also to a virtual machine…

Why prefer Mandriva over another distribution?

Yesterday someone asked on a Dutch website the same question which comes back on sites like Slashdot every time a new Mandriva release is announced: what is the the advantage of Mandriva above other distributions like Ubuntu, OpenSUSE and Fedora.

This made me think and so I wrote down a couple of reasons why I use Mandriva on my desktop systems.

10 advantages of Mandriva above other Linux distributions

  • The default graphical theme in Mandriva looks much better than Ubuntu’s brown mess.
  • All graphical configuration tools are centralized in the Mandriva Control Centre.
  • Mandriva has some unique configuration tools, such as msec which permits you to change advanced security settings from the GUI.
  • Mandriva makes it very easy to install 32 bit libraries and applications on the x86_64 version. In Ubuntu some of the more important 32 bit libraries can be found in the ia32-libs packages, but if you need something else which is not in there for whatever reason, things become more complicated and messy: you can for example extract the libraries by hand from the 32 bit deb package and install them in /usr/lib32, or you’ll have to create a complete 32 bit chroot. In Mandriva you can simply install packages from the 32 bit distribution on the x86_64 release by means of the standard console or GUI installation tools.
  • (shameless plug) The program menu is much nicer if you have installed KDE and GNOME together on your system (in Ubuntu and other distributions you will get very long menus containing lots of KDE and GNOME applications mixed together.
  • Mandriva’s booting times is about the fastest possible for a generic distribution thanks to Speedboot
  • KDE as shipped by Mandriva is generally a bit more stable and polished than in Ubuntu
  • Mandriva’s GNOME corresponds more to the default upstream GNOME than for example in OpenSUSE (e.g. by default it does not use that messy Slab menu)
  • Very flexible graphical installer in the Free and Powerpack editions for people who want a more complete and custom installation than the one from a standard live cd
  • Mandriva’s development community is very open and accessible, eg. via IRC and mailing lists. If you do a little bit of effort, it’s pretty easy to become a Mandriva package maintainer yourself and to integrate your contributions yourself in the distribution.

Some disadvantages of Mandriva

  • Security updates are sometimes a bit later than other distributions and for some packages even completely missing. It has to be said that these are mostly not too important security problems and I’m not aware of any problems this has caused for anyone in practice. Also bugfix updates for some reported problems are sometimes late or not done at all.
  • While the graphical themes are much better than Ubuntu’s in my opinion, I still think they cannot beat the upstream KDE and GTK+ themes.
  • The Mandriva configuration tools sometimes have annoying bugs or do not have the best looks possible.

Personally, I consider Mandriva and Debian as the best distributions available. I think Ubuntu is overhyped a lot and does not offer much (if anything?) you cannot do with Debian. I also think Debian’s distribution model consisiting of the Stable, Testing and Unstable distributions is great and makes it possible to have a pretty stable and “rolling” distribution with fairly up to date software at any time. However, the fact that I can directly contribute my own improvements to Mandriva and the fact that installing 32 bits stuff on x86_64 is dead easy, make tthat Mandriva is still my preferred choice on desktop systems.

Anyway, the choice is up to you!

Updating to Debian Lenny

Last week-end, Debian Lenny 5.0 was finally released. I use Debian on most servers I manage at work. A few of them were already using Lenny when it was still the testing branch, but most are still on Debian Etch. So this morning I decided to test upgrade one of the less critical Etch systems to Lenny. That system is only used to store back-up files from other systems, so it would not be a problem if that machine was off line for a couple of hours.
According to the release notes, you should rather use aptitude instead of apt to upgrade, so that’s what I did. All went well, until suddenly the package upgrade hung while installing new udev configuration files. I could Ctrl-C the process to continue, but from that moment on, more and more post installation scripts started hanging and had to be interrupted.

I noticed that also simple commands, such as ps and getent passwd were hanging too and that I could not log in via SSH anymore. Fortunately, the existing SSH connections continued to work, so I was not locked out yet.

I straced getent passwd and noticed that it hung while trying to connect to the remote LDAP server. The problem was apparently that Lenny’s libnns_ldap tried to connect via LDAPS to port 389, while LDAPS uses port 636 by default. It seems that you need to specify the port number 636 now to make LDAPS work right, so for example: ldaps://remote.host:636. I fixed this in libnss-ldap.conf and pam_ldap.conf, and then I could finish the upgrade without any problem. Apparently this is a known problem.

So definitely modify your configuration first if you are using LDAP authentication and want to upgrade to Lenny. I should probably also fix my nsswitch.conf so that applications don’t start to hang if the LDAP server is unreachable…

In spite of this problem, the whole upgrade was done in less than 1 hour. Without that problem, I guess it would have taken about 20 minutes less. Quite impressive!

Getting nice anti-aliased fonts in Debian

Since about a year I’m using Debian on an Apple Powerbook G4 PowerPC laptop. Mandriva does not have an active PowerPC port anymore, I don’t really like Ubuntu (and their PowerPC port does not get the same priority anymore as the x86 ports), so Debian was an obvious choice for me, and I have never regretted this.

One of the things that annoyed me however, was the default looks of fonts. Some fonts (especially in Firefox) did not look anti-aliased, while those that were, did not look as nice as I’m used to from Mandriva. At that time, I did not found anything better than compiling a more recent version of freetype (just standard ./configure, make, make install, no patches for enabling any patented stuff) and replacing the contents of /etc/fonts/conf.d by the one from a Mandriva system. And installing the Liberation fonts from Red Hat’s tarball.

Today, things are a bit easier: a Liberation package is now available in the Debian repository as are up to date packages of Freetype. And I learned a bit more about Debian’s Freetype configuration, so I was able to tweak the default settings now, instead of just replacing everything by Mandriva’s.

Here’s a quick howto. I assume you are using Debian Lenny, and have the unstable/sid repositories added to apt’s sources.list (use apt pinning so that testing is preferred over unstable).

  • Make sure you have the basic font packages installed: apt-get install ttf-dejavu ttf-liberation (the latter currently only exists in unstable)
  • Make sure you have a recent version of freetype installed. Run apt-cache policy libfreetype6 to see which versions are currently available in Debian. I installed version 2.3.6 from Unstable: apt-get install -t unstable libfreetype6
  • Install a recent fontconfig version. Run apt-cache policy fontconfig to see which versions are available. I installed version 2.6.0 from unstable: apt-get install -t unstable fontconfig libfontconfig1 fontconfig-config
  • Go the the directory /etc/fonts/conf.d. You’ll see that it contains all symbolic links to /etc/fonts.conf.avail which contains some more interesting configuration files which we’ll activate by adding a symbolic link. Especially I want to use the autohinter, enable RGB subpixel hinting and don’t want to use bitmap fonts:
    ln -s ../conf.avail/10-autohint.conf<br/>
    ln -s ../conf.avail/10-sub-pixel-rgb.conf<br/>
    ln -s ../conf.avail/70-no-bitmaps.conf
  • Now in GNOME go to the menu System – Preferences – Appearance and go to the Fonts tab and play a bit with the settings until you are happy with them. I used Deja Vu Sans Book 9pt for desktop and application fonts and Liberation Mono 9pt as fixed width font. Rendering is set to subpixel smoothing, and in the details panel I chose suppixel (LCD) smoothing, full hinting and RGB subpixel order. If you are using KDE 3, you can make similar settings in KDE’s Control Center under Look & Feel – Fonts (make sure anti-aliasing is enabled and click on the Configure button).
  • In Firefox/Iceweasel 3 go to Edit – Preferences – Content and click on the Advanced button in the Fonts & Colors section. Configure the fonts you like best (I chose Liberation fonts, and set sans-serif by default) and play a bit with the default and minimum font size (I chose 15 pt as default size, and 9 pt as minimum).

Enjoy your nice fonts!