89luca89 / distrobox

Use any linux distribution inside your terminal. Enable both backward and forward compatibility with software and freedom to use whatever distribution you’re more comfortable with. Mirror available at: https://gitlab.com/89luca89/distrobox
https://distrobox.it/
GNU General Public License v3.0
10.18k stars 419 forks source link

[Error] container save and restore seems not working #560

Open MilanKladivko opened 1 year ago

MilanKladivko commented 1 year ago

I am trying to make a backup of the modified container -- following the tips section https://distrobox.privatedns.org/useful_tips.html#container-save-and-restore.

It fails with "could not start entrypoint" on distrobox enter. When comparing to how the original logs look, it seems to fail at mounting flatpak, complaining must be superuser to use mount.

I am trying to run it with podman installed into my .local (is that rootless?) -- using the install scripts for recommended SteamOS:

curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/install | sh -s -- --prefix ~/.local
curl -s https://raw.githubusercontent.com/89luca89/distrobox/main/extras/install-podman | sh -s -- --prefix ~/.local`

I followed those commands exactly, I can reproduce it with freshly created images. It happens with anything I podman load < image.tar.gz and then try to distrobox create -i from it, even on the same system ( should be reproducible? ).

Container work is not running.
Starting container work
run this command to follow along:

 podman logs -f work

 Error: could not start entrypoint.
+ [ -n  ]
+ printf distrobox: Installing basic packages...\n
+ basename /bin/bash
+ shell_pkg=bash
+ [ bash = ash ]
+ [ 0 -ne 0 ]
+ command -v find
+ command -v mount
+ command -v passwd
+ command -v sudo
+ command -v useradd
+ command -v diff
+ command -v pinentry
+ command -v wget
+ command -v curl
+ command -v less
+ command -v bc
+ command -v time
+ command -v lsof
+ command -v bash
+ printf distrobox: Setting up read-only mounts...\n
+ HOST_MOUNTS_RO=
        /var/lib/flatpak
        /var/lib/systemd/coredump
        /var/log/journal
+ mount_bind /run/host/var/lib/flatpak /var/lib/flatpak ro
+ source_dir=/run/host/var/lib/flatpak
+ target_dir=/var/lib/flatpak
+ mount_flags=ro
+ [ -d /run/host/var/lib/flatpak ]
+ [ -e /var/lib/flatpak ]
+ mountpoint /var/lib/flatpak
+ [ -d /run/host/var/lib/flatpak ]
+ mkdir -p /var/lib/flatpak
+ [ ro =  ]
+ mount --rbind -o ro /run/host/var/lib/flatpak /var/lib/flatpak
mount: /var/lib/flatpak: must be superuser to use mount.
       dmesg(1) may have more information after failed mount system call.
+ printf Warning: failed to bind mount %s to %s\n /run/host/var/lib/flatpak /var/lib/flatpak
+ return 1
+ [ 1 -ne 0 ]
+ printf Error: An error occurred\n
distrobox: Installing basic packages...
/usr/bin/find
/usr/bin/mount
/usr/bin/passwd
/usr/bin/sudo
/usr/sbin/useradd
/usr/bin/diff
/usr/bin/pinentry
/usr/bin/wget
/usr/bin/curl
/usr/bin/less
/usr/bin/bc
/usr/bin/time
/usr/bin/lsof
/usr/bin/bash
distrobox: Setting up read-only mounts...
/var/lib/flatpak is not a mountpoint
Warning: failed to bind mount /run/host/var/lib/flatpak to /var/lib/flatpak
Error: An error occurred

An error occurred

An error occurred
MilanKladivko commented 1 year ago

By the way, tried to install both distrobox and podman with sudo (on Fedora w/ dnf) and, on create it hangs.

If I add --verbose, it stays at Adding mount /proc and doesn't even let me Ctrl+C out of the process (though it does print that it got the interrupt and it's terminating...).

89luca89 commented 1 year ago

Hi @MilanKladivko

This seems to have more to do with Podman itself (as save/restore are just podman commands) than distrobox

89luca89 commented 1 year ago

I'm also thinking this might be a duplicate of #545 Seems like it has similar output, but those other users weren't using a save/restore

MilanKladivko commented 1 year ago

Is there anything I could do to resolve / test it further?

Until then, I'll just keep everything I install as a "startup script" to catch up. I don't use it for anything else but installing everything the same way anywhere I go. Instead, "syncing" the work environment as a "install distrobox, make an image of ubuntu, install all the packages with a manually-written script" is a few steps more than I'd like, but it's good enough for now.

kkarsten62 commented 1 year ago

I have just tested on a Fedora 37 Workstation. I have manually installed docker beside the offical podman package installation. When using podman I am not able to restore. But when saving and restoring with docker it's working.

So I will use docker now on my Fedora 37 machine.