3

I am trying my hand at learning multi-booting, so far my target PC has antiX-Linux on one partition, and I have made other partitions for the following use-cases in which I am getting stuck at various levels.

Target PC has been partitioned with GPARTED and GPT partitioning scheme as under:

My PC has BIOS not UEFI.

 /dev/sda1 - 1 GB - fat32 - flags - boot, esp
 /dev/sda2 - 3 GB - flags - linux-swap
 /dev/sda3 - 15 GB - ext4 - Antix_Linux
 /dev/sda4 - 250 GB - exfat
 /dev/sda5 - 15 GB - freebsd_UFS
 /dev/sda6 - 0.5 GB - openbsd boot (formerly type 'EF' now type '0D')
 /dev/sda7 - rest space 15 GB -openbsd 'A6' type UFS

I have 2 pendrives, one with Ventoy and multiple iso/ img files, another making bootable only for one specific OS.

  1. FreeBSD with Ventoy: I now have entry in Antix Linux GRUB with which I can boot FreeBSD, have mounted the sda4 with fuse, setup .xinitrc for a working GUI for my non-root user and pretty much satisfied with how it runs as a daily minimal use OS.
  2. OpenBSD with Ventoy: Installed from the .iso file, downloaded file sets from HTTP, got stuck at installboot. Then it was showing “error EFI device busy,”∏ and since I don't have EFI, I changed the /dev/sda6from type EF to 0D and installboot successfully completed.

Then I rebooted, and trying to add a menuentry in /etc/grub.d/40_custom grub file, but update-grub is showing “warning discarded incorrectly nested partition hostdisk/dev/sda,gpt7,bsd(1-14)”

Giacomo1968
  • 58,727
Spandan
  • 175

2 Answers2

1

The section below titled "My Way of Installing the Triple Boot" describes the steps for installing which avoids the warning message posted in your question. Basically, Grub is updated before the partition causing the warning message is created.

In both your question and posted answer, you are trying to install a BIOS booting OpenBSD to a GPT drive. This results in the OpenBSD installer terminating before completing the installation. My answer avoids this by hybrid partitioning the drive before installing OpenBSD. Afterwards the hybrid partitioning can be left in place or removed.

Note
Before answering this question, I assumed only Windows could be installed to BIOS boot on a hybrid partitioned drive. OpenBSD can BIOS boot on MBR partition table, GPT and hybrid partitioned drives.

When updating grub after installing OpenBSD, The following message appears multiple times where X is positive integer. This is a warning message which can be ignored.

