Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot Start Flatpak Apps Due To Missing /tmp/.X11-unix/X1 Source Path #938

Open
Saroufim opened this issue Jul 29, 2017 · 27 comments
Open

Comments

@Saroufim
Copy link

In some cases, it's not possible to start Flatpak apps altogether. Running them form the commandline yields the following:

Can't find source path /tmp/.X11-unix/X1: No such file or directory

A simple restart would suffice to fix that issue, however. It happens every once in a while randomly but when it does happen, it starts from login and persists until reboot or shutdown.

I'm on Fedora 26 with Kernel 4.11.9 and the NVidia driver under X11.

@jacknlliu
Copy link

jacknlliu commented Oct 15, 2017

Same error here with Ubuntu 16.04.

@torpak
Copy link

torpak commented Nov 28, 2017

Is there any information on the reason or even a workaround available?
(reproduced on linux mint 18)

@jacknlliu
Copy link

I just reboot the system, and then everything works.

@Saroufim
Copy link
Author

Saroufim commented Nov 28, 2017 via email

@alexlarsson
Copy link
Member

I believe you have an issue with something periodically cleaning up the /tmp directory, removing the X socket. Other X apps may still work by using the abstract X socket, but that is not possible for flatpak to use.

@torpak
Copy link

torpak commented Dec 19, 2017

Rebooting is not an option for me. Is there any way to reconstruct the missing file?

@alexlarsson
Copy link
Member

You don't have to reboot, but I don't think it is possible to tell the xserver to listen to a new socket, so you have to log out + log in.

@alexlarsson
Copy link
Member

Also, you should go over your tmpwatches and make sure they don't remove stuff in /tmp/.X11-unix

@alexlarsson
Copy link
Member

@clefebvre this seems to be a mint issue. You probably have some tmpfile cleaning script that removes old files, and its hitting the X socket files which is bad.

It works for non-flatpak apps because the abstract socket path is not removed so clients fall back io it, but that one doesn't work in flatpaks.

@torpak
Copy link

torpak commented Dec 19, 2017

It seems a bit optimistic to rely on some file in /tmp never being deleted.
There must be a mechanism, that creates this file in the first place. Maybe it could just be reinvoked, in case the file is missing?
By the way: would this problem be solved by switching to wayland?

@alexlarsson
Copy link
Member

The problem is that it is a unix domain socket. one that is deleted you can't recreate it. I mean, you can create a new one in the same spot, but the Xserver will not be listening to connections to the new one.

For wayland this is better, because the wayland socket is in /run/user.

@alexlarsson
Copy link
Member

And i agree that it is a bit optimistic to rely on files in /tmp, but the X11 design is from the 80s...

@clefebvre
Copy link

hi @alexlarsson, I'm not aware of any scripts or job cleaning up /tmp, at least not out of the box. I assume this is added by a tool/package users have in common here. It seems to affect Mint but also Xenial and Fedora 26.

Can people list their cron jobs and running processes so we can see what everyone has in common?

@Saroufim
Copy link
Author

Saroufim commented Dec 31, 2017

Here's the list of running processes on my system (Fedora 27):


