61

I am trying to install Ubuntu 12.10 for quite some time, and passing hurdles one by one. Now I am in a situation as follows.

I have got a PC and 10 GB HDD which will be totally dedicated to Ubuntu so no option of Wubi and dual boot.

I was trying to install from DVD, but it is getting stuck at "Out of frequency" error. So I had to adapt for USB boot option. But my PC is USB non bootable, so workaround is "Plop Boot Manager". So I am doing the installation procedure as follows:

  1. starting from a CD drive which is having plop installed.
  2. opting for for USB boot in plop options.
  3. booting begins from USB.
  4. monitor eventually gives "out of frequency" error
  5. press Shift+Alt+F1 to get the terminal.
  6. open the grub with sudo nano /etc/default/grub.
  7. do necessary changes.
  8. sudo update-grub.

Now here I am getting error as follows:

/usr/sbin/grub-probe:error:failed to get canonical path of /cow.

My system is

P4 3.06 GHz, 1 GB ram , 10 GB HDD without an OS, monitor CRT lg StudioWorks (7 years old). Mobo Mercury P4 266a NDMx (865 equivalent). The whole system is perfectly in working condition under XP, but it is USB non bootable, and all other devices working perfectly.

What should I do next?

Organic Marble
  • 23,641
  • 15
  • 70
  • 122
ulkaNCST
  • 749
  • Does your computer have the Recommended Minimum System Requirements to run Ubuntu? I have had problems installing 12.04 to machines with less than 1GB RAM. – C.S.Cameron Feb 14 '13 at 05:49
  • Yes ,Now I have added my system specification to question. – ulkaNCST Feb 14 '13 at 07:56
  • http://askubuntu.com/questions/207663/cannot-update-grub-with-paramters-on-live-usb might be worth a try. – Rinzwind Feb 14 '13 at 07:59
  • Thank you Rinzwind, I have already tried that way but is not working at my end. I really don't know chroot to what ?? to usb or hdd ??? – ulkaNCST Feb 14 '13 at 08:02
  • 5
    First mount your hard drive to some folder, say /mnt and then chroot to /mnt. – green Feb 18 '13 at 03:44
  • Think you will get some benefit from this link as the issue with the out of frequency error has occurred for others. Seems the suggestion is to hit the ENTER key to force Ubuntu to boot when seeing the error. Then follow instructions provided in the previous link. That should help resolve the issue. – freecode Aug 27 '13 at 14:50
  • 3
  • is there print-error ? is size of harddisk 10 GB ? - you could then create an own new filesystem with multiplicating simply 0.01 - but then I dont know what happens, possible is you can hide away then your harddisk or it is extremely slowly then after this. – dschinn1001 Jun 03 '14 at 19:47
  • @ulkaNCST - where do you live ?! - is harddisk one with IDE/EIDE ?! – dschinn1001 Jun 05 '14 at 04:00
  • Use the link below, this will repair grub and will allow you to choose between Ubuntu and Windows. This is a lot easier, research Ubuntu boot-repair. https://www.howtogeek.com/114884/how-to-repair-grub2-when-ubuntu-wont-boot/ – Chin Dec 29 '17 at 02:00
  • This article helped me https://ubuntuforums.org/showthread.php?t=2036730 – Abhi May 17 '20 at 14:10

7 Answers7

46

After booting from the Ubuntu live CD (tried 14.04 and 16.04) I was able to work around this problem by running update-grub chroot'ed to the grub partition. (Substitute /dev/sda1 below with whatever partition you installed grub on. All commands as root.)

mkdir /mnt/chrootdir
mount /dev/sda1 /mnt/chrootdir
for dir in proc dev sys etc bin sbin var usr lib lib64 tmp; do
    mkdir /mnt/chrootdir/$dir && mount --bind /$dir /mnt/chrootdir/$dir
