Posts tagged ‘st00pid’

One-track thinking (unlocking root)

It seems I never quite learn. I like a clean system, so when I get a chance I remove unused packages. This practice has gotten me in trouble before. It got me in trouble again just the other day.

My now second machine used to be my primary. When it was demoted I left GNOME installed on it since you never know when it might come in handy. Over the last few months I’ve had no use for a GUI on it at all so last Friday I decided to remove GNOME. That got me in trouble because sudo is installed as a dependency of GNOME’s, and it’s marked “automatic” in aptitude. Couple that with my habit of locking the root account and I ended up with a system that I don’t have full access to anymore. Not good!

My immediate thought was to boot a live CD, chroot to the root filesystem of the installed system and unlock the root password. Except the damn box refused to boot from CD. I tried all my live and install CDs, Ubuntu (Breezy and Dapper), Knoppix, STD, Debian install (Woody and Sarge). Nothing worked.

A short search later and I found muLinux. A one-floppy live system that on paper seemed capable of doing what I needed. Now I had another problem, where do I get a floppy nowadays? The system admins downstairs had one they could spare. Good! Next problem—where to find a machine with a floppy drive that I can use to create the floppy?

That’s when it hit me. This plan wasn’t the best one, it just happened to be the first one that popped into my mind. I had been too focused on my first idea to take the time to stop and think of other ways of getting my root account back.

In the end I didn’t need to use a live CD/floppy, I could just use the system already present on the box:

  1. Boot straight into bash by sticking init=/bin/bash on the boot line in GRUB
  2. Remount the root filesystem, mount -o remount,rw /
  3. Unlock the password, passwd -u root

Being st00pid with lspci

This wasn’t a serious mistake and the only reason it took a while to sort out was my amazing thickness.

I had removed pciutils (and thereby lspci) from the system thinking that “now everything works, so I won’t ever need it again”. Just to show me the error of my ways the benevolent Debian decided to punish me by not giving me network. It turned out that Linux’ excellent support for a multitude of network cards worked against me on this one—which one to insert? After several uninspired thoughts I had an inspired one. Brute force! Insert them all!

# cd /lib/modules/2.6.17-2-686/kernel/drivers/net
# for f in *.ko; do insmod $f; done

A few error messages later I tried ifup eth0, and it worked :-) Quick download of pciutils. Now I know the machine in question requires eepro100 to get network. I recorded that in /etc/modules.

At the moment I’m having a hard time resisting removing pciutils. I mean, now everything works, I won’t ever need it again, right?

Damn it! I lost a translation…

Some kind soul sent me a Russian translation for epilicious… which I quickly lost. I guess I really should move mails to a rubbish bin rather than delete them completely.

Oh, I’d love to receive another email with that translation ;) Please!

Being st00pid with LVM

Well, this is the first entry in my st00pid category. I make quite a few mistakes when using Linux, mistakes that take time and effort to fix. From now on I’ll swallow my pride and write down, in a public place like this, about what st00pid things I do. Most importantly I’ll also write down what I did to get my Linux system back to the state it was before my brain temporarily popped out for a coffee.

I like keeping my Debian systems minimal. When running Sid there ends up being quite a few upgrades to download and when dependencies change your system ends up having “orphaned” packages, i.e. packages that were pulled in to satisfy a dependency but by now the dependent package has since moved on (or been deleted). This is of course a worrying thought, packages are installed that don’t actually need to be present on the system. My stomach’s turning. Some people use aptitude to handle this, personally I’ve never really like aptitude and I use debfoster.

Yesterday, after a sizable upgrade of my system at work I ran debfoster to prune orphaned packages. This was in fact the first time I ran it after setting up the system which resulted in quite a few questions regarding whether to keep specific packages or not. This is about the time when my brain popped out for a coffee. When asked if I wanted to keep lvm2 or not there was no brain to consult and I answered no. Had the brain been around it would have reminded me that I opted to use logical volumes on that particular machine (for two reasons, 1) I had never done it before and it’s damn cool, and 2) it makes the system a bit more flexible and future proof).

After a reboot I was sitting there with a system that was fairly useless since the root partition couldn’t be mounted. A quick calculation of just how long it’d take me to re-install later, I popped in the only live CD I had available at work–Ubuntu 5.04, Hoary Hedgehog. Using that I found a page on the Knoppix Wiki on how to use LVM2 with Knoppix. Now armed with something that looked like a workable plan I did the following in a terminal

$ sudo su -
# modprobe dm-mod
# vgscan
# vgchange -a y
# cd /mnt; mkdir debsys

Then I went ahead and mounted the root partition on /mnt/debsys. I also mounted the other partitions I have on my installed system, /var, etc. Then to get into it and fix it I

# chroot /debsys
# apt-get install lvm2 lvm-common

Except lvm2 refused to install, it complained about the kernel being too old. Not surprising since Hoary is getting really old by now. to get around that I downloaded the source for lvm2, modified debian/preinst so that the kernel version check was skipped, re-built the package, and installed it. Worked like a charm.