-   1 ?        00:00:01 systemd
-     2 ?        00:00:00 kthreadd
-     3 ?        00:00:00 kworker/0:0
-     4 ?        00:00:00 kworker/0:0H
-     6 ?        00:00:00 mm_percpu_wq
-     7 ?        00:00:00 ksoftirqd/0
-     8 ?        00:00:03 rcu_sched
-     9 ?        00:00:00 rcu_bh
-    10 ?        00:00:00 migration/0
-    11 ?        00:00:00 watchdog/0
-    12 ?        00:00:00 cpuhp/0
-    13 ?        00:00:00 cpuhp/1
-    14 ?        00:00:00 watchdog/1
-    15 ?        00:00:00 migration/1
-    16 ?        00:00:00 ksoftirqd/1
-    18 ?        00:00:00 kworker/1:0H
-    19 ?        00:00:00 cpuhp/2
-    20 ?        00:00:00 watchdog/2
-    21 ?        00:00:00 migration/2
-    22 ?        00:00:00 ksoftirqd/2
-    24 ?        00:00:00 kworker/2:0H
-    25 ?        00:00:00 cpuhp/3
-    26 ?        00:00:00 watchdog/3
-    27 ?        00:00:00 migration/3
-    28 ?        00:00:00 ksoftirqd/3
-    30 ?        00:00:00 kworker/3:0H
-    31 ?        00:00:00 kdevtmpfs
-    32 ?        00:00:00 netns
-    34 ?        00:00:00 kworker/2:1
-    35 ?        00:00:00 oom_reaper
-    36 ?        00:00:00 writeback
-    37 ?        00:00:00 kcompactd0
-    38 ?        00:00:00 ksmd
-    39 ?        00:00:00 khugepaged
-    40 ?        00:00:00 crypto
-    41 ?        00:00:00 kintegrityd
-    42 ?        00:00:00 kblockd
-    45 ?        00:00:00 ata_sff
-    46 ?        00:00:00 md
-    47 ?        00:00:00 edac-poller
-    48 ?        00:00:00 devfreq_wq
-    49 ?        00:00:00 watchdogd
-    51 ?        00:00:00 kauditd
-    52 ?        00:00:00 kswapd0
-   101 ?        00:00:00 kthrotld
-   102 ?        00:00:00 acpi_thermal_pm
-   103 ?        00:00:00 scsi_eh_0
-   104 ?        00:00:00 scsi_tmf_0
-   105 ?        00:00:00 scsi_eh_1
-   106 ?        00:00:00 scsi_tmf_1
-   108 ?        00:00:00 scsi_eh_2
-   109 ?        00:00:00 scsi_tmf_2
-   110 ?        00:00:00 scsi_eh_3
-   111 ?        00:00:00 scsi_tmf_3
-   114 ?        00:00:00 dm_bufio_cache
-   115 ?        00:00:00 ipv6_addrconf
-   121 ?        00:00:00 kstrp
-   137 ?        00:00:00 kworker/2:2
-   266 ?        00:00:00 kworker/1:2
-   307 ?        00:00:00 kworker/0:1H
-   308 ?        00:00:00 kworker/1:1H
-   309 ?        00:00:00 kworker/2:1H
-   310 ?        00:00:00 nvidia-modeset
-   311 ?        00:01:13 irq/25-nvidia
-   312 ?        00:00:00 nvidia
-   320 ?        00:00:00 kworker/3:1H
-   327 ?        00:00:00 btrfs-worker
-   328 ?        00:00:00 kworker/u9:0
-   330 ?        00:00:00 btrfs-worker-hi
-   331 ?        00:00:00 btrfs-delalloc
-   332 ?        00:00:00 btrfs-flush_del
-   333 ?        00:00:00 btrfs-cache
-   334 ?        00:00:00 btrfs-submit
-   335 ?        00:00:00 btrfs-fixup
-   336 ?        00:00:00 btrfs-endio
-   337 ?        00:00:00 btrfs-endio-met
-   338 ?        00:00:00 btrfs-endio-met
-   339 ?        00:00:00 btrfs-endio-rai
-   340 ?        00:00:00 btrfs-endio-rep
-   341 ?        00:00:00 btrfs-rmw
-   342 ?        00:00:00 btrfs-endio-wri
-   343 ?        00:00:00 btrfs-freespace
-   344 ?        00:00:00 btrfs-delayed-m
-   345 ?        00:00:00 btrfs-readahead
-   346 ?        00:00:00 btrfs-qgroup-re
-   347 ?        00:00:00 btrfs-extent-re
-   348 ?        00:00:00 btrfs-cleaner
-   349 ?        00:00:00 btrfs-transacti
-   431 ?        00:00:01 systemd-journal
-   452 ?        00:00:00 systemd-udevd
-   518 ?        00:00:00 irq/26-mei_me
-   598 ?        00:00:00 jbd2/sda1-8
-   599 ?        00:00:00 ext4-rsv-conver
-   601 ?        00:00:00 jbd2/sda3-8
-   602 ?        00:00:00 ext4-rsv-conver
-   611 ?        00:00:00 jbd2/sdb1-8
-   612 ?        00:00:00 ext4-rsv-conver
-   634 ?        00:00:00 auditd
-   636 ?        00:00:00 audispd
-   637 ?        00:00:00 rpciod
-   638 ?        00:00:00 xprtiod
-   642 ?        00:00:00 sedispatch
-   660 ?        00:00:00 rtkit-daemon
-   662 ?        00:00:00 mcelog
-   665 ?        00:00:00 alsactl
-   669 ?        00:00:00 accounts-daemon
-   672 ?        00:00:00 avahi-daemon
-   675 ?        00:00:00 systemd-logind
-   676 ?        00:00:00 dbus-daemon
-   716 ?        00:00:00 avahi-daemon
-   717 ?        00:00:00 gssproxy
-   727 ?        00:00:00 firewalld
-   730 ?        00:00:00 ModemManager
-   736 ?        00:00:00 abrtd
-   754 ?        00:00:00 polkitd
-   756 ?        00:00:00 chronyd
-   764 ?        00:00:00 abrt-dump-journ
-   765 ?        00:00:00 abrt-dump-journ
-   775 ?        00:00:00 NetworkManager
-   794 ?        00:00:00 atd
-   795 ?        00:00:00 crond
-   992 ?        00:00:00 gdm
-  1014 ?        00:00:00 gdm-session-wor
-  1049 ?        00:00:00 systemd
-  1058 ?        00:00:00 (sd-pam)
-  1063 tty1     00:00:00 gdm-x-session
-  1068 tty1     00:00:00 Xorg
-  1099 ?        00:00:00 dhclient
-  1142 ?        00:00:00 dbus-daemon
-  1145 tty1     00:00:00 gnome-session-b
-  1149 ?        00:00:00 at-spi-bus-laun
-  1154 ?        00:00:00 dbus-daemon
-  1157 ?        00:00:00 at-spi2-registr
-  1184 tty1     00:00:04 gnome-shell
-  1191 ?        00:00:00 upowerd
-  1217 ?        00:00:00 pulseaudio
-  1239 ?        00:00:00 xdg-permission-
-  1244 tty1     00:00:00 ibus-daemon
-  1248 tty1     00:00:00 ibus-dconf
-  1251 tty1     00:00:00 ibus-x11
-  1253 ?        00:00:00 ibus-portal
-  1272 ?        00:00:00 wpa_supplicant
-  1273 ?        00:00:00 packagekitd
-  1279 tty1     00:00:00 gsd-wacom
-  1281 tty1     00:00:00 gsd-xsettings
-  1282 tty1     00:00:00 gsd-a11y-keyboa
-  1283 tty1     00:00:00 gsd-a11y-settin
-  1284 tty1     00:00:00 gsd-clipboard
-  1285 tty1     00:00:00 gsd-color
-  1291 tty1     00:00:00 gsd-datetime
-  1293 tty1     00:00:00 gsd-housekeepin
-  1298 tty1     00:00:00 gsd-keyboard
-  1301 tty1     00:00:00 gsd-media-keys
-  1305 tty1     00:00:00 gsd-mouse
-  1306 tty1     00:00:00 gsd-power
-  1309 tty1     00:00:00 gsd-print-notif
-  1313 tty1     00:00:00 gsd-rfkill
-  1317 tty1     00:00:00 gsd-screensaver
-  1322 tty1     00:00:00 gsd-sharing
-  1327 tty1     00:00:00 gsd-smartcard
-  1330 tty1     00:00:00 gsd-sound
-  1347 ?        00:00:00 colord
-  1377 tty1     00:00:00 ibus-engine-sim
-  1427 ?        00:00:00 gdm-session-wor
-  1438 ?        00:00:00 systemd
-  1443 ?        00:00:00 (sd-pam)
-  1452 ?        00:00:00 gnome-keyring-d
-  1456 tty2     00:00:00 gdm-x-session
-  1460 tty2     00:00:55 Xorg
-  1479 ?        00:00:01 dbus-daemon
-  1484 tty2     00:00:00 gnome-session-b
-  1529 ?        00:00:00 at-spi-bus-laun
-  1534 ?        00:00:00 dbus-daemon
-  1538 ?        00:00:00 at-spi2-registr
-  1549 ?        00:00:00 gvfsd
-  1554 ?        00:00:00 gvfsd-fuse
-  1575 tty2     00:03:50 gnome-shell
-  1584 ?        00:00:00 pulseaudio
-  1603 ?        00:00:00 xdg-permission-
-  1605 ?        00:00:00 gnome-shell-cal
-  1609 tty2     00:00:00 ibus-daemon
-  1614 tty2     00:00:00 ibus-dconf
-  1616 tty2     00:00:00 ibus-x11
-  1618 ?        00:00:00 ibus-portal
-  1632 ?        00:00:00 geoclue
-  1641 ?        00:00:00 evolution-sourc
-  1649 ?        00:00:00 mission-control
-  1652 ?        00:00:00 gvfs-udisks2-vo
-  1657 ?        00:00:01 udisksd
-  1665 ?        00:00:01 goa-daemon
-  1676 ?        00:00:00 dconf-service
-  1692 ?        00:00:00 goa-identity-se
-  1693 ?        00:00:00 gvfsd-metadata
-  1715 ?        00:00:00 evolution-calen
-  1725 ?        00:00:00 gvfs-mtp-volume
-  1729 ?        00:00:00 gvfs-gphoto2-vo
-  1733 ?        00:00:00 gvfs-afc-volume
-  1739 ?        00:00:00 gvfs-goa-volume
-  1748 ?        00:00:00 evolution-calen
-  1751 tty2     00:00:00 gsd-sound
-  1752 tty2     00:00:00 gsd-wacom
-  1755 tty2     00:00:00 gsd-xsettings
-  1760 tty2     00:00:00 gsd-a11y-keyboa
-  1762 tty2     00:00:00 gsd-a11y-settin
-  1766 tty2     00:00:00 gsd-clipboard
-  1776 tty2     00:00:00 gsd-color
-  1780 tty2     00:00:00 gsd-datetime
-  1796 tty2     00:00:00 gsd-housekeepin
-  1798 tty2     00:00:00 gsd-keyboard
-  1801 tty2     00:00:00 gsd-media-keys
-  1806 tty2     00:00:00 gsd-mouse
-  1808 ?        00:00:00 evolution-calen
-  1809 tty2     00:00:00 gsd-power
-  1813 tty2     00:00:00 gsd-print-notif
-  1814 tty2     00:00:00 gsd-rfkill
-  1816 tty2     00:00:00 gsd-screensaver
-  1818 tty2     00:00:00 gsd-sharing
-  1821 tty2     00:00:00 gsd-smartcard
-  1857 ?        00:00:00 cupsd
-  1879 ?        00:00:00 evolution-addre
-  1880 tty2     00:00:00 seapplet
-  1890 ?        00:00:00 evolution-calen
-  1893 tty2     00:00:01 tracker-miner-f
-  1898 tty2     00:00:01 gnome-software
-  1904 tty2     00:00:01 kdeconnectd
-  1921 tty2     00:00:00 tracker-miner-a
-  1933 ?        00:00:00 evolution-addre
-  1936 tty2     00:00:00 zeitgeist-datah
-  1947 tty2     00:00:00 abrt-applet
-  1951 tty2     00:00:00 gsd-disk-utilit
-  1965 ?        00:00:00 tracker-store
-  1967 ?        00:00:00 zeitgeist-daemo
-  1988 tty2     00:00:00 tracker-extract
-  1993 ?        00:00:00 zeitgeist-fts
-  2034 ?        00:00:00 abrt-dbus
-  2043 tty2     00:00:00 gsd-printer
-  2090 tty2     00:00:00 ibus-engine-sim
-  2170 ?        00:00:00 fwupd
-  2240 ?        00:00:00 evolution-calen
-  2362 tty2     00:00:00 sshfs
-  2366 pts/0    00:00:00 ssh
-  2523 ?        00:00:00 gconfd-2
-  2668 ?        00:00:00 xdg-document-po
-  2683 ?        00:00:00 flatpak-session
-  2705 ?        00:00:00 xdg-desktop-por
-  2710 ?        00:00:00 xdg-desktop-por
-  2749 ?        00:00:00 gvfsd-trash
-  2837 tty2     00:00:00 playonlinux
-  2838 tty2     00:00:00 bash
-  2863 tty2     00:00:36 python
-  3370 tty2     00:00:00 bash <defunct>
-  3520 tty2     00:00:00 bash
-  3521 tty2     00:00:00 grep
-  3522 tty2     00:00:00 tee
-  3523 tty2     00:00:00 bash
-  3524 tty2     00:00:00 tee
-  3527 ?        00:04:03 wineserver
-  3533 ?        00:00:00 services.exe
-  3536 ?        00:00:00 winedevice.exe
-  3545 ?        00:00:00 plugplay.exe
-  3551 ?        00:00:00 winedevice.exe
-  3559 ?        00:00:00 explorer.exe
-  3568 ?        00:54:47 Battle.net.exe
-  3613 ?        00:03:47 Agent.exe
-  3616 ?        00:00:00 wineconsole
-  3768 ?        00:00:38 Battle.net Help
-  3955 ?        00:00:00 kworker/0:1
-  3957 ?        00:00:00 kworker/u8:2
-  3964 ?        00:00:00 kworker/3:1
-  3974 ?        00:00:00 kworker/u8:0
-  4018 ?        00:00:00 kworker/3:2
-  4019 ?        00:00:00 kworker/1:1
-  4082 tty2     00:03:40 firefox
-  4153 tty2     00:02:30 Web Content
-  4263 tty2     00:00:00 chrome-gnome-sh
-  4513 ?        00:00:00 kworker/u8:4
-  4579 ?        00:00:00 gnome-terminal-
-  4585 pts/1    00:00:00 bash
-  4643 ?        00:00:00 kworker/3:0
-  4832 ?        00:00:00 kworker/1:0
-  4849 pts/2    00:00:00 bash
-  4888 pts/2    00:00:00 ps


