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

an incubator for software projects


Moderator: Forum moderators

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

Your file "Outptut-like-on-line563.gz" list all the drives and should not. Try this in a terminal:
parted /dev/nvme0n1 print

It should only list the nvme0n1 drive.

I then plugged in another msdos device, a USB stick, fat32, bootflag, and made it bootable successfully.

I think we'll have to discount my results since they aren't for a NVME. Would you send me your modified file and line numbers you changed?

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 Sorry for causing any confusion. Output-like-on-line563 contains the result of 3 individual calls to parted "/dev/xxxx print > file".

Attached is the output of nvme0n1 as it corresponds to the selection in the script.

In .test3 I changed fdisc to parted in line 551 and in line 701. Script attached.

Attachments
grub2config-test31.gz
(55.65 KiB) Downloaded 13 times
Output-like-line563-nvme0n1-only.gz
(330 Bytes) Downloaded 13 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
@muggins

I tested grub2config-test31 as follows:
-HDD, GPT = OK
-HDD, MSDOS = fails with Missing boot flag

@radky , who has greater coding magic than me, has made some changes which pass both test above. Attached is grub2config-test3-radky.gz. Please test on your NVME systems and let us know results.

Thanks
wizard

Attachments
grub2config-test3-radky.gz
remove fake .gz
(55.75 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 »

@wizard Have you adjusted the settings in the BIOS? I have to decide in the BIOS whether EFi or MBR.
I did various tests on two other computers and HDD, msdos worked very well with .test31. Even if other drives were connected at the same time. No matter whether GPT or msdos

I'll test the new script straight away.

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 @radky I get the error Missings:Boot flag on nvme0n1 See error logs

The variable $myDRIVEDEV in line 551 has the value "/dev/nvme0n" and I think it should have "/dev/nvme0n1".

If I change line 551 to parted -l $myDRIVEDEV the script works for me.

I am attaching the output of parted -l /dev/nvme0n and parted /dev/nvme0n1 print for comparison

parted /dev/nvme0 print brings an error because it doesn't exist. See Errorlog

Attachments
Test3-radky.tar
(10 KiB) Downloaded 19 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 .test3-radky worked for me on an old computer. HDD,MSDOS
Operating system Bionic64, the laptop is from 2012.

I don't know if this is important, but I noticed that fdisk -l produces quite different output.

In Bionic64 fdisk from until-linux ver 2.31
In F96-CE fdisk from until-linux ver 2.34
In Bookworm64 fdisk is a link to BusyBox

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 @radky After further testing I discovered that with -test31 (parted instead of fdisk) HDD,MBR does NOT work for me.
Reason: grldr is not copied, If this is already present by chance, through many tests, then this will not be noticeable.
With GPTdevices this has no consequence.

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'm an absolute amateur, with no bash scripting experience whatsoever. If I'm annoying please say.

-test3-radky:
part2drive is started several times:
from line 661 value "nvme0n1p2"
from line 771 value "nvme0n1"
from line 551 value "nvme0n"

For example, sda1 can never be less than sda. It's different with nvme drives.

"s/\(^.\..\)./\1/'" is a Spanish village for me.
But I suspect that part2drive is supposed to remove the partition names.

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

If I'm annoying please say.

Absolutely not, we need members who are willing to experiment and learn, you're doing great. The only one working on this with real skill is @radky and I think he, like me doesn't have a NVME drive for test. I've ordered some parts that should let me mount a NVME on one of my old desktop or maybe laptops, but will be sometime before they arrive.

But I suspect that part2drive is supposed to remove the partition names.

You got it, issue is it has to do it differently for SDA than NVME or eMMC drives.

Am doing some more test today and will report.

Thanks
wizard

Big pile of OLD computers

User avatar
rockedge
Site Admin
Posts: 5720
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1997 times
Been thanked: 2099 times
Contact:

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

Post by rockedge »

I can't help much since I don't have NVME drive to test on. I was able to adapt Grub2config for KLV variants and am interested in ensuring the program works thoroughly. The fact it can not deal with ext4 formatted partitions is an inhibitor and would be great to get that ability included.

radky
Posts: 296
Joined: Fri May 28, 2021 2:14 am
Has thanked: 35 times
Been thanked: 262 times

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

Post by radky »

@fr-ke

Please test the following replacement for the part2drive function in grub2config-test3-radky available below:

viewtopic.php?p=114209#p114209


Code: Select all

part2drive() {
	sed -e '/\([0-9]n[0-9]$\|mmcblk[0-9]$\)/! s/[0-9]*$//' -e 's/\([0-9]\)p$/\1/'
}

Thanks

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 »

@radky Test result attached

Attachments
grub2config-test3-1-radky.tar.gz
(876 Bytes) Downloaded 15 times
Screenshot-test3-1-radky.png.gz
(28.68 KiB) Downloaded 14 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 »

@rockedge

The fact it can not deal with ext4 formatted partitions is an inhibitor and would be great to get that ability included.

Rock, been working with G2C today and have no issues with it working on drives with P1=fat32 and P2=ext4 (Puppy).

Were you wanting it to install grub on the ext4 partition?

Thanks
wiz

Last edited by wizard on Mon Mar 18, 2024 1:06 am, edited 1 time in total.

Big pile of OLD computers

User avatar
rockedge
Site Admin
Posts: 5720
Joined: Mon Dec 02, 2019 1:38 am
Location: Connecticut,U.S.A.
Has thanked: 1997 times
Been thanked: 2099 times
Contact:

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

Post by rockedge »

@wizard I might be using a different version in KLV?

Where I see the message is trying to use Grub2config on a QEMU VM running KLV-Airedale started from ISO. The virtual HDD is formatted to ext4 and has the boot flag set. Grub2config does as expected to the point of writing the boot loader where it stops with the message it can not work on ext4

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 »

Rockedge, will Test3-radky.tar work if the virtual HDD is formatted to ext3? Although there are other advantages to using ext4 rather than ext3, https://askubuntu.com/questions/44908/w ... erspective the principal ones are:

"Overall maximum ext4 file system size is 1 EB (exabyte). 1 EB = 1024 PB (petabyte). 1 PB = 1024 TB (terabyte). [As opposed to 4TB under Ext3, https://stackoverflow.com/questions/250 ... bit-system]

A directory can contain a maximum of 64,000 subdirectories (as opposed to 32,000 in ext3)."

Such greater capacity is hardly to have value when running an OS within a Virtual Machine. Ext4 formatting would be a perk; but not essential.

@wizard, I wanted to try this on my finicky HP Laptop. But I've gotten lost in the replies. Which version do I download. The boot partition, sda1, is formatted Fat32. And, IIRC, I just download the file, make it executable and run it before running grubconfig? Or something else? The reason I ask is that when I downloaded a file named Test3-radky.tar and extracted it, this was it contents:

Contents.png
Contents.png (24.46 KiB) Viewed 1386 times

So just making a tar file executable seemed wrong.

p.s. The "@wizard' above is in red because I "colorized" it. Have I missed trick to have such notation colorized automatically?

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

Test3-radky.tar is just a report from fr-ke, the file you can test is: grub2config-test3-radky.gz.
If your drive is NVME you can also manually insert the revised code from radky a few post up.

p.s. The "@wizard' above is in red because I "colorized" it. Have I missed trick to have such notation colorized automatically?

If you start typing @wizard (or any other member name) the site will at some point offer you the name, when you choose it, it will be enclosed in "smention" tags which will make it red when you submit the post. This should also trigger a notification to the member that they were mentioned

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 »

@radky @wizard

part2drive seems to be working now. I queried the return values at several places in the script.

whereto_check (in the original -test3-radky line 774) calls boot_part (line 557) with the value "nvme0n1".
and comes back with value "nvme0n11".

For the analogue “sda1”, “nvme0n1p1” should probably come back.

What exactly happens in the boot_part is too high for me.

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

Attached is grub2config-test4-radky.gz from @radky . My testing on msdos and GPT HDD results are also attached.
Please test on your NVME drives and report.

EDIT: The FTR error should be a non-issue

Thanks
wizard

Attachments
g2c.xls
(67.5 KiB) Downloaded 15 times
grub2config-test4-radky.gz
remove fake .gz
(55.76 KiB) Downloaded 18 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 »

@wizard I successfully installed with the modified test3-radky:
nvme,gpt
sda,gpt
sda, mbr

In boot_part, for the test with nvme, I manually changed line 567 DRIVEsd+=$LAST_BOOT_PART to DRIVEsd+="p"$LAST_BOOT_PART

I think if you were to insert a wide if e.g. if_nvme and alternatively add the "p" at this point that would be sufficient.

Despite everything working, there was an error at the end. But it may have nothing to do with the script because I didn't find the error message.

Log files attached

Attachments
grub2config-test3-1-radky.log
(2.68 KiB) Downloaded 15 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 I posted quicker than I read.

grub2config-test4-radky basically works for me, but ends up giving an error message with the nvme drive.

Attachments
grub2config-test4-radky-nvme.log
(799 Bytes) Downloaded 13 times
g2c.xls
(68.5 KiB) Downloaded 18 times
radky
Posts: 296
Joined: Fri May 28, 2021 2:14 am
Has thanked: 35 times
Been thanked: 262 times

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

Post by radky »

@fr-ke

Thanks for the log report.

Error: invalid numeric value e
Failed to register Puppy boot loader

This non-fatal log error is due to original grub2config code which defines the BOOTPART variable based on the traditional linux nomenclature of a three-character drive (such as sda) followed by a single-digit partition number (such as sda2).

The code (line 1761 of grub2config-test4) correctly selects a single-digit partition number for a traditional sdx drive but fails for your nvme0n1p1 partition by returning 'e' as the 4th character (and the efibootmgr utility generates the invalid numeric value e error in line 1768).

You could try the following:

Replace line 1761 of grub2config-test4:

Code: Select all

EFI_PARTITION=$(echo $BOOTPART | cut -b4)

with

Code: Select all

[ $(echo "$BOOTPART" | grep -E 'mmcblk|nvme') ] && \
EFI_PARTITION=$(echo $BOOTPART | cut -d'p' -f2) || \
EFI_PARTITION=$(echo $BOOTPART | cut -c 4-)
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 »

@radky everything is fine with these changes !!! :thumbup:

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 »

@radky

Test today on a eMMC drive installed all files to fat32 p1, then gave "Failed to register" error. See attached.

Thanks
wizard

Attachments
g2c-240320.xls
(130.5 KiB) Downloaded 14 times

Big pile of OLD computers

radky
Posts: 296
Joined: Fri May 28, 2021 2:14 am
Has thanked: 35 times
Been thanked: 262 times

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

Post by radky »

wizard wrote: Wed Mar 20, 2024 3:29 pm

Test today on a eMMC drive installed all files to fat32 p1, then gave "Failed to register" error.

@wizard

I assume you have already edited grub2config-test4 as described here:

viewtopic.php?p=114381#p114381

After the edit, it would be helpful to see the log reports generated after running the updated grub2config.

For example:

1 - /tmp/grub2config-test4/grub2config.disks
2 - /tmp/grub2config-test4/grub2config-test4.log

Thanks

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 »

@radky

I assume you have already edited grub2config-test4 as described here:

You could assume that, but would be wrong :oops: :oops: My bad.

Did the edit and all works OK. Spreadsheet corrected and attached.

Thanks
wizard

Attachments
g2c-240320a.xls
(69 KiB) Downloaded 21 times

Big pile of OLD computers

radky
Posts: 296
Joined: Fri May 28, 2021 2:14 am
Has thanked: 35 times
Been thanked: 262 times

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

Post by radky »

wizard wrote: Wed Mar 20, 2024 7:04 pm

Did the edit and all works OK. Spreadsheet corrected and attached.

@wizard
Thanks for confirming your eMMC device and boot partition are detected and registered correctly. :thumbup2:

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

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

Post by muggins »

Hello Radky,

I too can report success, after making the changes to line 1761 as you suggested. Unfortunately I've still had to go back to Limine
bootloader, because when I boot grub2, it keeps using "ghost" entries that point to non-existing installs from a previous attempt at
installing grub2. I've searched unsuccessfully for where these are installed, tried using efibootmgr to delete all boot entries, but
they're still there somewhere on my system.

radky
Posts: 296
Joined: Fri May 28, 2021 2:14 am
Has thanked: 35 times
Been thanked: 262 times

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

Post by radky »

muggins wrote: Thu Mar 21, 2024 3:04 am

...when I boot grub2, it keeps using "ghost" entries that point to non-existing installs from a previous attempt at installing grub2. I've searched unsuccessfully for where these are installed, tried using efibootmgr to delete all boot entries, but they're still there somewhere on my system.

@muggins

If I understand correctly, you previously installed Puppy via Grub2, then subsequently deleted Puppy and/or the Linux partition containing Puppy. If this is the case, possibly your current "ghost" entries are referenced in residual bootloader files of the (non-deleted) EFI boot partition created by the initial Grub2 installation.

Maybe other forum members will provide additional guidance.

radky
Posts: 296
Joined: Fri May 28, 2021 2:14 am
Has thanked: 35 times
Been thanked: 262 times

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

Post by radky »

rockedge wrote: Sun Mar 17, 2024 9:27 pm

...trying to use Grub2config on a QEMU VM running KLV-Airedale started from ISO. The virtual HDD is formatted to ext4 and has the boot flag set. Grub2config does as expected to the point of writing the boot loader where it stops with the message it can not work on ext4

@rockedge

If I understand correctly, Shinobar's Grub2config fully supports Grub2 on modern GPT/UEFI systems but also retains functional Grub2 support on legacy MBR systems. However, in the case of MBR installations, the current Grub2config (v2.0.1) does not install grub2.mbr but instead it installs the same legacy grub.mbr used by the venerable Grub4dos (which does not support MBR boot partitions on ext4).

In the following post, Shinobar suggests he would like to add support for installing Grub2 directly to the MBR (grub2.mbr), but it seems he has not visited the Puppy forum since 2021.

viewtopic.php?p=36605#p36605

Currently, for legacy MBR systems, Grub2config supports the following boot-partition filesystems:

MBR_SUPPORT_FSS = vfat | ntfs | ext2 | ext3

radky
Posts: 296
Joined: Fri May 28, 2021 2:14 am
Has thanked: 35 times
Been thanked: 262 times

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

Post by radky »

Grub2config-2.0.2_Beta1 removed

Updated package available at the following link:

viewtopic.php?p=115435#p115435

Last edited by radky on Fri Mar 29, 2024 9:10 pm, edited 2 times in total.
Post Reply

Return to “Development”