Grub2Config PROBLEM -- Coder(s) Needed !!!

an incubator for software projects


Moderator: Forum moderators

User avatar
mikeslr
Posts: 2793
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 173 times
Been thanked: 837 times

Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by mikeslr »

Just flagging a problem which surfaced on the Bookworm thread, https://www.forum.puppylinux.com/viewto ... 31#p113831: "grub2config v2.01 fails on GPT drive". And several posts which follow that.

User avatar
BarryK
Posts: 2273
Joined: Tue Dec 24, 2019 1:04 pm
Has thanked: 93 times
Been thanked: 564 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by BarryK »

User avatar
mikeslr
Posts: 2793
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 173 times
Been thanked: 837 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by mikeslr »

I see that gyrog has been working on grub2, https://www.forum.puppylinux.com/viewto ... 76#p104876, updating it to 2.06 from 2.03 or 2.04. I wonder if that is sufficient, noting --from the above thread-- that the new 2.06 binary doesn't support Secure Boot and that "GRUB2 has matured to version 2.12".

User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@BarryK

I seem to recall awhile back that setting the "boot" flag on the esp partition has become optional.
Nothing to do with whether drive is GPT or MBR.
Did you do what the window requested, run Gparted and set the boot flag?

Yes, also, gparted will not allow you to just select boot or esp, they are paired when you select either one.

Thanks
wizard

Big pile of OLD computers

fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

wizard, "grub2config v2.01 fails...Has anyone else seen this error?"

I had this error when I switched to a new drive, recognized as nvme and not sda.

Installed FrugalPup v41 from PuppyInstaller - without changing anything to the partitions - works perfectly.
I can't read scripts well enough to have solutions, but as far as I understood at the time, the nvme partitions are not recognized correctly.

fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

-

On the same computer on which Grub2Config gives the mentioned error message for the NVME drive, I plugged in a USB flash drive with 2 Fat32 partitions and Grub2Config works perfectly on this.

Attachments
out.jpg
out.jpg (65.27 KiB) Viewed 1230 times
Screenshot.png
Screenshot.png (49.83 KiB) Viewed 1230 times
Screenshot(1).png
Screenshot(1).png (41.84 KiB) Viewed 1230 times
User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@mikeslr

I see that gyrog has been working on grub2, https://www.forum.puppylinux.com/viewto ... 76#p104876, updating it to 2.06 from 2.03 or 2.04. I wonder if that is sufficient, noting --from the above thread-- that the new 2.06 binary doesn't support Secure Boot and that "GRUB2 has matured to version 2.12".

Checked that post and it is the grub2 code as opposed to grub2config being the installer, so doesn't help for this issue.

Thanks
wizard

Big pile of OLD computers

User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@fr-ke

The issue only seems to apply to GPT drives.

Thanks
wizard

Big pile of OLD computers

User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

Keep in mind my coding skills are poor. The test drive has sda1=fat32, flags=boot, esp

Here is the grub2config message:

grub2-error.png
grub2-error.png (34.23 KiB) Viewed 1224 times

Looking at the code, the "Boot loader to:" section is generated by:
-line 793 - BOOTPART_STATUS is evaluating to None

The "Missings" section is generated by:
-line 834 - BOOTPART is evaluating to ""

At line 780 BOOTPART has no value.
Tracing that to line 556, boot_part() function, then it looks like line 562, LAST_BOOT_PART variable may be where the problem is, just don't know how to fix it yet.

Thanks
wizard

Last edited by wizard on Wed Mar 13, 2024 2:47 am, edited 2 times in total.

Big pile of OLD computers

User avatar
mikeslr
Posts: 2793
Joined: Mon Jul 13, 2020 11:08 pm
Has thanked: 173 times
Been thanked: 837 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by mikeslr »

Not sure if the following provides useful information or is just a 'red herring'.

On the two laptops on which I've encountered the problem one was an HP Pavilion (I think) model 15-cc184cl. I think because it is a 17" and could not find a model other than an otherwise identical 15". It came with Windows 10 which I did not want to erase.

Puppy isn't the only Distro that encounters problems with this computer. I first installed Zorin accepting accepting its 'install side-by-side' offer. That created another partition onto which both Zorin's boot-loader and OS were installed; Id'd as sda6, which suggests that the partitioning scheme is GPT.

My previous experience with installing 'Other Distros' is that its boot-loader would become the primary, offering to boot into Windows via chain-loading. But Windows boot-loader remained the primary. And examining the Bios preference options, I could find no way to set the boot-loader on sda6 as the default. In order to boot into Zorin I would have to press the 'Esc' on each boot-up and then select Zorin's boot-loader.