As for cron jobs:

-rw-r--r--. 1 root root   0 ago  2 22:32 /etc/cron.deny
-rw-r--r--. 1 root root 451 jul 26 08:43 /etc/crontab

/etc/cron.d:
total 8
-rw-r--r--. 1 root root 128 ago  2 22:32 0hourly
-rw-r--r--. 1 root root 108 ago  4 04:02 raid-check

/etc/cron.daily:
total 4
-rwxr-xr-x. 1 root root 189 abr 27  2017 logrotate

/etc/cron.hourly:
total 4
-rwxr-xr-x. 1 root root 575 ago  2 22:32 0anacron

/etc/cron.monthly:
total 0

/etc/cron.weekly:
total 4
-rwxr-xr-x. 1 root root 603 ago  5 09:37 98-zfs-fuse-scrub

@alexlarsson
Copy link
Member

I believe on newer systems this is handled by systemd-tmpfiles. Do you have anything in /etc/tmpfiles.d ?

@alexlarsson
Copy link
Member

On fedora this seems to be in /usr/lib/tmpfiles.d/tmp.conf

@alexlarsson
Copy link
Member

@poettering does this line in /usr/lib/tmpfiles.d/x11.conf

d /tmp/.X11-unix 1777 root root 10d

Mean that the sockets in /tmp/.X11-unix are deleted after 10 days even if the xserver is running? That doesn't seem to be happening to me, but some people are seeing it.

