[Error] distrobox-init errors out then using a ostree based distribution inside and outside the distrobox
- Lenguaje dominante
- Go
- Estrellas
- 13k
- Forks
- 541
- Merge medio
- 20 h 47 min
- PR fusionados (30 d)
- 4
Descripción
**Describe the bug**
I have a ostree-based distribution on my host and use the same distribution in distrobox.
The distrobox contains a symlink from /home to var/home (as does the system outside!). Distrobox mounts my home dir into /var/home/distrobox as expected. When just using the generated container without triggering `distrobox-init` the container works well. `distrobix-init` is not happy though: It tries to bind mount `/run/host/var/home/USER` to `/home/USER` and gets a bit confused :-)
**To Reproduce**
Use e.g. bluefin on your host and use a bluefin-image as image for a distrobox.
**Expected behavior**
This works:-)
**Logs**
Not necessary...
**Desktop (please complete the following information):**
- I am using podman 5.7.0
- distrobox is at 1.8.2.2
- The distribution is bluefin, based on fedora 43 and a home-made build of the same distribution inside distrobox
- It is in the default install.
**Additional context**
This fixes the issue for me:
```diff
--- /usr/bin/distrobox-init 1970-01-01 01:00:00.000000000 +0100
+++ bin/distrobox-init 2025-12-13 15:29:44.644475671 +0100
@@ -1900,8 +1900,8 @@
# On some ostree systems, home is in /var/home, but most of the software expects
# it to be in /home. In the hosts systems this is fixed by using a symlink.
-# Do something similar here with a bind mount.
-if [ -e "/var/home/${container_user_name}" ]; then
+# Do something similar here with a bind mount, if /home is not a symlink already
+if [ -e "/var/home/${container_user_name}" && ! -L /home ]; then
if ! mount_bind "/run/host/var/home/${container_user_name}" "/home/${container_user_name}"; then
printf "Warning: Cannot bind mount %s to /run/host%s\n" "/var/home" "/home"
fi
```
Guía de contribución
Evaluación
Este issue todavía no se ha evaluado.