9
$ sudo update-grub
/usr/sbin/grub-probe: error: failed to get canonical path of `none'.

This is the situation I'm in after an interrupted upgrade from vivid to wily

[edit]

Further delving into grub source code, the second command is probably the failing one:

$ grub-probe --target=device /
/dev/md2
$ grub-probe --target=device /boot
grub-probe: error: failed to get canonical path of `none'.

The following also gives the error:

$ sudo grub-probe -t device /boot/grub
grub-probe: error: failed to get canonical path of `none'.
$ sudo grub-probe -t fs_uuid /boot/grub
grub-probe: error: failed to get canonical path of `none'.

[/edit]

I don't have /boot/grub/grub.cfg present (or older /boot/grub/menu.lst)

It was impossible to install a boot loader during grub configuration:

https://i.stack.imgur.com/IBEiQ.jpg

Grub failed to install on the available options (/dev/sda /dev/sdb or /dev/md2)

md1 wasn't given as an option, even though it is currently mounted at /boot :

$ cat /etc/fstab
proc /proc proc defaults 0 0
/dev/md/0 none swap sw 0 0
/dev/md/1 /boot ext3 defaults 0 0
/dev/md/2 / ext4 defaults 0 0

I've got a raid setup with /dev/sda and /dev/sdb anyhow:

$ sudo fdisk -l
Disk /dev/sda: 447.1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00032e61

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sda1          2048   8390656   8388609     4G fd Linux raid autodetect
/dev/sda2       8392704   9441280   1048577   512M fd Linux raid autodetect
/dev/sda3       9443328 937701040 928257713 442.6G fd Linux raid autodetect


Disk /dev/sdb: 447.1 GiB, 480103981056 bytes, 937703088 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00074c3d

Device     Boot   Start       End   Sectors   Size Id Type
/dev/sdb1          2048   8390656   8388609     4G fd Linux raid autodetect
/dev/sdb2       8392704   9441280   1048577   512M fd Linux raid autodetect
/dev/sdb3       9443328 937701040 928257713 442.6G fd Linux raid autodetect


Disk /dev/md2: 442.5 GiB, 475133575168 bytes, 927995264 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md0: 4 GiB, 4292804608 bytes, 8384384 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/md1: 511.7 MiB, 536543232 bytes, 1047936 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Grub appears to be installed (detection from another answer on serverfault):

