chenall / grub4dos

外部命令和工具源码:https://github.com/chenall/grubutils 下载:
http://grub4dos.chenall.net
GNU General Public License v2.0
650 stars 136 forks source link

Strange issue works if formatted to Fat16, but not Fat32?? #337

Open msetzerii opened 3 years ago

msetzerii commented 3 years ago

I have a flash that I have used for many years 128G with 100M Fat32 partition and rest is Ext4. That works fine, and still boots just fine. Trying to create a similar setup on a 30G flash. Make the same 100M Fat32 partition, and put the same files on it. use ./bootlace.com /dev/sdb Says success. Try to boot system, but it looks at all the partitions in machine, and reports it can't find GRLDR. Redo the same 100M with Fat16 partition. Copy files, and do the bootlace command. This time, it boots up just fine?? Think the old flash was setup with 4.5c, and now I am using 4.6a? The old flash was probable setup with 4.5c long ago, but all the files have been updated on partition to 4.6a and work? Never figured out how to use the bootlace via windows. Works fine on linux with the /dev/sdb or whatever the usb is set for. Instructions for dos talked about 0x80 and other number for Floppy, but nothing for usb that I saw.. Was able to use Grub4DOS_Toolbox_for_Windows-0.23.exe in past and it worked. Have a Windows 10 machine, and tried bootlace.com bootlace64.com and Grub4DOS_Toolbox_for_Windows-0.23.exe and all fail saying they don't support 64bit?? Have been doing the G4L project since 2004, and it has booted with syslinux for cd or flash, but have also had it setup to boot from a usb flash using grub4dos. Recently got a setup that supports UEFI booting, and can setup a flash just like the one for grub4dos, and it boots the efi. Put the extra EFI directory on original flash, and it can be used to boot via EFI or use the grub4dos. Was trying to to the same on a new flash, and it does work if I make partition Fat16?? doesn't seem to matter if the boot and esp flags are on or off on my Dell 9020 machine. I can select either Regular USB device and it boots with grub4dos, or choice UEFI USB option and it boots via UEFI. The UEFI works if partition is Fat32 or Fat16? So, it appears from Linux with Fat16 the bootlace.com will install bootloader, and it works. With a 64bit windows machine, none of the option would setup the grub4dos to boot successfully. (That I have found??) Thanks.

yaya2007 commented 3 years ago

格式化为Faf16,格式化为Fat32,是在同一U盘的同一区域吗?

GRLDR,2次测试,是在同一U盘的同一区域吗?也就是说,是放在新格式化后的分区吗?

msetzerii commented 3 years ago

Use the same exact process to create iso file, and then use dd to copy to flash. With -F32 the flash will boot, but then gives message that it can't find GRLDR. List (hd0,0) as FAT32 No GRLDR then does 3 other partitions on disk, with NULL result. Then shows (hd1,0) and (hd1,1) as No GRLDR and (hd1,2) and (hd1,3) as NULL.

Do the exact same script with -F16, and it boots up just fine??

!/usr/bin/bash

ver="-0.60"

create a 64M blank file to create Image

dd if=/dev/zero of=g4lefi$ver.iso bs=1M count=64

create gpt disk format

parted -s g4lefi$ver.iso mklabel gpt

create single partition, set esp on and boot flag

parted -s g4lefi$ver.iso mkpart G4L 1MiB 100% parted -s g4lefi$ver.iso set 1 esp on parted -s g4lefi$ver.iso set 1 boot on

Use fdisk to display the status

fdisk -l g4lefi$ver.iso

Create a loop setup to access the partition within file

losetup --offset $((5122048)) --sizelimit $((512131038)) --show --find g4lefi$ver.iso