done
chroot /mnt/chrootdir
grub-install /dev/sda # May not be required
update-grub2
  • 2
    Attempting to run mount gives me the error:, NTFS signature is missing. which is odd, because it should be Ext4, not NTFS... – Cerin Apr 13 '15 at 03:01
  • 1
    @Cerin, I emphasize /dev/sda1 was the right partition for me, but evidently not for you, if that volume is NTFS. – Nathan Kidd Apr 13 '15 at 15:55
  • Your solution is confusing. Do you need to run the first part and the second from within the chroot of the first? Or do you throw away everything you did in the first part and only run the second part? Why do you mount both /dev/sda and /dev/sda1? – Cerin Apr 15 '15 at 01:18
  • /dev/sda was a typo, it should be /dev/sda1, sorry. I updated the info. Is it clearer now? – Nathan Kidd Apr 15 '15 at 16:13
  • 4
    I followed your instructions and ended up with /usr/sbin/grub-probe: error: failed to get canonical path of '/boot'. I had only my /boot partition on my boot drive, the rest was elsewhere. – Sled Sep 30 '15 at 01:13
  • 1
    Had to do an additional grub-install /dev/sda before update-grub, then it worked! – kiw Jul 07 '16 at 07:50
  • In case of restoring EFI boot: 1) be sure to boot Live CD/USB in EFI mode; 2) combine above instruction with instruction from here https://unix.stackexchange.com/questions/379774/grub-installation-failed – 1844144 Sep 16 '18 at 20:07
  • Someone made an edit to add boot to the list of dirs to link in. While I can believe there exists some situation that may be needed, in the general case the entire point here is you pull in boot from /dev/sda1; you don't want a different boot. – Nathan Kidd Jul 22 '19 at 17:30
  • You saved my day! Thank you very much! – automatix Sep 09 '20 at 10:38
  • mkdir /mnt/chrootdir/$dir will most likely result in errors, since this direcories should already exist. – mook765 Aug 09 '22 at 16:39
27

Find your drive that's supposed to boot with

mount

Or

parted -l

Or

fdisk /dev/sda

And type p to list the partitions, look for type 83.

(If you've got Fedora you might have to use the commands vgs and lvs and if you've got mdraid you might have to cat /proc/mdstat or mdadm -A --scan or insmod raid1 or insmod raid5 and then mdadm -A --scan) and you will use /dev/md0 or /dev/mapper/my-vg instead of /dev/sda

then try mount it

mkdir /mnt
mount /dev/sda1 /mnt
cd /mnt
ls -l

Is this your drive? Cool!

grub-install --recheck --root-directory=/mnt /dev/sda 

