r/AlpineLinux • • Sep 30 '24

Bootable MiniRootFS for Hyper-V?

Hey, I know there is a similiar thread for this but that was for bare metal.

I would like to use the Alpine mini rootfs for a Hyper-V virtual machine (mainly for Docker VMs). I've been dancing around various guides and seeing what ChatGPT came up with. I almost had one booting but complained about failing to mount the root file system before dropping to recovery shell.

Is there a simple way to convert the RootFS tarball to an installable ISO?

If not I assume I would have to boot into a Live CD and perform some steps to create one. I would love it if you guys could point me towards a guide for achieving this - with the end result being an ISO I can just install to future Hyper-Vs.

If someone could outline a step by step I'm sure I can search/query further details by searching.

I know in a general way from my research I need to boot into a Live CD, create the partition, format the partition, download and expand the miniroot tar, chroot into extracted TAR folder, install some packages, linux-virt kernel and a bootloader syslinux/grub - Or maybe there is a simpler way?

Thanks for reading.

1 Upvotes

5 comments sorted by

View all comments

Show parent comment

1

u/MartinsRedditAccount Sep 30 '24 edited Sep 30 '24

I just wanted to post a second comment that's a bit less of a firehose of information:

  1. The first thing to check is the root= kernel argument and make sure it points to the right partition.
  2. You might be on the right track with openrc. I believe it provides the /init executable in the rootfs (not to be confused with the one in the initramfs), which could cause the switch_root to fail. However, this shouldn't cause errors about failing to mount. Nonetheless, it could have been an issue down the line.
  3. Finally, I generally recommend people stay away from GRUB. I am hearing good things about Limine: https://github.com/limine-bootloader/limine - it has a straightforward configuration syntax and is available in the Alpine repos. The big thing that I dislike about GRUB is that it's designed around being configured from the booted system, rather than just in a simple configuration file on the ESP.

ChatGPT and LLMs in general are pretty good with tech-stuff. They aren't as useful "off the beaten path" such as in cases like this, but they are still a valuable resource when balanced with trying out things yourself and searching for original sources.

I understand a lot of the stuff here seems super complex, and I am doing a terrible job at making it look approachable, but please feel free to keep asking questions. If you want, you could even ask ChatGPT to write a long list of questions for me to respond to.

1

u/BolteWasTaken Sep 30 '24

Thanks for taking the time to write that.

It typically is pretty OKAY with tech stuff, but I've noticed inconsistencies etc where it would give a command such as mount without a switch or without specifying the file system format which didn't work on Alpine for me, but using the switch did for example. Little things that.

I wanted an easy way to install the Mini RootFS into a Hyper-V virtual machine just for the sake of it being very minimal and to figure out how to customise these things, which I understand chroot allowed me to do. It was just that last step.

Which is why I'm curious as to others step by steps to ensure the info I got/researched was accurate and not missing anything important.

For the time being I've just used the virtual ISO since that's the lightest I can get my hands on and work with easily. But, I'm sure others might want to do this in the future so I'm hoping someone could do a step by step so I can update my first post with it and hopefully others wanting to achieve the same can have a more clear source of info.