Oh Linux, why can’t you just let me win.
This morning I decided to go ahead and upgrade my kernel to 2.6.22-14. But things didn’t go smoothly. Something went wrong, so I tried it again
apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages will be REMOVED:
easytag
0 upgraded, 0 newly installed, 1 to remove and 1 not upgraded.
3 not fully installed or removed.
Need to get 0B of archives.
After unpacking 3170kB disk space will be freed.
Do you want to continue [Y/n]? y
(Reading database ... 288305 files and directories currently installed.)
Removing easytag ...
Setting up linux-image-2.6.22-14-386 (2.6.22-14.47) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.22-14-386
Not updating initrd symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Running postinst hook script /sbin/update-grub.
Your /etc/kernel-img.conf needs to be updated. Read grub's NEWS.Debian[1]
file and follow its instructions.
1. /usr/share/doc/grub/NEWS.Debian.gz
Searching for GRUB installation directory ...
No GRUB directory found. To create a template run 'mkdir /boot/grub' first. To install grub, install it manually or try the 'grub-install' command. ### Warning, grub-install is used to change your MBR. ###
User postinst hook script [/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.22-14-386 (--configure):
subprocess post-installation script returned error exit status 1
Setting up linux-image-2.6.22-14-generic (2.6.22-14.47) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.22-14-generic
Not updating initrd symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Running postinst hook script /sbin/update-grub.
Your /etc/kernel-img.conf needs to be updated. Read grub's NEWS.Debian[1]
file and follow its instructions.
1. /usr/share/doc/grub/NEWS.Debian.gz
Searching for GRUB installation directory ...
No GRUB directory found. To create a template run 'mkdir /boot/grub' first. To install grub, install it manually or try the 'grub-install' command. ### Warning, grub-install is used to change your MBR. ###
User postinst hook script [/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.22-14-generic (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
linux-image-2.6.22-14-386
linux-image-2.6.22-14-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
Alright, seems some stuff needs to be changed. One thing at a time. I make the changes in described in /usr/share/doc/grub/NEWS.Debian.gz and try it again
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
2 not fully installed or removed.
Need to get 0B of archives.
After unpacking 0B of additional disk space will be used.
Setting up linux-image-2.6.22-14-386 (2.6.22-14.47) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.22-14-386
Not updating initrd symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Running postinst hook script /usr/sbin/update-grub.
Searching for GRUB installation directory ...
No GRUB directory found. To create a template run 'mkdir /boot/grub' first. To install grub, install it manually or try the 'grub-install' command. ### Warning, grub-install is used to change your MBR. ###
User postinst hook script [/usr/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.22-14-386 (--configure):
subprocess post-installation script returned error exit status 1
Setting up linux-image-2.6.22-14-generic (2.6.22-14.47) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.22-14-generic
Not updating initrd symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Running postinst hook script /usr/sbin/update-grub.
Searching for GRUB installation directory ...
No GRUB directory found. To create a template run 'mkdir /boot/grub' first. To install grub, install it manually or try the 'grub-install' command. ### Warning, grub-install is used to change your MBR. ###
User postinst hook script [/usr/sbin/update-grub] exited with value 1
dpkg: error processing linux-image-2.6.22-14-generic (--configure):
subprocess post-installation script returned error exit status 1
Errors were encountered while processing:
linux-image-2.6.22-14-386
linux-image-2.6.22-14-generic
E: Sub-process /usr/bin/dpkg returned an error code (1)
It’s strange really. Why am I missing my grub folder? If grub is really gone, how am I even able to boot into Linux?
So I make the folder, /boot/grub, and try again.
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded.
2 not fully installed or removed.
Need to get 0B of archives.
After unpacking 0B of additional disk space will be used.
Setting up linux-image-2.6.22-14-386 (2.6.22-14.47) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.22-14-386
Not updating initrd symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Running postinst hook script /usr/sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... Generating /boot/grub/default file and setting the default boot entry to 0
Searching for GRUB installation directory ... found: /boot/grub
Testing for an existing GRUB menu.lst file ...
Could not find /boot/grub/menu.lst file. Would you like /boot/grub/menu.lst generated for you? (y/N) y
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.22-14-386
Found kernel: /vmlinuz-2.6.22-14-generic
Updating /boot/grub/menu.lst ... done
Setting up linux-image-2.6.22-14-generic (2.6.22-14.47) ...
Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.22-14-generic
Not updating initrd symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Not updating image symbolic links since we are being updated/reinstalled
(2.6.22-14.46 was configured last, according to dpkg)
Running postinst hook script /usr/sbin/update-grub.
Searching for GRUB installation directory ... found: /boot/grub
Searching for default file ... found: /boot/grub/default
Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst
Searching for splash image ... none found, skipping ...
Found kernel: /vmlinuz-2.6.22-14-386
Found kernel: /vmlinuz-2.6.22-14-generic
Updating /boot/grub/menu.lst ... done
Success! But is it really?
Let’s look at my boot directory.
/boot$ find .
.
./initrd.img-2.6.22-14-386
./System.map-2.6.22-14-386
./vmlinuz-2.6.22-14-386
./config-2.6.22-14-386
./abi-2.6.22-14-386
./System.map-2.6.22-14-generic
./vmlinuz-2.6.22-14-generic
./config-2.6.22-14-generic
./abi-2.6.22-14-generic
./initrd.img-2.6.22-14-generic
./initrd.img-2.6.22-14-386.bak
./grub
./grub/default
./grub/menu.lst
./grub/menu.lst~
./initrd.img-2.6.22-14-generic.bak
That can’t be right. I’m missing files. GRUB just doesn’t disappear like that. Something had to have happened. Something big and scary.
I check and see what file systems are mounted
$ mount
/dev/mapper/Ubuntu-root on / type ext3 (rw,errors=remount-ro)
proc on /proc type proc (rw,noexec,nosuid,nodev)
/sys on /sys type sysfs (rw,noexec,nosuid,nodev)
varrun on /var/run type tmpfs (rw,noexec,nosuid,nodev,mode=0755)
varlock on /var/lock type tmpfs (rw,noexec,nosuid,nodev,mode=1777)
udev on /dev type tmpfs (rw,mode=0755)
devshm on /dev/shm type tmpfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
lrm on /lib/modules/2.6.22-14-generic/volatile type tmpfs (rw)
/dev/md1 on /tivo type xfs (rw)
/dev/mapper/raid-seagate320 on /share type xfs (rw)
/dev/mapper/Ubuntu-extra on /extra type xfs (rw)
securityfs on /sys/kernel/security type securityfs (rw)
nfsd on /proc/fs/nfsd type nfsd (rw)
binfmt_misc on /proc/sys/fs/binfmt_misc type binfmt_misc (rw,noexec,nosuid,nodev)
Where is my boot partition?
From my /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/mapper/Ubuntu-root / ext3 defaults,errors=remount-ro 0 1
# /dev/sda1 -- converted during upgrade to edgy
UUID=065448c7-0098-4bbe-a6c1-d207b4201a1a /boot ext3 defaults 0 2
I tried manually mounting /boot, but it would get error messages like
mount: /dev/sdb1 already mounted or /boot busy
It was looking like /boot wasn’t being mounted. Was my UUID wrong? Nope. Checking /dev/disk/by-uuid shows that the UUID is correct. Something else was going on. Then I remembered something. A few months ago I was having trouble mounting a raid drive. I’m not an expert in Linux, but it looked like mount wasn’t taking actual device names. For example, /dev/md0 wasn’t working but /dev/mapper/Ubunut-extra was working. So I fixed my fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
/dev/mapper/Ubuntu-root / ext3 defaults,errors=remount-ro 0 1
# /dev/sda1 -- converted during upgrade to edgy
# UUID=065448c7-0098-4bbe-a6c1-d207b4201a1a /boot ext3 defaults 0 2
/dev/mapper/sdb1 /boot ext3 defaults 0 2
and reran apt-get install -f, restarted, and sacrificed a goat.
It worked. I don’t know what happened. I’m not sure what I did was the correct fix. But it’s working.
So Linux, what up?