Customizing a Lindows MobilePC
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.
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.
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.
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.
- Linux Kernel Testing and Debugging
- NSA: Linux Journal is an "extremist forum" and its readers get flagged for extra surveillance
- Wanted: Your Embedded Linux Projects
- Tails above the Rest, Part III
- RSS Feeds
- The 101 Uses of OpenSSH: Part I
- Dolphins in the NSA Dragnet
- Are you an extremist?
- Pass on Passwords with scp
- Validate an E-Mail Address with PHP, the Right Way