$ sudo dd bs=512 count=1 if=/dev/sda 2>/dev/null | strings
ZRr=
`|f 
\|f1
GRUB 
Geom
Hard Disk
Read
 Error

When I run grub-emu, I get a blank prompt:

enter image description here

$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 15.10
Release:        15.10
Codename:       wily

This is on a server with only ssh access so I don't have access to the live CD if grub fails!

[edit] output of df -h:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             63G     0   63G   0% /dev
tmpfs            13G  714M   12G   6% /run
/dev/md2        436G  178G  236G  44% /
tmpfs            63G  8.0K   63G   1% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs            63G     0   63G   0% /sys/fs/cgroup
none            436G  178G  236G  44% /boot
tmpfs            13G     0   13G   0% /run/user/0
tmpfs            13G     0   13G   0% /run/user/1002
/dev/md2        436G  178G  236G  44% /var/cache/apt/archives
none            436G  178G  236G  44% /bin
none            436G  178G  236G  44% /etc
none            436G  178G  236G  44% /initrd
none            436G  178G  236G  44% /lib
none            436G  178G  236G  44% /lib32
none            436G  178G  236G  44% /lib64
none            436G  178G  236G  44% /sbin
none            436G  178G  236G  44% /usr
none            436G  178G  236G  44% /var

[further edit] the above command seems to report that /boot is mounted at none. I think this might be the none grub-probe is complaining about. Here's the output of mount -l which shows two separate mount 'entries'; investigating how to remove the second now.

mount -l |grep boot
/dev/md1 on /boot type ext3 (rw,relatime,data=ordered)
none on /boot type aufs (rw,relatime,si=6ea5aad590be877d)
EoghanM
  • 5,125
  • From the images you posted, it appears that you chose not to install grub on any device (or the device you chose failed), so the fact the system won't boot is not surprising. I second the advice to run boot-repair. – Organic Marble May 24 '16 at 22:17
  • 1
    Vivid is EOL; possibly that has something to do with it. In that case this tutorial applies. – Gunnar Hjalmarsson May 25 '16 at 02:36
  • Can you get to the installation phase again with ssh? if yes, then check if there is /boot directory on the device returned by the command grub-probe --target=device / – Anwar May 25 '16 at 02:42
  • @AnwarShah I've still got ssh access as I haven't rebooted at all. I've added details on the df command in relation to the /boot directory – EoghanM May 25 '16 at 19:34

5 Answers5

5

Ok I seem to have got it with the following (everything is simple in retrospect):

$ umount /boot

I tried this as I noticed that there were two 'mounts' for /boot:

$ mount -l |grep boot
/dev/md1 on /boot type ext3 (rw,relatime,data=ordered)
none on /boot type aufs (rw,relatime,si=6ea5aad590be877d)

And that the latter was overriding the former:

$ df -h |grep boot
none            436G  178G  236G  44% /boot

After umount the same commands look like this:

$ mount -l |grep boot
/dev/md1 on /boot type ext3 (rw,relatime,data=ordered)
$ df -h |grep boot
/dev/md1        488M   75M  388M  17% /boot

(no idea how the second mount happened)

I was then able to reinstall grub as follows (I've raid1 so that's why there's two commands for sda and sdb):

$ grub-install /dev/sda
Installing for i386-pc platform.
Installation finished. No error reported.
$ grub-install /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.
$ update-grub
Generating grub configuration file ...
Warning: Setting GRUB_TIMEOUT to a non-zero value when GRUB_HIDDEN_TIMEOUT is set is no longer supported.
Found linux image: /boot/vmlinuz-3.19.0-30-generic
Found initrd image: /boot/initrd.img-3.19.0-30-generic
Found linux image: /boot/vmlinuz-3.19.0-25-generic
Found initrd image: /boot/initrd.img-3.19.0-25-generic
done

Postscript

After reboot the server came back up (could ping it), but I found I couldn't ssh in. This turned out to be a separate problem to do with /dev/null (might have gotten broken at the same time). I was able to ssh in using a separate rescue system and apply this fix: http://thesystemadministrator.net/linux-administration/sshd-deamon-failing-to-start

EoghanM
  • 5,125
  • «the bounty is still active» But it seems you have solved your question. Or was the question something else? In the latter case, could you clarify the question a little bit? – Andrea Lazzarotto May 25 '16 at 20:37
  • I think I've solved it, just double checking everything (haven't rebooted yet). I've upvoted userDepth so the bounty might automatically go to them although that answer proved to be a red herring. I'm not sure what the etiquette is now; should I close the question to stop people wasting their time on it? – EoghanM May 25 '16 at 20:46
  • @EoghanM, have you checked /etc/fstab if contains an entry for the 2nd mount. – user.dz May 25 '16 at 22:06
  • No, /etc/fstab never had doubly defined that mount (and doesn't now), I don't know where the 2nd one came from. – EoghanM May 25 '16 at 22:13
0

In my case, I found the terminal I had opened was in my "home" directory. Changing the directory using cd .. until I got to the root directory allowed me to run update-grub with no problem.

Andy
  • 1
0

Do not bother trying to fix it. Use boot-repair Connect to the internet, then open a terminal with Ctrl+Alt+t, paste the following commands and run them by pressing Enter:

sudo add-apt-repository -y ppa:yannubuntu/boot-repair; \
sudo apt-get update; \
sudo apt-get install -y boot-repair && boot-repair

The next (dangerous) thing you can do if boot-repair did not work is try to reinstall which is will not let you. So choose something else. Create everything the same and have the same password and username. This has been said to work as a repair.

Better alternative if boot-repair does not work is to backup your data and fresh install. You can backup with a live disk. I remember I did something trivial in Lubuntu that only messed up some settings. It was suggested to backup and fresh install. I was told it would take an hour to do and not to spend hours trying to figure it out. I ended up following this advice after trying some other things. He was right.

You can also try this link for repairing grub from a live usb https://community.linuxmint.com/tutorial/view/245 I tried something similar (but not the same link) when a failed kernel upgrade messed everything up. I googled "how to fix grub after failed linux upgrade" and got a variety of pages. You might try searching for "grub repair usb live". Try this which has terminal and graphical answers. http://www.howtogeek.com/114884/how-to-repair-grub2-when-ubuntu-wont-boot/

  • (I didn't downvote you) I understand boot-repair is GUI only? And isn't this an attempt to fix it! Backup and reinstall is the default position that I'm trying to avoid. – EoghanM May 25 '16 at 19:31
  • There was another thing I once used for using a live cd and mounting and reinstalling grub as a boot repair althernative. I will try to find it. It worked and worked nice, but it was difficult to find. – Bhikkhu Subhuti May 25 '16 at 22:36
  • Oh.. I see you have answered your own question..a little bit like the way I edit my answer..ok.. – Bhikkhu Subhuti May 25 '16 at 22:48
0

Have you tried grub-install ?

If you can't use it then...

As I see you can run a terminal in the system:

Do

apt-get -f install

As super user.

The if it didn't ask to install anything then nothing is broken.

Consider :

apt-get upgrade //To finish upgrading

Last

apt-get install -y aptitude && aptitude reinstall grub

Now try again with grub-install

Note:

For grub-install usage do:

man grub-install
userDepth
  • 2,010
  • I don't know why you got a downvote, aptitude reinstall grub seems to have made some progress; installing a package called grub{b} libc6-i386{a} and uninstalling what must have been leftover packages; grub2-common grub-pc grub – EoghanM May 25 '16 at 19:52
  • Downvotes are for the order in which answers are presented. To help others find the most valuable answers first. – userDepth May 25 '16 at 20:09
  • 1
    Hmmm, I'm pretty sure it's better to let the upvotes do the ordering. downvotes imply there is something wrong with the answer. And your answer helped me make progress and certainly was not worse than the only other answer. – EoghanM May 25 '16 at 20:15
  • It much better to use sytem utilities if it comes with the OS media. You are talking about upgrades and PPA's aren't friendly to this. The two answers are good as you state but... Using Grub has more efficiency probabilities when learned despite having an apparently lengthy learning curve. With f install you try to amend, upgrade restarts the process. I focused on the Grub mini part but... Check for the sources list and if it was not changed to the new release you'll need to also do apt-get dist-upgrade to restart the process. – userDepth May 25 '16 at 20:31
  • Further to my initial comment, I didn't realize that aptitude reinstall grub actually downgraded me from grub2 to grub0.97. This was actually not really progress and I've reinstalled grub2 – EoghanM May 25 '16 at 20:34
  • Depends on how you see it, was I able to see your repos weren't correctly set? That's one way to know. When you use the CLI you're supposed to read. I think you progressed more than what you realize. – userDepth May 25 '16 at 22:24
0

This would be sufficient as root in recovery-mode after network is enabled :

sudo apt-get install --reinstall grub*

sudo grub-install /dev/partition

For partition you type the booting partition which you are very secure of like for example /dev/sda

Then do this following:

There is spell-checking error but only slightly ? You could try this :

sudo update-grub2

and NOT

sudo update-grub

dschinn1001
  • 3,829