(Or whichever /dev drive your root is, with it's mounted path)

grub-install --recheck --root-directory=/mnt /dev/sda --force

(Force it if it doesn't like your partitions.)

Now it should boot into grub, and you can use the grub commands to boot up, after rebooting and selecting the right boot drive from the BIOS Setup, or by pressing ESC, F8 or F12 depending on your BIOS and whether you are quick enough, then at the Grub prompt - you can use tab completion to find it if it's not (hd0,1) but (hd1,3) or something else instead, but beware, tab completion sometimes hangs for a few seconds if grub can't read the filesystem. Once booted into Grub you can try to boot with:

insmod linux
ls
root=(hd0,1)
linux /boot/vmlinuz root=/dev/sda1
initrd /boot/initrd
boot

Or, hopefully you've still got an intact grub.cfg file...

ls
ls (hd0,1)/
ls (hd0,1)/boot
configfile (hd0,1)/boot/grub.cfg

Grub 1 allows you to do the installation from Grub:

install (hd0,1)

Once booted from the correct drive, you can retry update-grub and grub-install. If it still fails, you can try:

grub-mkconfig -o /mnt/boot/grub/grub.cfg

Your paths may differ of course, so just play with these commands until you can see what's where and what's going on.

It might be a sign of imminent hard drive failure at worst, or at best maybe just a partition flag or boot file that got overwritten accidentally, or a deliberately- or accidentally broken installer from another OS.

Dagelf
  • 1,245
12

Revised solution based on code above

The solution from above will not work totally without problems because it mounts the boot partition into the / (root) of the file system. That makes grub complain that /boot does not exist, of course. This will fix that problem:

mkdir /mnt/chrootdir
mkdir /mnt/chrootdir/boot
mount /dev/sda1 /mnt/chrootdir/boot
for dir in proc dev sys etc bin sbin var usr lib lib64 tmp; do mkdir /mnt/chrootdir/$dir && mount --bind /$dir /mnt/chrootdir/$dir ; done
chroot /mnt/chrootdir
update-grub2  # inside chroot

As you see i also removed the line breaks so that it is easier to execute for everyone.

Another (simpler) solution

If you keep having problems getting it to work you should look to copy the /boot partition onto the / (root) partition. For that start your system with the Ubuntu live boot dvd and open the terminal. Inside it type:

sudo su
fdisk -l

To find out which partitions you have. In my case sda1 is my /boot partition which is about 250MB large and an sda5 which is about 500GB. I use these values in the commands below:

mkdir /mnt/boot/
mount /dev/sda1 /mnt/boot/

mkdir /mnt/root/
mount /dev/sda5 /mnt/root/

cp -R /mnt/boot/ /mnt/root/boot/

Set the bootable flag for the data partition and remove it for the boot partition:

fdisk /dev/sda
b -> 1 (unset the bootable flag for the first partition)
b -> 5 (set the bootable flag for the fifth partition)
w -> write changes to the MBR

Your computer will now look inside the sda5 for the boot files. Time to do the chrooting again, this time with some required folders needed for grub and which are generated by your Ubuntu live disc already:

mkdir /mnt/chrootdir/
mkdir /mnt/chrootdir/dev/
mkdir /mnt/chrootdir/proc/
mkdir /mnt/chrootdir/sys/

mount /dev/sda5 /mnt/chrootdir/
mount --bind /dev/ /mnt/chrootdir/dev/
mount --bind /proc/ /mnt/chrootdir/proc/
mount --bind /sys/ /mnt/chrootdir/sys/

chroot /mnt/chrootdir/

grub-install /dev/sda

Installation finished. No error reported.

If you do not see a message that the grub.cnf file is generated then also run the update command:

update-grub2 /dev/sda

Now you can safely reboot and see the well known boot menu appear again.

This solution was the only one which was working for me after migrating from a physical server to a virtual machine. I hope someone finds this useful!

Tim B.
  • 219
  • /usr/sbin/grub-mkconfig: 252: /usr/sbin/grub-mkconfig: cannot create /boot/grub/grub.cfg.new: Directory nonexistent – Quidam Apr 27 '20 at 15:10
  • 2nd solution: root@ubuntu:/# mkdir /mnt/boot/ mkdir: impossible to create «/mnt/boot/»: No file or folder of this type (It wasn't in English, so it's only roughly translated). – Quidam Apr 27 '20 at 15:13
  • It can be that you do not have grub installed as boot loader, then you dont have those files in that location. For your other comment: if you dont have the /mnt folder then create it. It just has to be a folder which you can (mis-)use to mount the disk on. – Tim B. Apr 28 '20 at 16:10
  • @Quidam mkdir /mnt first... or mkdir -p /mnt/boot/ to automatically do it... if it still won't try mkdir /tmp... you can put it anywhere, or use an existing unused folder – Dagelf Jul 23 '20 at 01:52
1

Got the same error. The only problem was that /cow was still mounted on /.

A little sudo umount /cow did the trick.

SinLey
  • 11
0

I tried all the solutions and couldn't get it fixed. What worked for me - was to install windows 10(it will create EFI partition), then delete every windows partition except EFI and install Linux. This time Linux will successfully and automatically configure grub

  • Not a possible answer as this is a 10 year old question and that version of Windows did not even exist. – David Mar 24 '23 at 11:53
  • @David, I came across this post, because last week I was installing linux on an 11 year old Dell Optiplex, and I had this error. I spent around 4h trying different solutions from different posts, because regular linux installation couldn't install grub, and grub-install command kept failing. Only managed to get it working when windows installer created EFI partition. When I created it manually from linux installer - it didn't work. – Liubomyr Kushnir Mar 25 '23 at 14:53
0

I know, it's a old problem, but I had the same troubles today with the actual version of mint-linux (ubuntu-based). I found a very simply solution! :-) Take off the internet-connection during the first installation. This stop loading of a non compatible grub2. Make the update of all after installation has finished.

anonymous2
  • 4,298
-7

It is the update-grub command which will give you the error when using it from a live cd. I faced with a similar situation when I was doing a GRUB rescue. Also grub-install wasn't in my path for some reason, so I had to run it with /usr/sbin/grub-install.

grub-install accepts a --boot-directory option, to set up GRUB to boot to a system different from the one that is currently running. Here is the relevant manual page.

aveemashfaq
  • 153
  • 5