hackerncoder / multibootusb

A collection of GRUB files and scripts that will allow you to create a pendrive capable of booting different ISO files
https://mbusb.aguslr.com
GNU General Public License v3.0
68 stars 21 forks source link

makeUSB.sh does not work on Fedora #39

Closed dko1905 closed 4 years ago

dko1905 commented 4 years ago

The script does not work on Fedora 32. Here is the output:

multibootusb git:(master) ./makeUSB.sh /dev/sda ext4 28G -e
This script must be run as root. Using sudo...
[sudo] password for daniel: 
Are you sure you want to use /dev/sda? [y/N] Y
THIS WILL DELETE ALL DATA ON THE DEVICE. Are you sure? [y/N] Y

# Remove partitions
sgdisk --zap-all "$usb_dev"
GPT data structures destroyed! You may now partition the disk using fdisk or
other utilities.

# Create GUID Partition Table
sgdisk --mbrtogpt "$usb_dev" || cleanUp 10
Creating new GPT entries in memory.
The operation has completed successfully.

# Create BIOS boot partition (1M)
sgdisk --new 1::+1M --typecode 1:ef02 \
    --change-name 1:"BIOS boot partition" "$usb_dev" || cleanUp 10
Setting name!
partNum is 0
The operation has completed successfully.

# Create EFI System partition (50M)
[ "$eficonfig" -eq 1 ] && \
    { sgdisk --new 2::+50M --typecode 2:ef00 \
    --change-name 2:"EFI System" "$usb_dev" || cleanUp 10; }
Setting name!
partNum is 1
The operation has completed successfully.

# Set data partition size
[ -z "$data_size" ] || \
    data_size="+$data_size"

# Set data partition information
case "$data_fmt" in
    ext2|ext3|ext4)
        type_code="8300"
        part_name="Linux filesystem"
        ;;
    msdos|fat|vfat|ntfs)
        type_code="0700"
        part_name="Microsoft basic data"
        ;;
    *)
        printf '%s: %s is an invalid filesystem type.\n' "$scriptname" "$data_fmt" >&2
        showUsage
        cleanUp 1
        ;;
esac

# Create data partition
sgdisk --new ${data_part}::"${data_size}": --typecode ${data_part}:"$type_code" \
    --change-name ${data_part}:"$part_name" "$usb_dev" || cleanUp 10
Setting name!
partNum is 2
The operation has completed successfully.

# Unmount device
unmountUSB "$usb_dev"

# Interactive configuration?
if [ "$interactive" -eq 1 ]; then
    # Create hybrid MBR manually
    # https://bit.ly/2z7HBrP
    gdisk "$usb_dev"
elif [ "$hybrid" -eq 1 ]; then
    # Create hybrid MBR
    if [ "$eficonfig" -eq 1 ]; then
        sgdisk --hybrid 1:2:3 "$usb_dev" || cleanUp 10
    else
        sgdisk --hybrid 1:2 "$usb_dev" || cleanUp 10
    fi
fi

# Set bootable flag for data partion
sgdisk --attributes ${data_part}:set:2 "$usb_dev" || cleanUp 10
The operation has completed successfully.

# Unmount device
unmountUSB "$usb_dev"

# Wipe BIOS boot partition
wipefs -af "${usb_dev}1" || true

# Format EFI System partition
if [ "$eficonfig" -eq 1 ]; then
    wipefs -af "${usb_dev}2" || true
    mkfs.vfat -v -F 32 "${usb_dev}2" || cleanUp 10
fi
/dev/sda2: 8 bytes were erased at offset 0x00000052 (vfat): 46 41 54 33 32 20 20 20
/dev/sda2: 1 byte was erased at offset 0x00000000 (vfat): eb
/dev/sda2: 2 bytes were erased at offset 0x000001fe (vfat): 55 aa
mkfs.fat 4.1 (2017-01-24)
/dev/sda2 has 64 heads and 32 sectors per track,
hidden sectors 0x1000;
logical sector size is 512,
using 0xf8 media descriptor, with 102400 sectors;
drive number 0x80;
filesystem has 2 32-bit FATs and 1 sector per cluster.
FAT size is 788 sectors, and provides 100792 clusters.
There are 32 reserved sectors.
Volume ID is 6fab29c7, no volume label.

# Wipe data partition
wipefs -af "${usb_dev}${data_part}" || true

# Format data partition
if [ "$data_fmt" = "ntfs" ]; then
    # Use mkntfs quick format
    mkfs -t "$data_fmt" -f "${usb_dev}${data_part}" || cleanUp 10
else
    mkfs -t "$data_fmt" "${usb_dev}${data_part}"    || cleanUp 10
fi
mke2fs 1.45.5 (07-Jan-2020)
Creating filesystem with 7340032 4k blocks and 1835008 inodes
Filesystem UUID: 9ac97385-ff3c-4525-9ddc-e6d4f887cf07
Superblock backups stored on blocks: 
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 
    4096000

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done   

# Unmount device
unmountUSB "$usb_dev"

# Create temporary directories
efi_mnt=$(mktemp -p "$tmp_dir" -d efi.XXXX)   || cleanUp 10
data_mnt=$(mktemp -p "$tmp_dir" -d data.XXXX) || cleanUp 10
repo_dir=$(mktemp -p "$tmp_dir" -d repo.XXXX) || cleanUp 10

# Mount EFI System partition
[ "$eficonfig" -eq 1 ] && \
    { mount "${usb_dev}2" "$efi_mnt" || cleanUp 10; }

# Mount data partition
mount "${usb_dev}${data_part}" "$data_mnt" || cleanUp 10

# Install GRUB for EFI
[ "$eficonfig" -eq 1 ] && \
    { $grub_cmd --target=x86_64-efi --efi-directory="$efi_mnt" \
    --boot-directory="${data_mnt}/${data_subdir}" --removable --recheck \
    || cleanUp 10; }
/usr/sbin/grub2-install: error: /usr/lib/grub/x86_64-efi/modinfo.sh doesn't exist. Please specify --target or --directory.

I thinks it's something with the grub configuration on Fedora.

drnest commented 4 years ago

Try add package grub2-efi-x64-modules.

dko1905 commented 4 years ago

I have switched away from Fedora, so I'll think I'll close this issue.