picto_welcome.png  Welcome   

picto_download.png  Get Lubuntu   

picto_help.png  Documentation   

picto_contact.png  Get Help   


GRUB reports no Operating System

So, you deleted all the kernels? or possibly it's so messed up GRUB can't find it ?

root with live system

Boot from live media (the "Desktop" image), open an LXTerminal session and gain root access by typing in

sudo -i

  • (X) Please remember that you have now turned off the inbuilt protection of Lubuntu, be VERY careful what you type!

identify root filesystem

Firstly, find where the Linux installation is..

fdisk -l 

traditional setup

You will see something like this :

    /dev/sda1   *           1        4660    37431418+  83  Linux
    /dev/sda2            4661        4865     1646662+   5  Extended
    /dev/sda5            4661        4865     1646631   82  Linux swap / Solaris

Look for the entry that ends in "83 Linux" which is /dev/sda1 in the above example.

If there is also a line with "LVM" in it, then you will need to skip to the LVM section below.

GPT

If the disk you think it is has only one partition with a "GPT" system, then you'll need to use a different tool than fdisk (unless you have package util-linux v2.23+ which is available in Utopic and beyond). This indicates that the drive uses GUID Partition Table instead of Master Boot Record. The former is starting to become more and more standard. Instead of fdisk, try:

parted -l

which should give an output something like:

Model: ATA Hitachi HDS72168 (scsi)
Disk /dev/sda: 80.0GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  62.5GB  62.5GB  primary  ext4
 2      62.5GB  71.1GB  8595MB  primary  linux-swap(v1)

In this case, the right partition is certainly /dev/sda1. (Please note that this example is MBR and not GPT, but the output should be similar).

LVM

If the fdisk command above yields a line like:

    /dev/sda5          501760   976771071   488134656   8e  Linux LVM

Then you have logical volume management, which requires a slightly different approach. You can get more information about your LVM partition with the following:

pvs

which will yield something like:

  PV         VG         Fmt  Attr PSize   PFree 
  /dev/sda5  lubuntu-vg lvm2 a--  465.52g 52.00m

Usually with LVM your normal partitions are contained within volume groups, which is what the "VG" column refers to. The kernel usually maps these to /dev/<VG>, so in this case, that would be /dev/lubuntu-vg. You can find out more specific information about your volume group:

lvdisplay /dev/<VG>

which should include output like so:

  --- Logical volume ---
  LV Path                /dev/lubuntu-vg/root
  LV Name                root

You need to identify your root file system, which in this case is clearly /dev/lubuntu-vg/root.

mount filesystem

Next, mount the partition in terms of the device file as per what was reported above, e.g. /dev/sda1, /dev/lubuntu-vg/root, etc.

mount <device file> /mnt

/mnt can also be some other directory (that must exist), should you choose.

Internet access

Use nm-applet to get connected to your wifi or plug in your Ethernet. Then copy over resolv.conf:

cp /etc/resolv.conf /mnt/etc/resolv.conf

point local filesystem at your HDD

for fs in sys proc dev dev/pts; do mount --bind /$fs /mnt/$fs; done 
chroot /mnt

  • (X) At this point, if you cd /, you'll be in your hard drive rather than the root of the live desktop. That being said, be careful!

divert installation to your HDD

dpkg-divert --local --rename --add /sbin/init
ln -s /bin/true /sbin/init

install the kernel

apt-get install linux-image-generic

  • (i) Be aware that if you use a different kernel than the standard one, such as low-latency, you should install the appropriate package, which you can list with: apt-cache search linux-image-.

If you have an error with the install, such as:

P: Installing debian theme...cp: cannot stat ‘/usr/share/syslinux/themes/debian-wheezy/extlinu/memtest.bin’: No such file or directory

then chances are you booted into memtest. For some reason you get an error that the file does not exist when it does. If you remove it, problem solved. After that, you'll need to reconfigure:

dpkg --configure -a

update GRUB

Next, you need to tell GRUB to update grub.cfg to allow you to use the new kernel.

update-grub

LVM concerns

A typical LVM setup puts /boot in a separate partition not managed by LVM. This means updating GRUB can only affect the /boot on the logical volume.

You could mount the separate partition, but you can't chroot to it since this command always runs some command (default is /bin/sh) and no commands exist on the partition.

However, when you update GRUB, you load the necessary modules to load the kernel and initial ramdisk from the logical volume. So if you copy /boot from the logical volume to the separate partition, you'll be good to go!

To do this:

  1. Follow the clean up instructions below. No, you don't need to be in the chroot anymore.

  2. Mount both filesystems. You should have the logical volume already mounted so just go here to identify the separate partition and mount it.

  3. Make a backup of the original boot:
    • ### The following example assumes:
      ### * Your logical volume is mounted to /mnt/root
      ### * Your separate partition is mounted to /mnt/boot
      mkdir /mnt/root/oldgrub         
      mv /mnt/boot/* /mnt/root/oldgrub
  4. Copy over the new boot:
    • ### See the previous for assumptions on this example
      cp -R /mnt/root/grub/* /mnt/boot/
  5. Reboot and enjoy your new kernel! To be sure all is well, make sure to update GRUB once again:
    • update-grub

clean up

Remove the link and divert...

unlink /sbin/init
dpkg-divert --rename --remove /sbin/init
exit

https://help.ubuntu.com/community/Grub2/Installing#Reinstalling_GRUB_2 All done!! Restart you will have the option to boot into the new kernel. If for some reason, it doesn't boot right in, hold down SHIFT when your system starts up to see the GRUB menu.

still problems…

If you have come here for an edge case and/or not found luck, you may want to consider reinstalling GRUB.

RemoveOldKernels/Problems (last edited 2016-10-25 02:09:33 by lfaraone)