Format the Partition a Fat16 (For some reason using Fat32 fails to fine boot loader??

mkfs.fat -F16 /dev/loop0 -n G4L

Now that partition exist, mount and copy files

mount /dev/loop0 /mnt cd /mnt || exit unzip /home/msetzerii/g4l0.60alpha/g4l-lite-fc33.zip cd /root || exit umount /mnt losetup -d /dev/loop0

Installation of the grub4dos boot loader onto gpt disk image file

bootlace programs don't seem to work from windows 64bit at all??

./bootlace.com --gpt g4lefi$ver.iso

Two be able to transfer image to flash, have system find what it shows as.

Filters out my CD/DVD, primary disk, and ramdisk.

Only get lines with sd and then only need 1st line. Located in bytes 26-28

Flash most times shows as sdb, but sometimes shows as sdc??

disks="none none on" fsarchiver probe 2>&1 | sed '/^$/Q' >/tmp/fsarchiver for a in $(ls -l /dev/disk/by-path/usb 2>/dev/null | grep -v part |sed 's_^.*/s_sg' | sort) ; do b=$(grep $a </tmp/fsarchiver | cut -b21-51);b=$(echo ${b} |tr ' ' '') disks="$disks $a $b OFF "; done Xdialog --radiolist "Select USB to be overwritten\nAll data will be lost on it." 15 60 4 $disks 2>/tmp/flash flash=$(cat /tmp/flash) rm /tmp/flash

flash=$(grep -v "sr0|sda|zram" </proc/partitions | grep sd |head -n 1 |cut -b 26-28)

If a value is returned proceed with copy of the g4lefi$ver.iso to flash.

if [[ "$flash" > "sd " ]] ; then clear echo copying g4lefi$ver.iso to /dev/"$flash" dd if=g4lefi$ver.iso bs=64MiB of=/dev/"$flash" & PID=$! echo "THIS MAY TAKE A WHILE, PLEASE BE PATIENT WHILE WGET IS RUNNING..." while ps hp $PID >/dev/null ; do printf "▓" sleep .25 done echo copy finished

copy of 64M image to a flash that is larger results in an error in setup.

The flash will work with error, but using parted -l, it will offer to fix issue.

This will then allow the other space to be used. Don't know if windows has a similar process.

echo fix GPT layout by running parted -l

echo "Enter Fix (after warning message displays)"

echo -e "Fix" | parted -l ---pretend-input-tty

parted -l

else echo "No selection" fi

At this point, the flash should have dual boot capabilities.

Can be booted as a regular USB using the grub4os boot loader

Can be booted as UEFI USB using the EFI boot loader.

Have asked question on why it works using Fat16 but not Fat32 on grub4dos

Sees the gpt or regular grub4dos bootloader placed by bootlace

But fails with message that it can't find grldr program on actual partition??

cp g4lefi$ver.iso /home/msetzerii

msetzerii commented 3 years ago

Things are now stranger. Have the issue with 4 SanDisk USB flashes that will only work if I format the partition to FAT16. 3 are 8G and 1 is 30G. Have it configured with grub4dos booting in regular USB mode, and now also in UEFI mode. If I format to FAT32 they come up with message that they can not fine GRLDR, but the files are exactly the same as went I format it to FAT16 and it works. Now ran into a strange issue. Have a PNY 120G flash, and tried to copy the image to it. With FAT16 format with it comes up booting message, but no menu. For the fun of it, I reformmated the partition to FAT32, and reinstalled the files and the it boots just fine in both regular USB and UEFI modes? Problem is that I haven't been able to find a way to get bootlace to work in windows anymore, so was making an iso file that was a 64M disk image that contained the regular and UEFI boot options. Might have to create a FAT16 and FAT32 version of files and people will just have to figure which one works with there flashes. If a Windows 64 bit version of bootlace was available that would solve problem. Files are just in a archive file, and extracted to partition. So, just getting the gpt bootloader installed. Did also get memtest86+ to work with the regular USB, but instructions I found for 4.10 version didn't work. Finally found that using memdisk from syslinux 6.04pre1 and then loading the MEMTEST.IMG file those instructions mentioned works fine. With UEFI it gives a message that kernel is too old? I also discovered that the UEFI grub4dos doesn't have the background command, but that is minor. Just have no clue why some flashes only work with the FAT16 and now the PNY one only works with FAT32?? 1st partition is the exact same size for both about 64M. Perhaps it is something obvious that I am missing?? Thanks.

steve6375 commented 3 years ago

There can be many causes so you need to try some things:

  1. Eliminate that the BIOS is causing the issue by testing with a Virtual Machine or Emulator (e.g. QEMU Boot Manager, RMPrepUSB - QEMU, VirtualBox+VMUB, etc.). The easiest might be to install RMPrepUSB under Windows and click the QEMU button. Does it give the same results as a real system? https://rmprepusb.com/
  2. You may have fake/faulty USB drives. Test them using FakeFlashTest.exe or RMPrepUSB.exe - Quick Size Test.
  3. Drive preparation - try using RMPrepUSB.exe to prepare the drive.
  4. RMPrepUSB can also be used to install the grub4dos bootloader and a fairly recent version of grub4dos grldr.
msetzerii commented 3 years ago

I know that the flashes are all good, and compare all the files on them to make sure there is no corruption. The sandisk ones all work if they are formatted as FAT16, but if formatted as FAT32 give message that GRLDR is not found. The PNY 120G flash if formatted as FAT16, shows a message on screen HD(0,0) booting or something like that, and just sits at that screen. If formatted as FAT32, it boots up just fine as a regular USB boot, and also as a UEFI boot. Systems use the same two kernel files, and same ramdisk.lzma files to run the process. Originally, I had tried it with FAT32 on the sandisk USBs, and it failed with the GRLDR not found, but the file was actual there. Then just as a test, tried using FAT16, and it worked perfectly. Didn't think there would be any issue using FAT16 for any device, but then with PNY USB, it fails with FAT16, but works with FAT32?? No error message when using bootlace under linux to install the GRLDR. Have create image files that are all zeroed out, and then run bootlace on them after they are formatted to FAT16 and FAT32. Seems to change the first 102 bytes on each, which guess is the boot loader, than load the 8192 at 17409. Then some other difference. Will have to take a look at RPMPrep and see what it does. Would be nice if the bootlace.com or bootlace64.com worked with windows. Use to use Grub4DOS_Toolbox_for_Windows-0.23.exe but it also doesn't work with windows 64. Have run the iso image with FAT16, and it works with virtualbox in linux with no problem. didn't try it with the FAT32? Basically testing on a DELL 9020 machine with Windows 10. Have a user that got new machines DELL 3080, and they no longer support non-UEFI booting, so had to come up with a way to fix that, and the FAT16 worked for him. Don't know what it might be that causes the FAT16 to work on the 8G and 30G flashes, but not the 120G? Or if the issue is that FAT16 works with the SANDISK flashes, but not on the PNY? Did test the FAT16 version being setup using RUFUS to burn it to same SANDISK USBs after wiping it to make sure it was a good install. Did note that there were 8 bytes that had different values, but not sure if it was just some signature or something was outside the data area of partition?? Am using the 4.6a grub4dos and 4.6a grub4dos efi, and it all works fine with the right FAT16 or FAT32?? Thanks for the quick response. Will look at links.

steve6375 commented 3 years ago

My RMPrepUSB and Easy2Boot websites both have a Chat pop-up facility. Feel free to use Chat (which has file/picture cut&paste facility) if you like.