Bug#843000: refind: fails to install on NVMe

2020-02-17 Thread Rod Smith
On Mon, 14 Nov 2016 14:04:41 -0800 Tianon Gravi  wrote:
> On 4 November 2016 at 02:34, Bjørn Mork  wrote:
> > + /bin/efibootmgr -c -l '\EFI\refind\refind_x64.efi' -L 'rEFInd Boot 
> > Manager' -d /dev/nvme0n1 -p 1
> 
> I just tested this on a friend's machine which has NVMe and uses
> rEFInd and we had to change the "-d" value to be "/dev/nvme0n1p1"
> (full path to the partition itself) for the entry to be created
> correctly (otherwise "efibootmgr -v" afterwards shows
> "HD(1,0,000...000,0x0,0x0)/File(...)" instead of the correct
> "HD(1,GPT,xxx...xxx,0x800,0x20)/File(...)", which we got after
> adjusting the "-d" path).
> 
> Rod, any ideas for why that might be the case (and how it might be
> handled properly in "refind-install")? :/

I've now got a couple of systems with NVMe drives, so I've dug through
the refind-install script and completely re-worked the ESP-detection
code. It seems to be working now, at least for me. This is available in
git commit 07d08b on Sourceforge:

https://sourceforge.net/p/refind/code/commit_browser

Note that I released rEFInd 0.11.5 a few days ago, and this commit is
the first since then.

As to efibootmgr requiring "/dev/nvme0n1p1", rather than the as-expected
"/dev/nvme0n1", as an option to "-d", that sounds like an efibootmgr
bug, and on my main test system (running Linux Mint 19, using efibootmgr
15-1), it takes "/dev/nvme0n1" and works correctly.

-- 
Rod Smith
rodsm...@rodsbooks.com
http://www.rodsbooks.com



Bug#843000: refind: fails to install on NVMe

2016-11-17 Thread Roderick W. Smith
On 11/14/2016 05:04 PM, Tianon Gravi wrote:
> On 4 November 2016 at 02:34, Bjørn Mork  wrote:
>> + /bin/efibootmgr -c -l '\EFI\refind\refind_x64.efi' -L 'rEFInd Boot 
>> Manager' -d /dev/nvme0n1 -p 1
> 
> I just tested this on a friend's machine which has NVMe and uses
> rEFInd and we had to change the "-d" value to be "/dev/nvme0n1p1"
> (full path to the partition itself) for the entry to be created
> correctly (otherwise "efibootmgr -v" afterwards shows
> "HD(1,0,000...000,0x0,0x0)/File(...)" instead of the correct
> "HD(1,GPT,xxx...xxx,0x800,0x20)/File(...)", which we got after
> adjusting the "-d" path).
> 
> Rod, any ideas for why that might be the case (and how it might be
> handled properly in "refind-install")? :/

This is starting to sound like a bug in efibootmgr to me, but I haven't
yet had a chance to look into it further.

-- 
Rod Smith
Server and Cloud Certification Engineer
rod.sm...@canonical.com



signature.asc
Description: OpenPGP digital signature


Bug#843000: refind: fails to install on NVMe

2016-11-14 Thread Tianon Gravi
On 4 November 2016 at 02:34, Bjørn Mork  wrote:
> + /bin/efibootmgr -c -l '\EFI\refind\refind_x64.efi' -L 'rEFInd Boot Manager' 
> -d /dev/nvme0n1 -p 1

I just tested this on a friend's machine which has NVMe and uses
rEFInd and we had to change the "-d" value to be "/dev/nvme0n1p1"
(full path to the partition itself) for the entry to be created
correctly (otherwise "efibootmgr -v" afterwards shows
"HD(1,0,000...000,0x0,0x0)/File(...)" instead of the correct
"HD(1,GPT,xxx...xxx,0x800,0x20)/File(...)", which we got after
adjusting the "-d" path).

Rod, any ideas for why that might be the case (and how it might be
handled properly in "refind-install")? :/


♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4



Bug#843000: refind: fails to install on NVMe

2016-11-04 Thread Bjørn Mork
Rod Smith  writes:
> On 11/03/2016 01:29 PM, Tianon Gravi wrote:
>> On 3 November 2016 at 10:28, Tianon Gravi  wrote:
>>> On 3 November 2016 at 10:19, Rod Smith  wrote:
 Note, however, that I have no NVMe or similar devices on which to test.
 The new code does the right thing on my /dev/sd? devices, and I think it
 SHOULD work on more exotic devices.
>>>
>>> I don't personally have an NVMe system I can test the script as-is on,
>>> but I tested that specific block of code on a friend's system which
>>> does have NVMe, and I got "/dev/nvme0n1" for InstallDisk and "p1" for
>>> PartNum from his "/boot" partition, so it looks like this code is
>>> correct. :)
>> 
>> Although now that I say that, it occurs to me that PartNum might
>> actually need to be simply "1", not "p1", right?
>
> Good question. I guess it depends on what efibootmgr wants, since that's
> where the variable is used. The efibootmgr man page implies it wants a
> number, so I've committed another change -- applying both 2a6f68 and
> bdf9ca from my git repository should do it:
>
> https://sourceforge.net/p/refind/code/commit_browser

