Closed meisenzahl closed 4 months ago
Unfortunately, switching to fedora:latest
did not help for generating the OSTree image either. There is still a similar error message:
error: Bootloader write config: Failed to execute child process ?grub2-mkconfig? (No such file or directory)
Although grub2-mkconfig
is installed:
# grub2-mkconfig --version
grub2-mkconfig (GRUB) 2.06
Updated the instructions and scripts to build OS 7. But unfortunately no luck either:
error: Bootloader write config: Failed to execute child process ?grub2-mkconfig? (No such file or directory)
I don't know if this will solve your problems here, but we recently opened our image builder if you want to have a look.
Something very likely needed for building the image in a container is to mount the entire host devices with -v /dev:/dev
. I don't look yet, but if you're trying to write to a loop backed file, there are several reasons why the device won't be there in a container. Docker doesn't do any type of dynamic device handling.
@dbnicholson thank you so much for your comments!
I was aware that endlessm/eos-image-builder exists. But I wanted to try to get as far as possible with your simple-builder branch, since it is easier to follow.
I have not tried to create a loop backed file yet. I just created an OSTree repository based on your branch and tried to create an image from it. I will try some more things and otherwise have a closer look at endlessm/eos-image-builder.
I really appreciate your feedback 🙏
I would personally stick with Debian or Ubuntu as the container image for both stages, but if you do use fedora, I believe that grub2-mkconfig is in the grub2-tools
package. I'm pretty sure either Debian or Ubuntu stable/LTS will be fine here as the deployment parts haven't changed significantly in OSTree in a while.
As for debugging the original problem, you can set the environment variable OSTREE_DEBUG_GRUB2
to something non-empty and it won't redirect grub-mkconfig
's output to /dev/null
. If you need to dig further into that process, it's contained in https://github.com/ostreedev/ostree/blob/main/src/libostree/ostree-bootloader-grub2.c.
Full disclosure - at Endless we just avoid grub rewriting configuration at all with a very dirty downstream patch. We should figure out how to upstream that in a reasonable way.
Debian's source has a bit of documentation on minimalist building in https://salsa.debian.org/debian/ostree/-/tree/debian/latest/debian/ostree-boot-examples. The starting point is deb-ostree-builder, though, so it may not provide much more than what you've found already.
Thanks to the help of @dbnicholson I have now managed to get a rootfs created for an OSTree based image. Also helpful was https://github.com/ostreedev/ostree/issues/2124. There I found the hint to tell ostree that the bootloader is not set.
I am currently struggling to create a bootable image based on the rootfs.
I am also evaluating the approaches mentioned by @dbnicholson to generate an image via multistrap
or mmdebstrap
. For this, a dependency is missing. elementary currently does not provide the public keys used to sign the Release file as a package. (Debian provides its keys with the debian-archive-keyring package.) But for the above mentioned tools we need such a package. We have already discussed steps to provide such a package for the elementary repositories.
Usually I copy the keys into the repo since it avoids having to trust downloaded keys while bootstrapping. This is what debootstrap does, after all, but using keys on disk in /usr/share/keyrings
. Getting the key into the install process is a little different for each of the tools though. For mmdebstrap there are some hook phases that can be used.
Getting closer with debootstrap
approach:
I've been without a computer for a little over a year, I'm just here to support the project
I know it's silly of me to show other alternatives to ostree at a time like this, but I think I also liked the way rlxos.dev calls its distro a semi-immutable system
Short update on the current state:
The image created with debootstrap
unfortunately does not boot. Therefore I am experimenting with multistrap
.
A version for OS 7 based on jammy
unfortunately gives the following error message:
[ 0.329269] Trying to unpack rootfs image as initramfs...
[ 0.329995] Initramfs unpacking failed: invalid magic at start of compressed archive
Apparently dracut
creates an unreadable image or grub
cannot read the image. I have already experimented with different compression algorithms when configuring dracut
. Unfortunately without success.
Therefore I am testing in parallel a version for OS 6 based on focal
. The created image can read the initramfs
, but fails afterwards with a kernel panic, because ostree
cannot prepare the filesystem:
[ 0.759772] Run /ostree/boot.1/elementary/5c6120cddb77ba236333081e69ac4f790d6983a899047df0e728bf1ab2b84afc/0/usr/lib/ostree/ostree-prepare-root as init process
[0.765120] Kernel panic - not syncing: Requested init /ostree/boot.1/elementary/5c6120cddb77ba236333081e69ac4f790d6983a899047df0e728bf1ab2b84afc/0/usr/lib/ostree/ostree-prepare-root failed (error -2).
[ 0.767585] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 5.4.0-91-generic #102-Ubuntu
[ 0.768568] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
[ 0.769670] call trace:
[ 0.769996] dump_stack+0x6d/0x8b
[ 0.770396] ? __noinstr_text_end+0x3888/0x38c8
[ 0.770946 ] panic+0x101/0x2e3
[ 0.771344] ? rest_init+0xb0/0xb0
[ 0.771747] kernel_init+0xb4/0x110
[ 0.772199] ret_from_fork+0x35/0x40
[ 0.772727] Kernel offset: 0x24a00000 from 0xffffff81000000 (relocation range: 0xffffff80000000-0xffffffbfffffff)
[0.774065] ---[ end Kernel panic - not syncing: Requested init /ostree/boot.1/elementary/5c6120cddb77ba236333081e69ac4f790d6983a899047df0e728bf1ab2b84afc/0/usr/lib/ostree/ostree-prepare-root failed (error -2). ]---
I will keep you updated.
I am now able boot an ostree based image for OS 7 based on Ubuntu 22.04.
But currently systemd
services fail with a permission denied
error:
This results in me only being able to log into a terminal.
Hi @meisenzahl, I don't know where or how to begin, but I'd like to assist with this effort if at all possible.
May I ask, just of curiosity, why this PR was closed? Is a different solution being proposed? There was a lot of good work in here and just wondering.
This PR is work in progress and aims to explore the possibilities for an OSTree-based image for elementary OS.
Current state
An OSTree repository for OS 6 is created using the script
build-ostree-repository.sh
. This is based on our build scripts for the ARM based images and thedeb-ostree-builder
script from @dbnicholson in https://github.com/dbnicholson/deb-ostree-builder/tree/simple-builder.The actual creation of an OSTree based image is done in
build-ostree-image.sh
. This script is heavily based oncreate-deployment
from the mentioned repository. Here only paths and variables were adapted.Unfortunately, the creation of an image just fails with the following error message:
Although
grub-mkconfig
is installed:TODOs
OSTree repository
/etc/fstab
based onostree admin deploy
OSTree image
Contributing
Hints for trying out are in
README.md
. A short explanation of the implemented logic can be found inCONTRIBUTING.md
.