Sunday, April 28, 2024
 Popular · Latest · Hot · Upcoming
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 18650  / 3 Years ago, wed, june 16, 2021, 4:40:47

I just upgraded from Ubuntu 12.04 to 14.04, but during the installation grub-install failed:



enter image description here



enter image description here



I continued with the installation and hoped to fix the grub issue afterwards. However, I ran into some difficulties. I have not restarted my system, as I fear that it will not be able to reboot.



This is the error that I always get trying to install grub:



 $ sudo grub-install /dev/mapper/isw_cjccfdbihf_Volume0p1 
Installing for i386-pc platform.
grub-install: error: cannot find a GRUB drive for /dev/mapper/isw_cjccfdbihf_Volume0p1. Check your device.map.


(I also tried sudo grub-install /dev/sda but it also fails with the exact same error messsage.)



The machine seems to use a RAID 1 setup. Here are some information:



$ ls -algh /dev/mapper/
total 0
drwxr-xr-x 2 root 120 Aug 12 19:41 .
drwxr-xr-x 16 root 5.2K Aug 12 20:27 ..
crw------- 1 root 10, 236 Jul 28 10:30 control
lrwxrwxrwx 1 root 7 Aug 12 19:41 isw_cjccfdbihf_Volume0p1 -> ../dm-1
lrwxrwxrwx 1 root 7 Aug 12 19:41 isw_cjccfdbihf_Volume0p2 -> ../dm-2
lrwxrwxrwx 1 root 7 Aug 12 19:41 isw_cjccfdbihf_Volume0p5 -> ../dm-3

$ sudo grub-probe -t device /boot/grub
/dev/mapper/isw_cjccfdbihf_Volume0p1

$ sudo fdisk -l

Disk /dev/sda: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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 identifier: 0x0003b681

Device Boot Start End Blocks Id System
/dev/sda1 2048 468514815 234256384 83 Linux
/dev/sda2 468516862 488390655 9936897 5 Extended
/dev/sda5 468516864 488390655 9936896 82 Linux swap / Solaris

Disk /dev/sdb: 250.1 GB, 250059350016 bytes
255 heads, 63 sectors/track, 30401 cylinders, total 488397168 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 identifier: 0x0003b681

Device Boot Start End Blocks Id System
/dev/sdb1 2048 468514815 234256384 83 Linux
/dev/sdb2 468516862 488390655 9936897 5 Extended
/dev/sdb5 468516864 488390655 9936896 82 Linux swap / Solaris

Disk /dev/mapper/isw_cjccfdbihf_Volume0p1: 239.9 GB, 239878537216 bytes
255 heads, 63 sectors/track, 29163 cylinders, total 468512768 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 identifier: 0x00000000

Disk /dev/mapper/isw_cjccfdbihf_Volume0p1 doesn't contain a valid partition table
fdisk: unable to read /dev/mapper/isw_cjccfdbihf_Volume0p2: Inappropriate ioctl for device


Especially, the last two lines seem to indicate a deeper problem. :-(



The error message of grub-install also mentions a device.map file.



$ cat /boot/grub/device.map
cat: /boot/grub/device.map: No such file or directory


I tried to generate it but it did not help either (the error message did not change):



$ sudo grub-mkdevicemap
$ cat /boot/grub/device.map
(hd0) /dev/disk/by-id/ata-WDC_WD2500AAJS-00YZCA0_WD-WCAYU7549707
(hd1) /dev/disk/by-id/ata-WDC_WD2500AAJS-00YZCA0_WD-WCAYU7501473


Do you have any recommendations what I should try out next? Any help is deeply appreciated.



Update:



$ debconf-show grub-pc
debconf: DbDriver "passwords" warning: could not open /var/cache/debconf /passwords.dat: Permission denied
* grub-pc/install_devices: /dev/disk/by-id/dm-name-isw_cjccfdbihf_Volume0
grub-pc/kopt_extracted: false
grub-pc/partition_description:
* grub2/linux_cmdline:
grub-pc/install_devices_empty: false
grub-pc/timeout: 10
grub-pc/install_devices_failed_upgrade: true
* grub2/linux_cmdline_default: quiet splash
grub-pc/postrm_purge_boot_grub: false
grub-pc/hidden_timeout: true
grub-pc/disk_description:
grub-pc/mixed_legacy_and_grub2: true
grub2/kfreebsd_cmdline_default: quiet splash
grub2/device_map_regenerated:
* grub-pc/install_devices_failed: true
grub-pc/chainload_from_menu.lst: true
grub-pc/install_devices_disks_changed:
grub2/kfreebsd_cmdline:


Note the line: grub-pc/install_devices: /dev/disk/by-id/dm-name-isw_cjccfdbihf_Volume0



Now the content of /etc/fstab:



proc            /proc           proc    nodev,noexec,nosuid 0       0
/dev/mapper/isw_cjccfdbihf_Volume01 / ext4 errors=remount-ro 0 1
/dev/mapper/isw_cjccfdbihf_Volume0p5 none swap sw 0 0


An backup file from 2012 shows slightly different entries for swap (Volume05 instead of Volume0p5), which indicates that the names could have been changed:



 # Note that this is an old file at the time the system was installed (Ubuntu 10.04 or 10.10)
# (This is also the time from which the original grub configuration is from, isn't it?!)
/dev/mapper/isw_cjccfdbihf_Volume01 / ext4 errors=remount-ro 0 1
/dev/mapper/isw_cjccfdbihf_Volume05 none swap sw 0 0


So, maybe it has something to do with "_Volume01" vs "_Volume0p1" vs "_Volume0". /etc/fstab says "01", ls /dev/mapper returns mappings "0p1", "0p2" and "0p5" (swap), and finally debconf-show grub-pc says "Volume0". I think this inconsistency is the root of the problem.



Now I wonder:




  1. What should the line grub-pc/install_devices in the output of debconf-show grub-pc be?

  2. How can I change the Grub settings, so I can experiment with different values?



I also just noticed that the installation of grub-pc is broken:



$ sudo dpkg-reconfigure grub-pc
/usr/sbin/dpkg-reconfigure: grub-pc is broken or not fully installed

More From » 14.04

 Answers
7

Here is how I fixed the problem:



In a quiet moment, I had time to risk downtime. So I rebooted the system with a Ubuntu 14.04 Live CD and reinstalled Grub. I did not encounter problems and afterwards, the system booted normally.



Here is a general description: https://help.ubuntu.com/community/Grub2/Installing#via_the_LiveCD_terminal



From memory, here are the commands that I used in my specific case:



Boot from Live CD and executed the following commands:



 $ sudo su
$ mount /dev/mapper/isw_cjccfdbihf_Volume0p1 /mnt

(Sorry, I'm not 100% sure whether the target was /dev/mapper/isw_cjccfdbihf_Volume0p1 or
/dev/sda. I think it was /dev/mapper/isw_cjccfdbihf_Volume0p1.)
$ grub-install --root-directory=/mnt /dev/mapper/isw_cjccfdbihf_Volume0p1
$ reboot


After that, the system rebooted. Finally, I could finish the broken installation with sudo apt-get install.



At the moment, /etc/fstab still lists /dev/mapper/isw_cjccfdbihf_Volume01 for the root directory. I still don't know if that is actually correct, but I haven't tried to change it to /dev/mapper/isw_cjccfdbihf_Volume0p1 to find out whether it still works after a reboot.


[#23674] Wednesday, June 16, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
motivengry

Total Points: 459
Total Questions: 112
Total Answers: 108

Location: Bonaire
Member since Sat, May 1, 2021
3 Years ago
motivengry questions
Tue, Oct 4, 22, 10:02, 2 Years ago
Wed, May 31, 23, 14:33, 12 Months ago
;