Directly booting an ISO file: Difference between revisions

From Alpine Linux
(added ventoy link from Discussion page, redone the headings)
 
(10 intermediate revisions by 6 users not shown)
Line 1: Line 1:
It is technically possible to boot an <code>.iso</code> file directly, without flashing it to a disk or device.
It is technically possible to boot an <code>.iso</code> file directly, without flashing it to a disk or device.


== Using a virtual machine ==
== Using a virtual machine ==


The [[Qemu#Live_mode|Qemu]] page shows how an ISO image and .apkovl customizations are booted with a virtual machine.
The [[QEMU#Live_mode|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 ===
 
No solution found yet.
 
::::: I've given up. Couldn't make the intended setup work with my meager Linux knowledge. I did find a page here at the wiki where under the heading '[http://www.alpinelinux.org/w/index.php?title=Replacing_non-Alpine_Linux_with_Alpine_remotely Install Alpine cd-rom image on hard disk]' a somewhat related solution is provided, but it involves extracting the distro files from the iso, something that [http://unetbootin.sourceforge.net/ unetbootin] does in a rather more easy and straightforward way -- at least, that's what I used to get Alpine to boot from a USB pendrive (plenty of recipes for that around). However, I still believe a simple 'boot from iso' procedure could do wonders for Alpine, so I'm leaving this here for future reference. Should anyone disagree, do feel free to delete. [[User:Pnin|Pnin]] 05:43, 8 February 2011 (UTC)
 
 
Current system is a 2.8 Prescott Pentium IV with 2MB RAM, booting from a 1GB CF plugged into the IDE interface, with an attached 500GB SATA HDD for data. When I tried to install Alpine from the LiveCD to this card, which is listed as a hard drive by the BIOS, it complained of insufficient space. Fair enough. Next I tried to follow [http://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ this recipe] to boot from Alpine 2.1.4 iso. At the end you find this tip:
 
:''Adding an Unlisted ISO: To try ISO Files that are not yet listed, use the existing menu entry examples in /boot/grub/grub.cfg and append any options normally found in the distribution's syslinux.cfg file on the "append" line to the "linux" line of the menu entry.''
 
So I downloaded the latest Alpine iso via wget and modified the relevant ''grub.cfg'' lines to:
 
linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet
initrd (loop)/boot/grsec.gz
 
All I got when I tried to boot this was the following error:
 
'''Alpine Init 2.1.2'''
'''/init: eval: line 1: syntax error: unexpected "("'''
'''kernel panic - not syncing: attempted to kill init!'''
'''Pid: 1, comm: init Not tainted 2.6.35.10-grsec #1-Alpine'''
[...]
 
I must say all went well with the Linux Mint 10.10 and the TinyCore isos, into which I'm able to boot with no issues. Anyone care to advise?
 
[[User:Pnin|Pnin]]
 
 
----
 
 
Hi, that "linux (loop)/boot/...." thing looks funny to me.
 
According to: https://help.ubuntu.com/community/Grub2
 
Could you try:
 
set root=(loop0)
linux /boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet
initrd /boot/grsec.gz
 
[[User:Nangel|Nangel]] 13:49, 6 February 2011 (UTC)
 
 
----
 
 
Hi & thanks, Nangel.


Tried that and got this error:
== Using GRUB ==
{{Main|Bootloaders#GRUB}}
Ensure that 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.


error: no such disk.
=== Loading intramfs ===
error: you need to load the kernel first.
press any key to continue...


Pressing any key returns to the grub menu. Maybe the full ''grub.cfg'' entry should be reported here:
GRUB can be caused to load kernel and initramfs by one of the following two ways:


menuentry "Alpine Linux" {
==== Adding menu entry ====
loopback loop /alpine214.iso
linux (loop)/boot/grsec initrd=/boot/grsec.gz iso-scan/filename=/alpine214.iso alpine_dev=usbdisk:vfat modules=loop,cramfs,sd-mod,usb-storage quiet
initrd (loop)/boot/grsec.gz
}


It should also be noted that the LiveCD used to perform the [http://www.pendrivelinux.com/boot-multiple-iso-from-usb-via-grub2-using-linux/ recipe] was "Linux Mint 9 LXDE", which caused Grub 1.98-1ubuntu5-1mint2 to be installed, not Grub2. And that (loop) part is present in every other successful menu entry.
Add a menu entry in grub for the ISO image by creating an file {{Path|/etc/grub.d/40_custom}} and insert the following :{{Cat|/etc/grub.d/40_custom|<nowiki>
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
}
</nowiki>}}


[EDIT: Just to add that IMHO coupled with the [http://www.alpinelinux.org/wiki/Alpine_local_backup Alpine Local Backup Utility] (lbu), booting from iso would be a killer feature for Alpine, making systems really easy to troubleshoot (delete local backup) and upgrade (replace iso).]
Proceed to create a new GRUB2 configuration file by issuing the command:{{Cmd|# grub-mkconfig -o /boot/grub/grub.cfg}}
Reboot the computer {{Cmd|# reboot}}


[[User:Pnin|Pnin]] 14:34, 6 February 2011 (UTC)
Select created menu entry and proceed to [[#Mount ISO image|Mount ISO image]] section for further instructions.


----
==== Using GRUB commandline ====


Suppose alpine-extended-3.14.0-x86_64.iso is stored in directory boot in partition 1 on disk.
Alternatively the statements <code>loopback</code>, <code>linux</code> and <code>initrd</code> can be entered manually in GRUB commandline as follows:
GRUB2 can be caused to load kernel and initramfs by entering:


  grub> loopback lb /boot/alpine-extended-3.14.0-x86_64.iso
  grub> loopback lb /boot/alpine-extended-3.14.0-x86_64.iso
Line 94: Line 44:
  grub> boot
  grub> boot


Of course a menue entry for GRUB2 can be created with these statements.
Proceed to [[#Mount ISO image|Mount ISO image]] section for further instructions.


Initialising Alpine will then be aborted with messages:
=== Mount ISO image ===


Mounting boot media: failed
Irrespective of method adopted, the boot will work until boot media is to be mounted. The following error will appear:{{Cmd|
initramfs emergency recovery shell launched. Type 'exit' to continue boot
Mounting boot media: failed
initramfs emergency recovery shell launched}}


To mount the filesystem where alpine-extended-3.14.0-x86_64.iso is stored, enter:
Now mount the boot media manually in the initramfs emergency recovery shell: {{Cmd|<nowiki># mount /dev/sda1 /media/sda1
# mount -o loop -t iso9660 /media/sda1/boot/alpine-extended-3.22.1-x86_64.iso /media/cdrom
# exit
</nowiki>}}


# mount /dev/sda1 /media/sda1
Then login as root and issue the command {{ic| # setup-alpine}} to proceed with [[Installation#Base_configuration|Installation]].


To mount the ISO image, enter:
== syslinux ==


# mount -o loop -t iso9660 /media/sda1/boot/alpine-extended-3.14.0-x86_64.iso /media/cdrom
No solution found yet.
 
Continue initialisation with:
 
# exit
 
At last these messages will be displayed:
 
/lib/rc/sh/openrc-run.sh: eval: line 1: syntax error: unexpected "("
* ERROR: firstboot failed to start


but login root works and Alpine can be configured using
== Using grub-imageboot tool ==


# alpine-setup
The Debian package '''grub-imageboot''' allows booting .iso files placed in the /boot/images directory.


[[User:HGT|HGT]] 2021-07-08
== See also ==  
 
* [https://wiki.archlinux.org/title/Ventoy Boot iso files using Ventoy]
----
 
=== syslinux ===
 
No solution found yet.


[[Category:Installation]]
[[Category:Installation]]

Latest revision as of 03:27, 5 July 2025

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 GRUB

Ensure that 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.

Loading intramfs

GRUB can be caused to load kernel and initramfs by one of the following two ways:

Adding menu entry

Add a menu entry in grub for the ISO image by creating an file /etc/grub.d/40_custom and insert the following :

Contents of /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 }

Proceed to create a new GRUB2 configuration file by issuing the command:

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

Reboot the computer

# reboot

Select created menu entry and proceed to Mount ISO image section for further instructions.

Using GRUB commandline

Alternatively the statements loopback, linux and initrd can be entered manually in GRUB commandline as follows:

grub> loopback lb /boot/alpine-extended-3.14.0-x86_64.iso
grub> linux  (lb)/boot/vmlinuz-lts
grub> initrd (lb)/boot/initramfs-lts
grub> boot

Proceed to Mount ISO image section for further instructions.

Mount ISO image

Irrespective of method adopted, the boot will work until boot media is to be mounted. The following error will appear:

Mounting boot media: failed initramfs emergency recovery shell launched

Now mount the boot media manually in the initramfs emergency recovery shell:

# 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 issue the command # setup-alpine to proceed with Installation.

syslinux

No solution found yet.

Using grub-imageboot tool

The Debian package grub-imageboot allows booting .iso files placed in the /boot/images directory.

See also