@poettering
Copy link

@alexlarsson We have code in tmpfiles that explicitly checks /proc/net/unix before we remove any AF_UNIX device nodes:

https://github.com/systemd/systemd/blob/master/src/tmpfiles/tmpfiles.c#L376

Of course, strictly speaking this is racy, but this is unlikely to be an issue IRL. At least I never heard of that.

Hence, yes, the "10d" will cause aging, but /proc/net/unix should exclude it from that.

Note that this logic is easily confused though: if you create an AF_UNIX node, and then rename it, then /proc/net/unix will show the old name, and hence the new name might be aged out by tmpfiles. Hence, doing "atomic" prepare-and-rename stuff with AF_UNIX is not gonna work.

@rockhazard
Copy link

I'm running Linux Mint 19.1 and this is still happening. I don't have tmpwatch installed, nor do I have anything in /etc/tmpfiles.d. I have no cron jobs running that should wipe /tmp. This problem didn't happen for me on Linux Mint 18.3.

@torpak
Copy link

torpak commented Apr 16, 2019

It also doesn't happen with any other X program i know about.

@alexlarsson
Copy link
Member

@torpak non-flatpak apps typically use the X11 abstract socket name which is not tmp-cleaned. Unfortunately that doesn't work for flatpak due to how network namespaces work, so flatpaked apps use the real on-filesystem socket.

