Distrobox - Vulkan packages cannot be installed/uninstalled and cause problems

I am encountering some problems in distroboxes regarding vulkan packages, maybe because they are immutable in some way on the base system? To be honest I am not an expert.
The following are some example cases I ran into.

  1. Set up ubuntu distrobox: ujust distrobox-assemble ubuntu
    Then try to run:
    sudo apt remove mesa-vulkan-drivers

Reading package lists… Done
Building dependency tree… Done
Reading state information… Done
The following packages will be REMOVED:
mesa-vulkan-drivers
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 54.0 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database … 43000 files and directories currently installed.)
Removing mesa-vulkan-drivers:amd64 (24.0.9-0ubuntu0.3) …
dpkg: error processing package mesa-vulkan-drivers:amd64 (–remove):
unable to securely remove ‘/usr/share/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json’: Device or resource b
usy
dpkg: too many errors, stopping
Errors were encountered while processing:
mesa-vulkan-drivers:amd64
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Result: can no longer update/install/remove any package. Trying to run “sudo apt --fix-broken install” does nothing.

  1. Set up opensuse distrobox: ujust distrobox-assemble opensuse
    The run:
    sudo zypper in vulkan-headers-1.4

Loading repository data…
Reading installed packages…
Resolving package dependencies…
The following NEW package is going to be installed:
vulkan-headers
1 new package to install.
Package download size: 1.3 MiB
Package install size change:
| 28.2 MiB required by packages that will be installed
28.2 MiB | - 0 B released by packages that will be removed
Backend: classic_rpmtrans
Continue? [y/n/v/…? shows all options] (y):
Retrieving: vulkan-headers-1.4.304-1.1.noarch (openSUSE-Tumbleweed-Oss) (1/1), 1.3 MiB
Retrieving: vulkan-headers-1.4.304-1.1.noarch.rpm …[done (4.2 MiB/s)]
Checking for file conflicts: …[done]
error: unpacking of archive failed on file /usr/share/vulkan/registry/apiconventions.py;67888391: cpio: rename failed - No data available
error: vulkan-headers-1.4.304-1.1.noarch: install failed
(1/1) Installing: vulkan-headers-1.4.304-1.1.noarch …[error]
Installation of vulkan-headers-1.4.304-1.1.noarch failed:
Error: Subprocess failed. Error: RPM failed: Command exited with status 1.

End result is that I cannot install vulkan-headers at all.

I remember some other problems that I ran into with other distros but I don’t have the exact setup anymore but I’ve ran into it frequently enough that I’m wondering if its just me or if there is a potential solution.

Does it also happen if you use distrobox-create instead?

distrobox-create -i ghcr.io/ublue-os/ubuntu-toolbox:latest -n ubuntu-toolbox

FWIW, using create works on my end and removing mesa-vulkan-drivers immediately after launching the box didn’t result in an error.

So I did some testing:
Running

distrobox-create -i ghcr.io/ublue-os/ubuntu-toolbox:latest -n ubuntu-toolbox

(the command you gave) works however it does not set up nvidia integration or the init system.

Running

distrobox-create -i ghcr.io/ublue-os/ubuntu-toolbox:latest -n ubuntu-toolbox --nvidia

now breaks the ability to install / uninstall vulkan packages.

Running

distrobox-create -i ghcr.io/ublue-os/ubuntu-toolbox:latest -n ubuntu-toolbox

breaks both some vulkan package install/uninstalls as well as atuin integration which had worked previously.

Thanks for the info, and sorry to hear that atuin broke. I can reproduce your issue, I think the issue lies with the NVIDIA stuff.

Also happens within an Alpine box created with `--nvidia --init`. Initial removal of `vulkan-headers` and `mesa-vulkan-layers` seemed to succeed, but readding `mesa-vulkan-layers` throws a `usr/share/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json`-related error.
camelot:~$ sudo apk del vulkan-headers
OK: 518 MiB in 362 packages
camelot:~$ sudo apk del mesa-vulkan-layers
(1/9) Purging mesa-vulkan-layers (24.2.8-r0)
(2/9) Purging python3-pyc (3.12.8-r1)
(3/9) Purging python3-pycache-pyc0 (3.12.8-r1)
(4/9) Purging pyc (3.12.8-r1)
(5/9) Purging python3-doc (3.12.8-r1)
(6/9) Purging python3 (3.12.8-r1)
(7/9) Purging mpdecimal-doc (4.0.0-r0)
(8/9) Purging mpdecimal (4.0.0-r0)
(9/9) Purging libpanelw (6.5_p20241006-r3)
Executing busybox-1.37.0-r9.trigger
OK: 484 MiB in 353 packages
camelot:~$ sudo apk add mesa-vulkan-layers
(1/9) Installing mpdecimal (4.0.0-r0)
(2/9) Installing mpdecimal-doc (4.0.0-r0)
(3/9) Installing libpanelw (6.5_p20241006-r3)
(4/9) Installing python3 (3.12.8-r1)
(5/9) Installing python3-pycache-pyc0 (3.12.8-r1)
(6/9) Installing pyc (3.12.8-r1)
(7/9) Installing python3-pyc (3.12.8-r1)
(8/9) Installing python3-doc (3.12.8-r1)
(9/9) Installing mesa-vulkan-layers (24.2.8-r0)
ERROR: mesa-vulkan-layers-24.2.8-r0: failed to rename usr/share/vulkan/implicit_layer.d/.apk.bc2da7ec5b989ca13d5e3c98897fe966b3aa15c8f4301f77 to usr/share/vulkan/implicit_layer.d/VkLayer_MESA_device_select.json.
Executing busybox-1.37.0-r9.trigger
1 error; 545 MiB in 363 packages

Do you know where the bug could be reported?

The Distrobox Github perhaps? Since this issue doesn’t seem to be exclusive to UBlue distroboxes.