chenall/grub4dos

Linux can't find root file system

JP95Git opened this issue · 29 comments

"Kaspersky Rescue Disk 2018" and "Knoppix 9.1" both have a similar issue, they boot the kernel (initrd too?) but fail to mount the root file system, if booted using Grub4DOS EFI (beta from issue 404 and release from 2023-03-29).

Here is the configuration:

title Kaspersky Rescue Disk 2018 (18.0.11.3.c, 64 Bit)
# https://support.kaspersky.com/de/viruses/krd18
set isoFile=krd.iso
set iso=/data/%isoFile%
find --set-root %iso%
map %iso% (0xff)
root (0xff)
kernel /boot/grub/k-x86_64 edd=off lang=en dostartx isoloop=%isoFile%
initrd /boot/grub/initrd.xz
title Knoppix 9.1 (64 Bit)
# https://www.knopper.net/knoppix-mirrors/
set iso=/Knoppix-9.1.iso
find --set-root %iso%
map %iso% (0xff)
root (0xff)
kernel /boot/isolinux/linux64 bootfrom=Knoppix-9.1.iso lang=de apm=power-off nomce hpsa.hpsa_allow_any=1 loglevel=1
initrd /boot/isolinux/minirt.gz

I used almost the same configuration (just removed the map --hook) in Grub4DOS for BIOS without any problems. I even moved the ISO files to a different partition. exFAT and NTFS do not work. Knoppix is bigger than 4 GB, so FAT32 will not work here. In Grub4DOS for BIOS both ISO are saved on a NTFS partition and Grub4DOS is loaded from Microsoft bootmgr.

#some krd.iso must be in the directory /data/,isoloop=krd.iso do not need path
title /data/krd.iso
find --ignore-floppies --ignore-cd --set-root /data/krd.iso
map /data/krd.iso (hd32)
map --hook
kernel (hd32)/boot/grub/k-x86_64 net.ifnames=0 lang=en dostartx isoloop=krd.iso
initrd (hd32)/boot/grub/initrd.xz

#try this boot code bootfrom=/mnt-iso//...
title /linux/knoppix/KNOPPIX_V9.1CD-2021-01-25-EN.iso
find --ignore-floppies --ignore-cd --set-root /linux/knoppix/KNOPPIX_V9.1CD-2021-01-25-EN.iso
map /linux/knoppix/KNOPPIX_V9.1CD-2021-01-25-EN.iso (hd32)
map --hook
kernel (hd32)/boot/isolinux/linux64 bootfrom=/mnt-iso//linux/knoppix/KNOPPIX_V9.1CD-2021-01-25-EN.iso lang=en apm=power-off nomce hpsa.hpsa_allow_any=1 loglevel=1
initrd (hd32)/boot/isolinux/minirt.gz

Seems to be a problem with krd iso and grub4efi
legacy grub4dos is OK, but grub4efi 2023-05-06 fails to load

The path seems to be using backslashes ?? Is that correct??

image

title MAP root krd.iso
errorcheck on
debug 3
debug msg=3
find --ignore-floppies --ignore-cd --set-root /data/krd.iso
echo
echo
map /data/krd.iso (0xff)
echo MAP DONE
echo
map --hook
root (0xff)
echo 
echo
kernel /boot/grub/k-x86 net.ifnames=0 lang=en dostartx isoloop=krd.iso
echo
echo KERNEL DONE
echo
initrd /boot/grub/initrd.xz
echo

k-x86_64,I have modified the post
kernel (hd32)/boot/grub/k-x86_64 net.ifnames=0 lang=en dostartx isoloop=krd.iso
try this version g4e2023-05-07.rar

image
2023-05-07 version doesnt load ???

kernel (hd32)/boot/grub/k-x86_64 net.ifnames=0 lang=en dostartx isoloop=krd.iso
Your menu is wrong.

ah ok - yes - krd now working!

what is latest BOOTX64.EFI that I should be testing? That version was 2022-03-28 !

g4e2023-05-07.rar is a test version by yaya2007777 in bbs.wuyou.net,you can test with it.
http://bbs.wuyou.net/forum.php?mod=redirect&goto=findpost&ptid=422652&pid=4911688&fromuid=298214

