Ubuntu

/boot too small [browsing answers seems broken?]

Asked by James Bradley on 2011-11-08

Hello:

I have a 200M /boot, and I guess should have made it larger? Here's what I read on a TOTALLY unrelated spot on this site to provide here for a fix:

 uname -a; dpkg -l | grep linux-image
Linux cow 2.6.38-11-generic-pae #50-Ubuntu SMP Mon Sep 12 22:21:04 UTC 2011 i686 i686 i386 GNU/Linux
rc linux-image-2.6.35-22-generic 2.6.35-22.35 Linux kernel image for version 2.6.35 on x86/x86_64
rc linux-image-2.6.35-28-generic 2.6.35-28.50 Linux kernel image for version 2.6.35 on x86/x86_64
ii linux-image-2.6.38-10-generic 2.6.38-10.46 Linux kernel image for version 2.6.38 on x86/x86_64
ii linux-image-2.6.38-10-generic-pae 2.6.38-10.46 Linux kernel image for version 2.6.38 on x86
ii linux-image-2.6.38-11-generic 2.6.38-11.50 Linux kernel image for version 2.6.38 on x86/x86_64
ii linux-image-2.6.38-11-generic-pae 2.6.38-11.50 Linux kernel image for version 2.6.38 on x86
ii linux-image-2.6.38-8-generic 2.6.38-8.42 Linux kernel image for version 2.6.38 on x86/x86_64
ii linux-image-2.6.38-8-generic-pae 2.6.38-8.42 Linux kernel image for version 2.6.38 on x86
ii linux-image-generic 2.6.38.11.26 Generic Linux kernel image
ii linux-image-generic-pae 2.6.38.11.26 Generic Linux kernel image

Supplementary question if I might; could this old kernel be the cause of a runaway encryption file on /home? I keep losing 120G for no other apparent reason, unless I have malicious code here running amok.

Thank You

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu linux Edit question
Assignee:
No assignee Edit question
Solved by:
Eliah Kagan
Solved:
2011-11-22
Last query:
2011-11-22
Last reply:
2011-11-22

This question was reopened

Sam_ (and-sam) said : #1

Purge the oldest keep one or two images.
e.g.
sudo apt-get purge linux-image-2.6.38-8-generic

Also grep installed headers:
dpkg -l linux-headers* |grep ii

Also:

sudo dpkg -P linux-image-2.6.35*

will help cleanup too. You can remove any of the installed kernels, just not the one shown in the output of uname which you gave. You can even use software centre if you wish.

James Bradley (dover3050) said : #3

Looks like I went too bombastic, I suspect on the headers. Yes, software centre might have helped the newbie out, but now that the cows bolted...

I suspect using a liveCD/USB is my only real way to get a kernel/header back in?

I only boot to memtest so far after upgrading online to 11.10.

If you think you may have removed too many kernel packages, and you are still booted into the system, then you can use the regular package management tools, like the Software Center, to put back whatever is missing.

Or are you saying that you have rebooted and are unable to boot into your Ubuntu system?

James Bradley (dover3050) said : #5

Sorry, I tried to reboot it into the new upgrade. Memtest looks like the only kernel I DID leave intact. ):

memtest is not a kernel at all, so it seems you probably removed all the kernels.

Boot from an Ubuntu live CD/DVD or live USB flash drive. Select Try Ubuntu rather than Install Ubuntu.

Go into a web browser and make sure that Internet connectivity is fully functional. If it isn't, set it up. If you have trouble with that, please post a reply describing the problem.

Open the GParted Partition Editor and find the device name (it will look something like /dev/sda3 or /dev/sdb1 or something) of the big partition of type ext4. I am going to use /dev/sda3 below, but if it isn't that, then you need to replace /dev/sda3 with whatever it is.

In addition, you might or might not have a separate /boot partition, which would be much smaller, and possibly also of type ext4, but maybe of type ext2 (or maybe ext3) instead.

Now close GParted and open a Terminal window (Ctrl+Alt+T). Run this command:

sudo mount /dev/sda3 /mnt

If you have a separate /boot partition as discussed above, then run a command like this -- change this command if necessary, replacing /dev/sda1 with the actual device name of the separate /boot partition:

sudo mount /dev/sda1 /mnt/boot

Now, run these commands:

sudo mount --bind /dev mnt/dev
sudo chroot /mnt
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

That chroots you into your installed system, so that actions you perform (from within this Terminal only) are as though they are performed from within the installed system. This enables you to perform package management operations in your installed system. If you're interested in knowing more about this concept, see http://en.wikipedia.org/wiki/Chroot (but you certainly do not have to read that to be able to follow these instructions).

Run this command to see if Internet connectivity works fully from within the chroot:

ping -c 4 launchpad.net

You're hoping for something like this:

PING launchpad.net (91.189.89.223) 56(84) bytes of data.
64 bytes from launchpad-net.banana.canonical.com (91.189.89.223): icmp_req=1 ttl=41 time=141 ms
64 bytes from launchpad-net.banana.canonical.com (91.189.89.223): icmp_req=2 ttl=41 time=143 ms
64 bytes from launchpad-net.banana.canonical.com (91.189.89.223): icmp_req=3 ttl=41 time=142 ms
64 bytes from launchpad-net.banana.canonical.com (91.189.89.223): icmp_req=4 ttl=41 time=140 ms

--- launchpad.net ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3003ms

On the other hand, if you are unable to transmit packets or you are unable to receive packets, then that indicates a problem. In that case, exit out of your chroot by running this command:

exit

Then run these commands:

sudo cp /mnt/etc/resolv.conf /mnt/etc/resolv.conf.old
sudo cp /mnt/etc/hosts /mnt/etc/hosts.old
sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
sudo cp /etc/hosts /mnt/etc/hosts

While generally you should stop this process if there is an error, don't worry if the first and/or second of those four commands fail, provided that the specific way in which it fails is by telling you that /mnt/etc/resolv.conf does not exist.

The chroot back in and try again:

sudo chroot /mnt
ping -c 4 launchpad.net

Assuming that worked (or that you didn't need to do it because the first time you ran "ping -c 4 ..." it worked), run:

export HOME=/root
export LC_ALL=C
apt-get update
apt-get -y install linux-image-generic-pae
update-grub
umount /proc || umount -lf /proc
umount /sys
umount /dev/pts
exit
sudo umount mnt/dev

That second-to-last command left the chroot, by the way.

If you ran this command and it did not fail

sudo cp /mnt/etc/resolv.conf /mnt/etc/resolv.conf.old

then, now, run:

sudo cp /mnt/etc/resolv.conf.old /mnt/etc/resolv.conf

And if you ran this command and it did not fail

sudo cp /mnt/etc/hosts /mnt/etc/hosts.old

then, now, run:

sudo cp /mnt/etc/hosts.old /mnt/etc/hosts

If your installed system has a separate /boot partition, unmount that:

sudo umount /mnt/boot

And finally, unmount your installed system's / partition:

sudo umount /mnt

Except where indicated above to do otherwise, if any of those commands seems to fail or reports errors when you run it, please stop. If that does happen, please select all the text in the Terminal (Edit > Select All), copy it to the clipboard (Edit > Copy), and paste it into your post here. And even if they all seem to succeed, since you won't know whether or not you'll be able to boot into your system until you reboot and try, you may as well save the text (you can run the Text Editor, paste it in, and then email the file to yourself as an attachment...then when you reboot, if the problem is not fixed, you can paste the text here).

Slight correction. I had said:

"While generally you should stop this process if there is an error, don't worry if the first and/or second of those four commands fail, provided that the specific way in which it fails is by telling you that /mnt/etc/resolv.conf does not exist."

I should have said:

"While generally you should stop this process if there is an error, don't worry if the first and/or second of those four commands fail, provided that the specific way in which it fails is by telling you that /mnt/etc/resolv.conf (or /mnt/etc/hosts) does not exist."

James Bradley (dover3050) said : #8

Everything worked until apt-get. I'll wager that I forgot to mount /var and /temp from /dev/sdb1-2 had something to do with it. {giggle} Should I also mount /home from dev/sdc1? {I can't imagine the need.}

The only other error was at umount /mnt. It said it was busy, so I just tried to reboot. There it was failing to start the livecd again.

I'll go at it again later tomorrow or tonight, but in case someone addresses this before then, shouldn't I use gparted to expand the /boot partition while I am at it, or will this old kernel~flushing be a part of regular maintenance or else always fill available space eventually?

Thank you for the detailed explanation!

James Bradley (dover3050) said : #9

*/tmp

Yeah, if you have separate /var and /tmp partitions, you need to mount those on /mnt/var and /mnt/tmp too. You probably don't have to mount /home, but you may as well (on /mnt/home). You have a lot of partitions for a GNU/Linux system...

I doubt you actually need to increase the size of /boot. Now that you've removed most of the kernels, you should have plenty of space there.

Sam_ (and-sam) said : #11

> part of regular maintenance or else always fill available space eventually?

Yep. Kernel images don't get removed automatically in case the upgrade version is broken.

James Bradley (dover3050) said : #12

I tried mounting /var and /tmp on either partition on /dev/sdb[1-2], in case I was deviating from my notes. When I failed to mount the drive at all in error for my first attempt, I did get to the apt-get stage just fine.

ubuntu@ubuntu:~$ sudo mount /dev/sda2 /mnt
ubuntu@ubuntu:~$ sudo mount /dev/sda1 /mnt/boot
ubuntu@ubuntu:~$ sudo mount /dev/sdb1 /mnt/tmp
ubuntu@ubuntu:~$ sudo mount /dev/sdb2 /mnt/var
ubuntu@ubuntu:~$ sudo mount /dev/sdc2 /mnt/home
mount: you must specify the filesystem type
ubuntu@ubuntu:~$ sudo mount --bind /dev mnt/dev
mount: mount point mnt/dev does not exist

