Running Alpine in Live mode in QEMU: Difference between revisions

From Alpine Linux
mNo edit summary
m (remove 'o' to change 'loosing' to 'losing')
(3 intermediate revisions by one other user not shown)
Line 3: Line 3:
{{Cmd|qemu -m 512 -cdrom alpine-3.2.0-x86_64.iso}}
{{Cmd|qemu -m 512 -cdrom alpine-3.2.0-x86_64.iso}}


Issue {{Cmd|grsec nomodeset}} at boot prompt to avoid being forced into graphical mode and loosing access.
Issue {{Cmd|grsec nomodeset}} at boot prompt to avoid being forced into graphical mode and losing access.


<u>Question</u>: Is there a way to pass an apkovl as paramater at this stage?<br/>
== Letting the .iso image load an apkovl ==
<u>Response</u> ''to self'': Yes. I do it like this, mounting /dev/vda1 to store the '''apkovl''' and the '''apkcache''':
 
This works by mounting a persitent filesytem under /media and selecting it to store the '''apkovl''' and the '''apkcache'''.


Preparing a KVM with a virtual drive:
Preparing a KVM with a virtual drive:
Line 20: Line 21:
</pre>
</pre>


And inside the KVM (in alpinelinux):
And inside the KVM (running alpine linux):


<pre>
<pre>
Line 26: Line 27:
mkdosfs /dev/vda1
mkdosfs /dev/vda1
mkdir -p /media/vda1
mkdir -p /media/vda1
# Newer releases seem to automount partitions without this entry, thus not required anymore:
echo "/dev/vda1 /media/vda1 vfat rw 0 0" >> /etc/fstab
# echo "/dev/vda1 /media/config vfat rw 0 0" >> /etc/fstab
mount -a
mount /dev/vda1 /media/vda1
setup-alpine  # (select vda1 for saving configs)
setup-alpine  # (select vda1 for saving state)
lbu commit
lbu commit
</pre>
</pre>

Revision as of 15:03, 1 June 2020

To just give Alpine Linux a try in diskless mode, qemu can be used to boot the .iso file without any need for a virtual HDD image or further configuration.

qemu -m 512 -cdrom alpine-3.2.0-x86_64.iso

Issue

grsec nomodeset

at boot prompt to avoid being forced into graphical mode and losing access.

Letting the .iso image load an apkovl

This works by mounting a persitent filesytem under /media and selecting it to store the apkovl and the apkcache.

Preparing a KVM with a virtual drive:

mkdir -p /media/usb/images
qemu-img create -f raw /media/usb/images/mykvm.config 32M
qemu-system-x86_64 -enable-kvm -m 384 \
-name mykvm \
-cdrom /media/usb/images/alpine-3.2.0-x86_64.iso \
-drive file=/media/usb/images/mykvm.config,if=virtio \ 
-net lan \
-boot d &

And inside the KVM (running alpine linux):

fdisk /dev/vda  #creating a partition
mkdosfs /dev/vda1
mkdir -p /media/vda1
echo "/dev/vda1 /media/vda1 vfat rw 0 0" >> /etc/fstab
mount -a
setup-alpine  # (select vda1 for saving configs)
lbu commit

The next reboot then loads the generated apkovl and apkcache found on /dev/vda1 -- completely running-from-ram based on the latest official ISO.