yaya will compile g4e in new ubuntu20+,2023-3-29 version maybe have bug in EFI handover/loadfile2 protocol,(I'm not sure).

KRD 2018 works using this file
https://github.com/chenall/grub4dos/files/11485626/g4e2023-05-07.zip

title Kaspersky Rescue Disk 2018 (18.0.11.3.c, 64 Bit) (efi, working)
# https://support.kaspersky.com/de/viruses/krd18
set isoFile=krd.iso
set iso=/data/%isoFile%
find --set-root %iso%
map %iso% (0xff)
root (0xff)
kernel /boot/grub/k-x86_64 net.ifnames=0 lang=en dostartx isoloop=%isoFile%
initrd /boot/grub/initrd.xz

Hiren 1.0.2 and MemTest also works with the above file, but still very slow.

Knoppix seems to work, as it does not show any error. Since Grub4DOS is horrible slow this will take some time for testing. I cancelled the start after 5 minutes, but I will try again the next days.
I am using a new USB 3.1 stick which is very fast in Windows 10 and Knoppix (booted using Grub4DOS for BIOS).

I did some tests with Knoppix 9.1. The map command seems to hang: The USB device is blinking for hours, means it read/writes something. This is strange as I can copy the ISO within 60 seconds to the same USB device.
I added some echo lines so I can see that the map command never finishes. I also added

errorcheck on
debug 3
debug msg=3

after the title command as shown by Steve, but I get no output.

I would suggest to close this issue, because this seems to be a different issue and KRD2018 works now.

That knoppix iso also hangs for me too on map command

Which version do you test?
I test OK

Knoppix 9.1

The map command hangs with this
https://github.com/chenall/grub4dos/files/11485626/g4e2023-05-07.zip

The map command works but the root filesystem is not found with this from issue 404:
https://github.com/chenall/grub4dos/files/11084520/BOOTX64.rar.txt

BOOTX642023-05-07.zip
I'm sorry,I made a mistake, there are too many g4e in my computer,I uploaded a wrong g4e,and now I upload the test version BOOTX642023-05-07.
It can boot KNOPPIX_V9.1CD-2021-01-25-EN.iso successfully.
make sure /mnt-iso//... it has two //

文件名称: BOOTX64.EFI
文件大小: 412.00 KB (421,888 字节)
修改时间: 2023年05月07日,16:50:56
MD5: 3DDDEA8AAF6BFCDAFF339E1A7E6CAF02
title /linux/KNOPPIX/KNOPPIX_V9.1CD-2021-01-25-EN.iso
find --ignore-floppies --ignore-cd --set-root /linux/KNOPPIX/KNOPPIX_V9.1CD-2021-01-25-EN.iso
map /linux/KNOPPIX/KNOPPIX_V9.1CD-2021-01-25-EN.iso (hd32)
map --hook
kernel (hd32)/boot/isolinux/linux64 bootfrom=/mnt-iso//linux/KNOPPIX/KNOPPIX_V9.1CD-2021-01-25-EN.iso lang=en apm=power-off nomce hpsa.hpsa_allow_any=1 loglevel=1
initrd (hd32)/boot/isolinux/minirt.gz
Ubuntu64-2023-05-18-18-25-55

Ubuntu64-2023-05-18-18-08-27

做两个//是怎么回事。发现linux怪怪的。

Knoppix 9.1 works too! Thanks!

I used this version:
https://github.com/chenall/grub4dos/files/11506842/BOOTX642023-05-07.zip

With this version I was also able to boot in EFI

  • ESET SysRescue 1.0.23
  • Hiren's BootCD 1.0.2
  • Kaspersky Rescue Disk 2018
  • Knoppix 9.1
  • Memtest86 7.5

Here is the config:

title Knoppix 9.1 (64 Bit) (efi, working)
# https://www.knopper.net/knoppix-mirrors/
set isoFile=Knoppix-9.1.iso
set iso=/%isoFile%
find --set-root %iso%
map %iso% (0xff)
root (0xff)
kernel /boot/isolinux/linux64 bootfrom=%isoFile% lang=de apm=power-off nomce hpsa.hpsa_allow_any=1 loglevel=1
initrd /boot/isolinux/minirt.gz

两个//是为了与真实的路径隔开啊,不然怎么知道是路径还是启动参数的一部分?linux的启动参数本来就千奇百怪,多种多样。我在关注该帖子,凌晨2点醒了,gitub好难上来,手机回帖。

Knoppix 9.1 works too! Thanks!

I used this version: https://github.com/chenall/grub4dos/files/11506842/BOOTX642023-05-07.zip

With this version I was also able to boot in EFI

  • ESET SysRescue 1.0.23
  • Hiren's BootCD 1.0.2
  • Kaspersky Rescue Disk 2018
  • Knoppix 9.1
  • Memtest86 7.5

Here is the config:

title Knoppix 9.1 (64 Bit) (efi, working)
# https://www.knopper.net/knoppix-mirrors/
set isoFile=Knoppix-9.1.iso
set iso=/%isoFile%
find --set-root %iso%
map %iso% (0xff)
root (0xff)
kernel /boot/isolinux/linux64 bootfrom=%isoFile% lang=de apm=power-off nomce hpsa.hpsa_allow_any=1 loglevel=1
initrd /boot/isolinux/minirt.gz

Congratulations!

Hiren's BootCD 1.0.2 seems to be missing some programs, but that not related to this issue, so this is fixed. Thanks!

ESET SysRescue 1.0.23,canyou post your menu.lst?I want to try it,thanks.

Here is the config for ESET SysRescue 1.0.23. You have to extract the folder "casper" from the ISO. Then change the "/dev/disk/by-label/MultiBoot-Data" to the partiton of the extracted folder. I use NTFS for my ISOs and the casper folder. I was not able to get it to work without extracting the folder.

title ESET SysRescue 1.0.23 (efi, working)
# https://www.eset.com/de/support/sysrescue/
set iso=/ESET-SysRescue-1.0.23.iso
find --set-root %iso%
map %iso% (0xff)
root (0xff)
kernel /casper/vmlinuz boot=casper live-media=/dev/disk/by-label/MultiBoot-Data debian-installer/language=de keyboard-configuration/layoutcode?=de
initrd /casper/initrd.lz

Unrelated:
I replaced the Hiren CD with this one. Works much better: https://github.com/ChrisRfr/Win10XPE

Here is the config for ESET SysRescue 1.0.23. You have to extract the folder "casper" from the ISO. Then change the "/dev/disk/by-label/MultiBoot-Data" to the partiton of the extracted folder. I use NTFS for my ISOs and the casper folder. I was not able to get it to work without extracting the folder.

title ESET SysRescue 1.0.23 (efi, working)
# https://www.eset.com/de/support/sysrescue/
set iso=/ESET-SysRescue-1.0.23.iso
find --set-root %iso%
map %iso% (0xff)
root (0xff)
kernel /casper/vmlinuz boot=casper live-media=/dev/disk/by-label/MultiBoot-Data debian-installer/language=de keyboard-configuration/layoutcode?=de
initrd /casper/initrd.lz

Unrelated: I replaced the Hiren CD with this one. Works much better: https://github.com/ChrisRfr/Win10XPE

thanks!

ESET SysRescue 1.0.23.iso,I didn't extract the iso,I test it can't boot by g4e/grub2,for the init/systemd didn't mount the orinigal iso.
Maybe it is derived from ubuntu.
But it didn't support the boot code iso-scan/filename.
It didn't support the boot code findiso,either.
It has nothing to do with g4e/grub2.

I think,you must extract the iso to boot it?And rename the disk label to MultiBoot-Data?

You can boot most Linux ISOs by using partnew
The USB drive must have an MBR partition table and the 4th partition table entry must be unused.
The ISO file must be contiguous.

here is some example code
(note that grub4efi seems to have a bug in parttype and unlike grub4dos it does not return 0x00 for a type 0 (empty) partition table!!)

title ESET SysRescue (using partnew)
# https://www.eset.com/de/support/sysrescue/
set iso=/_ISO/ANTIVIRUS/eset_sysrescue_live.iso
#USB boot disk must have Primary Partition 4 in MBR free
debug 3
debug msg=3
# check and make an empty table entry in 4th position in ptn table
parttype (hd0,3)
parttype (hd0,3) | set check=
set check=%check:~-5,4%
pause check=*%check%*
#grub4efi bug does not return a number if type is 0
if "%check%"=="" set check=0x00
pause check=*%check%*
if "%check%"=="0x00" partnew (hd0,3) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 4 IS ALREADY IN USE! && pause 
if not "%check%"=="0x00" errorcheck off && boot
partnew (hd0,3) 0 %iso%
map %iso% (0xff)
map --hook
root (0xff)
chainloader (0xff)

Note: if UEFI booting, the boot device may not be hd0. We must get the actual disk number instead of hardcoding hd0.
Also ISO must be a contiguous file (use Windows Defraggler or WinContig to defragment the file).

title ESET SysRescue (using partnew)
# https://www.eset.com/de/support/sysrescue/
set iso=/_ISO/ANTIVIRUS/eset_sysrescue_live.iso
#USB boot disk must have Primary Partition 4 in MBR free
debug 3
debug msg=3
# root must be same disk that ISO is on!  ISO must be contiguous
root | set diskno=
set diskno=%diskno:~3,2%
if "%diskno:~1,1%"=="," set diskno=%diskno:~0,1%
pause diskno=%diskno%
# check and make an empty table entry in 4th position in ptn table
parttype (hd%diskno%,3)
parttype (hd%diskno%,3) | set check=
set check=%check:~-5,4%
pause check=*%check%*
#grub4efi bug does not return a number if type is 0
if "%check%"=="" set check=0x00
pause check=*%check%*
if "%check%"=="0x00" partnew (hd%diskno%,3) 0 0 0
if not "%check%"=="0x00" echo WARNING: PTN TABLE 4 IS ALREADY IN USE! && pause 
if not "%check%"=="0x00" errorcheck off && boot
partnew (hd%diskno%,3) 0 %iso%
map %iso% (0xff)
map --hook
root (0xff)
chainloader (0xff)

Hi,steve6375,your code is very robust! very good!
In the past,I used such code to boot some linux.iso by partnew,which used wenv as a aux tool.

title /linux/puppy/fossapup64-9.5.iso-partnew[not_recommend]
find --ignore-floppies --ignore-cd --set-root /linux/puppy/fossapup64-9.5.iso
map /linux/puppy/fossapup64-9.5.iso (hd32) ;; map --hook
set root=%@root% ;; find /boot/grub/wenv | set p= ;; %p%/boot/grub/wenv set x=${root%,},3) ;; partnew %x% 0x00 /linux/puppy/fossapup64-9.5.iso
kernel (hd32)/vmlinuz PSUBDIR=/ pmedia=cd pfix=fsck
initrd (hd32)/initrd.gz

