Monday, December 31, 2007

Access ext2/ext3 Disk from Windows

I've formatted my old 60GB USB external backup disk as a single ext3 partition. I figured it would be ideal to offload to it all my media files (videos, music, e-books and other documents) . But then I realized that I'll need to move stuff to and from this disk and my wife's Windows PC. So I started searching for a way to do it. I ended up trying out two ext2 file-system drivers for Windows: ext2ifs and ext2fsd.

Both are free and both seem to handle the basics well - read and write files from and to the disk. Both require a rather cumbersome mounting procedure where a special utility is used to assign a drive letter to the ext2/ext3 disk (but Linux users like me should not complain). Both fully support ext2 (which also covers ext3 partitions, but without journaling).

I tried ext2ifs first, and it worked nicely - I used it to move a 4GB DVD image from one computer to the other (perfectly legal, I assure you). It can't, however, handle UTF-8 encoded file names. This limitation is clearly stated in the ext2ifs FAQ, but I somehow missed it.

The ext2fsd changelog, on the other hand, indicates that it correctly handles UTF-8 and other file name encodings. And indeed it does. But unlike with ext2ifs, I could not "safely remove" the USB disk even after I unmounted the drive and exited the ext2 volume manager.

I'll stick with ext2fsd for the time being, mainly because it solves the UTF-8 problem, but also because it seems to be a rather active project with a growing set of features, while ext2ifs seems to have been frozen for over a year now.

[27 Jan. 2008] UPDATE: ext2fsd USB issues have been fixed since version 0.42, and even better - it can be configured to auto-mount USB disks. Sweet!

Tuesday, December 25, 2007

HPLIP Upgrade or Yet Another Printing Problem

The long overdue upgrade of HPLIP (HP Linux Printing and Imaging) to version 2.7.10, was supposed to make me happier - it was supposed to fix the fax (try saying it fast).

It didn't.

The first problem I encountered after the upgrade was that hp-toolbox insisted that it can't communicate with my printer (HP OfficeJet 5510 all-in-one). It took some futzing around to discover that the printer was accessible if I ran the program as root with gksu -u root hp-toolbox. Annoying.

By this time I managed to remove the fax printing queue from CUPS. Never mind, I told myself - just run hp-setup, follow the wizard's instructions and it'll be good to go. But here I got another surprise - hp-setup created a printer queue, but failed to create a fax queue, complaining that it could not find the HPLIP fax PPD file.

I futzed around a bit more, trying to manually add a fax queue from within the CUPS web interface. But hp-sendfax reported an error when I tried to use it (I later realized that I selected the printer PPD file instead of the fax PPD file - simply because there was no fax PPD file to select).

I finally decided to go over the hplip package bug page on the Debian Bug Tracking System. I then realized that I was actually hit by two bugs:

Bug #452454: to use the printer the user must be a member of the scanner group.

Bug #454341: the path to the PPD files is wrong in /etc/hp/hplip.conf, and should be set like this:

ppd=/usr/share/ppd/hpijs/HP/

The fax works now. Dang.

Friday, December 21, 2007

Small Fonts in Icedove

I'm using Icedove 2.0.0.6 from the unstable package repository, as my email client. A recent update caused it to show small, difficult to read, fonts in both menus and messages. It took an hour of mucking around with font sizes, pondering the contents of .mozilla-thunderbird and googling for relevant search phrases, before I decided to go over the list of Icedove bugs.

And sure enough, the problem is not only known, but a workaround exists, too:
  1. in Icedove select Edit->Preferences
  2. select the Advanced tab
  3. press "Config Editor"
  4. enter "dpi", press enter
  5. modify the value of the key layout.css.dpi from -1 to 0
  6. restart Icedove
My eyes feel better now.

Wednesday, December 19, 2007

DHCP Server @ Home

My wife's windows PC is connected to my Debian box with a crossover Ethernet cable. It was configured to use a fixed IP (10.0.0.4), and my box (10.0.0.2) serves as both its gateway and its DNS. This setup works fine, but I decided, in the interest of flexibility and control, to attempt to install a DHCP server on my box.

So here goes:
  1. install the DHCP server:
    apt-get install dhcp3-server
  2. edit /etc/dhcp3/dhcpd.conf and add the following at its bottom:

    host windows-pc {
    hardware ethernet 00:16:36:8E:92:3B;
    fixed-address windows-pc.home;
    }

    subnet 10.0.0.0 netmask 255.255.255.0 {
    option domain-name "home";
    option domain-name-servers machine-cycle.home;
    option routers machine-cycle.home;
    default-lease-time 28800;
    max-lease-time 28800;

    # Unknown clients get this pool.
    pool {
    max-lease-time 300;
    range 10.0.0.200 10.0.0.253;
    allow unknown-clients;
    }

    # Known clients get this pool.
    pool {
    range 10.0.0.5 10.0.0.199;
    deny unknown-clients;
    }
    }

    subnet 172.27.208.0 netmask 255.255.240.0 {
    }


    The first stanza (host) assigns an IP address (or a host name) to the specified MAC address. The second stanza (subnet) defines the properties common to all computers on the home network (at the moment it's just my wife's laptop). Note the use of address pools (this stanza was copied almost verbatim from the man page for dhcpd.conf). The last stanza defines a subnet associated with my cable modem with no properties or hosts - this allows the DHCP server to ignore requests originating from the cable modem network interface.

  3. (Re)start the DHCP server:
    /etc/init.d/dhcp3-server start
  4. Configure the firewall (if you're using one) to allow DHCP traffic. For Shorewall simply add the following lines to the /etc/shorewall/rules file:
    #       dhcpd
    ACCEPT loc $FW udp 67 68
    ACCEPT $FW loc udp 68 67
  5. Restart the firewall:
    /etc/init.d/shorewall restart

  6. On the windows machine disable the relevant network interface, and reconfigure it (right-click, properties, etc.) to get its IP address by DHCP and the same for DNS.
  7. Configure the firewall on the windows machine to allow traffic on the 10.0.0.x subnet (in ZoneAlarm this means that this subnet should be added to the trusted zone).
  8. Enable the network interface and verify that it acquires the correct IP address, gateway and DNS.

Saturday, December 8, 2007

Mixing "testing" and "unstable"

I have several (14) packages installed from "unstable" (aka "sid"), and several (3) locally installed packages. The other packages (2192) come from the "testing" repository.

Setting up a mixed system is rather easy - I followed the instructions at the APT HOWTO, and you may also want to read the nice HOWTO and comments over at the Debian User Forums.

I use the following oneliner to list the packages from "unstable":
apt-show-versions | cut -d ' ' -f 1 | awk 'BEGIN{FS="/"}{if($2=="unstable")print$1}' | sort
(replace "unstable" with "testing" to list the packages from "testing").

And here's how to list the locally installed packages:
apt-show-versions | cut -d ' ' -f 1 | awk 'BEGIN{FS="/"}{if(NF==1)print$1}' | sort
Append "|wc -l" to these commands in order to count the packages instead of just list them.