You are not logged in.

#1 2022-04-04 22:03:03

AndrewSmart
Member
Registered: 2019-06-10
Posts: 66

[WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

F8 boot menu on ASUS PN50:
UCLWyDam.jpg

It is a stock PN50 with an empty SSD and flashdrive with 4 partitions.

F8 boot menu on a different machine ~2013 ASUS (Sabertooth 990FX) desktop with the same USB flashdrive instead has just two entries, one with "UEFI: " prefix and one without (for legacy BIOS boot). Selecting either results in GRUB screen and successful boot. When ESP is invalid (wrong path in grub-install command or bad FAT32 partition), then the "UEFI: " entry doesn't work on this machine. Sorry I don't have the F8 menu photograph for this other machine.

Partition 4 on the USB is the ESP, FAT16. I think that the ASUS PN50 has an ext2 UEFI firmware driver, so it can see ext4 partitions 1 and 2. I think this is the case following the logic of this Rufus developer here on the concept that some firmwares have an NTFS driver and may result in extra "UEFI: ... Partition N" entries.

On the ASUS PN50 when I try booting from partition 1 or partition 2 it is a split second black screen then it goes back to the F8 menu. When I try partition 4 it stays on the black screen for a few seconds then reboots to ASUS splash screen on fresh boot.

ASUS PN50 appears to have 64 bit UEFI firmware.

I think the PN50 firmware can be updated, but I'm hesistant as IIRC some people said the fan profile is quieter on the stock firmware and wanted to see if I saw a difference. I'll try that later.

Relevant setup commands, on Debian bullseye:

mkfs.fat -F 16 -s 1 -n U365-ESP /dev/disk/by-partlabel/u365-esp
grub-install --target=x86_64-efi --efi-directory=/media/esp --root-directory=/media/boot --boot-directory=/media/boot/live --removable --no-nvram

/dev/disk/by-partlabel/u365-esp is mounted on /media/esp
/dev/disk/by-partlabel/u365-live is mounted on /media/boot

I'm presuming --boot-directory points to where vmlinuz and initrd are, I couldn't tell from documents I read. But it works on the old ASUS motherboard (Sabertooth 990FX) with the path to where vmlinuz & initrd and does not work if it points to a different directory.

/media/esp$ tree
.
└── EFI
    └── BOOT
        ├── BOOTX64.CSV
        ├── BOOTX64.EFI
        ├── fbx64.efi
        ├── grub.cfg
        ├── grubx64.efi
        └── mmx64.efi
/media/boot$ tree
.
├── boot
│   └── grub
│       ├── fonts
│       │   └── unicode.pf2
│       ├── grub.cfg
│       ├── grub.cfg.bak
│       ├── grubenv
│       ├── i386-pc
│       │   ├── 915resolution.mod
│       │   ├── ...[truncated]...
│       ├── locale
│       ├── unicode.pf2
│       └── x86_64-efi
│       │   ├── acpi.mod
│       │   ├── ...[truncated]...
├── live
│   ├── config-5.10.0-9-amd64
│   ├── filesystem.packages.xz
│   ├── filesystem.squashfs
│   ├── grub -> ../boot/grub
│   ├── initrd.img-5.10.0-9-amd64
│   ├── memtest86+.bin
│   ├── memtest86+_multiboot.bin
│   ├── System.map-5.10.0-9-amd64
│   └── vmlinuz-5.10.0-9-amd6

From my reading I think I'm doing things right and I guess the PN50 firmware is looking for Windows on the USB. I don't know.

I'll try putting rEFInd in /EFI/BOOT/ and moving existing /EFI/BOOT/ to /EFI/debian/. Then update the PN50 firmware if that doesn't work. Just really weird UEFI boot works with things as-is on my older desktop (Sabertooth 990 FX). Maybe the PN50 really is looking for Windows on the USB somehow...

Something odd I noticed is shimx64.efi,debian file is referenced in BOOTX64.CSV, but that file does not exist in EFI partition, maybe this is the problem with grub-install --removable setup? Is it expecting /EFI/debian/shimx64.efi to exist analgous to this?:

$ cat EFI/BOOT/BOOTX64.CSV
shimx64.efi,debian,,This is the boot entry for debian

EDIT: edited in Sabertooth 990FX above, making more clear the result of the USB on different machines. Sorry I wasn't clear enough originally.

Last edited by AndrewSmart (2022-04-08 15:00:11)

Offline

#2 2022-04-04 23:01:45

rbh
Moderator
From: South of Lapplands inland
Registered: 2016-08-11
Posts: 1,921

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

AndrewSmart wrote:

F8 boot menu on ASUS PN50:
https://i.imgur.com/UCLWyDam.jpg

It is a stock PN50 with an empty SSD and flashdrive with 4 partitions.

Should not the SSD also shows? And, all partionson on the flashdrive, are they the same size and is the flashdrive an Toshiba, or is not that the SSD?

F8 boot menu on ~2013 ASUS desktop
[...]
ASUS PN50 appears to have 64 bit UEFI firmware.

In the Fdisk-log you have a GIGABYTE GP-GSM2NE3256GNTD  flashdisk. OS is Linux Mint. What do you mean with "~2013 ASUS desktop"?

Relevant setup commands, on Debian bullseye:

mkfs.fat -F 16 -s 1 -n U365-ESP /dev/disk/by-partlabel/u365-esp
grub-install --target=x86_64-efi --efi-directory=/media/esp --root-directory=/media/boot --boot-directory=/media/boot/live --removable --no-nvram

? Are you writing grub to the live/install media?

/dev/disk/by-partlabel/u365-esp is mounted on /media/esp
/dev/disk/by-partlabel/u365-live is mounted on /media/boot

I'm presuming --boot-directory points to where vmlinuz and initrd are,

Yes. but it can be safer to mount / and /boot and chroot before writing grub...
See  Chroot help-script


// Regards rbh

Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu

Offline

#3 2022-04-04 23:45:01

AndrewSmart
Member
Registered: 2019-06-10
Posts: 66

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

rbh wrote:
AndrewSmart wrote:

F8 boot menu on ASUS PN50:
https://i.imgur.com/UCLWyDam.jpg

It is a stock PN50 with an empty SSD and flashdrive with 4 partitions.

Should not the SSD also shows? And, all partionson on the flashdrive, are they the same size and is the flashdrive an Toshiba, or is not that the SSD?

Yes all partitions on flashdrive, Toshiba. SSD is unpartitioned.

$ fdisk -l /dev/sdd
Disk /dev/sdd: 116.4 GiB, 124923150336 bytes, 243990528 sectors
Disk model: TransMemory
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: D51192D1-0F22-7248-A322-CA45448A0687

Device       Start       End   Sectors   Size Type
/dev/sdd1    32768   2129919   2097152     1G Linux filesystem
/dev/sdd2  2129920 243988479 241858560 115.3G Linux filesystem
/dev/sdd3    24576     32767      8192     4M Linux filesystem
/dev/sdd4    16384     24575      8192     4M EFI System

Partition table entries are not in disk order
rbh wrote:

F8 boot menu on ~2013 ASUS desktop
[...]
ASUS PN50 appears to have 64 bit UEFI firmware.

In the Fdisk-log you have a GIGABYTE GP-GSM2NE3256GNTD  flashdisk. OS is Linux Mint. What do you mean with "~2013 ASUS desktop"?

That website is not my machine but someone else's PN50. It just shows to me that the PN50 hardware has a 64 bit EFI and not a 32 bit one.

The ~2013 ASUS desktop is a different computer I have, where the USB successfully loads grub and starts when I select the UEFI entry.

rbh wrote:

Relevant setup commands, on Debian bullseye:

mkfs.fat -F 16 -s 1 -n U365-ESP /dev/disk/by-partlabel/u365-esp
grub-install --target=x86_64-efi --efi-directory=/media/esp --root-directory=/media/boot --boot-directory=/media/boot/live --removable --no-nvram

? Are you writing grub to the live/install media?

Grub is on the live partition. The 1st partition, along with vmlinuz and initrd.

rbh wrote:

/dev/disk/by-partlabel/u365-esp is mounted on /media/esp
/dev/disk/by-partlabel/u365-live is mounted on /media/boot

I'm presuming --boot-directory points to where vmlinuz and initrd are,

Yes. but it can be safer to mount / and /boot and chroot before writing grub...
See  Chroot help-script

Oh yes those commands were all in a chroot.

Oh... I suppose I should have mounted u365-live on /boot in case there is something hardcoded to /boot somewhere in `grub-install`? I guess I assumed `--root-directory=/media/boot` means this is where the location is to install GRUB? Hmmm. Though it works with my ASUS desktop. Weird. Yes, I can try mounting that patition to /boot and re-doing the grub-install command.

Last edited by AndrewSmart (2022-04-04 23:54:25)

Offline

#4 2022-04-05 00:35:43

rbh
Moderator
From: South of Lapplands inland
Registered: 2016-08-11
Posts: 1,921

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

Please post output of lsbkl -f /dev/sdd

Is "~2013 ASUS" desktop mentioned in first post. same as "my ASUS desktop", mentioned above?
What is working on "my ASUS"?
Can you boot live media on my ASUS, but not on ASUS PN50?
Why write Grub to live media? Have you done a Live install instead of common install?


// Regards rbh

Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu

Offline

#5 2022-04-05 07:38:07

rbh
Moderator
From: South of Lapplands inland
Registered: 2016-08-11
Posts: 1,921

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

Also list output of "gdisk -l /dev/sdd"


// Regards rbh

Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu

Offline

#6 2022-04-05 08:40:49

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,698

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

I think you will not see an SSD as long as it does not have a partition table.

The current entries of the (U)efi should show you

efibootmgr -v

I suggest to prepare the SSD according to your ideas with gparted.

I strongly advise against the use of 'rufus'. Use Linux on-board tools.

Install with the appropriate installer if using the whole disk. If that is not the case, then choose the 'expert mode' of this installer.

Note: I have no idea about EFI because I don't own a physical machine.  wink

Offline

#7 2022-04-05 13:36:26

unklar
Back to the roots 1.9
From: #! BL
Registered: 2015-10-31
Posts: 2,698

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

^I don't know why you need sdd1 and sdd3.

It should be enough to mount sdd2 and sdd4 into the chroot.

sudo -s
mount /dev/sdd2 /mnt
mount /dev/sdd4 /mnt/boot/efi
for i in /proc /sys /dev /dev/pts; do mount --bind $i /mnt$i; done
chroot /mnt /bin/bash

After that, the commands should fix the problem:

grub-install --target=i386-pc --boot-directory=/mnt /dev/sdd

(if it doesn't want to, add the force as well)

grub-install --target=i386-pc --force --boot-directory=/mnt /dev/sdd
update-grub

If there is an fstab on the stick, check the entries.

Offline

#8 2022-04-05 15:05:17

rbh
Moderator
From: South of Lapplands inland
Registered: 2016-08-11
Posts: 1,921

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

If I mount /dev/sdc3 (containing sole working partition) in /srv/chroot and run "chroot /srv/chroot /bin/bash", then in chroot, the directory boot from boot in sdc3, will not be available in /mnt. I have to go to /boot to find the files.

What happens when giving flags to grub, that refers to mounts outside of the chroot, I do not know. But, when boot directory is located in default place, it can be omitted. I recomend to do that.


// Regards rbh

Please read before requesting help: "Guide to getting help", "Introduction to the Bunsenlabs Lithium Desktop" and other help topics under "Help & Resources" on the BunsenLabs menu

Offline

#9 2022-04-06 22:04:36

AndrewSmart
Member
Registered: 2019-06-10
Posts: 66

Re: [WORKAROUND] PN50 UEFI grub-install --removable --no-nvram USB nonboot

Ok, this rEFInd workaround works. No further assistance requested :-) Workaround details follows:
8tNd0E2m.jpg
rEFInd sees what grub-install made, and passes to that, and GRUB menu displays, and the PN50 system boots BunsenLabs.
I do not know why what grub-install put in /EFI/BOOT/ did not work. Maybe a bug where grub-install can't handle non-typical `--root-directory` or `--boot-directory` arguments?
I moved grub-install's /EFI/BOOT/* to /EFI/debian/*, and renamed /EFI/debian/BOOTX64.EFI to shimx64.efi to match what was in the BOOTX64.CSV file.
I put rEFInd into /EFI/BOOT/, with refind_x64.efi renamed as /EFI/BOOT/BOOTX64.EFI, used the stock refind.cfg, icons, and drivers_x64/ext4_x64.efi driver (plus ia32 stuff but those are not necessary). Resulting tree:

.
└── EFI
    ├── BOOT
    │   ├── BOOTX64.EFI
    │   ├── drivers_ia32
    │   │   └── ext4_ia32.efi
    │   ├── drivers_x64
    │   │   └── ext4_x64.efi
    │   ├── icons
    │   │   ├── arrow_left.png
    │   │   ├── arrow_right.png
    │   │   ├── [...truncated...]
    │   │   ├── os_debian.png
    │   │   ├── [...truncated...]
    │   │   ├── vol_efi.png
    │   │   ├── vol_external.png
    │   │   ├── vol_internal.png
    │   │   ├── vol_net.png
    │   │   └── vol_optical.png
    │   ├── refind.conf
    │   ├── refind_ia32.efi
    │   └── vars
    │       └── PreviousBoot
    └── debian
        ├── BOOTX64.CSV
        ├── fbx64.efi
        ├── grub.cfg
        ├── grubx64.efi
        ├── mmx64.efi
        └── shimx64.efi

The /EFI/debian/ entry works as called from refind. I guess someone with knowledge can reason what went wrong, but I have no idea. This workaround works so I'm leaving it rather than tinkering.

Here is more on the partitioning as asked about earlier:
I5C8vCFm.jpg

$ gdisk -l /dev/sdd
GPT fdisk (gdisk) version 1.0.3

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdd: 243990528 sectors, 116.3 GiB
Model: TransMemory     
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): D51192D1-0F22-7248-A322-CA45448A0687
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 243990494
Partitions will be aligned on 2048-sector boundaries
Total free space is 18365 sectors (9.0 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1           32768         2129919   1024.0 MiB  8300  u365-live
   2         2129920       243988479   115.3 GiB   8300  u365-persistence
   3           24576           32767   4.0 MiB     8300  
   4           16384           24575   4.0 MiB     EF00  u365-esp

A 4MB ESP, and it works.
This is a live USB with persistence. The 1GB partition contains the vmlinuz, initrd, and squashfs. The persistence partition is mounted over the squashfs using overlayfs using debian live-boot `man persistence.conf`.

rbh wrote:

Please post output of lsbkl -f /dev/sdd

Ok

$ lsblk -f /dev/sdd
NAME FSTYPE LABEL UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sdd
├─sdd1
│    ext4   u365-live
│                 ea4649a0-39c1-408b-9942-f7efbf7d7e37
├─sdd2
│    ext4   u365-persistence
│                 27969337-ada2-4751-965b-e3bd863fdd36   12.4G    84% /media/u36
├─sdd3
│
└─sdd4
     vfat   U365-ESP
                  89F0-8FD
rbh wrote:

Is "~2013 ASUS" desktop mentioned in first post. same as "my ASUS desktop", mentioned above?

Yes, sorry, I should have named it `ASUS Sabertooth 990FX`, I think that is the model. I couldn't remember when I wrote last.

rbh wrote:

What is working on "my ASUS"?

Both `UEFI: Toshiba` and regular `Toshiba` boot entries worked with what grub-install did on the ASUS Sabertooth 990FX system.

rbh wrote:

Can you boot live media on my ASUS, but not on ASUS PN50?

Yes that was the problem, the UEFI: entry for the USB worked on the ASUS Sabertooth and not the ASUS PN50.

rbh wrote:

Why write Grub to live media? Have you done a Live install instead of common install?

It is a live-persistence setup on a USB. Not a common install. I don't know correct terminology. I think Grub goes in /boot/grub/ on the live partition. Well it works as-is anyway as written in the tree in the OP, and the /live/grub symlink to ../boot/grub is necessary too for reasons I can't remember.

Last edited by AndrewSmart (2022-04-06 22:37:17)

Offline

Board footer

Powered by FluxBB