virt-manager / virt-bootstrap

GNU General Public License v3.0
78 stars 21 forks source link

Unable to get SELinux context of user: Invalid argument #12

Open lindevel opened 1 year ago

lindevel commented 1 year ago

When creating an LXC container in Virtual Machine Manager I get an error:

Unable to complete install: 'virt-bootstrap did not complete successfully'

Command 'virt-sandbox --security=inherit -c qemu:///session --name=bootstrap_1191442 -m host-bind:/mnt=/home/user/.local/share/libvirt/filesystems/container1 -- /bin/tar xf /home/user/Завантажене/rootfs.tar.xz -C /mnt --exclude dev/* --exclude */.wh.* --overwrite --absolute-names' returned non-zero exit status 1.
All extracted files will be owned by the current unprivileged user.
Passing the root_password directly via command line is deprecated and using the 'file:' selector is the recommended way to use this option.
Extracting files into destination directory
Extracting layer (1/1) with size: 98.17 MiB
Untar layer: /home/user/Завантажене/rootfs.tar.xz
Call command:
virt-sandbox --security=inherit -c qemu:///session --name=bootstrap_1191442 -m host-bind:/mnt=/home/user/.local/share/libvirt/filesystems/container1 -- /bin/tar xf /home/user/Завантажене/rootfs.tar.xz -C /mnt --exclude dev/* --exclude */.wh.* --overwrite --absolute-names
Stderr:
Не вдалося обробити запис захисту: Unable to get SELinux context of user: Некоректний аргумент

I studied the libvirt-sandbox source code, this error is caused by the --security=inherit option (this option requires SELinux to be enabled) https://github.com/libvirt/libvirt-sandbox/blob/04ea9686819a78886a6aee16c49c7d8886434dfa/libvirt-sandbox/libvirt-sandbox-config.c#L1895 My distro: Arch Linux Installing LXC rootfs: Alma Linux 9 from http://uk.lxd.images.canonical.com/images/almalinux/9/amd64/default/20230225_23:08/rootfs.tar.xz

morenathan commented 11 months ago

I suppose YMMV but removing that option does not solve the issue. Found in /usr/lib/python3.11/site-packages/virtBootstrap/utils.py if using the virt-bootstrap-git package on Archlinux. I'm also using the same.