Customizing a Lindows MobilePC

by Steve Hastings

The Lindows MobilePC is a slick piece of hardware; see my review in the December 2003 issue of Linux Journal. I bought one and I'm quite pleased with it. The Linux system it ships with, however, is not what I want, so I have spent some time customizing it to better suit my needs.

The Lindows MobilePC is a notebook called an eNote with Lindows 3.0 installed. For this article, I refer to the notebook itself as an eNote. You need root permissions to do almost everything described in this article.

Make Mine Debian

My favorite version of Linux is Debian GNU/Linux, and I wanted my eNote to run the Unstable branch of Debian. This did not require a complete reinstall because Lindows is based on Debian, and Lindows includes all the essential Debian utilities, such as apt-get. Lindows does not use these utilities but its own Click-N-Run system. Lindows.com could have easily removed those utilities, but it left them in place; that was nice.

So, Lindows is a Debian system with some non-Debian packages installed. To switch over to a Debian Unstable install, I wanted to remove all the non-Debian packages and then update to the latest Debian packages.

Preparing for Trouble

Switching from Lindows to something else offers you several chances to make mistakes that could leave your eNote unable to boot. It's a good idea to plan ahead for what to do if that happens. First of all, if there is any data you care about, back up that data! Even if you just bought your Lindows MobilePC and haven't done anything with it yet, you probably should have a reference copy of the setup files from /etc, so you can figure out how things used to be if something gets messed up. Probably the easiest way to back up the data is to copy it to another computer, perhaps using the scp command.

If at some point your eNote won't boot, how can you recover? An eNote does not include a floppy drive or a CD drive. It does, however, have the ability to boot from a USB device. If you have a USB CD drive, you can boot from an install CD for your favorite Linux distribution. If you prefer Red Hat, SuSE or some distribution of Linux other than Debian, you can use this technique to install a fresh system. The eNote also has the ability to do a network boot, but I have not tried this yet.

If you don't want to use a network boot or a USB device, there still is an easy way to give yourself a safety net: use the swap space to install an emergency kernel and some recovery tools. First, use swapoff to shut down swapping. Next, using a partition editor such as fdisk or cfdisk, change the type of swap partition from 0x82 (swap) to 0x83 (ext2). Then, use mke2fs to create an ext2 filesystem on the partition, and copy your recovery tools into the space.

The Lindows MobilePC comes with a 256MB swap partition, enough room for a lot of recovery tools. You could use the tool set from a Linux recovery disk distribution, but I suggest you simply grab copies of all the tools already available in the Lindows system. Assuming your swap partition is /dev/hda2, as it was on my MobilePC, these commands would do it:

# mkdir /mnt/tmp
# mount /dev/hda2 /mnt/tmp
# cp -pr /boot /bin /usr/bin /sbin /lib /mnt/tmp

Now all that remains is to make sure the bootloader can boot from the /dev/hda2 partition in a pinch. Later, I discuss the GRUB bootloader and return to this issue.

If you use this technique, make sure you have a working bootloader installed before you reboot. The recovery tools can't help you if the problem lies with your bootloader.

Switching to Debian

When it was time for the actual switch to Debian, I took a look at all the packages with

# dpkg -l | less

I knew I wanted to get rid of anything with lindows or xandros in the package name. As the version of XFree86 was a special Lindows version, I figured that was a great place to start. It would not make sense to try to remove XFree86 from a shell prompt running on the KDE desktop, because the whole X environment would be terminated, including my apt-get process. So I needed a shell independent of X. I used Ctrl+Alt+F1 to get a text-mode tty and found that on my Lindows MobilePC that there wasn't a text-mode tty there. So instead I used SSH from another computer on my network, logged in to the MobilePC remotely and got a root shell prompt.

I edited the /etc/apt/sources.list file, which was pointed right at the main US mirror for Debian, and pointed it instead to a mirror closer to my home. Then I updated APT's package list so APT would know what new packages were available:

# apt-get update

Then, it was time to start deleting the stuff I didn't want:

# apt-get remove xfree86-common

APT warned me I was about to remove 126 packages; that's what I wanted, so I pressed the Enter key.

This still left some packages I didn't want, so I built a command line that would find them all and get rid of them. This command looks for all packages with lindows in the name and feeds the list to apt-get remove:

# grep "Package: lindows" < /var/lib/dpkg/available | cut --delimiter=' ' -f2 | xargs apt-get remove -y

Then I did the same for any packages with xandros in the name:

# grep "Package: xandros" < /var/lib/dpkg/available | cut --delimiter=' ' -f2 | xargs apt-get remove -y

