Monday 30 January 2012

Dual-Booting McAfee Endpoint Encryption - Linux Kernel Upgrade

I used the package manager to upgrade the kernel to 3.0.0-15-generic in my laptop, yesterday evening and when I tried to boot into Windows this morning, I couldn't: there was no Windows entry in the Grub Boot Menu.

After a bit of cursing, when I finally calmed down, I realized what had happened. When a new kernel is installed, a new grub configuration file (grub.cfg) file will be generated and this is based, I think, on the output of os-prober, but, and this is crucial, because my Windows installation is encrypted, the installation is not detected and thus missed off the new grub configuration file.

In order to rectify this, I had to manually edit the grub configuration file (/boot/grub/grub.cfg) and add, following the last menuentry entry, this entry:
menuentry "Windows" {
        set root='(hd0,1)'
        chainloader +1
}
If your Windows installation is in another partition, then you'll need to modify the second line, e.g. set root='(hd1,1)' for the first partition of your second hard drive.

Do be careful when modifying /boot/grub/grub.cfg as you could end up when a non booting system and bear in mind that if you run update-grub2, this file will be overwritten, with whatever grub detects.

2 comments:

  1. McAfee Endpoint Security is best I also use that .

    ReplyDelete
  2. I had the same problem described in the Original Post: I have a Windows Laptop, onto which I had installed a dual-boot extra HD to run Linux (Ubuntu 12.04). At some point, my Windows partition was Encrypted.... However I was still able to boot reliably into either Windows or Linux.

    It was only after installing a new kernel, and having update-grub2 as part of the installation that I figured out that the OS Prober used by grub no longer recognized the Windows drive as a bootable OS. I used the Original Posters methodology to manually reinsert Windows into the boot GRUB menu.

    However, I offer the following refinement:

    1. Open the /boot/grub/grub.cfg file and note that it was auto-generated, and based on a number of files within /etc/grub.d

    2. These files were all "applied" during the "update-grub2" execution, in numeric order.

    3. Decide where in the GRUB menu that you want to see Windows --> I want it to be first, because I still spend most of my time there... However, you could also choose the middle (between Linux and the MemTest for example) or at the very end.

    4. Create the following new file using a number that does not yet exist. Since the Linux kernels are listed 1st for me, and come from /etc/grub.d/10_linux, I chose to call my new file /etc/grub.d/09_windows:

    #!/bin/sh
    cat <<EOF
    menuentry "Windows" {
    set root='(hd0,1)'
    chainloader +1
    }
    EOF

    The file should contain just those 7 lines.

    5. "update-grub2" can now be run, and the auto-generated file will contain the Windows grub menu item, in the position specified by the numbering of the file name. It should also persist over runnings of update-grub2 triggered by new kernel installations, or removals.

    6. Thank-you, Original Poster "manyrootsofallevil", for the original methodology.

    ReplyDelete