Search Results: "dpk"

26 March 2009

Raphaël Hertzog: Flights for Debconf

I have booked my flights for Debconf9 in July. I will arrive in Madrid on July 23th at 10:30 from Lyon Saint-Exup ry (LYS-MAD, flight AF5891) and I will leave on July 31th at 17:40 (MAD-LYS, flight AF5892). I plan to use the train to go to C ceres but it s too early to buy tickets on renfe.es. I also have no idea how far the train station is (from the airport) but it looks like I will have several hours transit time anyway. There aren t so many trains for C ceres. The train tickets will likely cost around 30 EUR each. I m glad that I can attend again this year. I m sure it will be very productive. At least concerning dpkg it will be good to meet Guillem Jover IRL. Partagez cet article / Share This

22 March 2009

Neil Williams: multistrap - debootstrap for multiple repositories

debootstrap has only ever been designed to work with a single repository and the current code includes a comment:

# XXX: I can't think how to deal well with dependency resolution and
# lots of Packages files. -- aj 2005/06/12

The main reason for that, AFAICT, is that debootstrap has a perfectly valid goal of trying to work without needing dpkg or apt themselves, doing everything in the chroot. Theoretically, anything that can run POSIX shell should be able to run debootstrap.

Emdebian has a need for a different script that can assume that both dpkg and apt are fully functional already and behave as normal Debian packages which opens the door to supporting as many repositories as apt itself can handle and, until now, that support was --foreign only. i.e. it was explicitly for cross-debootstrap (armel, etc.) for use with Emdebian Grip and actually used debootstrap for some of the work. That code has been simplified and there is no need for debootstrap now in multistrap. (multistrap itself is written in perl.)

I recognise that native support could be useful so I've been working on a fix for the native support - partially achieved by dropping the need to use debootstrap at all and porting the existing fix for #518719 from the emdebian-rootfs package (shell) into perl.

In effect, multistrap allows you to collapse the following stages into one:

  1. $ sudo debootstrap $suite $dir $mirror

  2. $ sudo chroot $dir

  3. # nano /etc/apt/sources.list

  4. # apt-get update

  5. # apt-get install $package_list

  6. # apt-get clean

  7. $ sudo $my_config_script


