puppylinux-woof-CE / woof-CE

woof - the Puppy builder
GNU General Public License v2.0
382 stars 273 forks source link

There is a bug in the init in BookwormPup64_10.0.6.iso #4267

Open liuzhaoyzz opened 3 months ago

liuzhaoyzz commented 3 months ago

There is a bug in the init in BookwormPup64_10.0.6.iso - Puppy Linux Discussion Forum https://forum.puppylinux.com/viewtopic.php?p=115718#p115718 I compared Puppy9.5 with 10.0.6: fossapup64-9.5. iso, BookwormPup64_10.0.6. iso. The startup script init maybe has issue, version 10.0.6 removed the overall startup function of iso. I feel like the official website doesn't understand what this feature is for.

Fossapup64-9.5. iso startup script, line 654:

Set by/sbin/isoboot

If ["$ISO-LOOP"]; Then TRY-PARTS=${ISO-PSAVE} | ${ISO-PSAVE-FS} ${ISO-LOOP # # */} | iso9660 ${TRY-PARTS}“ Fi

BookwormPup64_10.0.6.iso is not available. The result is that BookwormPup64_10.0.6.iso failed to start iso as a whole using grub4dos or grub2 and entered the command line. screenshot: https://pan.baidu.com/s/1FdOmwG9NE65a6h ... A?pwd=1111 提取码: 1111

the menu,grub.cfg,UEFI menuentry "/linux/puppy/BookwormPup64_10.0.6.iso" "/linux/puppy/BookwormPup64_10.0.6.iso" { set gfxpayload=keep search --no-floppy --set --file $2 loopback loop $2 linux (loop)/vmlinuz iso-scan/filename=$2 PSUBDIR=/ pmedia=cd pfix=fsck,fsckp initrd (loop)/ucode.cpio (loop)/initrd.gz }

menuentry "/linux/puppy/BookwormPup64_10.0.6.iso-loopback.cfg" "/linux/puppy/BookwormPup64_10.0.6.iso" { terminal_output console search --no-floppy --set --file $2 export iso_path=$2;loopback -d loop;loopback loop $2 set root=loop configfile (loop)/boot/grub/loopback.cfg }

6a45e7a305b7d3172ebd9eab5ca460e4 fossapup64-9.5. iso http://mirrors.nju.edu.cn/puppy/puppy-fossa/ Nanjing University Open Source Mirror Station Nanjing University Open Source Mirror Site

Tsinghua University Open Source Software Mirror Station | Tsinghua Open Source Mirror https://mirrors.tuna.tsinghua.edu.cn/

https://mirrors.tuna.tsinghua.edu.cn/puppy/puppy-fossa/

Fossapup64-9.5. iso MD5: 6a45e7a305b7d3172ebd9eab5ca460e4 fossapup64-9.5. iso

Index of/kernels/data/ISO/Bookworm-Pup64 https://rockedge.org/kernels/data/ISO/Bookworm_Pup64/ BookwormPup64_10.0.6.iso 2024-03-04 23:58 762M

MD5

6f3da7f6e8b916ffc7742cb5ac46ea01 BookwormPup64_10.0.6.iso

SHA256

612135478abb3ad2fbb3f2c7f300cd1bf8cc475e83eaad1e19b0d8b965836493 BookwormPup64_10.0.6.iso

A netizen tested and added that code to start BookwormPup64_10.0.6.iso normally

gyrog commented 3 months ago

I have no problem booting BookwormPup64_10.0.6.iso via grub2 loopback feature. Here is my grub2 boot entry:

menuentry "BookwormPup64_10.0.6.iso" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 export rootuuid search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" export iso_path loopback loop $iso_path root=(loop) configfile /boot/grub/loopback.cfg loopback -d loop }

liuzhaoyzz commented 3 months ago

I have no problem booting BookwormPup64_10.0.6.iso via grub2 loopback feature. Here is my grub2 boot entry:

menuentry "BookwormPup64_10.0.6.iso" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 export rootuuid search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" export iso_path loopback loop $iso_path root=(loop) configfile /boot/grub/loopback.cfg loopback -d loop }

I want to boot BookwormPup64_10.0.6.iso by the first menu,I can boot it successfully by the second menu. The first menu is usually boot menu like debian/ubuntu... The second menu will provide me secondary menu. I prefer the first menu.

gyrog commented 3 months ago

If I understand you correctly, you want to boot directly to the iso, not via the loopback.cfg.

The following worked for me: menuentry "BookwormPup64_10.0.6.iso (direct)" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" loopback loop $iso_path root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp img_dev=${rootuuid} img_loop=${iso_path} echo "Loading /ucode.cpio /initrd.gz" initrd /ucode.cpio /initrd.gz loopback -d loop }

liuzhaoyzz commented 3 months ago

Thank you for your help.I'm on the train,later I will try your menu,I also want to boot puppy by grub4dos. If the init script handled and loaded the isoboot script,it can boot normally without modify the menu,which can compatible with the old menu,I am puzzled why not add the part of the code,and make it not compatible with the old menu?why?why?why?

liuzhaoyzz commented 3 months ago

What is the advantage of the boot code rootuuid & img_dev & img_loop?it is very strange. People used to be use iso-scan/filename boot code ,include puppy/debian/ubuntu user.Why not compatible with the old menu and the old boot code?

liuzhaoyzz commented 3 months ago

If I understand you correctly, you want to boot directly to the iso, not via the loopback.cfg.

The following worked for me: menuentry "BookwormPup64_10.0.6.iso (direct)" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" loopback loop $iso_path root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp img_dev=${rootuuid} img_loop=${iso_path} echo "Loading /ucode.cpio /initrd.gz" initrd /ucode.cpio /initrd.gz loopback -d loop }

menuentry "BookwormPup64_10.0.6.iso (direct)x" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/linux/puppy/BookwormPup64_10.0.6.iso" loopback loop $iso_path root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp img_dev=${rootuuid} img_loop=${iso_path} echo "Loading /ucode.cpio /initrd.gz" initrd /ucode.cpio /initrd.gz loopback -d loop }

The menu boot failed.

image

liuzhaoyzz commented 3 months ago

menuentry "BookwormPup64_10.0.6.iso (direct)" "/linux/puppy/BookwormPup64_10.0.6.iso" { search --no-floppy --set --file $2;probe -u ($root) -s uuid;echo $uuid loopback loop $2 root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp img_dev=${uuid} img_loop=$2 initrd /ucode.cpio /initrd.gz }

I modified the menu,it boot successfully.

liuzhaoyzz commented 2 months ago

init startup script, line 654:

Set by/sbin/isoboot

If ["$ISO-LOOP"]; Then TRY-PARTS=${ISO-PSAVE} | ${ISO-PSAVE-FS} ${ISO-LOOP # # */} | iso9660 ${TRY-PARTS}“ Fi

Can you add the codes above into init,so that the old boot code "iso-scan/filename=" can be used,too?

gyrog commented 2 months ago

"The menu boot failed." Of course it failed, the included UUID is for one of my partitions. For it to work you need to change the UUID to the one for your partition.

This worked for me: menuentry "BookwormPup64_10.0.6.iso (direct)" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" loopback loop $iso_path root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp img_dev=${rootuuid} iso-scan/filename=${iso_path} echo "Loading /ucode.cpio /initrd.gz" initrd /ucode.cpio /initrd.gz loopback -d loop }

And even this worked: menuentry "BookwormPup64_10.0.6.iso (direct)" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" loopback loop $iso_path root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp iso-scan/filename=${iso_path} echo "Loading /ucode.cpio /initrd.gz" initrd /ucode.cpio /initrd.gz loopback -d loop } although it wasted 5 seconds waiting in case the iso was on a slow device, before it went searching for the iso file, since I did not tell it which partition conatined the iso.

"iso-scan/filename=" is still working, nothing has changed to either improve or reduce the support for "iso-scan/filename=".

liuzhaoyzz commented 2 months ago

"The menu boot failed." Of course it failed, the included UUID is for one of my partitions. For it to work you need to change the UUID to the one for your partition.

This worked for me: menuentry "BookwormPup64_10.0.6.iso (direct)" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" loopback loop $iso_path root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp img_dev=${rootuuid} iso-scan/filename=${iso_path} echo "Loading /ucode.cpio /initrd.gz" initrd /ucode.cpio /initrd.gz loopback -d loop }

And even this worked: menuentry "BookwormPup64_10.0.6.iso (direct)" { rmmod tpm insmod ext2 rootuuid=0db94719-cdf1-44b7-9766-23db62fb85a5 search --no-floppy --fs-uuid --set=root $rootuuid iso_path="/boot-isos/BookwormPup64_10.0.6.iso" loopback loop $iso_path root=(loop) linux /vmlinuz pmedia=cd pfix=fsck,fsckp iso-scan/filename=${iso_path} echo "Loading /ucode.cpio /initrd.gz" initrd /ucode.cpio /initrd.gz loopback -d loop } although it wasted 5 seconds waiting in case the iso was on a slow device, before it went searching for the iso file, since I did not tell it which partition conatined the iso.

"iso-scan/filename=" is still working, nothing has changed to either improve or reduce the support for "iso-scan/filename=".

The menu you offered, worked for me,like this: menuentry "/linux/puppy/BookwormPup64_10.0.6.iso" "/linux/puppy/BookwormPup64_10.0.6.iso" { set gfxpayload=keep search --no-floppy --set --file $2;probe -u ($root) -s rootuuid;echo $rootuuid loopback loop $2 root=(loop) linux (loop)/vmlinuz img_dev=${rootuuid} iso-scan/filename=$2 PSUBDIR=/ pmedia=cd pfix=fsck,fsckp initrd (loop)/ucode.cpio (loop)/initrd.gz }

Since you used boot code iso-scan/filename=,why need you to pass ${rootuuid} to the kernel??? You have deleted the code,and how can the boot code iso-scan/filename= work normal?it is strange.

##Set by/sbin/isoboot If ["$ISO-LOOP"]; Then TRY-PARTS=${ISO-PSAVE} | ${ISO-PSAVE-FS} ${ISO-LOOP # # */} | iso9660 ${TRY-PARTS}“ Fi

fossapup64-9.5.iso,needn't pass ${rootuuid} to the kernel,because the iso-scan/filename= boot code will find and load the iso automatically,and the root=(loop) is not need,the script will chroot automatically. The script /sbin/isoboot is very strong,why did you delete it?What inconvenience does it bring at all?

menuentry "/linux/puppy/fossapup64-9.5.iso" "/linux/puppy/fossapup64-9.5.iso" { set gfxpayload=keep search --no-floppy --set --file $2 loopback loop $2 linux (loop)/vmlinuz iso-scan/filename=$2 PSUBDIR=/ pmedia=cd pfix=fsck initrd (loop)/initrd.gz }

liuzhaoyzz commented 2 months ago

ubuntu.iso,do not need pass ${uuid} to the kernel,it just need boot code iso-scan/filename= menuentry "/linux/ubuntu/ubuntu-20.10-desktop-amd64.iso" "/linux/ubuntu/ubuntu-20.10-desktop-amd64.iso" { set gfxpayload=keep search --no-floppy --set --file $2 loopback loop $2 linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=/linux/ubuntu/ubuntu-20.10-desktop-amd64.iso noprompt noeject initrd (loop)/casper/initrd }

liuzhaoyzz commented 2 months ago
isoboot script:
#!/bin/ash
#
# sourced by init  -- sets ISO_LOOP
#
# - sets PMEDIA=cd
# - sets PSUBDIR=""
# - sets ISO_PSAVE
#
# requires: wait_for_usb() get_part_info() check_status()
#           decode_id()
#           ensure_mounted()
#
# loopback.cfg
# - https://askubuntu.com/questions/644400/is-there-documentation-for-iso-scan-filename
# - https://packages.ubuntu.com/disco/lupin-casper
#
# find_iso = iso-scan/filename

# A proper shutdown is achieved if:
# - sfs's are copied to ram
# - a savefolder is used

#===================
#    grub4dos  
#===================
#title Start pup.iso
#  find --set-root --ignore-floppies /ISO/pup.iso
#  map /ISO/pup.iso (0xff)
#  map --hook
#  root (0xff)
#  kernel (0xff)/vmlinuz find_iso=/ISO/pup.iso
#  initrd (0xff)/initrd.gz

#===================
#      grub2
#===================
#menuentry "Start pup.iso" {
#    set isofile="/ISO/pup.iso"
#    loopback loop $isofile
#    set root=(loop)
#    linux    (loop)/vmlinuz find_iso=$isofile
#    initrd   (loop)/initrd.gz
#}

#==================================================

iso_path=

if [ "$isofrom" ] ; then
  iso_path="$isofrom"
fi

if [ "$img_loop" ] ; then
  iso_path="$img_loop"
fi

if [ "$isoloop" ] ; then
  iso_path="$isoloop"
fi

if [ "$findiso" ] ; then
  iso_path="$findiso"
fi

if [ "$find_iso" ] ; then
  iso_path="$find_iso"
fi

if ! [ "$iso_path" ] ; then
  for x in $(cat /proc/cmdline); do
    case ${x} in
      iso-scan/filename=*) iso_path=${x#iso-scan/filename=} ;;
    esac
  done
fi

#==================================================

if [ "$iso_path" ]; then

  PMEDIA=cd
  FOUND_ISO=
  wait_for_usb

  for ONETRY in $HAVE_PARTS
  do
    ONE_PART="$(echo -n "$ONETRY" | cut -f 1 -d '|')"
    ensure_mounted "$ONE_PART" "/mnt/dev_save"
    if [ "$ONE_MP" ];then
      if [ -f "/mnt/dev_save/${iso_path#/}" ]; then
        ISO_PSAVE=${ONE_PART}
        ISO_PSAVE_FS=$(blkid /dev/${ISO_PSAVE} | grep -o ' TYPE=".*' | cut -f 2 -d '"')
        FOUND_ISO=/mnt/dev_save/${iso_path#/}
        break
      fi
      umount $ONE_MP
    fi
  done

  if ! [ "$FOUND_ISO" ] ; then
    echo -en "\n Could not find the ISO $iso_path \n "
    exec /bin/sh >/dev/console 2>&1
  fi

  ISO_LOOP=$(losetup -f)
  if losetup $ISO_LOOP "$FOUND_ISO" ; then
    PSUBDIR=""
  else
    echo -en "\n Error mounting ISO $iso_path \n "
    exec /bin/sh >/dev/console 2>&1
  fi

fi
liuzhaoyzz commented 2 months ago

All I need,is just to keep the partial code in the right place in init script,and the boot problems will be solved. Just so so.

##Set by/sbin/isoboot
If ["$ISO-LOOP"]; Then
TRY-PARTS=${ISO-PSAVE} | ${ISO-PSAVE-FS}
${ISO-LOOP # # */} | iso9660
${TRY-PARTS}“
Fi
liuzhaoyzz commented 2 months ago

Going further,if you keep the code about isoboot,ventoy maybe run well,bacause it need to save 4fs data. The partition where BookwormPup64_10.0.6.iso located is locked in 10.0.6,so how can it save 4fs data??? Compared with init in 9.5 and 10.0.6. init10.0.6 and 9.5.zip