Talk:Create Alpine Linux PV DomU: Difference between revisions

From Alpine Linux
(Added comment on fix for Debian 10 Alpine-Virt 3.13)
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
== Problems booting x86 Alpine on OracleVM 2.2.2 x86_64 ==
I had problems booting a 32bit Alpine domU on a OracleVM 2.2.2 (64bit) host - most probably since the Alpine kernel uses PVops.<br />
The domU kernel failed to load with the following error:<br />
:Error: (2, 'Invalid kernel', 'elf_xen_note_check: ERROR: Will only load images built for the generic loader or Linux images')
Solution is to make sure you have a 64bit ISO.
Changes:
I had to ln -s /media/cdrom to /media/xvdc or setup-alpine would not find some information.
The root fs would end up in readonly mount even when it shouldn't. Reason is that the barrier test during mount fails, if some of the underlying layers do not pass barriers (i.e. older LVM/DM in dom0). You have to change the /etc/fstab of the VM *and* run tune2fs -o nobarrier on the filesystem do disable barriers (or update the dom0).
The "mounting root filesystem rw" init script prints out OK during all that, I'll be opening a bug about it. Right now the bugtracker does not send out confirmation emails.
One more thing: didnt the local Xen god hack pygrub to be able to boot alpine directly?
This howto still assumes we need to save kernel somewhere, maybe we can instead pass them as arguments at first build. More complex but also more powerful.
<small><span class="autosigned">—&nbsp;Preceding [[Help:Signature|unsigned]] comment added by [[User:Darkfader|Darkfader]] ([[User talk:Darkfader|{{int:talkpagelinktext}}]] • [[Special:Contributions/Darkfader|{{int:contribslink}}]]) 2012</span></small>‎
== pvgrub2 changes ==
This page was recommended by the Xen Beginners Guide as an example of a manual installation of a domU. It no longer works (at least on a Debian host) because it's based on legacy grub (grub1). I sorted out how to change it to work with grub2. Because I'm not a regular Alpine user, I thought it might be helpful to post proposed changes here in case there were comments before changing the page.  
This page was recommended by the Xen Beginners Guide as an example of a manual installation of a domU. It no longer works (at least on a Debian host) because it's based on legacy grub (grub1). I sorted out how to change it to work with grub2. Because I'm not a regular Alpine user, I thought it might be helpful to post proposed changes here in case there were comments before changing the page.  


Line 29: Line 52:
-- [[User:Davehill|Davehill]] ([[User talk:Davehill|talk]]) 16:53, 6 June 2020 (UTC)
-- [[User:Davehill|Davehill]] ([[User talk:Davehill|talk]]) 16:53, 6 June 2020 (UTC)


 
== Debian 10 Dom0 with Alpine Virtual 3.13 ==
I had problems booting a 32bit Alpine domU on a OracleVM 2.2.2 (64bit) host - most probably since the Alpine kernel uses PVops.<br />
 
The domU kernel failed to load with the following error:<br />
 
:Error: (2, 'Invalid kernel', 'elf_xen_note_check: ERROR: Will only load images built for the generic loader or Linux images')
 
Solution is to make sure you have a 64bit ISO.
 
 
Changes:
I had to ln -s /media/cdrom to /media/xvdc or setup-alpine would not find some information.
 
The root fs would end up in readonly mount even when it shouldn't. Reason is that the barrier test during mount fails, if some of the underlying layers do not pass barriers (i.e. older LVM/DM in dom0). You have to change the /etc/fstab of the VM *and* run tune2fs -o nobarrier on the filesystem do disable barriers (or update the dom0).
The "mounting root filesystem rw" init script prints out OK during all that, I'll be opening a bug about it. Right now the bugtracker does not send out confirmation emails.
 
 
One more thing: didnt the local Xen god hack pygrub to be able to boot alpine directly?
This howto still assumes we need to save kernel somewhere, maybe we can instead pass them as arguments at first build. More complex but also more powerful.
 
 
--[[User:Raymi306|Raymi306]] ([[User talk:Raymi306|talk]]) 18:40, 22 January 2021 (UTC) -- START
 
Today I tried following this tutorial on a Debian 10 Dom0 with Alpine Virtual 3.13. The issue I ran into was in the grub config:
Today I tried following this tutorial on a Debian 10 Dom0 with Alpine Virtual 3.13. The issue I ran into was in the grub config:


Line 73: Line 74:


--[[User:Raymi306|Raymi306]] ([[User talk:Raymi306|talk]]) 18:40, 22 January 2021 (UTC) -- END
--[[User:Raymi306|Raymi306]] ([[User talk:Raymi306|talk]]) 18:40, 22 January 2021 (UTC) -- END
==  apk add grub-xenhost ==
Can someone more knowledgeable about this setup fact check the reference to a grub-xenhost apk? I do not see such an apk in the repos.
[[User:Zcrayfish|zcrayfish]] ([[User talk:Zcrayfish|talk]]) 20:15, 18 August 2023 (UTC)
== Using sparse file for backing /data/a1.img ==
To save both image creation time and disk space I suggest to rather create sparse file with command:
truncate -s 3G /data/a1.img
It will be instant (because no data blocks allocated) and it will occupy nearly zero bytes on disk (not counting metadata).
To see allocated space one can use 'ls' with '-s'. Below is example after installing Alpine 3.20 DomU guest:
$ ls -lhs /data/a1.img
158.3M -rw-r--r--    1 root    root        3.0G Jul 23 08:51 /data/a1.img
Only around 160MB is allocated by 'a1.img' of size 3GB.