That much is architecture-neutral (due to the support for working around #518719 which allows packages to be unpacked without running the configure scripts) - what I've added for native support is that sudo chroot $dir dpkg --configure -a can be automatically run before the config_script. In the typical Emdebian case, the configure stage would happen immediately after unpacking the multistrap filesystem onto the device (certainly before first boot).

That gives you a single method for creating a complete root filesystem with everything you need installed, everything configured and the config_script hook allows you to put in things like kernels and kernel modules etc. too - all ready for tar -czf and unpacking onto your device. Instead of a plain debootstrap, multistrap can give you a complete filesystem with all the packages you'd only install as soon as debootstrap had finished.

In addition, multistrap allows apt to decide which versions to install from the collection of Packages files so you can implement fallbacks and other permutations of mirrors and packages. Emdebian is using this functionality to mix private packages with official packages from Emdebian Grip 1.0 and ensure that not only are all dependencies met but that each dependency has the chance to be the latest version without needing any configuration or manual parsing. Just specify the repositories and which packages you need at the top level from each one. apt does the rest.

So, the question:

Does this deserve to be a separate source package ? For now, it's heading into Emdebian as part of the emdebian-rootfs package, version 1.6.1.

The advantages will be that multistrap itself doesn't need to be tied to the still rapidly developing emdebian-tools source package and doesn't need to carry the quite large changelog from emdebian-tools (which is just going to keep on growing).
 3014 2009-03-17 20:54 ./usr/share/doc/multistrap/README
2265 2009-02-18 18:32 ./usr/share/doc/multistrap/TODO
1536 2008-08-20 14:25 ./usr/share/doc/multistrap/copyright
21067 2009-03-17 21:58 ./usr/share/doc/multistrap/changelog.gz
1233 2008-10-28 13:13 ./usr/share/doc/multistrap/NEWS.Debian.gz


Disadvantages, it's very small (a lot of the current content is actually POD documentation) and probably doesn't warrant a source package all alone.

17774 2009-03-22 13:41 ./usr/sbin/multistrap


Details:
 Package: multistrap
Source: emdebian-tools
Version: 1.6.1
Architecture: all
Maintainer: Neil Williams
Installed-Size: 120
Depends: perl, apt, debhelper (>= 5),
libconfig-auto-perl, libparse-debian-packages-perl
Replaces: emdebian-rootfs (<= 1.6.0)
Section: admin
Priority: extra
Homepage: http://www.emdebian.org/
Description: multiple repository bootstrap based on apt
debootstrap replacement with multiple repository support
using apt to handle all dependency issues and conflicts.
.
Includes support for foreign architecture multistraps that need
only minimal configuration on the final device. Supports cleaning
up the generated bootstrap filesystem to remove downloaded packages
and hooks to modify the files in the bootstrap filesystem after
the packages have been unpacked but before being configured.


Is there a better home? devscripts? Ideas? (It would need to be a package I can join as Uploader: and I'd prefer if that package used subversion.)

19 March 2009

Uwe Hermann: Using Debian GNU/Linux on the Lenovo IdeaPad S9e netbook

TuxMobil - Linux on Laptops, Notebooks, PDAs and Mobile Phones Lenovo Ideapad S9e netbook I recently got my hands on a Lenovo IdeaPad S9e netbook for a short amount of time (I don't own it), so I did a few tests with Debian unstable (more or less Lenny right now) and a Linux 2.6.28 kernel on it, see results below. The machine type is 4187-42G, and it features an Intel Atom N270 CPU (with HyperThreading) at 1.6 GHz, 1 GB of DDR2 RAM, an 80 GB SATA drive, an 8.9" WSVGA 1024x600 (glossy) screen, VGA port, LAN, wifi, bluetooth, 2xUSB, SD card slot, PCI ExpressCard slot, built-in microphone, and a webcam. BIOS You can enter the BIOS by pressing F2, the boot menu by pressing F12 during boot. Booting from USB works fine on this netbook. There's a Splashtop installation on the netbook (called "Lenovo Quickstart" here) which you can disable in the BIOS. Installation There's no CD-ROM drive, so the simplest way is to use a USB thumb drive for installation. Here's how you can prepare one containing a Lenny installer (assuming your USB thumb drive is /dev/sda):
  $ wget http://cdimage.debian.org/debian-cd/5.0.0/i386/iso-cd/debian-500-i386-netinst.iso
  $ wget http://ftp.nl.debian.org/debian/dists/lenny/main/installer-i386/current/images/hd-media/boot.img.gz
  $ gunzip boot.img.gz
  $ dd if=boot.img of=/dev/sda1
  $ mount -t vfat /dev/sda1 /mnt
  $ cp debian-500-i386-netinst.iso /mnt
  $ umount /mnt
If the above USB thumb drive doesn't boot correctly (which it did not in my case: GRUB error 17) it's probably because of a messed-up MBR. This is how you can fix it:
  $ apt-get install mbr
  $ install-mbr /dev/sda
 Lenovo Ideapad S9e Debian installation Then insert the USB thumb drive in the Lenovo IdeaPad S9e, choose USB boot in the BIOS, and start the installer. Most of the process works as usual, the only small difference is that you might want to load the "parted" installer module in order to resize the Windows-partition on the disk (if you want to keep it) to make space for Linux. The second (fat32) partition seems to keep a restore image and/or the Splashtop stuff, not sure. Audio Works out of the box using the snd_hda_intel driver. The hardware is onboard audio in the southbridge (82801G / ICH7) and uses the Realtek ALC269 codec. If some programs don't have working audio, try modprobe snd-pcm-oss. Built-in microphone Untested so far. Bluetooth Works out of the box using the bluetooth and btusb driver. The laptop's Bluetooth device is USB-attached internally and shows up in lsusb as:
  $ lsusb
  Bus 003 Device 002: ID 0a5c:2150 Broadcom Corp.
  $ dmesg
  usb 3-2: Product: BCM2046 Bluetooth Device
After modprobe btusb you can use hcitool / hciconfig etc. as usual, and/or enable more related stuff with /etc/init.d/bluetooth start. Sensors The lm-sensors script detects the lm75, eeprom, i2c-dev, and i2c_i801 modules. The following is the 'sensors' output:
  $ sensors
  acpitz-virtual-0
  Adapter: Virtual device
  temp1:       +36.0  C  (crit = +95.0  C)    
The hard drive temperature can be viewed with:
  $ hddtemp /dev/sda
  /dev/sda: FUJITSU MHZ2080BH G1: 44  C
HPET The Intel ICH7 southbridge in this laptop supports High Performance Event Timers (HPET) which allows for more power savings and thus improved battery life.
  $ dmesg   grep -i hpet
  ACPI: HPET 3F6E1E41, 0038 (r1 INTEL  CALISTGA  6040000 LOHR       5A)
  ACPI: HPET id: 0x8086a201 base: 0xfed00000
  hpet clockevent registered
  HPET: 3 timers in total, 0 timers will be used for per-cpu timer
  hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
  hpet0: 3 comparators, 64-bit 14.318180 MHz counter
You can check the wakeups-per-second with powertop. SD card slot Works out of the box. It seems to be attached via USB internally (usb-storage driver).
  $ lsusb
  Bus 001 Device 004: ID 0bda:0158 Realtek Semiconductor Corp. Mass Stroage Device
PCI ExpressCard slot Untested so far. ACPI Works fine, see comments for "acpitool" output. Network card Works out of the box using the tg3 driver.
  $ modprobe tg3
  tg3.c:v3.94 (August 14, 2008)
  tg3 0000:02:00.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
  tg3 0000:02:00.0: setting latency timer to 64
  eth0: Tigon3 [partno(BCM95906) rev c002 PHY(5906)] (PCI Express) 10/100Base-TX Ethernet 00:11:22:33:44:55
  eth0: RXcsums[1] LinkChgREG[0] MIirq[0] ASF[0] WireSpeed[0] TSOcap[0]
  eth0: dma_rwctrl[76180000] dma_mask[64-bit]
Touchpad Works out of the box, both in X as well as in the console using gpm.
  $ dmesg
  Synaptics Touchpad, model: 1, fw: 7.2, id: 0x1c0b1, caps: 0xd04731/0xa40000
Suspend-to-disk and suspend-to-RAM I'm using the hibernate Debian package. You can explicitly force the usage of either method in /etc/hibernate/hibernate.conf by uncommenting the respective lines.
  TryMethod disk.conf
  # TryMethod ram.conf
Suspend does not yet work out of the box, however, as the machine is unknown:
  $ s2ram -n
  Machine unknown
  This machine can be identified by:
      sys_vendor   = "LENOVO                          "
      sys_product  = "418742G         "
      sys_version  = "Lenovo                  "
      bios_version = "14CN51WW  "
  See http://suspend.sf.net/s2ram-support.html for details.
After a few test I found that s2ram -f -a 3 works fine (tested from console only so far). Now this needs to be integrated upstream and in the Debian package (I'll file a bug report). Update: Submitted bug #520848, and an email to the upstream mailing list. Wireless There doesn't seem to be a mainline driver for the Broadcom BCM4312 wifi card in the laptop, yet:
  $ lspci -nn
  05:00.0 Network controller [0280]: Broadcom Corporation BCM4312 802.11b/g [14e4:4315] (rev 01)
Neither the b43 nor the b43legacy drivers work as of 2.6.28. For now, one of two possible options is to build a (partly non-free) driver provided by Broadcom from source (option 2 would be to use ndiswrapper, I guess, but that's untested):
  $ wget http://people.debian.org/~adamm/kernel/linux-kbuild-2.6.28_2.6.28-0.1_i386.deb
  $ dpkg -i linux-kbuild-2.6.28_2.6.28-0.1_i386.deb (currently needed in unstable due to bug #518115)
  $ apt-get install build-essential linux-headers-2.6.28-1-686
  $ mkdir temp; cd temp
  $ wget http://www.broadcom.com/docs/linux_sta/hybrid-portsrc-x86_32-v5_10_79_10.tar.gz
  $ tar xfvz hybrid-portsrc-x86_32-v5_10_79_10.tar.gz
  $ make -C /lib/modules/ uname -r /build M= pwd  clean
  $ make -C /lib/modules/ uname -r /build M= pwd  modules
If that worked, you can load the driver via:
  $ rmmod bcm43xx; rmmod b43; rmmod b43legacy (you could also permanently blacklist these modules)
  $ modprobe ieee80211_crypt_tkip
  $ insmod ./wl.ko
  $ dmesg
  wl: module license '' taints kernel.
  wl 0000:05:00.0: PCI INT A -> GSI 18 (level, low) -> IRQ 18
  wl 0000:05:00.0: setting latency timer to 64
  eth1: Broadcom BCM4315 802.11 Wireless Controller 5.10.79.10
You can now run iwconfig, iwlist, etc. from the command line, or use some GUIs such as kwifimanager. In order to disable wireless, run:
  $ rmmod wl
So far, I only tested WEP (but not WPA). CPU frequency scaling Works out of the box using the acpi_cpufreq driver. Use cpufreq-set -c 0 -g performance if you need full CPU power, cpufreq-set -c 0 -g powersave otherwise. Use -c 1 to do the same with the other CPU/core. PC speaker Works fine out of the box using the pcspkr module, tested with beep. Graphics card Works out of the box using the intel X.org driver.
  $ xrandr
  Screen 0: minimum 320 x 200, current 1024 x 600, maximum 1024 x 1024
  VGA disconnected (normal left inverted right x axis y axis)
  LVDS connected 1024x600+0+0 (normal left inverted right x axis y axis) 195mm x 113mm
     1024x600      60.0*+
     800x600        60.3  
     640x480        59.9  
  TV disconnected (normal left inverted right x axis y axis)
DRI works out of the box with the (mainline, open-source) driver:
  $ glxinfo   grep direct
  direct rendering: Yes
If you attach an external monitor or projector, you can enable it using xrandr as usual:
  $ xrandr --output VGA --auto
You can also use a dual-head setup by adding this to your "Screen" section in /etc/X11/xorg.conf:
  SubSection "Display"
    Virtual 2048 2048
  EndSubSection
After restarting the X server, you can play with xrandr and move the external screen (VGA) "below" the laptop's LCD screen (LVDS) for a simple dual-head setup. The GUI tools arandr or grandr are probably a bit simpler to use than plain command line xrandr. USB Works fine, of course. The only small problem is that there are only two USB ports, more would have been better. Disk drive Works fine, it's an 80 GB SATA drive. Webcam Works out of the box using the uvcvideo driver.
  $ lsusb
  Bus 001 Device 005: ID 5986:0141 Acer, Inc
  $ modprobe uvcvideo
  uvcvideo: Found UVC 1.00 device Lenovo EasyCamera (5986:0141)
  input: Lenovo EasyCamera as /devices/pci0000:00/0000:00:1d.7/usb1/1-3/1-3:1.0/input/input9
  usb 1-3: New USB device found, idVendor=5986, idProduct=0141
  usb 1-3: New USB device strings: Mfr=3, Product=1, SerialNumber=0
  usb 1-3: Product: Lenovo EasyCamera
  usb 1-3: Manufacturer: BISON Corporation
You can use luvcvideo for webcam viewing. Battery Lasts for ca. 3.5 hours, probably less if the system is under high load. Special keys Fn+CursorUp / Fn+CursorDown (brightness), Fn+ESC (enable/disable webcam), Fn+F1 (sleep mode), Fn+F2 (enable/disable TFT backlight), Fn+F6 (enable/disable thouchpad), Fn+F7 (Num lock), Fn+F8 (scroll lock), and Fn+F11 (F12 key) all work fine. Fn+F3, Fn+F5, Fn+F9, Fn+F10, and all other special keys are untested. LEDs The power, disk activity, CAPS lock, Num lock, and battery charging LEDs all work fine out of the box. lspci -tvnn
  -[0000:00]-+-00.0  Intel Corporation Mobile 945GME Express Memory Controller Hub [8086:27ac]
           +-02.0  Intel Corporation Mobile 945GME Express Integrated Graphics Controller [8086:27ae]
           +-02.1  Intel Corporation Mobile 945GM/GMS/GME, 943/940GML Express Integrated Graphics Controller [8086:27a6]
           +-1b.0  Intel Corporation 82801G (ICH7 Family) High Definition Audio Controller [8086:27d8]
           +-1c.0-[0000:02]----00.0  Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express [14e4:1713]
           +-1c.1-[0000:03-04]--
           +-1c.2-[0000:05]----00.0  Broadcom Corporation BCM4312 802.11b/g [14e4:4315]
           +-1d.0  Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #1 [8086:27c8]
           +-1d.1  Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #2 [8086:27c9]
           +-1d.2  Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #3 [8086:27ca]
           +-1d.3  Intel Corporation 82801G (ICH7 Family) USB UHCI Controller #4 [8086:27cb]
           +-1d.7  Intel Corporation 82801G (ICH7 Family) USB2 EHCI Controller [8086:27cc]
           +-1e.0-[0000:06]--
           +-1f.0  Intel Corporation 82801GBM (ICH7-M) LPC Interface Bridge [8086:27b9]
           +-1f.1  Intel Corporation 82801G (ICH7 Family) IDE Controller [8086:27df]
           +-1f.2  Intel Corporation 82801GBM/GHM (ICH7 Family) SATA IDE Controller [8086:27c4]
           \-1f.3  Intel Corporation 82801G (ICH7 Family) SMBus Controller [8086:27da]
cat /proc/cpuinfo See comments. Resources All in all it's a really nice hardware, and it works (more or less) flawlessly without much hassle with recent distros/kernels. Update 2009-03-22: Updated various sections, added more info. Added resources section.

13 March 2009

Julien Blache: Kodak scanner drivers for Linux - not there yet

So, Kodak announced the availability of Linux drivers for some of its scanners, together with a frontend application. While the effort is laudable, they re not quite there yet. Let s have a look. First of all, and contrary to what a few people believe after reading the press release, the drivers themselves aren t OpenSource, let alone Free Software. They re all proprietary; read better, the press release clearly mentions that only the frontend application is GPLv2. Now let s look at what Kodak offers in its drivers packages. I ve downloaded LinuxSoftware_i1200_v3.5.tar.gz from the Kodak website, these are the drivers for the Kodak i1200 series. The archive contains a set of RPM packages, one Debian package corresponding to one of the RPM packages, and a setup script. One of the packages contains the OpenUSB library, which is released under the LGPL; sources aren t there, I haven t asked for the sources, don t plan on doing so, and am not implying anything regarding license compliance whatsoever. I ll note that I haven t seen any written offer for the sources, though, be it in the archive (there s not even a README in there) or on the website. So, although Ubuntu is listed as supported, we can say that no Debian packages are provided. The setup script actually relies on alien to convert them if it thinks it s running on a Debian-based system, which is determined by the availability of dpkg in the PATH. Using alien is far from ideal. The packages ship libraries and components under /usr/lib, /usr/local/lib and even /opt, pretty randomly it seems. Let s repeat here that /usr/local and /opt are strictly reserved for the local administrator and packages must not install anything here. There are other oddities in the paths used by the software stack, like /var/kodak. It looks like the SANE backend is only a bridge to Kodak s TWAIN data source, so you d actually need the whole stack to use it. All in all, Kodak does no better, I d even venture to say it does worse, than Epson (Avasys). At least part of Epson s backend is Free Software, even if it relies on proprietary libraries for some scanners, though unfortunately most if not all of the recent ones. I also have to mention that Epson is offering both RPM and Debian packages, and by that I mean proper Debian packages. Kodak are far from that, even the RPM aren t that great (I think the RPM packages even lack dependency information, based on what I ve read in the setup script, though I haven t checked). What Kodak offers here is a GPL frontend for TWAIN that not many people will be using, while keeping the drivers proprietary. Unfortunately their SANE backend isn t a backend so to speak, and even if it was OpenSource it d still rely on the rest of the TWAIN software stack. So, in a nutshell, while I m very happy to see yet another vendor go down the road of Linux support for its products, I am immensely disappointed by the proprietary nature of the drivers and the low quality of the packages. I was, of course, investigating the drivers to possibly package them for Debian; as you ve probably understood, it s not possible, both technically and legally. And I kept a little gem from the setup script for the end:
# We need to create a link for the libdbus-1 requirement for openusb,
# but only on Fedora.
if [ -f /etc/fedora-release ]; then
    ln -s /lib/libdbus-1.so.3 /lib/libdbus-1.so.2 2>> /dev/null
fi
As we all know, sonames and soversions are useless and they just keep getting in the way. Duh.

11 March 2009

Steve Kemp: Oh my God, someone ate my entire pie!

Yesterday was my birthday, and it was full of cookies, pies, magical pixie dust and things made entirely of sugar and spice! The remainder of the day was spent re-installing Debian Lenny upon my EEE PC - Somehow I managed to completely screw the system. Because the EEE PC is one of those ultra-portable machines I mostly used it when I was travelling, or outdoors. That mean I was generally receiving poor connectivity and the system packages weren't up to date. While I was in bed I figured I'd dist-upgrade it to the recently released Lenny. Unfortunately I started the dist-upgrade inside X.org, once I realised this I figured I'd cancel the operation via Ctrl-c. Bad news everbody: I think I was unlucky enough to interrupt an upgrade of libc, or something equally critical. Every single application gave segfaults afterward. I had two open root terminals and I could navigate around via cd .., and "echo *", but all other commands such as sudo, dpkg, strace just gave segfaults. (Even static commands gave errors - so it might have been the dynamic loader that was borked, I admit I didn't look too closely.) I figured reinstalling would be a good solution since the machine has a 4Gb root partition and /home was stored on a separate 16Gb volume. Unfortunately I managed to misjudge the installer's partitioning step and nuke the partition table on the external volume so I ended up losing the whole system. Happily reinstallation was a breeze as my home network is setup to allow installation via PXE network booting (at some point I should document NFS-root PXE-booting). It took me longer to fiddle with the BIOS on the EEE PC to allow network booting than it did to complete a minimal install. Which I guess is good. I still need to restore my backup of /home/, but that can wait a few days. Right now I'm loathe to touch the machine at all - although I did distract myself by getting KVM to PXE boot:
# create 4gb disk image
dd if=/dev/zero of=/tmp/img.img bs=1024 count=4096k
# launch KVM
sudo kvm -no-acpi
  -boot n -tftp /var/lib/tftpboot/ -bootp /pxelinux.0
  -hda /tmp/img.img
  -net nic,macaddr=00:0E:35:be:de:ad  -net user
It seems that KVM wants to have access to the local TFTP root directory so I just pointed it at that. Since my desktop machine is also my TFTP + DHCP host that works out nicely. (A quick scan of the manual suggests that QEMU/KVM has funky built-in TFTP code, so it doesn't actually forward TFTP requests over the network.) DHCP requests were certainly passed around as expected though and were answered via my local dnsmasq installation. I did see errors at every DHCP request in syslog, but they seemed harmleess enough:
gold dnsmasq[29241]: no address range available for DHCP request via qemu0
*shrugs* ObFilm: Never Been Kissed.

10 March 2009

Neil Williams: RFP bugs

Not sure how many people check the list of packages requested - 452 packages at the time of writing.

One thing occurs to me when viewing the list, the standard DDPO page format doesn't lend itself to this kind of data. There is no PTS page, nothing available in pool, no bugs, no versions or builds (inevitably) and no popcon, watch or section. What might be more useful here would be not just a link to the RFP bug report, but the title of that bug report so that a quick scan of the RFP page could shed more light on the packages than the bare upstream package name.

Maybe even create RSS feeds for new ITP, RFP, O and ITA bugs?

(Particularly useful is the support for listing only specific source packages - I think I might link to some pages from Emdebian using that syntax.) e.g. this list of core packages for Emdebian support.

Also idly wondering if there could be some way of adding Emdebian data to this kind of output - maybe a line beneath the current suite listing with the em[0-9] details. Not sure what data sources are used for the DDPO package data but if it is Packages.gz files etc., those are available. If this seems like a good idea or knows how it could be done, please post a comment.

2 March 2009

Joey Hess: re: Declarative .deb maintainer scripts

Lars wonders about debhelper's approach of inserting script fragments into package maintainer scripts. It's really very interesting to survey debhelper's collection of fragments, in its autoscripts directory. Of the 55 fragments, the mean length is 4.5 lines, and the mode (and also shortest[1]) length is 3 lines. The 32 scripts that are each three lines follow a very simple pattern:
if [ "$1" = something ] && exists some-script; then
    some-script some-parameters
fi
It would be nice to get that down to Lar's more declarative one line approach:
some-script some-parameters $@
In practice though, many of these scripts are not always available, and so the postinst has to test for them before running them. And making them test the postinst's parameters to see if they should do anything makes them less general and less flexible (ie, not able to be run easily by a sysadmin), and so keeping the "$1" test in the postinst is reasonable. So, I think I've done a pretty good job at keeping debhelper script fragments short and keeping most of the possibly buggy bits that might need maintenace out of debhelper. The exceptions tend to be either older scripts, from a time when I was less careful about doing do, and fragments of code that I could not pawn off onto some other package, often because there was no package that owned the issue. (The dh_usrlocal code is the best example of that.) The most promising way to improve things seems to be using dpkg triggers, which is why I was very enthuisiastic when we finally got them, over a year ago. Triggers let many of these hooks into maintainer scripts go away completely. Rather than each package having to test for and call update-menus, menu can simply trigger on the modification of any menu file. Once menu finishes the conversion to using triggers, debhelper can drop those fragments entirely. Triggers seem likely to be able to eliminate well over 90% of the things we need to put into maintainer scripts, and I hope at least half of debhelper's script fragments can eventually go away thanks to them. The others seem more difficult. You probably cannot, for example, make a trigger that does something sane when an init script is installed. Debhelper has at least three different fragements that it can put into postinst scripts to handle init scripts, and these only cover the most common three cases (start, don't start, don't restart on upgrade). Moving even these things into a declarative form has long been a dream of mine. Maybe it could be done with a control file that specifies which of the methods for running the package's init script to use for this package. But it seems we can't do away with maintainer scripts entirely, no matter how hard we try. That's because maintainer scripts are our only way to deal with other crippling bugs in old versions of a package, and with upgrade issues, and with all the other myriad things that we put custom code in them to deal with. Pity.
[1] Slight oversimplification; two scripts cram the 3-line form in one line for no good reason and are counted as 3-lines above.

25 February 2009

Theodore Ts'o: Binary-only device drivers for Linux and the supportability matrix of doom

I came across the following from the ext3-users mailing list. The poor user was stuck on a never-updated RHEL 3 production server and running into kernel panic problems. He was advised to try updating to the latest kernel rpm from Red Hat, but he didn t feel he could do that. In his words:
I m caught between a rock and a hard place due to the EMC PowerPath binary only kernel crack. Which makes it painful to both me and my customers to regularly upgrade the kernel. Not to mention the EMC supportability matrix of doom.
That pretty much sums it all up right there. The good news is that I ve been told that dm-multipath is almost at the point where it has enough functionality to replace PowerPath. Of course, that version isn t yet shipping in distributions, and I m sure it needs more testing, but it ll be good when enterprise users who need this functionality can move to a 100% fully open source storage stack. About the only thing left to do is to work in a mention of the Frying Pan of Doom and the recipe for Quick After-Battle Triple Chocolate Cake into the mix. :-) Related posts (automatically generated):
  1. Tip o the hat, wag o the finger Linux power savings for laptop users It s interesting to see how far, and yet how much...
  2. How active are your local Linux User s Groups? At the Linux Foundation, I recently had been brainstorming with...

Uwe Hermann: Strange command line of the day

Stuff I didn't expect I'd had to type today:
  $ dpkg-repack dpkg-repack
Seriously.

22 February 2009

Antti-Juhani Kaijanaho: grep-dctrl is ten years old

My message Intent to package a Debian control file grepper to WNPP and debian-devel is today a decade old. Apparently, the message predates the invention of the acronym ITP for Intent to Package (the first instance I can find is from May 1999). The changelog reveals that the first upload was on March 1st, 1999. There is unfortunately no record of when the package hit unstable the first time, since dinstall did not send Installed (or even the later Accepted) mails to an archived mailing list at that time. I suppose I might have it in some old private email archive, but more likely it s just gone. Similarly, the first fixed bug (#35527) predates BTS archiving and is now lost. The grep-dctrl program came out of repeated awkward grepping of the dpkg available and status files. Eventually I decided there must be a better way, and failed to find any canned solutions (I was later pointed to sgrep, which didn t look useful enough, and even later to dpkg-awk, but I had already committed to my own solution by then). I wrote a simple C program that processed these files as a sequence of records and did simple substring searches in each record. I rapidly added support for field selection, regular expressions and output field selection. By version 1.3a of March 2000 (which was released with Debian 2.2 potato ), the program was as good as it was going to get with one exception. Make disjunctive searches possible, said my TODO file those days. Conjunctive searches (that is, AND-searches) were possible even then by using more than one grep-dctrl command in a pipeline. Disjunctive (OR) was not possible. The problem was not so much that it would be hard to program (although the program s internal structure wasn t very good, to be honest, making extensive changes difficult), it was more a problem of coming up with a good command line syntax. Another thing that bothered me with the old grep-dctrl was how to implement Ben Armstrong s feature request. Again, the programming part wasn t the problem, the problem was coming up with a good, clean semantics for the feature. It was finally the appearance of ara in 2003 that got me moving again. Ara s author proudly compared eir program to grep-dctrl, claiming that my program did not do disjunctive searches while ara does. Competition being good for the soul, I took it as a challenge. In April 2003 I announced a complete rewrite of grep-dctrl, which was completed in January 2004 (the 2.0 release). The rewrite changed the way the command line was handled even though the usual Unix switch style is still used, the command line is regarded as a language with a parser (first an operator-precedence parser, then a recursive-descent one). The command line is transformed into an interpreted stack-based language which drives the actual grepping. The rewrite also generalised the internal data structures into an internal library which could be used to write other tools. The first such tool was sort-dctrl (introcuded in 2.7, June 2005), which was soon followed by tbl-dctrl (2.8, July 2005). The later appearance of join-dctrl (2.11, August 2007) finally allowed me to close Ben Armstrong s longstanding feature request mentioned above. The unpronounceable part of the names, dctrl , is an abbreviation for Debian control , which I decided to call the file format used by dpkg. Some people call it a RFC-822 format, but that really is a misnomer, since the differences between dctrl and RFC-822 outweigh the mainly superficial similarities (and the historical connection). I did consider calling my program dpkg-grep, but I didn t feel like I had the right to invade the dpkg namespace. The later rename to dctrl-tools reflects the fact that there are now several tools, grep-dctrl being just the oldest. I have several plans for the dctrl-tools suite, but my time and energy are mostly claimed by other responsibilities. The suite is currently team-maintained, but unfortunately the team is not very active. I would love it if I weren t the most active one with my busy schedule! Feel free to pop in on the dctrl-tools-devel mailing list, and to look at the Git repository and the todo list. If you decide to participate, please follow the rules.

15 February 2009

Michael Prokop: Debian GNU/Linux 5.0 codename Lenny - News for sysadmins

Alright, Debian GNU/Linux 5.0 AKA as Lenny has been released. Time for a Debian unstable unfreeze party! 8-) What does the new stable release bring for system administrators? I ll give an overview what news you might expect when upgrading from Debian GNU/Linux 4.0, codename Etch (released on 8th April 2007) to the current version Debian GNU/Linux 5.0, codename Lenny (released on 14th February 2009). I try to avoid duplicated information so make sure to read the release announcement and the official release notes for Lenny beforehand. Noteworthy Changes
  • initrd-tools got replaced by initramfs-tools
  • netkit-inetd got replaced by openbsd-inetd
  • the default syslog daemon sysklogd got replaced by rsyslog
  • new defaults when creating ext2/ext3 file systems: dir_index and resize_inode feature enabled by default and use blocksize = 4096, inode_size = 256 and inode_ratio = 16384 (see /etc/mke2fs.conf)
  • improved IPv6 support
  • init.d-scripts for dependency-based init systems
  • Debian-Volatile (hosting packages providing data that needs to be regularly updated over time, such as timezones definitions, anti-virus signature files, ) is an official service
  • EVMS (Enterprise Volume Management System) was removed
  • compatibility with the FHS v2.3
  • software developed for version 3.2 of the LSB
  • official Debian Lenny live systems for the amd64 and i386 architectures
  • several new d-i features
Virtualisation Virtualisation related new tools:
  • ganeti: Cluster-based virtualization management software
  • libvirt-bin: Libvirt is a C toolkit to interact with the virtualization capabilities of recent versions of Linux (and other OSes). The library aims at providing a long term stable C API for different virtualization mechanisms.
  • virtinst: Programs to create and clone virtual machines
  • virt-manager: desktop application for managing virtual machines
  • xen-shell: Console based Xen administration utility
  • xenstore-utils: Xenstore utilities for Xen
  • xenwatch: Virtualization utilities, mostly for Xen
Desktop oriented packages like virtualbox and qemu are available as well of course. Noteworthy Updates This is a (selective) list of some noteworthy updates: New packages Lenny ships over 7000 new packages. Lists of new/removed/replaced packages are available online. I ll name 238 sysadmin related packages that might be worth a look. (Note: I don t list addon stuff like optional server-modules, docs-only and kernel-source related packages. I plan to present some of the following packages in more detail in separate blog entries.)
  • ack-grep: A grep-like program specifically for large source trees
  • acpitail: Show ACPI information in a tail-like style
  • adns-tools: Asynchronous-capable DNS client library and utilities
  • aggregate: ipv4 cidr prefix aggregator
  • aosd-cat: an on screen display tool which uses libaosd
  • apt-cacher-ng: Caching proxy for distribution of software packages
  • apt-cross: retrieve, build and install libraries for cross-compiling
  • aptfs: FUSE filesystem for APT source repositories
  • apt-p2p: apt helper for peer-to-peer downloads of Debian packages
  • apt-transport-https: APT https transport, use deb https://foo distro main lines in the sources.list
  • arp-scan: arp scanning and fingerprinting tool
  • array-info: command line tool reporting RAID status for several RAID types
  • balance: Load balancing solution and generic tcp proxy
  • bash-completion: programmable completion for the bash shell
  • blktrace: utilities for block layer IO tracing
  • daemonlogger: simple network packet logger and soft tap daemon
  • daemontools: a collection of tools for managing UNIX services
  • dbndns: Debian fork of djbdns, a collection of Domain Name System tools
  • dcfldd: enhanced version of dd for forensics and security
  • dctrl2xml: Debian control data to XML converter
  • debomatic: automatic build machine for Debian source packages
  • desproxy: tunnel TCP traffic through a HTTP proxy
  • detox: utility to replace problematic characters in filenames
  • di-netboot-assistant: Debian-Installer netboot assistant
  • dish: the diligence/distributed shell for parallel sysadmin
  • djbdns: a collection of Domain Name System tools
  • dns2tcp: TCP over DNS tunnel client and server
  • dnscache-run: djbdns dnscache service
  • dnshistory: Translating and storing of IP addresses from log files
  • dnsproxy: proxy for DNS queries
  • dsyslog: advanced modular syslog daemon
  • etckeeper: store /etc in git, mercurial, or bzr
  • ext3grep: Tool to help recover deleted files on ext3 filesystems
  • fair: high availability load balancer for TCP connections
  • fatresize: FAT16/FAT32 filesystem resizer
  • flog: dump STDIN to file and reopen on SIGHUP
  • freeradius-utils: FreeRadius client utilities
  • ganeti: Cluster-based virtualization management software
  • gfs2-tools: Red Hat cluster suite - global file system 2 tools
  • gitosis: git repository hosting application
  • gptsync: GPT and MBR partition tables synchronisation tool
  • grokevt: scripts for reading Microsoft Windows event log files
  • grub2: GRand Unified Bootloader, version 2
  • gt5: shell program to display visual disk usage with navigation
  • haproxy: fast and reliable load balancing reverse proxy
  • havp: HTTP Anti Virus Proxy
  • heirloom-mailx: feature-rich BSD mail(1)
  • hfsprogs: mkfs and fsck for HFS and HFS+ file systems
  • hinfo: Check address ownership and DNSBL listings for spam reporting
  • hlbr: IPS that runs over layer 2 (no TCP/IP stack required)
  • hobbit: monitoring system for systems, networks and applications - server
  • hotwire: Extensible graphical command execution shell
  • hunchentoot: the Common Lisp web server formerly known as TBNL
  • ifupdown-extra: Network scripts for ifupdown
  • ike: Shrew Soft VPN client - Daemon and libraries
  • incron: cron-like daemon which handles filesystem events
  • inoticoming: trigger actions when files hit an incoming directory
  • iodine: tool for tunneling IPv4 data through a DNS server
  • iotop: simple top-like I/O monitor
  • ipplan: web-based IP address manager and tracker
  • ips: Intelligent process status
  • iscsitarget: iSCSI Enterprise Target userland tools
  • isns: Internet Storage Naming Service
  • itop: simple top-like interrupt load monitor
  • iwatch: realtime filesystem monitoring program using inotify
  • jetring: gpg keyring mantainance using changesets
  • john: active password cracking tool
  • kanif: cluster management and administration swiss army knife
  • keepassx: Cross Platform Password Manager
  • keysafe: A safe to put your passwords in
  • killer: Background job killer
  • kpartx: create device mappings for partitions
  • kvm: Full virtualization on x86 hardware
  • latencytop: A tool for developers to visualize system latencies
  • lbcd: Return system load via UDP for remote load balancers
  • ldb-tools: LDAP-like embedded database - tools
  • ldnsutils: ldns library for DNS programming
  • lfhex: large file hex editor
  • live-helper: Debian Live build scripts
  • live-magic: GUI frontend to create Debian LiveCDs, netboot images, etc.
  • logapp: supervise execution of applications producing heavy output
  • lsat: Security auditor tool
  • lustre-utils: Userspace utilities for the Lustre filesystem
  • lwat: LDAP Web-based Administration Tool
  • maatkit: Command-line utilities for MySQL
  • mantis: web-based bug tracking system
  • memdump: memory dumper
  • memlockd: daemon to lock files into RAM
  • metainit: Generates init scripts
  • mirmon: monitor the state of mirrors
  • mkelfimage: utility to create ELF boot images from Linux kernel images
  • mongrel: A small fast HTTP library and server for Ruby
  • monkey: fast, efficient, small and easy to configure web server
  • monkeytail: tail variant designed for web developers monitoring logfiles
  • mpy-svn-stats: Simple and easy to use svn statistics generator
  • mr: a Multiple Repository management tool
  • msr-tools: Utilities for modifying MSRs from userspace
  • mtd-utils: Memory Technology Device Utilities
  • munge: authentication service to create and validate credentials
  • mxallowd: Anti-Spam-Daemon using nolisting/iptables
  • mylvmbackup: quickly creating backups of MySQL server s data files
  • myrescue: rescue data from damaged harddisks
  • mysql-proxy: high availability, load balancing and query modification for mysql
  • mysqltuner: high-performance MySQL tuning script
  • nagvis: Visualization addon for Nagios
  • ncdu: ncurses disk usage viewer
  • netrw: netcat like tool with nice features to transport files over network
  • netsend: a speedy filetransfer and network diagnostic program
  • network-config: Simple network configuration tool
  • nfdump: netflow capture daemon
  • ngetty: getty replacement - one single daemon for all consoles
  • nilfs2-tools: Continuous Snapshotting Log-structured Filesystem
  • ninja: Privilege escalation detection system for GNU\Linux
  • noip2: client for dynamic DNS service
  • nsd3: authoritative domain name server (3.x series)
  • ntfs-3g: read-write NTFS driver for FUSE
  • nulog: Graphical firewall log analysis interface
  • nuttcp: network performance measurement tool
  • ocsinventory-server: Hardware and software inventory tool (Communication Server)
  • odt2txt: simple converter from OpenDocument Text to plain text
  • olsrd: optimized link-state routing daemon (unik-olsrd)
  • onesixtyone: fast and simple SNMP scanner
  • openais: Standards-based cluster framework (daemon and modules)
  • opencryptoki: PKCS#11 implementation for Linux (daemon)
  • openvas-client: Remote network security auditor, the client
  • ophcrack: Microsoft Windows password cracker using rainbow tables
  • op: sudo like controlled privilege escalation
  • otpw-bin: OTPW programs for generating OTPW lists
  • packeth: Ethernet packet generator
  • paperkey: extract just the secret information out ouf OpenPGP secret key
  • paris-traceroute: New version of well known tool traceroute
  • password-gorilla: a cross-platform password manager
  • pathfinderd: Daemon for X.509 Path Discovery and Validation
  • pathfinder-utils: Utilities to use with the Pathfinder Daemon
  • pcaputils: specialized libpcap utilities
  • pcp: System level performance monitoring and performance management
  • perlconsole: small program that lets you evaluate Perl code interactively
  • pgloader: loads flat data files into PostgreSQL
  • pgpool2: connection pool server and replication proxy for PostgreSQL
  • pgsnap: PostgreSQL report tool
  • pmailq: postfix mail queue manager
  • pnputils: Plug and Play BIOS utilities
  • policykit: framework for managing administrative policies and privileges
  • postfwd: Postfix policyd to combine complex restrictions in a ruleset
  • postpone: schedules commands to be executed later
  • powertop: Linux tool to find out what is using power on a laptop
  • prayer: standalone IMAP-based webmail server
  • prelude-correlator: Hybrid Intrusion Detection System [ Correlator ]
  • privbind: Allow unprivileged apps to bind to a privileged port
  • pssh: Parallel versions of SSH-based tools
  • ptop: PostgreSQL performance monitoring tool akin to top
  • pyftpd: ftp daemon with advanced features
  • rancid-core: rancid Really Awesome New Cisco confIg Differ
  • rancid-util: Utilities for rancid
  • rdnssd: IPv6 recursive DNS server discovery daemon
  • rdup: utility to create a file list suitable for making backups
  • reglookup: utility to read and query Windows NT/2000/XP registry
  • rgmanager: Red Hat cluster suite - clustered resource group manager
  • rinse: RPM installation environment
  • rofs: Read-Only Filesystem for FUSE
  • rsyslog: enhanced multi-threaded syslogd
  • safe-rm: wrapper around the rm command to prevent accidental deletions
  • samba-tools: tools provided by the Samba suite
  • samdump2: Dump Windows 2k/NT/XP password hashes
  • scalpel: A Frugal, High Performance File Carver
  • scamper: advanced traceroute and network measurement utility
  • scanmem: Locate and modify a variable in a running process
  • schedtool: Queries/alters process scheduling policy and CPU affinity
  • screenie: a small and lightweight GNU screen(1) wrapper
  • scrounge-ntfs: Data recovery program for NTFS filesystems
  • ser: Sip Express Router, very fast and configurable SIP proxy
  • serverstats: a simple tool for creating graphs using rrdtool
  • shutdown-at-night: System to shut down clients at night, and wake them in the morning
  • sipcrack: SIP login dumper/cracker
  • sks: Synchronizing OpenPGP Key Server
  • slack: configuration management program for lazy admin
  • sma: Sendmail log analyser
  • smbind: PHP-based tool for managing DNS zones for BIND
  • smbnetfs: User-space filesystem for SMB/NMB (Windows) network servers and shares
  • softflowd: Flow-based network traffic analyser
  • speedometer: measure and display the rate of data across a network connection
  • spf-milter-python: RFC 4408 compliant Python SPF Milter for Sendmail and Postfix
  • spf-tools-perl: SPF tools (spfquery, spfd) based on the Mail::SPF Perl module
  • spf-tools-python: sender policy framework (SPF) tools for Python
  • sqlgrey: Postfix Greylisting Policy Server
  • ssdeep: Recursive piecewise hashing tool
  • sshfp: DNS SSHFP records generator
  • sshm: A command-line tool to manage your ssh servers
  • sshproxy: ssh gateway to apply ACLs on ssh connections
  • sslscan: Fast SSL scanner
  • strace64: A system call tracer for 64bit binaries
  • sucrack: multithreaded su bruteforcer
  • supercat: program that colorizes text for terminals and HTML
  • superiotool: Super I/O detection tool
  • system-config-lvm: A utility for graphically configuring Logical Volumes
  • system-config-printer: graphical interface to configure the printing system
  • tack: terminfo action checker
  • taktuk: efficient, large scale, parallel remote execution of commands
  • tcpwatch-httpproxy: TCP monitoring and logging tool with support for HTTP 1.1
  • terminator: Multiple GNOME terminals in one window
  • timelimit: Simple utility to limit a process s absolute execution time
  • tipcutils: TIPC utilities
  • tor: anonymizing overlay network for TCP
  • tpm-tools: Management tools for the TPM hardware (tools)
  • tracker-utils: metadata database, indexer and search tool - commandline tools
  • tumgreyspf: external policy checker for the postfix mail server
  • ucspi-tcp: command-line tools for building TCP client-server applications
  • unbound: validating, recursive, caching DNS resolver
  • unhide: Forensic tool to find hidden processes and ports
  • uniutils: Tools for finding out what is in a Unicode file
  • unsort: reorders lines in a file in semirandom ways
  • uphpmvault: upload recovery images to HP MediaVault2 via Ethernet
  • usermode: Graphical tools for certain user account management tasks
  • utf8-migration-tool: Debian UTF-8 migration wizard
  • uuid-runtime: universally unique id library
  • vblade-persist: create/manage supervised AoE exports
  • vde2: Virtual Distributed Ethernet
  • vdmfec: recover lost blocks using Forward Error Correction
  • virtinst: Programs to create and clone virtual machines
  • virt-manager: desktop application for managing virtual machines
  • virtualbox-ose: x86 virtualization solution - binaries
  • virt-viewer: Displaying the graphical console of a virtual machine
  • watchupstream: Look for newer upstream releases
  • whirlpool: Implementation of the whirlpool hash algorithm
  • win32-loader: Debian-Installer loader for win32
  • xavante: Lua HTTP 1.1 Web server
  • xdelta3: A diff utility which works with binary files
  • xen-shell: Console based Xen administration utility
  • xenstore-utils: Xenstore utilities for Xen
  • xenwatch: Virtualization utilities, mostly for Xen
  • xfingerd: BSD-like finger daemon with qmail support
  • xl2tpd: a layer 2 tunneling protocol implementation
  • xrdp: Remote Desktop Protocol (RDP) server
  • yersinia: Network vulnerabilities check software
  • zerofree: zero free blocks from ext2/3 file-systems
  • zipcmp: compare contents of zip archives
  • zipmerge: merge zip archives
  • ziproxy: compressing HTTP proxy server
Further Ressources

10 February 2009

Gunnar Wolf: dh-make-drupal - Easily debianize Drupal modules, themes

I have spent a couple of days working into dh-make-drupal. Yes, you guessed right: An idea based on the wonderful dh-make-perl, but applied to the Drupal Content Management System.
Drupal's greatest strengths, IMHO, are:
  • Drupal offers a huge number of modules and themes
  • Drupal has an amazingly sane configuration handling, where -contrary to what usually happens in PHP-land and, in general, among webapps- you set up the code only at a single place, with only the site-specific configuration (usually a single file) handling all of the differences
Yup, even though I am quite fond of its flexibility and power, I fell for Drupal in no small part because of its sysadmin-friendliness. Now, I hate having non-Debian-packaged files spilled over my /usr/share partition. Drupal modules want to be installed in /usr/share/drupal5/modules/module_name (or s/5/6/ for Drupal6, to which I have not yet migrated). For that reason, over the last year I have been growing my personal apt repository of Drupal stuff. Yes, it is still on, and I don't plan on taking it off. You can access it by adding deb http://www.iiec.unam.mx/apt/ etch drupal to your /etc/apt/sources. However, you can now also do the process locally. Do you fancy the wonderful Biblio module? Or the very nice Abarre theme? Great!
  1. 0 gwolf@mosca 4 /tmp$ ~/code/dh-make-drupal/dh-make-drupal --drupal 5 biblio
  2. 0 gwolf@mosca 5 /tmp$ cd drupal5-mod-biblio-1.16/
  3. 0 gwolf@mosca 6 /tmp/drupal5-mod-biblio-1.16$ debuild -us -uc >& /dev/null
  4. 0 gwolf@mosca 7 /tmp/drupal5-mod-biblio-1.16$ cd ..
  5. 0 gwolf@mosca 8 /tmp$ su
  6. Password:
  7. 0 root@mosca[1]/tmp# dpkg -i drupal5-mod-biblio_1.16-1_all.deb
  8. Selecting previously deselected package drupal5-mod-biblio.
  9. (Reading > database ... 275110 files and directories currently installed.)
  10. Unpacking drupal5-mod-biblio (from drupal5-mod-biblio_1.16-1_all.deb) ...
  11. Setting up drupal5-mod-biblio (1.16-1) ...
Yay! Yes, still many more things to come (i.e. including the debuild call and whatnot), but... Enjoy! BTW, this piece of software owes a couple of beers to Why the lucky stiff, author of Hpricot. You are insane (but we are all well aware of that). You deserve to go to the webscraping heaven. Yes, besides the programming-languages-teaching-cartoon heaven. You find out how to split the time between them. [Update]: Of course, ITP bug #514786 has been filed, and I will soon be uploading this into Debian.

8 February 2009

Daniel Burrows: Dear Lazyweb, does anyone understand job control?

I've been banging my head against this all day and it doesn't make any more sense than it did when I started. I have a need to write some code that can manage job control on a terminal. More specifically, I need to run a single process and stuff it into the background at will, so that it gets suspended when it tries to read from the terminal. So, there's a controller process and a subprocess process.
 controller  ----------> subprocess
               manages
The man-pages and glibc info documentation make this look simple: disable TOSTOP if it's enabled via tcsetattr() so that the subprocess can write to the terminal, then start the subprocess in a new process group (by fork()ing and calling setpgid()). Once it's going, you can put it in the foreground or background by calling tcsetpgrp() to set the terminal's foreground process group to the subprocess (to put it in the foreground), or to the controller process (to put the subprocess in the background). Whenever the subprocess is in the background, it will be sent SIGTTIN if it tries to read from the terminal. I have everything working -- except for the very last sentence of that last paragraph. I can see my processes being put into the right process group, and I can see them going into the foreground and the background. For instance, here the first line is the controller process and the rest of the lines are the process group of the subprocess (this one started a few other processes).
STAT CMD                           PID  PGID TPGID  PPID   SID
Ss+  ./src/aptitude              26989 26989 26989 26980 26989
S    ./src/aptitude              26991 26991 26989 26989 26989
S    /bin/sh -c /usr/sbin/dpkg-p 27027 26991 26989 26991 26989
S    /usr/bin/perl -w /usr/sbin/ 27028 26991 26989 27027 26989
Z    [dpkg-preconfigu] <defunct> 27034 26991 26989 27028 26989
S    /bin/sh -e /tmp/lynx-cur.co 27039 26991 26989 27028 26989
S    whiptail --backtitle Packag 27043 26991 26989 27028 26989
If I try to move the background process into the foreground, it is marked as the foreground process in this session:
STAT CMD                           PID  PGID TPGID  PPID   SID
Ss   ./src/aptitude              26989 26989 26991 26980 26989
S+   ./src/aptitude              26991 26991 26991 26989 26989
S+   /bin/sh -c /usr/sbin/dpkg-p 27027 26991 26991 26991 26989
S+   /usr/bin/perl -w /usr/sbin/ 27028 26991 26991 27027 26989
Z+   [dpkg-preconfigu] <defunct> 27034 26991 26991 27028 26989
S+   /bin/sh -e /tmp/lynx-cur.co 27039 26991 26991 27028 26989
S+   whiptail --backtitle Packag 27043 26991 26991 27028 26989
Note that the background process is not suspended, even though it's busy reading from the tty. If I manually suspend the process group with kill -TTIN -26991, it stops as expected:
STAT CMD                           PID  PGID TPGID  PPID   SID
Ss   ./src/aptitude              26989 26989 26991 26980 26989
T+   ./src/aptitude              26991 26991 26991 26989 26989
T+   /bin/sh -c /usr/sbin/dpkg-p 27027 26991 26991 26991 26989
T+   /usr/bin/perl -w /usr/sbin/ 27028 26991 26991 27027 26989
Z+   [dpkg-preconfigu] <defunct> 27034 26991 26991 27028 26989
T+   /bin/sh -e /tmp/lynx-cur.co 27039 26991 26991 27028 26989
T+   whiptail --backtitle Packag 27043 26991 26991 27028 26989
So the signal isn't being blocked or ignored. I can also run programs in a normal shell, outside my harness (e.g., links &) and watch them auto-suspend, but the same thing doesn't happen when I start them directly under my controller process. It's not even that they're starting as foreground processes: I start them in the background, and they never see a SIGTTIN. Does anyone have a clue what's going on? Hopefully it's as simple as a flag I have to set somewhere... Oh, and for extra fun, this is all happening inside a VTE terminal widget. That shouldn't make a difference (after all, it's what gnome-terminal uses, and SIGTTIN behaved as expected when I tested it there), but who knows, it might be relevant. [UPDATE] I did a little more testing: I was bringing the subprocess into the foreground whenever the terminal was active, so I couldn't try typing into the terminal while the subprocess was in the background. If I do that, it does get SIGTTIN and it suspends. So it looks like select() doesn't count as a read for the purposes of job control. I doubt there's much I can do to get around that. :-(

5 February 2009

Maximilian Attems: initramfs-tools new Lenny features

initramfs-tools design principle is to ship a generic initramfs. The design explicitly allows lots of customization through hook and boot scripts. A previous post focused on the history of initramfs-tools. Several contributors enhanced initramfs-tools since the Debian Etch release so the non exclusive new feature list:
  • The initramfs contains all drivers/ ata,block,ide,mmc,scsi modules instead of a stupid hard coded list. This gives bonus points for getting more future proof.
  • Configurable small initramfs: The MODULES=dep mode walks /sys/ for the needed drivers of the specific box. This was the most wanted feature and is the new default for some Debian-Installer embedded architectures. The code seems in between well tested even if some corner cases might still emerge. The smaller initramfs is needed for specific bootloaders and helps on slow target boxes.
    For a even smaller initramfs you can kick busybox if you don't have an lvm2 root or don't need it's debugging tools.
  • Quicker initramfs build: The update-initramfs command uses dpkg trigger and thus not every postinst update-initramfs(8) call leads to a new initramfs build. Also the build time got improved.
  • Improved panic message (yes users need to be handhold at this point :).
  • Potential debug log is visible after call to init(8) inside /dev/.initramfs/.
  • update-initramfs got hardened against failure on update or ro partitons.
  • The klibc utilities got worked on: chroot, fstype, ipconfig, mount, nfsmount sync.
  • Fixed various bugs in NFS and networking setup due to incorrect option parsing.
  • Allow to blacklist modules on boot by cmdline bootarg blacklist=modulename.
  • Allow non root usage of mkinitramfs.
As bonus to some cleanup and docs update we have also seen a Ubuntu sync and are not too diverged.

3 February 2009

Gustavo R. Montesino: libgda3 3.0.2-4

This new Debian release of libgda moves gtk-doc and related packages back to build-depends-indep, and add some makefile logic on debian/rules to detect if gtk-doc is installed (looking for gtk-doc.pc) and enable or not documentation (re)generation on-the-fly. Of course, I've also been bitten by the sha1 checksums on the changes files, as I had a new version of dpkg-dev and an old devscripts/debsign installed. It took me some time to figure how to fix this one.

1 February 2009

Daniel Burrows: A better map of the apt state files

Last week, I posted some diagrams showing where apt and dpkg store their state files. I got a few suggestions about how to simplify them and make them more readable, and here's a tweaked version that includes those changes as well as some of my own. diagram of apt files This image is also available in svg and pdf formats. As before, the SVG probably won't work outside of Inkscape on Linux, and the PDF requires Acrobat Reader to display properly. If anyone knows how to convert Inkscape SVGs to PDFs that work everywhere, I'd be happy to give it a shot. As before, I also made a slightly less flashy version that should be easier on printers, and perhaps easier on the eyes too: simpler diagram of apt files This image is also available in svg and pdf formats.

29 January 2009

Neil Williams: langupdate uploaded to experimental

I'm happy enough with the langupdate tool now that I've made the upload to Debian experimental. langupdate is an apt frontend to Emdebian TDebs to support Emdebian Grip and Emdebian Crush but also to support mixed installations of Debian and Emdebian.

Any Debian package is ignored because those packages already contain all the translation files.

Emdebian packages do not include /usr/share/locale, so langupdate identifies these packages from the dpkg status files, identifies the available Emdebian TDebs for the corresponding source package via libapt-pkg and a temporary apt-cache in /var/lib/langupdate and identifies which locales are supported on the current machine from the environment and from /etc/locale.gen. The Emdebian TDeb packages that match these criteria are then automatically installed.

If only Debian packages exist, langupdate reports "Nothing to do."

The end result, for Emdebian users, is that a typical 450Mb /usr/share/locale on Debian is stripped down to 9Mb (or less) per configured language.

The advantages over localepurge are:
  1. The Emdebian packages are smaller because the translations have already been removed at the repository, so no wasted bandwidth or wasted CPU workload removing files that have just been installed.

  2. If a language is added or de-configured, all the corresponding translation files are added or removed respectively.


langupdate can use any suitable repository - the default is the Emdebian TDeb repository.

Note that, unlike in Debian, Emdebian TDebs are architecture-dependent and are split into individual packages for each language and source package and architecture. Yes, it is a lot of packages and a lot of work for the machine hosting the server but better that than trying to do the work on the Emdebian device.

Currently, Emdebian Grip still has a very limited package set so the list of packages that have Emdebian TDebs is still small. Depending on how long it takes to release Lenny, more packages will get added to Grip but the "full Grip experience" will, for most people, involve upgrading from Emdebian Grip 1.0 (based on Debian 5.0 "lenny") to Emdebian Grip testing - what will become 2.0, based on Squeeze.

langupdate itself is translated into 7 languages (cs, de, eu, fr, it, ru and sv) thank you to those who prepared those translations before the deadline ended tonight and uses a langupdate-locale package as a precursor to the eventual Debian TDeb.

26 January 2009

Daniel Burrows: A map of the apt and dpkg state files

Continuing my recent interest in making diagrams of things, this weekend's project was a visual representation of what the global state files of apt and dpkg are, what's stored in them, and how they're manipulated. As before, this includes only the core part of the system (ok, I squeezed aptitude in there too), for the simple reason that I'm not smart enough to include more stuff in the diagram without making it utterly illegible. As it is, it's already pushing the boundaries of how much you can fit on a single page of paper: diagram of apt files This image is also available in svg and pdf formats. Be warned, though, that the SVG might display oddly in anything but Inkscape, and the PDF only displays correctly in Acrobat Reader. If you want to print off a copy without wasting toner, if you don't have a program capable of printing the above, or if gradients offend you, you can also download a simpler version of the diagram: simpler diagram of apt files Also available as an svg file or a pdf file. Unlike the last diagram I produced, this one was made in Inkscape. It took pretty much the whole weekend, most of which time I spent learning features of Inkscape that I didn't end up using. Oh well. I've come to the conclusion that Inkscape is an amazing graphics program and an utterly terrible diagram editor. Although to be fair, it seems to be one of the best, if not the best, diagram editors in Debian; also, if you slog through it and you have more graphical talent than me, the diagrams will look very good. [EDIT]: fixed an oversight in the first version of the diagram (apt-get also writes the extended_states file).

21 January 2009

Axel Beckert: Tablet Amora runs on the OpenMoko FreeRunner (updated)

Amora ( A MObile Remote Assistant ) is a client/server suite which allows you to remote control an X desktop using a bluetooth enabled mobile phone. Initially there was only a Symbian client (running e.g. on nearly all Nokia E and N series phones), but J2ME clients are under developement, too. Then there is Tablet Amora (aka Tamora), an Amora proof of concept client for the Maemo platform which runs on internet tablets like e.g. the linux based Nokia N770, N800, and N810. Since Maemo isn t that far away from what runs on the OpenMoko, getting Tamora working on the OpenMoko, too, suggested itself. Maemo seems to use the deb package format, too, just slightly extended (e.g. by package icons), so it wasn t even that hard work to adapt the existing Maemo packaging to build, install and run on Debian, too. So that s how Tamora looks on the OpenMoko:
The packaging is still far away from Debian standards (throws tons of lintian warnings and the source package generation is b0rked), so yet there are no prebuilt debs available, but you can checkout amora-client from the Subversion repository and build the package from there:
 $ svn checkout http://amora.googlecode.com/svn/trunk/amora-client/maemo/ amora-client
 $ cd amora-client
 $ debuild -uc -us
 $ cd ..
 # dpkg -i amora-client_0.1-2maemo+openmoko_all.deb
For running and installing tamora you need packages from the pkg-fso APT repository on alioth. And to build it, you need the libedje-bin which is available from the pkg-fso repository for at least the armel architecture, or else from Debian experimental. You can add these repositories to your sources.list as follows:
 # PKG FSO repository
 deb     http://pkg-fso.alioth.debian.org/debian unstable main
 deb-src http://pkg-fso.alioth.debian.org/debian unstable main
 # Debian Experimental
 deb     http://ftp.ch.debian.org/debian experimental main
 deb-src http://ftp.ch.debian.org/debian experimental main
Since Tamora is yet only a proof of concept client, currently only the following remote functions are available:
  • pressing arrow key right/left
  • pressing F5 (fullscreen for the OpenOffice.org Presenter)
This should though at least suffice for a presentation with the OpenOffice.org Presenter. To use Tamora to remote control your Debian laptop, you need a bluetooth dongle (or builtin bluetooth support) and amora-server installed as with the Symbian S60 (3rd Edition) Amora client, too. Update, 23:51 libedje-bin seem not available in the pkg-fso repository for every architecture. You ll also find it in Debian experimental. Updated the sources.list section above appropriately. Thanks to Sebastian Montini for pointing out this problem.

16 January 2009

Joey Hess: little known fact

An apparently little known fact about dpkg is that it clears suid bits when upgrading packages. This defeats the hardlink-a-suid-binary-and-wait-for-exploit attack that used to be a worry, and which apparently still is to some.
joey@gnu:~>ln /usr/bin/sudo
joey@gnu:~>dir sudo
-rwsr-xr-x 3 root root 112K Jul  6  2008 sudo*
joey@gnu:~>sudo apt-get --reinstall install sudo
Reading package lists... Done
[...]
Get:1 http://ftp.egr.msu.edu unstable/main sudo 1.6.9p17-1 [177kB]
Fetched 177kB in 1s (91.0kB/s)    
Created commit e5523fe: saving uncommitted changes in /etc prior to apt run
 1 files changed, 14 insertions(+), 0 deletions(-)
(Reading database ... 167780 files and directories currently installed.)
Preparing to replace sudo 1.6.9p17-1 (using .../sudo_1.6.9p17-1_i386.deb) ...
Unpacking replacement sudo ...
Processing triggers for man-db ...
Setting up sudo (1.6.9p17-1) ...
joey@gnu:~>dir sudo 
-rw------- 1 root root 112K Jul  6  2008 sudo
dpkg has done this since version 1.10.18.1, released in 2004. PS, Can any rpm users tell me if rpm does this? PPS, If you find yourself making statements like "While noexec is only a weak defense, it gives a little bit more protection", you are probably not really talking about security, but instead about a warm fuzzy feeling. PPS, If shellcode can create a suid root executable, it can create it in /root or some other directory that is not mounted nosuid.

Next.

Previous.