guefi dont work with m2 disk

You think you have found a bug? Let us know about it.
Post Reply
User avatar
ibka
Posts: 158
Joined: 12. Sep 2010, 13:14
Location: Sweden
Contact:

guefi dont work with m2 disk

Post by ibka »

Hi
I have a new computer with M2 disk (/dev/nvme0) as system disk and i get this error when i try to run guefi:

Code: Select all

Traceback (most recent call last):
  File "/usr/sbin/guefi", line 692, in <module>
    app = GUEFI()
  File "/usr/sbin/guefi", line 643, in __init__
    self.update_list()
  File "/usr/sbin/guefi", line 588, in update_list
    self.uefi.update()
  File "/usr/sbin/guefi", line 122, in update
    self.efi_mountpoint = self.get_efi_mountpoint()
  File "/usr/sbin/guefi", line 61, in get_efi_mountpoint
    partition = "%s%s" % (self.efi_hd, self.efi_partition)
AttributeError: UEFI instance has no attribute 'efi_hd'
When i check the guefi code it only scans for disk beginning with sd so that's not surprising it don't work.

Regards Ingemar
Image
User avatar
gapan
Salix Wizard
Posts: 6236
Joined: 6. Jun 2009, 17:40

Re: guefi dont work with m2 disk

Post by gapan »

Thanks for the report ibka!

Can you try and see if changing line 47 from:

Code: Select all

if i.startswith('sd'):
to

Code: Select all

if i.startswith('sd') or i.startswith('nvme'):
works? I don't currently have an nvme drive to test. Hopefully it's as simple as that.
Image
Image
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: guefi dont work with m2 disk

Post by DidierSpaier »

Hi George and all,

While you are at if you could also handle SD cards ,and eMMC drives fund in cheap laptops. They all begin in /dev/mmc

Cheers,
Didier
User avatar
ibka
Posts: 158
Joined: 12. Sep 2010, 13:14
Location: Sweden
Contact:

Re: guefi dont work with m2 disk

Post by ibka »

That didn't work, so it was not that simple.
When i list the disks in dev they look like this:

Code: Select all

/dev/nvme0
/dev/nvme0n1
/dev/nvme0n1p1
/dev/nvme0n1p2
while normal sata disk looks like this:

Code: Select all

/dev/sda
/dev/sda1
/dev/sda2
@Didier
I don't know how the SD cards looks like in cheap laptops but, in Raspberry Pi they look like this:

Code: Select all

/dev/mmcblk0
/dev/mmcblk0p1
/dev/mmcblk0p2
so if they look something like that its probably not that simple to implement.
Image
User avatar
gapan
Salix Wizard
Posts: 6236
Joined: 6. Jun 2009, 17:40

Re: guefi dont work with m2 disk

Post by gapan »

Ah, I see now. Yes, that wouldn't work that simply. I'll need to spend some time with this. It's a good opportunity to also add support for multiple EFI partitions which has been missing too.
Image
Image
DidierSpaier
Posts: 518
Joined: 20. Jun 2016, 20:15

Re: guefi dont work with m2 disk

Post by DidierSpaier »

FWIW here is how I detect the EFI partition in the Slint installer (and now Pat does the same in the Slackware installer)

Code: Select all

rm -f $TMP/SeTefipartitions
touch $TMP/SeTefipartitions

# The UEFI specification states that an EFI System partition has a GUID
# of C12A7328-F81F-11D2-BA4B-00A0C93EC93B for a GPT layout.
# In case of a DOS layout instead, an ESP should have an OS type of
# 0xEF. lsblk writes these values in the same field PARTTYPE.
ESPPARTTYPE=C12A7328-F81F-11D2-BA4B-00A0C93EC93B
OSTYPE=0xEF

# List the accessible EFI system partitions or ESPs
lsblk -l -o name,parttype,uuid,pkname|\
grep -i -F -e "$ESPPARTTYPE" -e "$OSTYPE"|\
sed "s/ \{1,\}.*//;s,^,/dev/," > $TMP/SeTefipartitions

if [ "$(cat $TMP/SeTefipartitions)" = "" ]; then # No EFI partitions
  rm -f $TMP/SeTefipartitions
 exit
fi
The file is here.

Cheers, Didier
Post Reply