Latest revision as of 07:12, 23 July 2024

Problems booting x86 Alpine on OracleVM 2.2.2 x86_64

I had problems booting a 32bit Alpine domU on a OracleVM 2.2.2 (64bit) host - most probably since the Alpine kernel uses PVops.

The domU kernel failed to load with the following error:

Error: (2, 'Invalid kernel', 'elf_xen_note_check: ERROR: Will only load images built for the generic loader or Linux images')

Solution is to make sure you have a 64bit ISO.


Changes: I had to ln -s /media/cdrom to /media/xvdc or setup-alpine would not find some information.

The root fs would end up in readonly mount even when it shouldn't. Reason is that the barrier test during mount fails, if some of the underlying layers do not pass barriers (i.e. older LVM/DM in dom0). You have to change the /etc/fstab of the VM *and* run tune2fs -o nobarrier on the filesystem do disable barriers (or update the dom0). The "mounting root filesystem rw" init script prints out OK during all that, I'll be opening a bug about it. Right now the bugtracker does not send out confirmation emails.


One more thing: didnt the local Xen god hack pygrub to be able to boot alpine directly? This howto still assumes we need to save kernel somewhere, maybe we can instead pass them as arguments at first build. More complex but also more powerful.

— Preceding unsigned comment added by Darkfader (talkcontribs) 2012

pvgrub2 changes

This page was recommended by the Xen Beginners Guide as an example of a manual installation of a domU. It no longer works (at least on a Debian host) because it's based on legacy grub (grub1). I sorted out how to change it to work with grub2. Because I'm not a regular Alpine user, I thought it might be helpful to post proposed changes here in case there were comments before changing the page.

So, I propose changing the content to make it work with pvgrub2. The biggest change would be to swap out the instructions to create menu.lst with instructions to create grub.cfg as follows:

Before you reboot, mount the boot partition and create a grub/grub.cfg file for pvgrub:

mount /dev/xvda1 /mnt mkdir /mnt/grub

Install a basic text editor like nano or vim:

apk add nano

If using nano, enter:

nano /mnt/grub/grub.cfg

Then add the following to create a basic grub2 configuration file:

Contents of /mnt/grub/grub.cfg

menuentry 'alpine-xen' { set root=(xen/xvda,msdos1) linux /boot/vmlinuz-virt root=/dev/xvda3 modules=ext4 initrd /boot/initramfs }

Finally, Ctrl-S to save, Ctrl-X to exit nano.


I would add/change a few other small things: a bit more on pvgrub2, instructions to use LVM if that's set up in the host and a few more details around the initial installation process, etc.

Comments welcome.

-- Davehill (talk) 16:53, 6 June 2020 (UTC)

Debian 10 Dom0 with Alpine Virtual 3.13

Today I tried following this tutorial on a Debian 10 Dom0 with Alpine Virtual 3.13. The issue I ran into was in the grub config:


   menuentry 'alpine-xen' {
       set root=(xen/xvda,msdos1)
       linux /boot/vmlinuz-virt root=/dev/xvda3 modules=ext4
       initrd /boot/initramfs
   }

After playing around in GRUB, I believe I just had to change the path from /boot/initramfs to /boot/initramfs-virt, the alpine version in this tutorial isn't current so I guess the name changed. I also wasn't interested in having it display the menu, so I changed the format to be like below:

   set root=(xen/xvda,msdos1)
   linux /boot/vmlinuz-virt root=/dev/xvda3 modules=ext4
   initrd /boot/initramfs-virt
   boot

I used my logical volume group and replaced the target path in 'format=raw, vdev=xvda, access=w, target=/data/a1.img' to /dev/$VG_NAME/alpine-1 and everything appears to be working fine

I haven't really done any wiki editing before but I wanted to at least put this out there, and hopefully get some feedback as to if others would like to edit the entry or would like me to edit the entry to try and convey some of this information

--Raymi306 (talk) 18:40, 22 January 2021 (UTC) -- END

apk add grub-xenhost

Can someone more knowledgeable about this setup fact check the reference to a grub-xenhost apk? I do not see such an apk in the repos. zcrayfish (talk) 20:15, 18 August 2023 (UTC)

Using sparse file for backing /data/a1.img

To save both image creation time and disk space I suggest to rather create sparse file with command:

truncate -s 3G /data/a1.img

It will be instant (because no data blocks allocated) and it will occupy nearly zero bytes on disk (not counting metadata). To see allocated space one can use 'ls' with '-s'. Below is example after installing Alpine 3.20 DomU guest:

$ ls -lhs /data/a1.img
158.3M -rw-r--r--    1 root     root        3.0G Jul 23 08:51 /data/a1.img

Only around 160MB is allocated by 'a1.img' of size 3GB.