e7e393 works for me:

+ [[ -n /bin/efibootmgr ]]
++ grep /boot/efi /etc/mtab
++ cut -d ' ' -f 1
+ InstallPart=/dev/nvme0n1p1
++ lsblk -r
++ grep disk
++ cut -f 1 -d ' '
+ for Name in `lsblk -r | grep disk | cut -f 1 -d " "`
+ [[ /dev/nvme0n1p1 == *\n\v\m\e\0\n\1* ]]
+ InstallDisk=/dev/nvme0n1
+ PartNum=p1
++ echo 1
+ PartNum=1
+ break
+ [[ -z /dev/nvme0n1 ]]
+ [[ -z 1 ]]
..

+ [[ 0 == 0 ]]
+ /bin/efibootmgr -c -l '\EFI\refind\refind_x64.efi' -L 'rEFInd Boot Manager' 
-d /dev/nvme0n1 -p 1

Thanks.

And I don't think NVMe is *that* exotic anymore :)  This is a pretty
standard 2016 model laptop, as sold by Lenovo.


Bjørn



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Tianon Gravi
On 3 November 2016 at 11:45, Rod Smith  wrote:
> Oops; I cut-and-pasted the wrong stuff from my test script to the
> refind-install script. I've added another commit -- e7e393 -- so that's
> three commits in total

Looks like that did the trick!  Now getting "1" instead of "p1".


♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Rod Smith
On 11/03/2016 02:16 PM, Tianon Gravi wrote:
> On 3 November 2016 at 11:03, Rod Smith  wrote:
>> Good question. I guess it depends on what efibootmgr wants, since that's
>> where the variable is used. The efibootmgr man page implies it wants a
>> number, so I've committed another change -- applying both 2a6f68 and
>> bdf9ca from my git repository should do it:
> 
> Am I looking at the correct change?
> 
> -PartNum=${InstallPart#$InstallDisk}
> +PartNum=`echo "${InstallPart#$InstallDisk}"`
> 
> I'm not clear on how that's going to remove the "p" (or do anything at
> all, actually).
> 
> Something like this is more what I expected:
> 
>  PartNum=${InstallPart#$InstallDisk}
> +PartNum=${InstallPart#p}
> 
> (which should remove a "p" prefix if it exists)

Oops; I cut-and-pasted the wrong stuff from my test script to the
refind-install script. I've added another commit -- e7e393 -- so that's
three commits in total

-- 
Rod Smith
rodsm...@rodsbooks.com
http://www.rodsbooks.com



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Tianon Gravi
On 3 November 2016 at 11:16, Tianon Gravi  wrote:
>  PartNum=${InstallPart#$InstallDisk}
> +PartNum=${InstallPart#p}

Err, I meant:

 PartNum=${InstallPart#$InstallDisk}
+PartNum=${PartNum#p}


♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Tianon Gravi
On 3 November 2016 at 11:03, Rod Smith  wrote:
> Good question. I guess it depends on what efibootmgr wants, since that's
> where the variable is used. The efibootmgr man page implies it wants a
> number, so I've committed another change -- applying both 2a6f68 and
> bdf9ca from my git repository should do it:

Am I looking at the correct change?

-PartNum=${InstallPart#$InstallDisk}
+PartNum=`echo "${InstallPart#$InstallDisk}"`

I'm not clear on how that's going to remove the "p" (or do anything at
all, actually).

Something like this is more what I expected:

 PartNum=${InstallPart#$InstallDisk}
+PartNum=${InstallPart#p}

(which should remove a "p" prefix if it exists)

♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Rod Smith
On 11/03/2016 01:29 PM, Tianon Gravi wrote:
> On 3 November 2016 at 10:28, Tianon Gravi  wrote:
>> On 3 November 2016 at 10:19, Rod Smith  wrote:
>>> Note, however, that I have no NVMe or similar devices on which to test.
>>> The new code does the right thing on my /dev/sd? devices, and I think it
>>> SHOULD work on more exotic devices.
>>
>> I don't personally have an NVMe system I can test the script as-is on,
>> but I tested that specific block of code on a friend's system which
>> does have NVMe, and I got "/dev/nvme0n1" for InstallDisk and "p1" for
>> PartNum from his "/boot" partition, so it looks like this code is
>> correct. :)
> 
> Although now that I say that, it occurs to me that PartNum might
> actually need to be simply "1", not "p1", right?

Good question. I guess it depends on what efibootmgr wants, since that's
where the variable is used. The efibootmgr man page implies it wants a
number, so I've committed another change -- applying both 2a6f68 and
bdf9ca from my git repository should do it:

https://sourceforge.net/p/refind/code/commit_browser

-- 
Rod Smith
rodsm...@rodsbooks.com
http://www.rodsbooks.com



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Tianon Gravi
On 3 November 2016 at 10:28, Tianon Gravi  wrote:
> On 3 November 2016 at 10:19, Rod Smith  wrote:
>> Note, however, that I have no NVMe or similar devices on which to test.
>> The new code does the right thing on my /dev/sd? devices, and I think it
>> SHOULD work on more exotic devices.
>
> I don't personally have an NVMe system I can test the script as-is on,
> but I tested that specific block of code on a friend's system which
> does have NVMe, and I got "/dev/nvme0n1" for InstallDisk and "p1" for
> PartNum from his "/boot" partition, so it looks like this code is
> correct. :)

Although now that I say that, it occurs to me that PartNum might
actually need to be simply "1", not "p1", right?


♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Tianon Gravi
On 3 November 2016 at 10:19, Rod Smith  wrote:
> Note, however, that I have no NVMe or similar devices on which to test.
> The new code does the right thing on my /dev/sd? devices, and I think it
> SHOULD work on more exotic devices.

I don't personally have an NVMe system I can test the script as-is on,
but I tested that specific block of code on a friend's system which
does have NVMe, and I got "/dev/nvme0n1" for InstallDisk and "p1" for
PartNum from his "/boot" partition, so it looks like this code is
correct. :)


♥,
- Tianon
  4096R / B42F 6819 007F 00F8 8E36  4FD4 036A 9C25 BF35 7DD4



Bug#843000: refind: fails to install on NVMe

2016-11-03 Thread Rod Smith
Thanks for the bug report. I've fixed this upstream in commit 2a6f68:

https://sourceforge.net/p/refind/code/commit_browser

Note, however, that I have no NVMe or similar devices on which to test.
The new code does the right thing on my /dev/sd? devices, and I think it
SHOULD work on more exotic devices.

-- 
Rod Smith
rodsm...@rodsbooks.com
http://www.rodsbooks.com



Bug#843000: refind: fails to install on NVMe

2016-11-02 Thread Bjørn Mork
Package: refind
Version: 0.10.4-1
Severity: important

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA512

The refind-install script makes bogus assumptions:

  InstallDisk=`grep "$InstallDir" /etc/mtab | cut -d " " -f 1 | cut -c 1-8`
  PartNum=`grep "$InstallDir" /etc/mtab | cut -d " " -f 1 | cut -c 9-10`

This is obviously fragile. NVMe is just one example where it fails:

 bjorn@miraculix:~$ grep /boot/efi /etc/mtab | cut -d " " -f 1
 /dev/nvme0n1p1

You cannot assume that the disk device name is exactly 8 characters. There is
no such rule.  Please find a more robust way to figure out device names.


- -- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.8.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages refind depends on:
ii  debconf [debconf-2.0]  1.5.59
ii  efibootmgr 14-1
ii  openssl1.1.0b-2
ii  parted 3.2-16+b1

Versions of packages refind recommends:
ii  python3 3.5.1-4
pn  sbsigntool  

refind suggests no packages.

- -- debconf information:
* refind/install_to_esp: true

-BEGIN PGP SIGNATURE-

iQIrBAEBCgAVBQJYGnWiDhxiam9ybkBtb3JrLm5vAAoJEOGX/BLv8F7NFXAP/3r8
vAX1BZGFvaYQhc8bbegYxMSwpl7rYY4sD6EZDMpTU6JTpGuNqbE5o/h193hjk2Sw
0m0eitzo3BbbpWn45AtRG9RvaaJrovODzeNIlFHovZtU4+IitQrqtT1eRFLyoV7A
uLt5Jc/q62e+evkU4pKMwASeXyj8JUnsHM9TOmPjPlCkzk0jSDAy9SYPnzaXeUdB
R77FVbsgNsbznrF9s1h10G0iQX/x3fONKgwPOcQEL8WkWutSB5dioH1JFUGEVzx1
dMZLTkDI9IXYLrfo3ZokWZiuX64nxR00BtM8tAA6ZGx+a545nWh/DQQfEw5IqQiq
Bc0gRtkLfsIRCBka/6oY5Kl/WsJXlub/Qtmp6csQ6y1I2poejTYOlst/0yplmbwe
mmVSopQ+Qbjlg9VO8Fj9SOv+9uZipVIYEOlLVpLu4f4dClf60VN9/vQbueUjvj52
iR5BKz/vNZO2LqJyXWPKu81jKe8OI9EWihIYgdpQCxXyFwzSGs2+B1kbPZXxD8Tw
12Ew5eHf7Bg+9JWAwdjRnA/EQYsxbWOrMfJHiNejTs0Kj8Bj7AgIDOZSBL5TBvpx
YQBnfEKA5CmxiU696tpwCj5HdSyVotyNHRQBkLi5R+Q08ycs+jA7m2GaXruATogF
TEBOHD5lHyvLUBaRg1VJJINajp9AGOrXa3DzgOyw
=GBN/
-END PGP SIGNATURE-