Repository navigation
Closed
Description
When testing Builder on Atomic Workstation, I get an error where bwrap can't chdir() into a directory that exists.
I've not been able to track down why, so figured I'd ask here to see if you have any ideas.
flatpak build \
--env=LANG=en_US.UTF-8 \
--env=USER=christian \
--env=HOME=/home/christian \
--env=PATH=/usr/bin:/bin \
--env=TERM=xterm-256color \
--env=V=0 \
--env=CCACHE_DIR=/home/christian/.var/app/org.gnome.Builder/cache/gnome-builder/flatpak-builder/ccache \
--env=PATH=/app/bin:/usr/bin \
--share=network \
--nofilesystem=host \
--filesystem=/home/christian/.var/app/org.gnome.Builder/cache/gnome-builder \
--filesystem=/home/christian/Projects/TestApp \
--filesystem=/home/christian/.var/app/org.gnome.Builder/cache/gnome-builder/projects/TestApp/builds/org.gnome.Testapp.json-local-flatpak-org.gnome.Platform-x86_64-master-master \
--build-dir=/home/christian/.var/app/org.gnome.Builder/cache/gnome-builder/projects/TestApp/builds/org.gnome.Testapp.json-local-flatpak-org.gnome.Platform-x86_64-master-master \
--env=V=1 \
'--env=CFLAGS=-O2 -g' \
'--env=CXXFLAGS=-O2 -g' \
--env=NOCONFIGURE=1 \
/home/christian/.var/app/org.gnome.Builder/cache/gnome-builder/projects/TestApp/flatpak/staging/flatpak:org.gnome.Platform-x86_64-master:master \
meson /var/home/christian/Projects/TestApp . --prefix /app --libdir=lib
bwrap: Can't chdir to /home/christian/.var/app/org.gnome.Builder/cache/gnome-builder/projects/TestApp/builds/org.gnome.Testapp.json-local-flatpak-org.gnome.Platform-x86_64-master-master: No such file or directory
The directory does exist.
[christian@localhost TestApp]$ test -d /home/christian/.var/app/org.gnome.Builder/cache/gnome-builder/projects/TestApp/builds/org.gnome.Testapp.json-local-flatpak-org.gnome.Platform-x86_64-master-master
[christian@localhost TestApp]$ echo $?
0
Metadata
Metadata
Assignees
Labels
No labels
Activity
chergert commentedon Feb 12, 2018
I should note that this only happens on Fedora Atomic Workstation, and is completely fine everywhere else I've tested (non-Atomic that is).
/CC @cgwalters
chergert commentedon Feb 12, 2018
I've noticed that this seems to be in relation to applying
--build-dir. I also have learned that Atomic is using a symlink for home, to /var/home which could be related. Though I've adjusted paths to use /var/home and did not see any difference (along with--filesystem=/var/home).Perhaps it doesn't matter though, as I saw this from strace output.
chergert commentedon Feb 12, 2018
I think this strace output shows that we are in fact stomping over
--filesystem=provided that include/var.alexlarsson commentedon Feb 13, 2018
Just remounts that mountpoint nosuid,nodev,relatime which should be fine.
Is any path element traversed when resolving /var/home/christian/.var/app/org.gnome.Builder/cache/gnome-builder/projects/TestApp/builds/org.gnome.Testapp.json-local-flatpak-org.gnome.Platform-x86_64-master-master an absolute symlink? Because those don't work during the bwrap setup phase (because the root is at /newroot).
chergert commentedon Feb 13, 2018
alexlarsson commentedon Feb 13, 2018
That is a relative link though, they should work fine.
matthiasclasen commentedon Feb 14, 2018
After staring at this some more, and talking to Colin, I've come to the conclusion that this is caused by flatpak setting up its own /var, and symlinks like home -> var/home getting resolved 'too late', when the world has changed underneath them.
To confirm that theory, I changed my atomic ws to mount my home partition on /home, instead of mounting it on /var/home with a symlink. Sure enough, that makes the problem go away.
Colin suggests that maybe the easiest flatpak-side fix would be to avoid /var, and maybe use /flatpak instead - would that be possible ?
alexlarsson commentedon Feb 14, 2018
Flatpak doesn't "use" /var for anything itself really, it just has to supply it in the sandbox due to applications expecting it to be there, for example for /var/tmp.
cgwalters commentedon Feb 14, 2018
This is probably the same issue as #1280 btw.
cgwalters commentedon Feb 14, 2018
Maybe what would work is to "reverse" symlinks - follow them to their destination, then mount that as the original target?
In general though...for systems which want to "passthrough" the full host (AFAIK steam wants this), the only general solution may be to have it appear as
/hostwhich is a pattern we've come up with in Project Atomic for tools containers.alexlarsson commentedon Feb 15, 2018
Oh, i see. This is specific to "flatpak build" which makes /var be the same as $builddir/var so that we can persist things in there...
alexlarsson commentedon Feb 15, 2018
This was actually a workaround for /var/home being a symlink:
1aadc3e
alexlarsson commentedon Feb 15, 2018
Fucking symlinks, how do they work!
Fix flatpak build on atomic
Fix flatpak build on atomic
Fix flatpak build on atomic