Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add loop-less disk builder (systemd-repart) #2445

Open
schaefi opened this issue Jan 31, 2024 · 7 comments
Open

Add loop-less disk builder (systemd-repart) #2445

schaefi opened this issue Jan 31, 2024 · 7 comments

Comments

@schaefi
Copy link
Collaborator

schaefi commented Jan 31, 2024

Description

The current implementation for the disk builder makes use kernel interfaces, meaning the produced devices are created through loop devices as well as the produced file-systems gets mounted and more. Under certain conditions the dependency into the kernel could cause a problem e.g if the calling user has not enough permissions or the environment does not expose access to these interfaces. In this case it would be handy if kiwi could offer a disk builder which does not require kernel interfaces.

The systemd project offers a tool called systemd-repart which implements many parts of the build process without the need for the kernel interfaces. This leads to the idea to write a new builder class that utilizes systemd-repart to build the disk image. systemd-repart is also used in the mkosi image builder from which the idea originates. For reference see make_image():

kiwi needs to implement an interface to systemd-repart and its required input files

@schaefi
Copy link
Collaborator Author

schaefi commented Jan 31, 2024

on suse systemd-repart is provided with the systemd-experimental package

@Conan-Kudo
Copy link
Member

Conan-Kudo commented Feb 28, 2024

On RH/Fedora, it's part of the systemd-udev package (yeah, I dunno why, but oh well?).

@schaefi schaefi changed the title Add loop-less disk builder Add loop-less disk builder (systemd-repart) Apr 30, 2024
@Conan-Kudo
Copy link
Member

This might become more important to resolve issues around running kiwi in container environments.

@bnicolae86
Copy link

Ok, so that's why I cannot build the image in a container...

[ DEBUG   ]: 20:41:27 | EXEC: [sgdisk -n 3:0:0 -c 3:p.lxroot /dev/loop3]
[ DEBUG   ]: 20:41:29 | EXEC: [sgdisk -t 3:8300 /dev/loop3]
[ DEBUG   ]: 20:41:30 | EXEC: [partx --add /dev/loop3]
[ ERROR   ]: 20:41:30 | KiwiMappedDeviceError: Device /dev/loop3p1 does not exist

@schaefi
Copy link
Collaborator Author

schaefi commented Sep 6, 2024

yes this is a known problem in containers when no udev is running inside. You can fix this as follows

Make sure your container comes with a file named /etc/kiwi.yml inside of the file set:

mapper:
  - part_mapper: kpartx

rebuild the image. kiwi will now use kpartx which doesn't require udev to create the device nodes.

Your container still needs to be privileged though to allow creation of device nodes

@bnicolae86
Copy link

yes this is a known problem in containers when no udev is running inside. You can fix this as follows

Make sure your container comes with a file named /etc/kiwi.yml inside of the file set:

mapper:
  - part_mapper: kpartx

rebuild the image. kiwi will now use kpartx which doesn't require udev to create the device nodes.

Your container still needs to be privileged though to allow creation of device nodes

thanks, I'll try it

@bnicolae86
Copy link

yes this is a known problem in containers when no udev is running inside. You can fix this as follows
Make sure your container comes with a file named /etc/kiwi.yml inside of the file set:

mapper:
  - part_mapper: kpartx

rebuild the image. kiwi will now use kpartx which doesn't require udev to create the device nodes.
Your container still needs to be privileged though to allow creation of device nodes

thanks, I'll try it

@schaefi it worked but now I have another issue trying to use gitlab.com runners. it seems that they don't have support for BTRFS filesystems :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Development

No branches or pull requests

3 participants