Recommended

2010-02-20

This blog post explains how to try the GDM login screen and make screen shots in any, user-specified screen resolution. This can be useful when designing GDM themes. The instructions were tried on Ubuntu Hardy (8.04), but they should work on Ubuntu Intrepid (8.10) and Ubuntu Jaunty (9.04). They won't work on Ubuntu Karmic or Ubuntu Lucid, because they contain GDM 2, which doesn't have the --xnest feature implemented (** (gdmflexiserver:18758): WARNING **: Not yet implemented).
Installation instructions:

(When asked to run a command, run it in a terminal window.)

Make sure GDM is your display manager. Since GDM is the default, chances are that it is. To make sure, run sudo dpkg-reconfigure gdm, and select GDM if it asks you.

Log in using GDM if you haven't already done so. To do that, run sudo /etc/init.d/gdm restart . (You will lose your X11 session doing so.)

Try Xephyr: Xephyr :9 -screen 800x600 -extension RANDR . A new window should appear with the usual a black-and-white diagonal background and a diagonal cross-shaped cursor. Abort Xephyr in the terminal window. Try with different -screen sizes.

Usage instructions (how to show the GDM login dialog inside a window, and how to make a screen shot):

If not already logged in, login in at the GDM login screen.

Run gdmflexiserver --xnest to get the GDM login dialog inside a window of your regular session. You can specify the window size using e.g. echo 1024x768 >/tmp/new-xnest-geometry && gdmflexiserver --xnest

To make a JPEG screen shot, run xephyr-import -quality 75 screenshot.jpg while the Xephyr window with the GDM login screen is still open.

2010-02-19

This blog post gives some hints how to create a .deb package file (to be used with Debian, Ubuntu and similar Linux distributions). The intended audience is programmers and system administrators, both with a strong Debian or Ubuntu Linux background and strong scripting skills. It is assumed that you know almost everything about your Linux system, you have installed .deb packages by hand (with dpkg. and apt-get), you understand the dependencies etc., and the only information you need how to create a .deb package from your software.

This blog post describes a low-level, hacky and quick approach with little automatic validation and instrumentation. This approach is useful for packages which don't require compilation or complicated runtime configuration. To start learning the more consistent, heavy-weight, validated approaches, fetch some source packages with apt-get source, and have a look at their debian subdirectories. The merit of our approach is simplicity (you have to understand only a few basic concepts to create your first package) and speed. Disadvantages are that it lets you create suboptimal, nonworking or nonstandard packages since there is only very little automatic validation, so you may sometimes recognize problems with your .deb packages too late, when it's too expensive to fix them; also this approach doesn't force you learn and follow the conventions and best practices of your Linux distribution.

First, have a look at the contents of .deb packages similar to your software. To get the .deb file, use apt-get install --reinstall ${PACKAGENAME}, abort the process once all files are downloaded, and fetch the file you are interested in from /var/cache/apt/sources. Once you have the .deb file, extract it with dpkg-deb:

/tmp/${MYFILE}/DEBIAN/control: all meta-information: package name, size, version number, dependencies, short description, long description

/tmp/${MYFILE}/DEBIAN/md5sums: md5sum values for all regular files in the package

/tmp/${MYFILE}/DEBIAN/postinst: executable script which will be run by dpkg -i after dependencies are installed, and files of this package are extracted

/tmp/${MYFILE}/DEBIAN/preinst: a similar executable script

/tmp/${MYFILE}/DEBIAN/prerm: another similar executable script

/tmp/${MYFILE}/DEBIAN/postrm: another similar executable script

Use Google to find out more about these (and possibly other) special files. To get examples, look at the special files of the packages installed to your system; those special files are in /var/lib/dpkg/info.

Create a directory named ${PACKAGENAME}_${VERSION}_${ARCHITECTURE}. We'll call this the package directory.

Create subdirectories and files in the package directory. For example, if you want to have your package contain /usr/bin/footool, then create usr, create usr/bin and copy your prebuilt footool binary to usr/bin.

Make sure the owner, group and permission bits are right (as intended on the target system) for all files and directories.

Create the DEBIAN subdirectory in the package directory.

Create your DEBIAN/control file, possibly copying a similar one, and modifying some fields.

If you need to run some code during installation after the package files are extracted to /, then create DEBIAN/postinst as a script (usually starting with #! /bin/sh), and make it executable. To prevent future troubles, make this script robust and idempotent, i.e. it should exit successfully even after a previous half-finished package installation. However, if there is something wrong in the system, the script should exit with a non-zero exit code. set -e can help here: it makes the shell running the script exit at the first nonsuccessful command (outside a subshell).

Set the Installed-Size: field of the DEBIAN/control file to last number in the total output of du run in the package directory.

Make sure that the package name, version number and architecture in the package directory name are the same is what's indicated in DEBIAN/control.

Make sure there are no backup files (*~, especially DEBIAN/*~) or temporary files lying around inside the package directory.

Go one level above the package directory, and run dpkg-deb -b ${PACKAGENAME}_${VERSION}_${ARCHITECTURE} . This creates ${PACKAGENAME}_${VERSION}_${ARCHITECTURE}.deb.

Your .deb package is ready. Try installing it to your system (sudo dpkg -i ${PACKAGENAME}_${VERSION}_${ARCHITECTURE}.deb . Play with it. Fix problems and rebuild it as many times as necessary. Increase the version number.

2010-02-11

This blog post explains how to run Firefox 3.6 32-bit on an old Linux system, such as Debian Etch.

First, here is some technical background. The most important problem with the stock Firefox 3.6 for Linux (especially with Flash Player 10) is that it needs newer versions of system libraries than what is available on some old Linux systems, such as Debian Etch. Copying those libraries from a newer system (such as Ubuntu Hardy) does the trick, except that some other data files (such as Pango's libpango1.0-0.modules file) also have to be copied, and Linux has to be persuaded that it should read libraries and data files from non-standard locations. For the latter, setting LD_LIBRARY_PATH and specifying the new lib/ld-linux.so.2 explicitly almost solves the problem, but it won't force the new directory for the config and data files. For that, we have to LD_PRELOAD our library overriding open(), fopen() etc.