urpmi

Among all package management systems, Mandriva's urpmi is certainly the least known, and to a considerable extent the most underrated one. Since years, its reliability in resolving dependencies is on par with Debians celebrated apt-get. It's speed has lagged behind slightly, but in its most recent incarnation (5.19), urpmi is just every bit as fast as apt-get. That's good news...and to add to it, there's a lot of functionality which is virtually unknown to everybody except the most seasoned advocates of Mandriva.

Use... urpmi "package" urpme "package" ...to install and remove packages, respectively.

And use... urpmq "package" urpmq --fuzzy "partofpackagename" ...for listing existing packages either with exactly the same name, or with part of the name as a wildcard.

And if you want to know which package contains a certain file, use... urpmf "filename" ...which will tell you both the name of the package as well as the precise path.

wajig

The package management of Debian and its forks is arguably one of the best ever created. Its user interface evolved from the primitive dselect, over the ubiquitous apt-get, to aptitude, the current standard (of which synaptic and adept are graphical implementations). Aptitude resolves dependencies very reliably and is, for example, also able to clean the system from orphaned packages.

Aptitude, however, is not sufficient for the entire range of tasks for package management, but requires additional helper-tools such as apt-cache and dpkg. For this reason, I use wajig, a unifying python script which simplifies package management in Debian (or Ubuntu) enourmously. Wajig combines the abilities of apt-get, apt-cache, and dpkg under a single consistent interface, and it is much easier to use than aptitude. I wonder why so few people know and use wajig...

OpenSuse and KDE4

The primary reason for the existence of my OpenSuse 10.3 installation is the fact that most servers I'm responsible for run SLES. I thus have the possibility to test configuration changes without risking any adverse consequences.

As a secondary purpose, I also installed KDE 4 for being able to follow the development of my favored desktop environment. Since the release of KDE 4.1 I was waiting for an upgrade to come, and I got increasingly impatient. Surely it's not possible that the Suse developers are so slow? No, they aren't...the fault is all mine. I just used the wrong update channel, namely, KDE:KDE4:STABLE:Desktop instead of KDE:KDE4:Factory:Desktop. One can learn that from the first hit after a quick search on Google...

To change the channel, use smart channel --edit or zypper -h The latter in case you are unfortunate enough to use zypper. 😉

Convenience

We all love the bash. And since we are are lazy, we love bash's history in particular.

  • Everyone knows that: one can go back in the history by hitting the "arrow up" key.
  • One can repeat any command from the history by typing !x, where x is the running number of the command in the history.
  • One can scroll though any command issued before and starting with the letter "l" with l
  • Even better: one can reverse search bash's history by typing ctrl+r.

X.509

Security professionals involved in the support of enterprise-class public-key infrastructures tend to ridicule OpenPGP and the web of trust. They view the idea as naive and consider the implementation to be amateurish. Of course, they celebrate X.509 certificates as being the best that happened to humanity since the invention of the transistor.

A sad example for entirely inappropriate arrogance, isn't it? These "professionals" have, evidently, no fucking clue. At home, I couldn't care less whether my friend signs his mails with a $500 certificate guaranteeing that he is Mr. Thomas Hauenstolz, Jr., III in real life. I don't even know his actual name. I know he's a good guy, and that's the only thing which counts.

For my job, however, I got such a certificate, and I also have to use it. What really annoys me is the difficulty of installing and using it. First of all, one needs to download the certificate. Konqueror doesn't support the import of certificates at all. Opera imports all right, and exports happily, but the exported certificate doesn't import in gpgsm, which however is necessary to use the certificate for signing e-mails with kmail...

Firefox can import the certificate, but the export fails with a meaningless error message ("unknown general error"). Google tells me that the certificate will be exported correctly when the tor add-on is disabled. Of course! *slapforehead*

Now, gpgsm imports the certificate. I test the whole thing by signing mails with my shiny new certificate, and reveive mails from the equally proud owners of X.509 certificates. It works! After some time I just wonder what exactly occupies so much RAM...ohhh, I see: each operation with my X.509 certificate spawns at least two gpgsm processes, which will remain in RAM until the end of days. Why? Ask a security professional.

Backup your data

Backup your data. Easy to say, difficult to do. Or not?

Try rsnapshot.

It's deceptively easy, but....

  • never ever use a space in rsnapshot.conf
  • never ever add "no_create_root" before you created the initial backup
  • never ever add --stats to the long arguments of rsync before you created the initial backup

An article on rsnapshot will follow. It is a truly excellent backup solution.

One-line calculators

Old news, I know. But still nice to know.

 awk "BEGIN { print $* ; }"

 echo "scale=5; $1" | bc -l

 perl -e "print $1";echo

Prepend any of these lines with #!/bin/bash, call it, well, calc, and invoke your new calculator with 'calc 2+2'.

PS: No, the 'run command' utility of KDE can't compete with these one-liners. But katapult can.

Random hex numbers

Can't live with them, can't live without them. 😉

od -w8 -t x8 -A n /dev/urandom | head -1000 | sed 's/^[ \t]*//'

This gives you one thousand of them. 😏

Shrink VirtualBox disk image

  • prerequisite: the virtual disk image is of type "dynamically expanding"
  • delete and install in the guest as much as you want
  • defrag your virtual disk, if necessary (Windows guests)
  • with the guest running, fill the free space on your virtual disk with zeros.

    • For Windows guests, use sdelete:

      sdelete -c c:
      
    • For Linux and BSD guests:

      cat /dev/zero > zero.fill;sync;sleep 1;sync;rm -f zero.fill
      
  • finally, with the guest shut down, issue the following command in your host system:

    VBoxManage modifyvdi virtualdiskname.vdi compact
    

YMMV, but I managed to save 2 GB in this way for a Windows XP guest.

Update: in VirtualBox 3.* and later, use the following command:

VBoxManage modifyhd --compact virtualdiskname.vdi

Furthermore, in more recent versions of sdelete, the command-line options 'c' and 'z' has been exchanged. To zero a disk, you now have to use

sdelete -z c: