Wednesday, July 2, 2014

Mint 17 install with Windows 8, machine doesn't boot...

I tried Arch for about six months but -- a running release system isn't for me.  I like the stability and ease with which Ubuntu/Mint can be maintained.  I was constantly breaking wifi and other things with Arch -- probably I was doing it wrong but, hey, when you use Linux you have a ton of choices.  So back to Mint.
After installing Mint 17 the machine didn't reboot.  I went directly to the grub2 recovery prompt and got something like this:

GRUB loading:
Welcome to GRUB!

error: file '/grub/i386-pc/normal.mod' not found
Entering rescue mode...
grub rescue>

Since you've already installed Mint (or Ubuntu), you can boot again with your LiveCD but then chroot into your new system.  This is kind of like exactly like using jumper cables on a car to get it started (this is the LiveCD), and then removing the jumper cables once the car is running (this is the chroot part).

Good instructions are here.  The important part:

Update Failure

If there was an update that made your system non-bootable and they have fixed it in the repositories, you can use the Live CD to run apt-get to get the new files to fix your system.
  1. Boot the Ubuntu Live CD.
  2. Press Ctrl-Alt-F1
  3. sudo mount /dev/sda1 /mnt  (/dev/sda8 is my Linux partition)
  4. sudo mount --bind /dev /mnt/dev
  5. sudo mount --bind /proc /mnt/proc
  6. sudo mount --bind /sys /mnt/sys
  7. sudo chroot /mnt
  8. apt-get update
  9. apt-get upgrade
If you have trouble accessing your network after chroot, you probably use DHCP and can work around this by adding OpenDNS name servers to your /etc/resolv.conf after you use chroot:
nameserver 208.67.222.222
nameserver 208.67.220.220
 

If you boot with the LiveCD and follow the above instructions, you'll be "in" your new Mint environment -- you just used jumper cables to get there.  At this point we can fix the booting issue.  (Notice that steps #8 and #9 above require you to update all of the packages on your system, this is a great idea to fix things that maybe weren't updated at the time the LiveCD was released.)

Now we need to fix grub.  If you look at my older post about installing Arch on top of Mint13, you know that I've got a Windows 8 system.  My boot partition is actually /dev/sda1 -- this is where the EFI stuff goes.  So just like I mentioned in that old post, I first need to mount /dev/sda1 to /boot/efi.

mint boot # mount /dev/sda1 /boot/efi

With that done I can run grub-install and tell it to put the efi stuff into /boot/efi (which will go into /dev/sda1 since it is mounted there).  If you are uncomfortable at this point I suggest you find some help elsewhere, like the Ubuntu forums.  There are also some tools like boot-repair that work quite well.  If you know what is going on so far, continue reading:

 
mint boot # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=mint17 --boot-directory=/boot --recheck
Installing for x86_64-efi platform. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Installation finished. 
No error reported. 


mint boot # modprobe efivars 


mint boot # grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=mint17 --boot-directory=/boot --recheck 
Installing for x86_64-efi platform. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Fatal: Couldn't open either sysfs or procfs directories for accessing EFI variables. 
Try 'modprobe efivars' as root. 
Installation finished. 
No error reported. 


mint boot # grub-mkconfig -o /boot/grub/grub.cfg 
Generating grub configuration file ... 
Found linux image: /boot/vmlinuz-3.13.0-24-generic 
Found initrd image: /boot/initrd.img-3.13.0-24-generic 
No volume groups found done 
mint boot #

Hm, that doesn't look good. Turns out I didn't boot the LiveCD the Right Way. I used the legacy method of booting and I needed to use the UEFI method.  I shut the machine down and restarted it. 

Now go into your BIOS setup and create a new EFI entry that will point to grub.  I talk about doing this in another old post.

To my surprise, after configuring the new UEFI option, the system booted. So I booted into my new Mint system but then I re-ran grub-install just to be sure:

wskellenger@marquette /boot $ mount | grep boot
/dev/sda7 on /boot type ext4 (rw)
/dev/sda1 on /boot/efi type vfat (rw)


wskellenger@marquette /boot $ sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=mint17 --boot-directory=/boot --recheck
[sudo] password for wskellenger:
Installing for x86_64-efi platform.
Installation finished. No error reported.


wskellenger@marquette /boot $ sudo grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-3.13.0-24-generic
Found initrd image: /boot/initrd.img-3.13.0-24-generic
  No volume groups found
Found Windows Boot Manager on /dev/sda1@/EFI/Microsoft/Boot/bootmgfw.efi
Adding boot menu entry for EFI firmware configuration
done


wskellenger@marquette /boot $


You should be booting now.