Difference between revisions of "Running Alpine in Qemu Live mode"

From Alpine Linux
Jump to: navigation, search
m
Line 6: Line 6:
  
 
<u>Question</u>: Is there a way to pass an apkovl as paramater at this stage?<br/>
 
<u>Question</u>: Is there a way to pass an apkovl as paramater at this stage?<br/>
<u>Response</u> ''to self'': Yes. I do it like this and I mount /dev/vda1 as /media/config to store the '''apkovl''' and the '''apkcache''': <pre>
+
<u>Response</u> ''to self'': Yes. I do it like this and I mount /dev/vda1 as /media/config to store the '''apkovl''' and the '''apkcache''':
 +
 
 +
<pre>
 
mkdir -p /media/usb/images
 
mkdir -p /media/usb/images
 
qemu-img create -f raw /media/usb/images/mykvm.config 32M
 
qemu-img create -f raw /media/usb/images/mykvm.config 32M
Line 15: Line 17:
 
-net lan \
 
-net lan \
 
-boot d &
 
-boot d &
</pre> And inside the KVM <pre>
+
</pre>
 +
 
 +
And inside the KVM:
 +
 
 +
<pre>
 
fdisk /dev/vda
 
fdisk /dev/vda
 
mkdosfs /dev/vda1
 
mkdosfs /dev/vda1
mkdir -p /media/config
+
mkdir -p /media/vda1
echo "/dev/vda1 /media/config vfat rw 0 0" >> /etc/fstab
+
# Newer versions seem to automount partitions. Not needed:
mount /media/config
+
# echo "/dev/vda1 /media/config vfat rw 0 0" >> /etc/fstab
setup-alpine
+
mount /dev/vda1 /media/vda1
lbu ci
+
setup-alpine # (select vda1 for saving state)
</pre> At next reboot, it will use the newly generated apkovl and apkcache stored on /dev/vda1 running in ''run-from-ram'' from the latest official ISO.
+
lbu commit
 +
</pre>
 +
 
 +
The next reboot then loads the generated apkovl and apkcache found on /dev/vda1, fully ''running-from-ram'' based on the latest official ISO.
  
 
[[Category:Virtualization]]
 
[[Category:Virtualization]]

Revision as of 17:16, 6 May 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 in graphical mode and loosing access.

Question: Is there a way to pass an apkovl as paramater at this stage?
Response to self: Yes. I do it like this and I mount /dev/vda1 as /media/config to store the apkovl and the apkcache:

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:

fdisk /dev/vda
mkdosfs /dev/vda1
mkdir -p /media/vda1
# Newer versions seem to automount partitions. Not needed:
# echo "/dev/vda1 /media/config vfat rw 0 0" >> /etc/fstab
mount /dev/vda1 /media/vda1
setup-alpine  # (select vda1 for saving state)
lbu commit

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