I checked to make sure I had done what I intended. dpkg -l was a little bit confusing, because it showed non-installed packages too. So I piped it through fgrep to find only the installed packages (flagged with status ii:

# dpkg -l | fgrep ii | less

Everything looked good thus far, so it was time to upgrade all packages to the latest Debian Unstable versions:

# apt-get dist-upgrade

As sometimes happens with APT, my upgrade hung on some circular dependencies on some packages related to the aRts sound system. I had to delete by hand with dpkg two old packages to get things unstuck:

# dpkg -r libarts1-bin
# dpkg -r libarts1-glib
# apt-get -f install
# apt-get dist-upgrade

Once the dist-upgrade finished, it was time to install the GNOME system:

# apt-get install gnome

This process pulled in 185 new packages and took a while. This step also pulled in XFree86 for me. Again, a few packages didn't install because of circular dependencies. All I had to do was run the command one more time, and everything installed with no further errors:

# apt-get install gnome

I checked to make sure that GDM was installed and found that wasn't. GDM is the login manager I prefer, so I installed it with:

# apt-get install gdm

At this point I decided to run aptitude.

# apt-get install aptitude

aptitude is an ncurses-based APT tool. One of the cool features of aptitude is it can find all the recommended packages and install them. I pressed the G key twice to start the update, and a few dozen more packages installed.

Now, I wanted to make sure that GNOME actually worked, so I manually started up GDM:

# /etc/init.d/gdm start

GDM started, I logged in and my GNOME desktop came right up. I love it when a plan comes together.

Enter the GRUB

By now my notebook had no more Lindows packages and a full GNOME desktop. But I wanted to check what boot manager was installed. It turned out that none was because the Lindows system had been using xandros-lilo2, and I had removed all xandros* packages. I could have installed LILO from Debian, but I prefer GRUB, so I installed that:

# apt-get install grub

Then I went through the GRUB install process. There is no need to summarize that here; you can read about it in the GRUB manual.

If you used the swap space to stash a recovery kernel and some recovery tools as described above, you now would need to edit the menu.lst file in your /boot/grub directory and add these lines:

title           Disaster recovery!
root            (hd0,1)
kernel          /boot/vmlinuz-2.4.20 root=/dev/hda3 ro single
initrd          /boot/initrd-2.4.20.gz
boot

Incidentally, here are menu.lst lines for booting a 2.4.20 kernel, such as the one that came with Lindows. This assumes the kernel is in the boot partition Lindows created, /dev/hda1, which usually is mounted as /boot:

title           Debian GNU/Linux, kernel 2.4.20
root            (hd0,0)
kernel          /vmlinuz-2.4.20 root=/dev/hda3 ro
initrd          /initrd-2.4.20.gz
savedefault
boot
The Moment of Truth

I installed a couple of kernels, including one I built using the Debian kernel-package tools. And then it was time for the moment of truth: the first reboot with the drastically changed system.

And it didn't work.

It booted up part way and then stopped, returning this message:

Warning: unable to open an initial console.

This was true of both my Debian kernel and my own custom-built one. And I discovered that the original Lindows kernel was gone, no doubt when I removed all the lindows* packages.

I hadn't installed any recovery tools in the swap space, so I booted from a USB CD-ROM drive. None of the recovery disks I had on hand worked, but a Red Hat 9 CD worked and so did a Lindows 4.0 bootable demo CD. I copied in the original Lindows 2.4.20 kernel, added it to my GRUB menu.lst and rebooted.

It still didn't work.

When I set up my GRUB menu.lst file, I had failed to specify the initrd for the 2.4.20 kernel. I fixed that, rebooted and success! A happy day. My eNote now contains an up-to-date Debian Unstable system with a GNOME desktop. With Debian, my eNote also has the text-mode ttys bound to Ctrl+Alt+F1 through Ctrl+Alt+F6, a feature it didn't have with Lindows.

At the moment, the only kernel I have working is the original Lindows kernel. As far as I can tell, the problem is the kernel tries to mount a DevFS filesystem while the root filesystem is mounted read-only. I believe the only way to fix this is to use an initial RAM disk (initrd) with the kernel. The kernel can mount DevFS to the writable root filesystem on the RAM disk and then later re-mount on the ReiserFS root filesystem. The original Lindows kernel comes with an initrd and thus works.

Settling In

If you tucked recovery tools into the swap space, now is the point when you can get that space back, like this:

# mkswap /dev/hda2
# swapon -a

If you have a PCMCIA modem card, you can use that for Internet access when you are away from home. Here's how I got my Zoom Telephonics PCMCIA modem to work.

I started by plugging in the modem and hoping it would work. It didn't, but your modem might so give it a try.

Next, I used the cardctl command to query the card:

# cardctl ident

Which returned:

Socket 0:
  product info: "Zoom Telephonics, Inc.", "PCMCIA 56K LT DataFax"
  manfid: 0x0200, 0x0001
  function: 2 (serial)
Socket 1:
  no product info available

Notice that the manufacturer's ID code is 0x0200, 0x0001.

Next I edited /etc/pcmcia/config and added these lines to the Modems and other serial devices section:

card "Zoom PC Card Modem"
  manfid 0x0200, 0x0001
  bind "serial_cs"

That did it. My Zoom modem now worked.

So far, I have not found a GNOME-based PPP dialer that works as well as Kppp from KDE. At the moment, I am still running sudo kppp& when I want to connect to the Internet with my modem.

Conclusion

I still want to make some tweaks and customizations to my eNote. The Lindows KDE desktop had a battery life monitor; I want to get one working on GNOME. I have a PCMCIA card for WiFi net access, and I want to get that going. And there are a few other things.

But all the essentials are there and working: I have my GNOME desktop, I have a working modem card, web browsers and e-mail and all the other applications I use. I am very satisfied with the eNote and my new GNOME desktop.

Resources

Debian GNU/Linux: www.debian.org

GRUB boot loader: www.gnu.org/software/grub

Steve R. Hastings first used UNIX on actual paper teletypes. He enjoys bicycling with his wife, listening to music, petting his cat and making his Linux computers do new things.

Load Disqus comments

Firstwave Cloud