containers / toolbox

Tool for interactive command line environments on Linux
https://containertoolbx.org/
Apache License 2.0
2.54k stars 218 forks source link

flatpak-builder cannot find Flatpak SDK in fedora-toolbox-35 #863

Open vchernin opened 3 years ago

vchernin commented 3 years ago

Describe the bug

Cannot use flatpak-builder in Fedora 35 with a fedora-toolbox-35 container since sdks can't be found.

Steps how to reproduce the behaviour

  1. Use flatpak-builder in a fedora-toolbox-35 container on Fedora 35 (I used Silverblue).
  2. Attempt to build an app with any Flatpak SDK (I tried with GNOME SDK, probably affects others).
  3. You will see Failed to init: Unable to find sdk org.gnome.Sdk version 40 regardless of whether the sdk is installed on the host or not.
  4. I am not able to install flatpak correctly either, but I think this was a problem in fedora-toolbox-34 and Fedora 34 as well. But this issue was only introduced in 35, even when https://github.com/containers/toolbox/issues/629 existed before.

Expected behaviour flatpak-builder finds needed sdks as expected.

Actual behaviour flatpak-builder is effectively useless without its sdks in a fedora-toolbox-35 container

Output of toolbox --version (v0.0.90+) toolbox version 0.0.99.2

Toolbox package info (rpm -q toolbox) toolbox-0.0.99.2^3.git075b9a8d2779-1.fc35.x86_64

Output of podman version

Version:      3.3.0
API Version:  3.3.0
Go Version:   go1.16.6
Built:        Fri Aug 20 12:35:44 2021
OS/Arch:      linux/amd64

Podman package info (rpm -q podman) podman-3.3.0-1.fc35.x86_64

Info about your OS Fedora Silverblue 35

Additional context Used fresh fedora-toolbox-35 image. flatpak-builder-1.0.12-4.fc35.x86_64

anthr76 commented 3 years ago

Typically I called out to flatpak with flatpak-spawn but wonder if that pattern has changed as of lately?

vchernin commented 3 years ago

@anthr76 Could you provide an example of what you usually used to use?

Doing things like flatpak-spawn --host flatpak install org.gnome.Platform//40 from toolbox to get the 40 runtime doesn't help me much, as they provide the same result as just running in the host.

For reference I usually use flatpak-builder installed via dnf in toolbox, and flatpak provided in the base image.

I am somewhat conceptually at a loss how this can be resolved.

anthr76 commented 3 years ago

something like this

cat /usr/bin/flatpak
#!/bin/bash 
# https://github.com/containers/toolbox/issues/145
executable=$(basename "$0")
exec flatpak-spawn --host --watch-bus --forward-fd=1 --forward-fd=2 --directory="$(pwd)" --env=TERM=xterm-256color "$executable" "$@

flatpak-spawn in the toolbox flatpak on the host. Flatpaks are installed on the host

vchernin commented 3 years ago

Ah I think I see what you meant now. I usually took advantage of behaviour like https://github.com/containers/toolbox/issues/659#issuecomment-776287070 when I tried running flatpak in toolbox, but I didn't do that much anyway.

Still as far as I can tell flatpak-spawn doesn't really help with running flatpak-builder, or could it?

fedelibre commented 2 years ago

Perhaps this has been fixed by #640 (0.1.0 milestone)? See also this comment.

Workaround:

$ ls -l /var/lib/ | grep flatpak
drwxr-xr-x. 1 nobody nobody  136 Nov 24 22:40 flatpak
$ sudo umount /var/lib/flatpak
$ ls -l /var/lib/ | grep flatpak
drwxr-xr-x. 2 root root     40 Nov 25 07:49 flatpak
$ sudo dnf install -y flatpak

Installation succeeds, but now flatpak list can see only the user installations. Exit the container and stop it (podman stop fedora-toolbox-35). When you enter it again, /var/lib/flatpak will be again as it used to be and flatpak list will show also the flatpaks installed system-wide.