@refi64
Copy link
Collaborator

refi64 commented Mar 20, 2020

I just randomly saw this on a non-NVIDIA, mostly vanilla Fedora 31 Silverblue system. It's only been booted for around an hour or two, so I doubt tmpfiles ran...

Unfortunately that doesn't work for flatpak due to how network namespaces work, so flatpaked apps use the real on-filesystem socket.

Out of curiosity, could an socat-like approach work here? E.g. forward the abstract socket name to a socket path that's private to a Flatpak and then redirect that one inside?

@smcv
Copy link
Collaborator

smcv commented Apr 6, 2022

This seems like the same issue as #4702. If that's the case, then it should be fixed by flatpak 1.12.7 (and 1.13.1), to the extent that it can be fixed at all.

If the app has --share=network, flatpak 1.12.7 will log something like this:

F: X11 socket /tmp/.X11-unix/X1 does not exist in filesystem, trying to use abstract socket instead.

and the app should continue to work.

If the app does not have --share=network, flatpak 1.12.7 will log something like this:

F: X11 socket /tmp/.X11-unix/X1 does not exist in filesystem.
F: X11 access will require --share=network permission.

and the app will not work.

Because abstract sockets are part of the network namespace, apps without --share=network cannot make use of them: this is part of how the kernel works, and so is basically "won't fix" for Flatpak.