As I could boot Puppys from a USB-Key, I used Fossapup64's gparted to delete the sda6 partition. Then did a custom install of LinuxMint to sda6, trying to specify sda1 as the location of the boot-loader. That didn't work (I don't recall why) so I allowed LinuxMint to install its boot-loader to sda6. To boot into LinuxMint I still have to press 'Esc' on each boot-up and then select LinuxMint's boot-loader.

Grub2config works fine for creating USB-Installs. But even with Puppys file-systems deployed to a folder on sda6, grub2config can not successfully write to sda(1).

I assumed that HP's original formatting of sda had 'screwed the pouch' and did not report the problem when encountered.

I don't exactly recall the details of what went wrong with the other laptop. The following I think is correct. I had removed Windows 7 and installed an old (then current) version of LInuxMint on one partition, various Puppys on another and used Puppys grub2config to install a boot-loader to sda. After replacing LinuxMint with a current version of Zorin, grub2config no longer would write to sda. Formtting, I think, was still ms-dos. Replacing Zorin with a current version of LinuxMint did not solve the boot-loader problem. So I gave up: installed LinuxMint to the entire drive figuring I'd customize its boot-loader to boot Puppys. Haven't done that, yet.

Last edited by mikeslr on Tue Mar 12, 2024 11:20 pm, edited 2 times in total.
fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

@wizard According to GParted Deviceinfo, this doesn't look like a GPT drive to me.
Partition Table: msdos

Attachments
Screenshot.png
Screenshot.png (46.52 KiB) Viewed 1184 times
Clarity
Posts: 3273
Joined: Fri Jul 24, 2020 10:59 pm
Has thanked: 1349 times
Been thanked: 438 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by Clarity »

In support of current findings

Grub2Config error.jpg
Grub2Config error.jpg (153.16 KiB) Viewed 1160 times
User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@fr-ke

this doesn't look like a GPT drive to me.

Per your image, it is not GPT. So, your issue may or may not have any relation to the GPT issue. In either case you should start another topic so we don't get the two cases intermixed.

Thanks
wizard

Big pile of OLD computers

muggins
Posts: 81
Joined: Mon Aug 31, 2020 1:31 am
Been thanked: 19 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by muggins »

Curious why grub2config is correctly seeing my drive as nvme0n1, but then giving me an error:

Code: Select all

fdisk: cannot open /dev/nvme0n: No such file or directory

I wonder if part2drive, line 358, is the culprit?

Code: Select all

# v1.7.9: ex. mmcblk0p1 to be mmcblk0
part2drive() {
	sed -e 's/[0-9]*$//' -e 's/\([0-9]\)p$/\1/'
}
User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

For the GPT test drive with sda1, fat32, flags=boot,esp, line 556, the boot_part() function should return "sda1", but is instead returning "" (nothing).

line 562 is:
LAST_BOOT_PART=$(echo "$FDISKOUT"| grep '^/dev/.*' | grep 'EFI System' | cut -d' ' -f1| cut -d'/' -f3)

The ERROR occurs because FDISKOUT does not contain the string 'EFI System' and in fact running: "fdisk -l /dev/sda" in terminal confirms this. Testing a HDD partitioned with two other MS Windows partition programs showed they output differently in fdisk. This suggest that searching for 'EFI System' is not a reliable method.

Test do indicate using "parted" (instead of "fdisk") produces consistent output that can be used.

Consider grub2config-test2 which is attached as a BETA, use only for testing. The revised code is on lines 562-567 and should only effect GPT drives.

Download to any directory, be sure it is executable, and run.

My test were done on HDD drives, it would also be good to have testing on SSD , both MBR and GPT. NVME drives are not yet included.

Comments and suggestions are invited.

Thanks
wizard

Attachments
grub2config-test2.gz
remove fake .gz
(55.5 KiB) Downloaded 23 times

Big pile of OLD computers

muggins
Posts: 81
Joined: Mon Aug 31, 2020 1:31 am
Been thanked: 19 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by muggins »

Good detective work Wizard. I know you say Nvme drives aren't covered, but I had to try. If I alter the two instance of fdisk -l to parted -l,
then it gets past the error message that "Boot flag not found on nvme0n1", and identifies puppy installations, as shown in imagea, but proceeding, then gives errot shown in imageb.

The error log has:

/mnt/nvme1n1p4/grub2config-test3
version 2.0.1
Thu Mar 14 13:39:22 AEDT 2024
mount-FULL: /mnt/: can't find in /etc/fstab.
Boot Partition:e0n()
mount-FULL: /mnt/: can't find in /etc/fstab.
mount-FULL: /mnt/: can't find in /etc/fstab.
Failed mounting:

Attachments
imagea.png
imagea.png (75.4 KiB) Viewed 968 times
imageb.png
imageb.png (36.94 KiB) Viewed 968 times
User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@muggins

Thanks muggins, I was hoping you would be up for testing. Will be posting another version later today aimed at NVME drives.

wizard

Big pile of OLD computers

User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@fr-ke
@muggins

Thanks to @radky we now have a version for NVME testing. Since I don't have a computer with a NVME drive we'll need members that do to provide good feedback.

Consider grub2config-test3 which is attached as a BETA, use only for testing. The revised code is on lines 358-360 and 562-567.

Download to any directory, be sure it is executable, and run.

Thanks
wizard

Attachments
grub2config-test3.gz
Remove fake .gz
(55.65 KiB) Downloaded 21 times

Big pile of OLD computers

fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

The grub2config-test2 test was negative. See screenshots.

Attachments
Screenshot3.png
Screenshot3.png (24.28 KiB) Viewed 870 times
Screenshot2.png
Screenshot2.png (73.52 KiB) Viewed 870 times
Screenshot.png
Screenshot.png (35.4 KiB) Viewed 870 times
fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

the same result with a GPT device

Attachments
Screenshot(1).png
Screenshot(1).png (91.23 KiB) Viewed 857 times
out.jpg
out.jpg (54.28 KiB) Viewed 857 times
User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@fr-ke

Please try the -test3 version. Thanks for testing.

Thanks
wizard

Big pile of OLD computers

fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

sorry, I sent the wrong log files. The test was carried out with test3.
The appropriate log files are now attached

Attachments
Screenshot.png
Screenshot.png (85.1 KiB) Viewed 849 times
fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

@wizard wild guessing.
Is it possible that line 361 removes both 1s and turns nvme01n1 into nvme0n?

fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

@wizard I tried linking /dev/nvme0n1 to /dev/nvme0n.
Both test2 and test3 made some progress, but still ended with errors.
See log files

Attachments
grub2config-test3.log
(156 Bytes) Downloaded 11 times
grub2config-test2.log
(249 Bytes) Downloaded 12 times
User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@fr-ke

Is it possible that line 361 removes both 1s and turns nvme01n1 into nvme0n?

Think you mean line 360, and I'm looking at it.

You shouldn't run anymore test with -test2 since it will not handle NVME drives at all.

Thanks
wizard

Big pile of OLD computers

muggins
Posts: 81
Joined: Mon Aug 31, 2020 1:31 am
Been thanked: 19 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by muggins »

No, line 360 isn't causing nvme01n1 into nvme0n. If I run version test3, I get the error message about missing boot flag on nvme01n1.
But if I edit test3, & change instances of fdisk -l to parted -l, on lines 551 & 701, then I get a successfully
installed grub.cfg to nvme01n1.

Success.png
Success.png (37.15 KiB) Viewed 667 times

However, clicking on the "Edit menu" button brings up a blank grub.cfg, not the one that was installed on nvme01n1.

Also, I still haven't successfully booted using test3, as now I'm wrestling with the laptops annoying InsydeH2O bios, to get it
to use grub.cfg.

fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

But if I edit test3, & change instances of fdisk -l to parted -l, on lines 551 & 701, then I get a successfully

I can confirm

However, clicking on the "Edit menu" button brings up a blank grub.cfg, not the one that was installed on nvme01n1.

This is only the case for me if the 1st partition is not mounted, if mounted clicking on "Edit menu" brings the expected result

User avatar
wizard
Posts: 1587
Joined: Sun Aug 09, 2020 7:50 pm
Has thanked: 2127 times
Been thanked: 503 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by wizard »

@fr-ke
@muggins

My testing is on a eMMC, which uses a similar drive naming syntax.

parted -l, on lines 551 & 701,

This outputs for all drives and can causes problems if you have USB, SDCARD or more than one internal drive attached. Plug in a USB and try it and see if it fails. Also, run "parted -l in terminal and check the output. The code is going to run on whatever drive is listed first.

Need to specify the drive like on line 563: parted [drive] print

Thanks
wizard

Big pile of OLD computers

fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

@wizard Attached is the output of parted -l print.

All three drives were connected at the same time.
nvme0n1 and sdb as GPT devices with boot flag, sda as msdos device with boot flag but ext4 .

The modified script test3 produced a bootable result for nvme0n1 and sdb.
sda rightly failed because ext4
I then plugged in another msdos device, a USB stick, fat32, bootflag, and made it bootable successfully.

Attachments
Output-parted-print-all-fake.gz
(1.08 KiB) Downloaded 9 times
fr-ke
Posts: 105
Joined: Mon Nov 07, 2022 3:18 pm
Has thanked: 4 times
Been thanked: 35 times

Re: Grub2Config PROBLEM -- Coder(s) Needed !!!

Post by fr-ke »

@wizard Output from parted as in line 563

Attachments
Outptut-like-on-line563.gz
(830 Bytes) Downloaded 9 times
Post Reply

Return to “Development”