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

Problems installing libvirt on centos-bootc #553

Closed
spmfox opened this issue May 20, 2024 · 2 comments
Closed

Problems installing libvirt on centos-bootc #553

spmfox opened this issue May 20, 2024 · 2 comments
Labels
area/osintegration Relates to an external OS/distro base image

Comments

@spmfox
Copy link

spmfox commented May 20, 2024

Hello - I'm sorry if this is not the correct place to report this problem. I don't think this is a problem regarding bootc itself, but rather how the container image is working. I am trying to create a hypervisor bootc image, nothing fancy just kvm/libvirt on top of centos-bootc - however the resulting libvirt installation is broken.

To reproduce this:

host# podman run --rm -d quay.io/centos-bootc/centos-bootc:stream9 /bin/bash
container# dnf install -y libvirt

Results in:

  Running scriptlet: libvirt-daemon-driver-qemu-10.0.0-7.el9.x86_64                                                                   79/80 
useradd: group 'kvm' does not exist

  Installing       : libvirt-daemon-driver-qemu-10.0.0-7.el9.x86_64                                                                   79/80 
warning: user qemu does not exist - using root

This does not fail though, and if you build a bootc container with libvirt it will succeed however kvm/libvirt will be broken in several places due to the qemu user being missing. I think I can workaround this, if I can figure out exactly what users/groups need to be created and if any directories need to be chown'ed - but I have not had success yet.

Digging into this, trying to create the user manually results in:

container# groupadd kvm
groupadd: group 'kvm' already exists

So it looks like the group exists already, its referenced in /lib/group. I'm not familiar enough with how this altfile structure works but it looks like the installer for libvirt doesn't understand it.

Thanks in advance for the assistance.

@shi2wei3
Copy link

@cgwalters cgwalters added the area/osintegration Relates to an external OS/distro base image label May 20, 2024
@spmfox
Copy link
Author

spmfox commented May 23, 2024

I took another look at this thinking perhaps the problem is easier than I originally thought.

https://containers.github.io/bootc/filesystem.html?highlight=merge#etc
https://docs.fedoraproject.org/en-US/packaging-guidelines/UsersAndGroups/

After reading the bootc manual again, and better understanding the 3-way merge, I realized the error was misleading. The /real/ issue was that the qemu user was missing, and it could not be created because the group already existed (in /lib/group). So based on the Fedora reference of static UIDs, and seeing the GID matched and was already defined, I simply added this to my build process (before libvirt install):

echo "qemu:x:107:107:qemu user:/:/sbin/nologin" >> /etc/passwd

And that completely solved the problem for me. I think I understand now why all those users and groups are predefined - so I'm not sure why the qemu user was missing but the group was not - either way this solved it for me.

@spmfox spmfox closed this as completed May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/osintegration Relates to an external OS/distro base image
Projects
None yet
Development

No branches or pull requests

3 participants