Out of curiosity, could an socat-like approach work here? E.g. forward the abstract socket name to a socket path that's private to a Flatpak and then redirect that one inside?

This would technically be implementable, but would be quite a lot of code to support something that is arguably already a broken system. More code means more bugs, so the Flatpak maintainers are not particularly keen to implement this.

@smcv
Copy link
Collaborator

smcv commented Apr 6, 2022

Proxying the socket (a socat-like approach) was discussed on #4706 but the conclusion was that we shouldn't.

@ermshiperete
Copy link

Unfortunately this doesn't seem to be fixed by 1.12.7 - I'm running 1.12.7 and still getting this issue. It doesn't log the error line (or at least I can't find it), but the app still doesn't start if /tmp/.X11-unix is missing. Explicitly specifying --share=network doesn't help.

@smcv
Copy link
Collaborator

smcv commented Jul 14, 2023

@ermshiperete: Please try running it as flatpak -vv run so that you get verbose/debug output.

the app still doesn't start if /tmp/.X11-unix is missing

Do you mean "if /tmp/.X11-unix/X1 is missing", or "if the whole /tmp/.X11-unix directory is missing"? (Not necessarily the same!)

@ermshiperete
Copy link

ermshiperete commented Jul 14, 2023

The whole /tmp/.X11-unix folder was missing.

I tried running with -vv - that showed log messages but didn't show anything after the script for starting the app started - it just silently quits.

Hmm, maybe that particular log message was in the log messages before starting the app? I didn't explicitly search for that. I'll try that next time it's happening - I rebooted and so currently don't have the problem.

By the way, I don't have a /tmp/.X11-unix/X1 folder - I have /tmp/.X11-unix/X0 as well as /tmp/.X11-unix/X1024 and /tmp/.X11-unix/X1025 (with X0 owned by my user, X1024 and X1025 owned by gdm).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants