GRUB and LILO both fail to install to NVMe hard disk

Help with issues regarding installation of Debian

GRUB and LILO both fail to install to NVMe hard disk

Postby michael_a » 2016-05-03 14:21

I'm trying to install 64-bit Debian stable on a new Lenovo Thinkpad X1 Carbon using the netinstall CD. When I get to the installation step that installs the bootloader, I get this message:

An installation step failed. You can try running the failing item again from the menu, or skip it and choose something else. The failing step is: Install the GRUB boot loader on a hard disk


Going back to the menu and selecting LILO gives me the same error. The installation log says
Code: Select all
May  1 13:24:23 main-menu[188]: WARNING **: Configuring 'grub-installer' failed with error code 1
May  1 13:24:23 main-menu[188]: WARNING **: Menu item 'grub-installer' failed.
May  1 13:24:28 main-menu[188]: INFO: Menu item 'lilo-installer' selected
May  1 13:24:28 main-menu[188]: WARNING **: Unable to set title for fdisk-udeb.
May  1 13:24:28 main-menu[188]: WARNING **: Configuring 'lilo-installer' failed with error code 1
May  1 13:24:28 main-menu[188]: WARNING **: Menu item 'lilo-installer' failed.


I'm not using LVM or RAID. Here's what I tried so far:

  1. I disabled UEFI boot in the BIOS and selected legacy boot instead. The error still occurs with both GRUB and LILO.
  2. Instead of the netinstall CD, I used the full DVD. Same error. I'm booting both of these from USB.
  3. The machine passed all hardware tests. When I first bought it, I ran all the available hardware tests, both from within the BIOS and from within Windows, and it passed all of them. I'm assuming that means the hardware isn't malfunctioning.
  4. Following this thread on the Crunchbang forums that had a similar error (albeit with LVM), I redid the partition scheme with a small /boot partition at the beginning of the disk, formatted with ext2. Same error with both bootloaders.
  5. Switching to TTY4 to look at the installation output, I also see the error
    Code: Select all
    chroot: can't execute 'grub-probe': No such file or directory

    Searching for information on that turns up this thread and this bug report related to GRUB. However, those are fairly old posts, and I have run through the installation over a dozen times now and I get the error every time, so it doesn't seem like a one-off thing.
  6. I've used Gparted to check that the hard disk is completely empty. Other threads have mentioned that Windows' recovery partitions and other hidden partitions may cause problems, but as far as I can tell that isn't the case here. I was able to successfully create an msdos partition table and three partitions (for /, /home, and swap) on the drive in the previous installation step, so I don't know why GRUB and LILO suddenly can't write to the drive when parted could.
  7. Following the instructions on this StackExchange question that had a (possibly) similar issue with GRUB, GPT, and RAID, I can

    Code: Select all
    parted /dev/nvme01
    set 1 bios_grub on

    from TTY2, but I get an error that says "parted not found." On my system /dev/nvme01 is the only hard disk.

How do I fix this and get Debian installed? I also posted a version of this question on the Unix StackExchange, but I'll update this thread if I get any updates there and vice versa.

---
Could part of the problem be that Debian/parted recognizes the disk incorrectly? It says the disk is 512.1 GB, which is true in the sense that the specs say 512 GB and that's what is advertised, and it will let me allocate all 512 GB to various partitions. However, if I load it in Gparted live, the actual disk space is closer to 476 GB, but I assumed that's just the usual 1024 vs 1000 stuff.
Last edited by michael_a on 2016-05-03 20:31, edited 1 time in total.
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to hard disk

Postby kiyop » 2016-05-03 15:17

Have you partitioned the media with GPT?
If so, Grub2 needs bios boot partition (with bios_grub flag). Is there any bios boot partition in the media?
Refer https://en.wikipedia.org/wiki/BIOS_boot_partition
bios boot partition can be generated with Gparted live cd, which you seem to have used.

You can also use old msdos-type partition table on MBR and so on. In such case, if you leave more than 63sectors free space just after the MBR, you may be able to install smoothly grub2 code onto the media.

ADDED AT Wed May 4 09:06:26 JST 2016;

Thank Head_on_a_Stick for the following:
viewtopic.php?f=17&t=128212&p=614869#p614845
Head_on_a_Stick wrote:I think GRUB has a problem with NVMe drives.

See https://bugs.debian.org/cgi-bin/bugrepo ... bug=785149

viewtopic.php?f=17&t=128212&p=614869#p614866
Head_on_a_Stick wrote:I think gummiboot works with NVMe drives.

Or you could just boot the kernel image directly without a bootloader at all:
https://wiki.debian.org/EFIStub

Of course, you will need a more flexible installation method than that provided by the Debian installer.

See https://www.debian.org/releases/jessie/ ... 03.html.en
Last edited by kiyop on 2016-05-04 00:08, edited 1 time in total.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/
User avatar
kiyop
 
Posts: 3984
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan

Re: GRUB and LILO both fail to install to hard disk

Postby michael_a » 2016-05-03 16:21

No, I'm not using GPT. The only type of partition table I've created is msdos. Is there any way to check for the existence of a BIOS boot partition from within the installation (so that if I get the error I can check without having to boot into another live CD and restart the installation)?

I created an msdos partition table with partitions for /, /home, and swap (see point #6), but I did not create a separate /boot partition. I thought if I didn't specify this it was included in the partition mounted as / ?
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to hard disk

Postby Head_on_a_Stick » 2016-05-03 18:35

michael_a wrote:
Code: Select all
/dev/nvme01

I think GRUB has a problem with NVMe drives.

See https://bugs.debian.org/cgi-bin/bugrepo ... bug=785149
User avatar
Head_on_a_Stick
 
Posts: 10321
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GRUB and LILO both fail to install to hard disk

Postby michael_a » 2016-05-03 19:07

Does LILO also have a problem? I run into the same problem when using LILO as the bootloader. If I'm reading the bug report right, it sounds like it's been fixed (according to message #30) and there's discussion of backporting it to Jessie, i.e. Debian stable, which is the version I'm trying to install.

Also, if GRUB and LILO don't work on NVMe drives, am I completely out of luck, since I just can't install Debian on this machine?
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to hard disk

Postby Head_on_a_Stick » 2016-05-03 20:09

michael_a wrote:Also, if GRUB and LILO don't work on NVMe drives, am I completely out of luck, since I just can't install Debian on this machine?

I think gummiboot works with NVMe drives.

Or you could just boot the kernel image directly without a bootloader at all:
https://wiki.debian.org/EFIStub

Of course, you will need a more flexible installation method than that provided by the Debian installer.

See https://www.debian.org/releases/jessie/ ... 03.html.en
User avatar
Head_on_a_Stick
 
Posts: 10321
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby michael_a » 2016-05-03 20:27

I'll look into those then. It sounds like I would need to install another *nix system on the machine first (on another drive, e.g. a USB drive), since those steps describe how to install Debian from within another distribution.

Was I reading that GRUB bug report incorrectly? It really sounded like the bug was fixed, and obviously, being able to use the standard installer is the path of least resistance, so I'd like to use that if at all possible. It doesn't sound like it is possible, though. Maybe it's not fixed in the version of GRUB that is currently packaged with Jessie/stable.

Also, I'm not 100% convinced this is simply an issue with GRUB not supporting NVMe drives (it increasingly looks like that's the case, however) since LILO also fails. Both bootloaders fail to install to the hard disk, not just GRUB.

In hindsight, I should have bought the model that didn't have a NVMe SSD... I didn't realize compatibility would be such a problem.
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby kiyop » 2016-05-04 00:36

Insert the debian installation full DVD (USB media). Type "rescue" at "boot:" prompt.
Can you select the installed partition as /(root) partition?
If you can, select it and execute
Code: Select all
fdisk -l
blkid

and post the results.
If the result contains the /(root) partition of the installed debian,
Code: Select all
mkidr /mnt
mount -t auto /dev/THE_DEVICE_FILE_NAME_OF_THE_ROOT_PARTITION /mnt -o rw
ls /mnt
ls /mnt/boot

and post the results. Replace the above "THE_DEVICE_FILE_NAME_OF_THE_ROOT_PARTITION" with the proper letters.

How about trying EFIStub method Head_on_a_Stick told?
Be sure to enable UEFI and make an EFI SYSTEM PARTITION with fat32 (vfat) filesystem. You need not prepare separate /boot partition.

How about trying gummiboot Head_on_a_Stick told?
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/
User avatar
kiyop
 
Posts: 3984
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby michael_a » 2016-05-05 14:06

How about trying EFIStub method Head_on_a_Stick told?
Be sure to enable UEFI and make an EFI SYSTEM PARTITION with fat32 (vfat) filesystem. You need not prepare separate /boot partition.

This looks promising; I'll try this tonight or this weekend, and failing that, I'll begin trying the other methods. Thank you!
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby michael_a » 2016-05-06 16:53

kiyop wrote:Insert the debian installation full DVD (USB media). Type "rescue" at "boot:" prompt.
Can you select the installed partition as /(root) partition?
If you can, select it and execute
Code: Select all
fdisk -l
blkid

and post the results.


I was not able to select the installed partition as root from the rescue CD. The only partitions that appeared in the list were /dev/sda1 and /dev/sdb1, which were the two USB drives that were hooked up to the system. That being said, this is the output from fdisk -l and blkid:
Code: Select all
# fdisk -l

Disk /dev/nvme0n1: 477 GiB, 512110190592 bytes, 1000215216 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: gpt
Disk identifier: CC8E835F-613F-49FE-AB5D-2339AB7FF7A2

Device            Start        End   Sectors   Size Type
/dev/nvme0n1p1     2048    1050623   1048576   512M EFI System
/dev/nvme0n1p2  1050624   20582399  19531776   9.3G Linux filesystem
/dev/nvme0n1p3 20582400   49569791  28987392  13.8G Linux swap
/dev/nvme0n1p4 49569792 1000214527 950644736 453.3G Linux filesystem

Disk /dev/sda: 7.5 GiB, 8005787648 bytes, 15636304 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: 0x000d45df

Device     Boot Start      End  Sectors  Size Id Type
/dev/sda1  *     2048 15634431 15632384  7.5G  b W95 FAT32

Disk /dev/sdb: 3.7 GiB, 4005527552 bytes, 7823296 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: 0x0009ebba

Device     Boot Start     End Sectors  Size Id Type
/dev/sdb1  *     2048 7821311 7819264  3.7G 83 Linux



# blkid

/dev/nvme0n1: PTUUID="cc8e835f-613f-49fe-ab5d-2339ab7ff7a2" PTTYPE="gpt"
/dev/nvme0n1p1: UUID="13FA-E2C8" TYPE="vfat" PARTUUID="9acfa546-3d9c-4fe0-a70c-ff77f427ed2e"
/dev/nvme0n1p2: UUID="4afbf01a-ef67-41b5-9344-601bd362d457" TYPE="ext4" PARTUUID="edeaeee1-8700-400f-9a55-e08328304f5c"
/dev/nvme0n1p3: UUID="f47a9938-44cd-4593-9cd9-288beb973e6d" TYPE="swap" PARTUUID="846b7e28-4f54-4e48-8bf8-bba93487f320"
/dev/nvme0n1p4: UUID="2c754fee-3141-4110-8bc0-d35667ace51f" TYPE="ext4" PARTUUID="b306915b-7daf-472f-9acb-d66c986dcb91"
/dev/sda1: UUID="3868-4B2E" TYPE="vfat" PARTUUID="000d45df-01"
/dev/sdb1: UUID="abbfcd98-cc7c-4191-9d26-361aa6ee16d8" TYPE="ext4" PARTUUID="0009ebba-01"



If the result contains the /(root) partition of the installed debian,
Code: Select all
mkidr /mnt
mount -t auto /dev/THE_DEVICE_FILE_NAME_OF_THE_ROOT_PARTITION /mnt -o rw
ls /mnt
ls /mnt/boot

and post the results. Replace the above "THE_DEVICE_FILE_NAME_OF_THE_ROOT_PARTITION" with the proper letters.


This is the output from ls /mnt/ssd (where I mounted the root partition /dev/nvme0n1p1):
Code: Select all
     0 drwxr-xr-x    5 root     root         100 May  6 02:03 ..
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:39 run
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:39 sbin
     4 drwxr-xr-x   88 root     root        4.0K May  6 00:38 etc
     4 drwxrwxrwt    2 root     root        4.0K May  6 00:15 tmp
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:14 bin
     4 drwxr-xr-x   15 root     root        4.0K May  6 00:14 lib
     4 drwxr-xr-x    3 root     root        4.0K May  6 00:12 boot
     4 drwxr-xr-x   22 root     root        4.0K May  6 00:12 .
     0 lrwxrwxrwx    1 root     root          31 May  6 00:12 initrd.img -> /boot/initrd.img-3.16.0-4-amd64
     0 lrwxrwxrwx    1 root     root          27 May  6 00:12 vmlinuz -> boot/vmlinuz-3.16.0-4-amd64
     4 drwxr-xr-x    3 root     root        4.0K May  6 00:12 media
     4 drwxr-xr-x    4 root     root        4.0K May  6 00:12 dev
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:11 lib64
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:11 mnt
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:11 opt
     4 drwx------    2 root     root        4.0K May  6 00:11 root
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:11 srv
     4 drwxr-xr-x   10 root     root        4.0K May  6 00:11 usr
     4 drwxr-xr-x   11 root     root        4.0K May  6 00:11 var
     4 drwxr-xr-x    2 root     root        4.0K May  6 00:11 home
    16 drwx------    2 root     root       16.0K May  6 00:11 lost+found
     4 drwxr-xr-x    2 root     root        4.0K Mar 13 23:46 proc
     4 drwxr-xr-x    2 root     root        4.0K Apr  6  2015 sys

(I just realized I mistakenly overwrote the output file from ls /mnt/ssd/boot, so I can't post that at the moment)

How about trying EFIStub method Head_on_a_Stick told?
Be sure to enable UEFI and make an EFI SYSTEM PARTITION with fat32 (vfat) filesystem. You need not prepare separate /boot partition.


I'm still planning to try this, but in order to follow the EFIStub instructions, I need to be able to boot into the system first. Otherwise, I can't run efibootmgr. I realize there might be a way to access the system from the rescue CD by binding/mounting the necessary directories and chrooting into the system, but I'll have to figure that out since I don't have much experience with doing that.

I don't want to use an external disk to boot the system going forward, but I'm also going to try specifying a /boot partition on a separate /dev/sdaX drive (and installing GRUB there), just to see if it lets me boot into the system. Then I can get up the efibootmgr from there.
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby Head_on_a_Stick » 2016-05-06 21:47

michael_a wrote:in order to follow the EFIStub instructions, I need to be able to boot into the system first. Otherwise, I can't run efibootmgr. I realize there might be a way to access the system from the rescue CD by binding/mounting the necessary directories and chrooting into the system, but I'll have to figure that out since I don't have much experience with doing that.

Code: Select all
# mount /dev/nvme0n1p2 /mnt
# mount /dev/nvme0n1p1 /mnt/boot/efi
# for i in /proc /sys /dev; do mount --bind $i /mnt$i; done
# chroot /mnt /bin/bash
# . /etc/profile

This presumes that /dev/nvme0n1p2 is your root filesystem.

Then follow the instructions in the guide -- the `efibootmgr` command can be run from any live ISO image that supports UEFI.
User avatar
Head_on_a_Stick
 
Posts: 10321
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby michael_a » 2016-05-07 00:46

That worked through the chroot into /mnt, but it doesn't look the Debian installation has the efibootmgr installed. It's installed on the Ubuntu live CD that I'm using (Ubuntu is what I had laying around), and I can copy it from /bin on the live system to /bin on the hard drive, but is that barking up the wrong tree, since I'll be resolving dependencies manually at that point? I presume that before I exit the Debian installer, I can drop into a terminal and run aptitude to install the efibootmgr that way, to make sure it's installed on the system properly, before booting into a live CD. Is that possible? I ask before I try it because I don't want to run through the installation process yet again unless it's necessary.

Once I get it installed on the hard drive, the rest of the EFI instructions are complete, i.e. creating a kernel update script. I just need to run the actual command:
Code: Select all
efibootmgr -c -g -L "Debian (EFI stub)" -l '\EFI\debian\vmlinuz' -u "root-UUID=$UUID ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img" --disk /dev/nvme0n1

with the necessary adjustment to the --disk option because my hard drive isn't the default /dev/sda.
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby lostfarmer » 2016-05-07 01:52

Head_on_a_Stick wrote: the `efibootmgr` command can be run from any live ISO image that supports UEFI.

You just need to boot into your live ubuntu in efi mode and run efibootmgr command. You do not need to run it from the installed linux or through the chroot environment. You do need to have the 2 files (/vmlinuz and /initrd.img) coped to the EFI/debian folder as per instructions. Be sure to replace $UUID with the root partition's uuid.
lostfarmer
 
Posts: 19
Joined: 2016-05-07 01:13
Location: Idaho

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby michael_a » 2016-05-07 22:13

Hmm, maybe this Ubuntu live CD doesn't support UEFI. From the live CD, I ran
Code: Select all
# sudo -s
# mount /dev/nvme0n1p2 /mnt
# mount /dev/nvme0n1p1 /mnt/boot/efi
# for i in /proc /sys /dev; do mount --bind $i /mnt$i; done
# chroot /mnt /bin/bash

Then, from within the chroot, I ran
Code: Select all
# . /etc/profile
# mkdir /boot/efi/EFI/debian
# cp /vmlinuz /initrd.img /boot/efi/EFI/debian/

I created /etc/kernel/postinst.d/update-efistub with
Code: Select all
#!/bin/sh
cp /vmlinuz /initrd.img /boot/efi/EFI/debian/

made it executable with chmod +x, then exited the chroot. From the live CD, blkid gives me
Code: Select all
/dev/loop0: TYPE="squashfs"
/dev/nvme0n1: PTUUID="d2213c40-3fcc-483f-989e-792a50956698" PTTYPE="gpt"
/dev/nvme0n1p1: UUID="ADC6-E6B1" TYPE="vfat" PARTUUID="1aa8a7db-6b19-4a14-91d9-4f7a3d699696"
/dev/nvme0n1p2: UUID="0c46b12c-3316-4fda-bc0f-4d56a5ca432a" TYPE="ext4" PARTUUID="1b9d8380-5d56-4386-91c7-358cfd9302da"
/dev/nvme0n1p3: UUID="8cc95ff4-f08b-458a-bc39-6437be4c070c" TYPE="swap" PARTUUID="c18ada68-82d3-437a-8432-4ff6d3857287"
/dev/nvme0n1p4: UUID="cde63a8f-efa7-49b2-999a-4a2078d7cfb7" TYPE="ext4" PARTUUID="341883d7-6b62-4937-8bb2-4e9483bd6306"
/dev/mmcblk0: PTUUID="59947da9" PTTYPE="dos"
/dev/mmcblk0p1: UUID="D682-B903" TYPE="vfat" PARTUUID="59947da9-01"
/dev/sda1: UUID="abbfcd98-cc7c-4191-9d26-361aa6ee16d8" TYPE="ext4" PARTUUID="0009ebba-01"

so I ran
Code: Select all
sudo efibootmgr -c -g -L "Debian (EFI stub)" -l '\EFI\debian\vmlinuz' -u "root-UUID=ADC6-E6B1 ro quiet rootfstype=ext4 add_efi_memmap initrd=\\EFI\\debian\\initrd.img" --disk /dev/nvme0n1

only to get the error
Code: Select all
efibootmgr: EFI variables are not supported on this system.

Maybe the live CD wasn't booted in UEFI mode, so I'll look into that. Failing that, I'll try these same steps from rescue mode on a Debian DVD and see if they work there.
michael_a
 
Posts: 28
Joined: 2016-05-03 13:59

Re: GRUB and LILO both fail to install to NVMe hard disk

Postby lostfarmer » 2016-05-07 23:05

looks like ubuntu is not booted in efi mode. to check run in a terminal "ls /sys/firmware" does it output 'efi' , if no it is not booted into efi mode. You say 'ubuntu cd' , is it a cd or just gerneric term ?

You should not need to run your first commands again, just the 'efibootmgr' command. You can check to be sure the efi partition '/dev/nvme0n1p1' does have /EFI/debian/ folder with the 2 files /vmlinuz and /initrd.img. If the 2 files are present , all then you need to do is register them in the EFI firmware with the 'efibootmgr' command. If it still does not boot, the main question then, is your comp capable of booting from a NVMe hdd ( might check if you have the latest 'bios'/firmware installed )
lostfarmer
 
Posts: 19
Joined: 2016-05-07 01:13
Location: Idaho

Next

Return to Installation

Who is online

Users browsing this forum: phenest and 9 guests

fashionable