flatpak / freedesktop-sdk-images

Flatpak freedesktop 1.6 runtime. Note: New development is at https://gitlab.com/freedesktop-sdk/freedesktop-sdk
29 stars 33 forks source link

Permission(s) changes on the filesystem(s) between version 1.6 and 18.08 #115

Closed x80486 closed 6 years ago

x80486 commented 6 years ago

So, while I was doing the JetBrains DataGrip Flatpak, I noticed that, if I use the Freedesktop 18.08 I was getting a warning: External file changes sync may be slow: File watcher failed to start; but the underlying issue was that the utility fsnotifier64 (used like exec /app/extra/DataGrip-2018.2.2/bin/fsnotifier64 --selftest) couldn’t open /etc/mtab:

uplink DataGrip: fsnotifier[3]  info: started (self-test mode) (v.20160218.1348)
uplink DataGrip: fsnotifier[3] debug: inotify fd: 3
uplink DataGrip: fsnotifier[3]  info: inotify watch descriptors: 524288
uplink DataGrip: fsnotifier[3]  info: updating roots (curr:0, new:1)
uplink DataGrip: fsnotifier[3] error: cannot open /etc/mtab
uplink DataGrip: fsnotifier[3]  info: finished (0)

If I use the Freedesktop 1.6, this doesn’t happen:

uplink DataGrip: fsnotifier[3]  info: started (self-test mode) (v.20160218.1348)
uplink DataGrip: fsnotifier[3] debug: inotify fd: 3
uplink DataGrip: fsnotifier[3]  info: inotify watch descriptors: 524288
uplink DataGrip: fsnotifier[3]  info: updating roots (curr:0, new:1)
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : rw,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: /usr : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /app : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /usr/lib/dri/intel-vaapi-driver : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /usr/lib/ffmpeg : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /usr/share/runtime/locale : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : rw,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: /proc : proc
uplink DataGrip: fsnotifier[3] debug: mtab: /sys/block : sysfs
uplink DataGrip: fsnotifier[3] debug: mtab: /sys/bus : sysfs
uplink DataGrip: fsnotifier[3] debug: mtab: /sys/class : sysfs
uplink DataGrip: fsnotifier[3] debug: mtab: /sys/dev : sysfs
uplink DataGrip: fsnotifier[3] debug: mtab: /sys/devices : sysfs
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : rw,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/machine-id : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/skel : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/issue.net : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/ca-certificates : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/timestamp : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/ld.so.conf : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/nsswitch.conf : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/rpc : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/services : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/geoclue : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/profile.d : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/profile : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/hostname : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/gtk-2.0 : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/dbus-1 : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/default : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/terminfo : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/rpm : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/bash_completion.d : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/issue : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/init.d : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/shells : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/xdg : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/ssl : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/pulse : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/motd : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/rcS.d : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/sysctl.conf : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/gtk-3.0 : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/ld.so.cache : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/inputrc : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/version : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/fonts : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/fstab : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/vdpau_wrapper.cfg : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/locale.conf : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/timezone : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/protocols : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/filesystems : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/ca-certificates.conf : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/xml : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/drirc : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /etc/pki : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /var/cache : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /var/data : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /var/config : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /var/tmp : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /run/host/monitor : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : rw,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: /run/user/1000/p11-kit/pkcs11 : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : rw,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : ro,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: /run/user/1000/.flatpak/3363461067 : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : ro,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: /run/user/1000/doc : fuse
uplink DataGrip: fsnotifier[3] debug: mtab: /dev : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/null : devtmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/zero : devtmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/full : devtmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/random : devtmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/urandom : devtmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/tty : devtmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/pts : devpts
uplink DataGrip: fsnotifier[3] debug: mtab: /dev/dri : devtmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /run/user/1000/app/DataGrip : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /home/x80486 : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /home/x80486/.local/share/flatpak : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /home/x80486/.var/app : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /home/x80486/.var/app/DataGrip : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /home/x80486/.var/app/DataGrip/config/user-dirs.dirs : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /tmp/.X11-unix : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /tmp/.X11-unix/X99 : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: tmpfs : rw,nosuid,nodev,relatime,uid=1000,gid=985
uplink DataGrip: fsnotifier[3] debug: mtab: /run/user/1000/bus : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /run/user/1000/at-spi-bus : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /run/systemd/journal/socket : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /run/systemd/journal/stdout : tmpfs
uplink DataGrip: fsnotifier[3] debug: mtab: /run/host/fonts : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /run/host/fonts-cache : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /run/host/user-fonts-cache : ext4
uplink DataGrip: fsnotifier[3] debug: mtab: /run/host/share/icons : ext4
uplink DataGrip: fsnotifier[3]  info: registering root: /home/x80486
...
uplink DataGrip: fsnotifier[3] debug: unwatching /home/x80486/Workshop/Development/kotlin-micronaut/.git/objects/e8: 15885 (0x17838d0)
uplink DataGrip: fsnotifier[3] debug: unwatching /home/x80486/Workshop/Development/kotlin-micronaut/.git/objects/61: 15886 (0x1783940)
uplink DataGrip: fsnotifier[3] debug: unwatching /home/x80486/Workshop/Development/kotlin-micronaut/.git/objects/37: 15887 (0x17839b0)
uplink DataGrip: fsnotifier[3] debug: unwatching /home/x80486/Workshop/Development/kotlin-micronaut/.git/objects/ba: 15888 (0x1783a20)

Those are the symptoms I've noticed, but I don't really know the root cause for this. My guess is that something changed in that regard between versions.

If so, was that intended? Moreover, is it possible to have the same behavior back?

TingPing commented 6 years ago

18.08 issues go here: https://gitlab.com/freedesktop-sdk/freedesktop-sdk

cungureanu commented 5 years ago

@x80486 @TingPing I had a look to identify the problem. It seems that sdk version 18.08 has removed the symlink for /etc/mtab (which should link to /proc/mounts). This for fsnotifier is a problem, because it only looks for the symlink and doesn't have a fallback for example to check the original file as well.

Check the source below for the logic, line 413 http://git.jetbrains.org/?p=idea/community.git;a=blob;f=native/fsNotifier/linux/main.c;h=26d9f3795970e4c4e760b7ba021b62fea67ae654;hb=b3e2ed3518e1a315de8ba6c1c542742cb36aea43#l413

A solution is either add back /etc/mtab or push a patch to intellij community repository upstream.

x80486 commented 5 years ago

@cungureanu, those are great news! Thanks for taking the time to investigate this one!

The fsnotifier utility is used by several JetBrains' products. If the issue is finally identified as part of the same, the JetBrains folks would have to fix it "across the board".

On the other hand, it would be nice to know beforehand why the symlink for /etc/mtab was removed in Freedesktop 18.08...maybe that wasn't intended.

x80486 commented 5 years ago

Regardless of the changes in the Flatpak runtime, the JetBrains folks are going to use also /proc/mounts as a fallback, possibly on 2019.1.