The filesystem on /home (On /dev/sdc2. Swap on 1.) is ext4 but I think I botched my full install avenue by encrypting it. I'd still like to save it if at all possible, but just assumed I could ignore it for this operation. Sorry to be so much trouble on this. A shining example of knowing just enough to be dangerous to myself, I imagine.

First, to correct my mistake. I had said to run:

sudo mount --bind /dev mnt/dev

That is wrong, and will always fail. You should run this instead:

sudo mount --bind /dev /mnt/dev

As for "sudo mount /dev/sdc2 /mnt/home", are you sure /dev/sdc2 is the device name for your home partition? If you are sure, then I agree with you that it's not worthwhile to bother mounting it if it's encrypted. If you were chrooting in to change your password (which actually requires far less mounting than chrooting to perform package management), then we'd have to deal with this, because changing your password would make it so that your home directory would no longer decrypt with the new password. But for this, you should be able to get away with not having /home mounted.

James Bradley (dover3050) said : #14

Punching the text in the first time, I *absolutely* knew what you meant. *Relatively* it was ineffectual when I was copy ~ pasting your text. (Sorry, I couldn't resist. ]P~) For the record, your umount instruction adopted the same typo.

Yes, all told I have seven hard drives running this system on a poverty footing.

IDE:
/dev/sda1 /boot
/dev/sda2 /
/dev/sdb1 /var
/dev/sdb2 /tmp

SCSI RAID 5
/dev/sdc1 swap
/dev/sdc2 /home

This keeps the potential DOS attacks to the sdb, and the speed *used* to be pretty snappy across the RAID. Sorry, but I am not having a great experience so far with 11.10, but we'll see how it susses out from here.

Thank you SO much for all your efforts.

So...were you able to get a kernel back installed?

James Bradley (dover3050) said : #16

Sorry, yes. the kernel is in, and I flagged the topic as "solved" with the last post. However, I seem to be having plenty of performance issues, and I might be going through a DOS attack right now. (The IDE drive light is just ON full time now.) FF runs only simple pages, and Chromium doesn't work at all. (I am looking for Answers now, but might fire up the Windblows machine to speed that search up.) For the record, my abbreviated notes from you with the two typos fixed:

PS: Please see a final question at end.

sudo mount /dev/sda2 /mnt
sudo mount /dev/sda1 /mnt/boot
sudo mount /dev/sdb1 /mnt/var
sudo mount /dev/sdb2 /mnt/tmp
sudo mount /dev/sdc2 /mnt/home

sudo mount --bind /dev /mnt/dev
sudo chroot /mnt
mount -t proc none /proc
mount -t sysfs none /sys
mount -t devpts none /dev/pts

ping -c 4 launchpad.net

    >if no ping
    exit
    sudo cp /mnt/etc/resolv.conf /mnt/etc/resolv.conf.old
    sudo cp /mnt/etc/hosts /mnt/etc/hosts.old
    sudo cp /etc/resolv.conf /mnt/etc/resolv.conf
    sudo cp /etc/hosts /mnt/etc/hosts

    sudo chroot /mnt
    ping -c 4 launchpad.net

export HOME=/root
export LC_ALL=C
apt-get update
apt-get -y install linux-image-generic-pae
update-grub
umount /proc || umount -lf /proc
umount /sys
umount /dev/pts
exit
sudo umount /mnt/dev

    sudo cp /mnt/etc/resolv.conf /mnt/etc/resolv.conf.old
    sudo cp /mnt/etc/resolv.conf.old /mnt/etc/resolv.conf
    sudo cp /mnt/etc/hosts /mnt/etc/hosts.old
    sudo cp /mnt/etc/hosts.old /mnt/etc/hosts

sudo umount /mnt/boot
sudo umount /mnt
sudo umount /mnt/var
sudo umount /mnt/tmp
sudo umount /mnt/home

As a side note, I did ping well from the CL, so I didn't bother with the 'resolv.conf' and 'host' shuffle. This is likely the cause of my sluggish internet performance, then?

Thanks Again

James Bradley (dover3050) said : #17

Ah... Now the GUI is gone. I'm booting to a CL, and <alt><arrow key> to log on. The last message is something about checking battery state. *Maybe* I have a battery on the SCSI controller, but more likely just the CMOS. I should open a new question I take it?

The message about the battery state is unlikely to have anything to do with the reason you have no GUI. That's probably just the last message that is shown before the GUI is started.

Perhaps this is a consequence of you running a different kernel. Can you check and see if you're running the same kernel you were running before (if you know which one you were running before)?

If that is the case, it's likely that the problem can be fixed (or worked around, depending on how you view it) by using the nomodeset boot option (http://ubuntuforums.org/showthread.php?t=1613132).

James Bradley (dover3050) said : #19

I seem to be booting relieably into the GUI now, I suspect because of the following kernel:

3.0.0-13-generic-pae

I still have a fozen encrypted /home however. (Two year old answer about to be implemented.)

https://answers.launchpad.net/ubuntu/+question/179598

Thank you SO much for your patience, and sorry if I left the topic open by mistake.