wenv can get the variable before the "," such as ${root%,} (hd10,0)→(hd10,it is the same disk with linux.iso.

How can I am sure the primary partition is less than 3?
I used chkmbrpbr.exe to judge it,which was wrote by Chinese friend.
And the menu.lst is dynamically generated by sed for windows.
If the number of MBR primary partition is less than 3,the menu will be generated.
Otherwise,it will not be generated at all.
Partnew is a very dangerous command,we must restrict it's boundary conditions.

Maybe you can use the variable %@RetVal% to get the command result.
parttype (hd1,1)
echo %@RetVal%

parttype (hd1,2)
echo %@RetVal%

parttype (hd1,3)
echo %@RetVal%

If the (hd1,3) is empty,%@RetVal%=0

GPT-TEST-2023-05-23-09-34-51

parttype (hd%diskno%,3) ;; set rt=%@RetVal% ;; echo %rt%
if %rt%==0 partnew (hd%diskno%,3) 0 0 0
......

title /linux/puppy/fossapup64-9.5.iso-partnew[not_recommend]
find --ignore-floppies --ignore-cd --set-root /linux/puppy/fossapup64-9.5.iso
map /linux/puppy/fossapup64-9.5.iso (hd32) ;; map --hook
set root=%@root% | set diskno= ;; set diskno=%diskno:~3,2% ;; if "%diskno:~1,1%"=="," set diskno=%diskno:~0,1%
parttype (hd%diskno%,3) ;; set rt=%@RetVal% ;; echo %rt%
if %rt%==0 partnew (hd%diskno%,3) 0x00 /linux/puppy/fossapup64-9.5.iso
kernel (hd32)/vmlinuz PSUBDIR=/ pmedia=cd pfix=fsck
initrd (hd32)/initrd.gz

diskno is not set in above code. ???

sorry.
set root=%@root% | set diskno= ;; .....
or
root | set diskno= ;; ......