warning: Discarding improperly nested partition (hostdisk//dev/sda,gpt5,bsdX).

Below are two Bash scripts that can be used to keep this message from appearing.

  • The following script filters out the warning message.

    #!/usr/bin/bash
    /usr/sbin/update-grub |& grep -v "warning: Discarding improperly nested partition (hostdisk//dev/sda,gpt5,bsd"
    
  • The following script temporarily sets the offending partition type to zero.

    #!/usr/bin/bash
    if [[ "$USER" != root ]]; then
        echo "$0: You must run this as root"
        exit 1
    fi
    DEVICE=/dev/sda
    PARTITION=5
    TYPE="$(sfdisk --part-type $DEVICE $PARTITION)"
    TYPE00=00000000-0000-0000-0000-000000000000
    TYPEA6=824CC7A0-36A8-11E3-890A-952519AD3F61
    if [[ "$TYPE" == "$TYPEA6" ]] then
        sfdisk --no-tell-kernel --part-type $DEVICE $PARTITION "$TYPE00"
        partprobe
    fi
    /usr/sbin/update-grub
    STATUS=$?
    if [[ "$TYPE" == "$TYPEA6" ]] then
        sfdisk --no-tell-kernel --part-type $DEVICE $PARTITION "$TYPEA6"
        partprobe
    fi
    exit $STATUS
    

The scripts should be stored in the /usr/local/sbin folder under the name update-grub. The owner:group should be root:root and the mode bits should be set to 0755. In other words, enter the commands below as the root user.

    chown root:root /usr/local/sbin/update-grub
    chmod 0755 /usr/local/sbin/update-grub

My Way of Installing the Triple Boot

Below are the instructions for installing a AnitX Linux, FreeBSD and OpenBSD triple boot on a SATA drive. The operating system need to be installed in the order given.

AntiX Linux

  1. Boot from the AntiX Linux installation media. When an image similar to the one below appears, select "Use Modern Kernel".

    Use Modern Kernel

  2. When the desktop appears, open a Terminal Application window. Enter the following command be become the root user. You will need to enter the rest of the commands as the root user. Note: The password was demo.

    sudo -s
    
  3. Enter the command below to create a GPT and add the following partitions: BIOS boot partition, Linux filesystem and Microsoft basic data.

    gdisk /dev/sda
    

    The gdisk command is interactive. Enter the values in the first column of the table given below. Note: The commands are case independent.

    Entry Default Type Comment
    o command Create a new empty GUID partition table (GPT).
    y parameter Do you want to proceed?
    n command Add a new partition.
    1 parameter Partition number.
    2048 parameter First sector.
    +1m parameter Set partition size 1 MiB.
    ef02 parameter Hex code for BIOS boot partition.
    n command Add a new partition.
    2 parameter Partition number.
    4096 parameter First sector.
    +18g parameter Set partition size 18 GiB.
    8300 parameter Hex code for Linux filesystem.
    n command Add a new partition.
    3 parameter Partition number.
    37752832 parameter First sector.
    +235g parameter Set partition size 235 GiB.
    700 parameter Hex code for Microsoft basic data.
    p command Print the GPT.
    w command Write tables to disk and exit.
    y parameter Do you want to proceed?
  4. Enter the command below to format the third partition exFAT.

    mkfs.exfat -L MyShared /dev/sda3
    
  5. Close the Terminal application and open the Installer application. Proceed with the installation of AntiX Linux.

    When an image similar to the one below appears, set "Use For" as shown below.

    Choose partitions

    When an image similar to the one below appears, confirm the actions are the same before continuing.

    Confirm actions

    When an image similar to the one below appears, change the size of the swap file if desired. When finished, select the "Next' button.

    Grub and swap

    Proceed with the installation until completion.

FreeBSD

  1. Boot to AntiX Linux and open a Terminal Application window. Enter the following command be become the root user. You will need to enter the rest of the commands as the root user.

    sudo -s
    
  2. As the root user, append the following to the end of the /etc/grub.d/40_custom file.

    menuentry "FreeBSD" {
        set root=hd0,gpt4
        kfreebsd /boot/loader
    }
    

    Enter the command below to update Grub.

    update-grub
    
  3. Boot from the FreeBSD installation media. When you see a image similar to below, select Install.

    Install

    Proceed with the installation. When you see a image similar to below, select Manual, the OK.

    Manual

    When you see a image similar to below, select Create.

    Create

    In the Add Partition popup shown below, set the size to 18GB, the mountpoint to / and the label to FreeBSD UFS, then select OK.

    Add partition

    In the Boot Partition popup shown below, select No.

    Boot Partition

    When you see a image similar to below, select Finish.

    Finish

    In the Confirmation popup shown below, select Commit.

    Confirmation

    Proceed with the installation.

    Note
    When adding users, there will be the following question.

    Invite <new user> into other groups? []:

    If you want the su command to work for the new user, then enter the group wheel.
  4. After you have finished installing and have booted to the FreeBSD installation, enter the following commands as the root user. This will create a 3 GiB swap file.

    dd if=/dev/zero of=/usr/swap0 bs=1M count=3072 status=progress
    chmod 0600 /usr/swap0
    

    Append the following line to the end of /etc/fstab. I did this by using the nano text edtior. To install this editor, enter the command pkg install nano.

    md99 none swap sw,file=/usr/swap0,late 0 0
    

    Swap space will be added on system startup. To add swap space immediately, enter the following command.

    swapon -aL
    
  5. Enter the following command to install software that will allow mounting of exFAT volumes.

    pkg install fusefs-exfat
    

    To get the software to execute at starup, append the following line to the end of /boot/loader.conf.

    fusefs_load="YES"
    

    Enter the following command to create the directory where the exFAT volume will be mounted.

    mkdir -p /media/MyShared
    

    Append the following line to the end of /etc/fstab.

    /dev/ada0p3 /media/MyShared exfat rw,mountprog=/usr/local/sbin/mount.exfat 0 0
    

    The exFAT volume will be mounted on system startup. To mount immediately, enter the following commands.

    kldload fusefs
    mount -a
    

OpenBSD

  1. Boot to AntiX Linux and open a Terminal Application window. Enter the following command be become the root user. You will need to enter the rest of the commands as the root user.

    sudo -s
    
  2. As the root user, append the following to the end of the /etc/grub.d/40_custom file.

    menuentry "OpenBSD" {
        set root=hd0,gpt5
        kopenbsd -r sd0a /bsd
    }
    

    Enter the command below to update Grub.

    update-grub
    
  3. Enter the command below to add a OpenBSD disklabel partition.

    gdisk /dev/sda
    
    Note
    With a GPT partitioned disk, the installer will attempt to install an UEFI booting OpenBSD. To cause a BIOS booting installation, the gdisk command will be used to hybrid partition the drive. This will cause the installer to see the drive as only having a legacy MBR partition table.

    The gdisk command is interactive. Enter the values in the first column of the table given below. Note: The commands are case independent.

    Entry Default Type Comment
    n command Add a new partition.
    5 parameter Partition number.
    568332288 parameter First sector.
    621803519 parameter Last sector.
    a600 parameter Hex code for OpenBSD disklabel.
    p command Print the GPT.
    r command Switch to recovery and transformation options menu.
    h command Make hybrid MBR.
    3 4 5 parameter GPT partition numbers.
    y parameter Place EFI GPT (0xEE) partition first in MBR?
    07 parameter Hex code for 2nd primary MBR partition.
    n parameter Set boot flag for 2nd primary MBR partition?
    da parameter Hex code for 3rd primary MBR partition.
    n parameter Set boot flag for 3rd primary MBR partition?
    a6 parameter Hex code for 4th primary MBR partition.
    y parameter Set boot flag for 4th primary MBR partition?
    o command Print the MBR partition table.
    w command Write tables to disk and exit.
    y parameter Do you want to proceed?
  4. Boot from the OpenBSD installation media. When you see text similar to below, enter i followed by the Enter key.

    Welcome to the OpenBSD/amd64 7.7 installation program.
    (I)nstall, (U)pgrade, (A)autoinstall or (S)hell?
    

    When you see text similar to below, select the default OpenBSD by pressing the Enter key.

    Use (W)hole disk MBR, whole disk (G)PT, (O)penBSD area or (E)dit? [OpenBSD]
    

    When you see text similar to below, select the default a by pressing the Enter key.

    Use (A)uto layout, (E)dit auto layout, or create (C)ustom layout? [a]
    

    If you see text similar to below, enter yes followed by the Enter key.

    Directory does not contain SHA256.sig. Continue without verification? [no]
    
  5. After you have finished installing and have booted to the OpenBSD installation, enter the following commands as the root user. This will install the software needed to mount the exFAT volume.

    pkg_add exfat-fuse
    mkdir -p /media/MyShared
    

    To mount the exFAT volume, enter the following commands.

    disklabel -pm sd0
    mount.exfat /dev/sd0i /media/MyShared
    
  6. Remove the hybrid partitioning.

    Note
    This step is optional.

    Boot to AntiX Linux and open a Terminal Application window. Enter the command below to remove the hybrid partitioning.

    sudo gdisk /dev/sda
    

    The gdisk command is interactive. Enter the values in the first column of the table given below. Note: The commands are case independent.

    Entry Default Type Comment
    x command Switch to extra functionality options menu.
    n command Create a new protective MBR.
    o command Print the MBR partition table.
    w command Write the MBR partition table to disk and exit.
    y parameter Do you want to proceed?

Downloaded Installation ISO Files

  • AntiX Linux: antiX-23.2_x64-full.iso
  • FreeBSD: FreeBSD-14.2-Release-amd64-dvd1.iso
  • OpenBSD: install77.iso

References

Below are specific to AntiX Linux.

Below are specific to FreeBSD.

Below are specific to OpenBSD.

1

Finally, I found a solution, ignore the installer asking to create 2 partitions of EF and A6, just make one A6 partition, let disklabel create auto-layout and reboot.

Add a menu-entry in 40_custom file of /etc/grub.d as follows:

menuentry "OpenBSD 7.7" {
 kopenbsd -r sd0a (hd0,gpt6)/bsd
}
Giacomo1968
  • 58,727
Spandan
  • 175