Directly booting an ISO file: Difference between revisions

From Alpine Linux
(add expansion request)
Line 16: Line 16:
=== Manual Grub menu entry ===
=== Manual Grub menu entry ===


No solution found yet.
Suppose Alpine ISO image is stored in partition 1 of a disk or SSD in directory <code>/boot</code> and
the installed Linux in that partition has GRUB2.
 
Then insert the following in <code>/etc/grub.d/40_custom</code>:
 
menuentry 'Alpine Linux 3.22 (loopback from /dev/sda1)' --class alpine --class gnu-linux --class gnu --class os {
        echo            Device:      $root
        set            isofile=/boot/alpine-extended-3.22.1-x86_64.iso
        loopback        lb $isofile
        echo            ISO root:      $root
        echo            ISO image:      $isofile
        echo            "Alpine Linux 3.22 is booting from $isofile"
        echo            'loading the kernel'
        linux          (lb)/boot/vmlinuz-lts
        echo            'loading initial root filesystem'
        initrd          (lb)/boot/initramfs-lts
}
 
Alternatively the statements <code>loopback</code>, <code>linux</code> and <code>initrd</code> can be entered manually in GRUB2 commandline.
 
Create a new GRUB2 configuration file:
 
# grub-mkconfig -o /boot/grub/grub.cfg
 
# reboot
 
Select created menu entry.
 
Boot will work until boot media is to be mounted:
 
Mounting boot media: failed
initramfs emergency recovery shell launched
 
So mount it manually:
 
# mount /dev/sda1 /media/sda1
# mount -o loop -t iso9660 /media/sda1/boot/alpine-extended-3.22.1-x86_64.iso /media/cdrom
# exit
 
Then login as root and
 
# setup-alpine


=== syslinux ===
=== syslinux ===

Revision as of 14:05, 28 June 2025

This material needs expanding ...

See Discuss

It is technically possible to boot an .iso file directly, without flashing it to a disk or device.

Using a virtual machine

The QEMU page shows how an ISO image and .apkovl customizations are booted with a virtual machine. This works very well with Proxmox as well - just attach the ISO and Alpine boots to RAM on startup. You can customize your .iso file by building a custom ISO image by following the instructions on How to make a custom ISO image with mkimage

Using an installed Bootloader

grub-imageboot

In addition to standard partitions or drives, the Debian package grub-imageboot allows booting .iso files placed in the /boot/images directory.

Manual Grub menu entry

Suppose Alpine ISO image is stored in partition 1 of a disk or SSD in directory /boot and the installed Linux in that partition has GRUB2.

Then insert the following in /etc/grub.d/40_custom:

menuentry 'Alpine Linux 3.22 (loopback from /dev/sda1)' --class alpine --class gnu-linux --class gnu --class os {
       echo            Device:      $root
       set             isofile=/boot/alpine-extended-3.22.1-x86_64.iso
       loopback        lb $isofile
       echo            ISO root:       $root
       echo            ISO image:      $isofile
       echo            "Alpine Linux 3.22 is booting from $isofile"
       echo            'loading the kernel'
       linux           (lb)/boot/vmlinuz-lts
       echo            'loading initial root filesystem'
       initrd          (lb)/boot/initramfs-lts
}

Alternatively the statements loopback, linux and initrd can be entered manually in GRUB2 commandline.

Create a new GRUB2 configuration file:

# grub-mkconfig -o /boot/grub/grub.cfg
# reboot

Select created menu entry.

Boot will work until boot media is to be mounted:

Mounting boot media: failed
initramfs emergency recovery shell launched

So mount it manually:

# mount /dev/sda1 /media/sda1
# mount -o loop -t iso9660 /media/sda1/boot/alpine-extended-3.22.1-x86_64.iso /media/cdrom
# exit

Then login as root and

# setup-alpine

syslinux

No solution found yet.