I'm running the Ubuntu 12.04 LTS LAMP server. I got an error stating that my root directory was full after running an apt-get dist-upgrade, so following the instructions I found online, I uninstalled some of the old kernels using apt-get. However, I somehow accidentally uninstalled all of the kernels. My system won't reboot now.
I found a thread from 2011 about resolving this issue How to restore a system after accidentally removing all kernels?
But when I try to follow the instructions, they don't work for me.
When I do this:
sudo parted -l
I get this:
Model: ATA WDC WD20EZRX-00D (scsi)
Disk /dev/sda: 2000GB
Sector size (logical/physical): 512B/4096B
Partition Table: msdos
Number Start End Size Type File system Flags
1 1049kB 256MB 255MB primary ext2 boot
2 257MB 2000GB 2000GB extended
5 257MB 2000GB 2000GB logical lvm
Warning: Unable to open /dev/sr0 read-write (Read-only file system). /dev/sr0
has been opened read-only.
Error: Can't have a partition outside the disk!
I don't understand why partition 1 is ext2 since this was a fresh install of 12.04 LTS, but I did this command as instructed:
sudo mount /dev/sda1 /mnt
Then I tried this command:
sudo mount --bind /dev /mnt/dev
and it said it couldn't find the mount point.
So, I did this:
mkdir /mnt/dev
and then it did the mount.
Okay, so now I'm ready for chroot per the instructions:
sudo chroot /mnt
And I get this:
chroot: failed to run command '/bin/bash': No such file or directory
I apologize in advance, but I don't know enough about linux to figure out what's going on here. Could someone please help me? It will take me a long time to reinstall everything on my server.
UPDATE: Thanks for your answer. When I enter
sudo pvs
I get:
PV VG Fmt Attr PSize PFree
/dev/sda5 HOP-Server lvm2 a- 1.82t 136.00m
Then, I enter
sudo lvdisplay /dev/HOP-Server
and get this:
--- Logical volume ---
LV Name /dev/HOP-Server/root
VG Name HOP-Server
LV UUID feUsjU-HFHi-WFre-322J-SlWF-0J1K-zpiTQX
LV Write Access read/write
LV Status NOT available
LV Size 1.81 TiB
Current LE 474993
Segments 1
Allocation inherit
Read ahead sectors auto
--- Logical volume ---
LV Name /dev/HOP-Server/swap_1
VG Name HOP-Server
LV UUID tuJSFw-EKU4-oeLI-A934-srj2-DA2L-VqZtYr
LV Write Access read/write
LV Status NOT available
LV Size 7.20 GiB
Current LE 1843
Segments 1
Allocation inherit
Read ahead sectors auto
That's slightly different from your example, but I presume that I should enter
sudo mount /dev/HOP-Server/root /mnt **UPDATED**
But when I do, I get this:
mount: special device /dev/HOP-Server/root does not exist
**UPDATE: ** I used this web page to help me mount the file system partition:
http://linuxwave.blogspot.com/2007/11/mounting-lvm-disk-using-ubuntu-livecd.html
After that, I was able to follow the rest of the original instructions with no errors. However, when I reboot, the only options are to start two versions of the memory test utility. I rebooted the live CD again and followed the instructions again. When I got to the apt-get for the kernel, it said that it's up to date.
UPDATE: Okay, I mounted the partitions again, and I can see that in /root is a file named initrd.img-3.2.0-56-generic. IIRC, that's the latest kernel. I ran update-grub, but it gives me the error, "cannot find a device for /".
UPDATE: After another search, I found this:
http://sourceforge.net/apps/mediawiki/bootinfoscript/index.php?title=Boot_Problems:Cannot_Find_A_Device_For_boot/grub
I followed that procedure, and it didn't get any errors. However, now when I boot, I get this:
error: ELF header smaller than expected
grub rescue>
/mnt/boot
directory and mounting /dev/sda1 there? – steeldriver Nov 19 '13 at 08:05/boot/
. Just checked the instructions and lucky for us, the second answer already contains a section about dealing with a separate boot partition. Added a hint to look at that to my answer. – drc Nov 19 '13 at 08:15