Race condition in mounting /tmp at boot
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
systemd (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
I have configured a separate /tmp partition, which is a LVM volume and create at boot via an /etc/crypttab entry
vol-tmp_crypt /dev/mapper/vol-tmp /dev/urandom cipher=
and mounted via an fstab entry
/dev/
At about every third boot /tmp is not mounted and then gnome-shell cannot start, because it is not allowed to write in not mounted /tmp directory. One or two restart are required to fix this problem.
###############
Independent of the success of the boot process, the log message related to the problem seem to be:
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found ordering cycle on systemd-
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on systemd-
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-mount.
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import.
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import-
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on cryptsetup.
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Job systemd-
Aug 17 07:11:02 hostname systemd[1]: Unnecessary job for /dev/mapper/vol-tmp was removed.
[...]
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: systemd-
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found ordering cycle on systemd-
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on systemd-
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-mount.
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import.
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import-
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on cryptsetup.
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Job systemd-
###############
Only in a unsuccessful boot up i see:
Aug 17 07:11:02 hostname systemd[1]: Reached target Block Device Preparation for /dev/mapper/
Aug 17 07:11:02 hostname systemd[1]: Stopped target Block Device Preparation for /dev/mapper/
[...]
Aug 17 07:11:17 hostname gnome-shell[3387]: failed to create lock file /tmp/.X1071-lock: Permission denied
Aug 17 07:11:17 hostname gnome-shell[3387]: failed to create lock file /tmp/.X1072-lock: Permission denied
Aug 17 07:11:17 hostname gnome-shell[3387]: failed to create lock file /tmp/.X1073-lock: Permission denied
Aug 17 07:11:17 hostname gnome-shell[3387]: Failed to create an X lock file
Aug 17 07:11:17 hostname gnome-shell[3387]: Failed to start X Wayland
###############
I am running an up-to-date 20.04 on amd64
with uname -a:
Linux hostname 5.4.0-40-generic #44-Ubuntu SMP Tue Jun 23 00:01:04 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
and systemd --version:
systemd 245 (245.4-4ubuntu3.2)
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-
Even with around 15000 PassMark CPU Points the race to the mounting of /tmp is unreliable. I switched to a memory based /tmp. I removed the mentioned lines from /etc/crypttab and /etc/fstab and added strictatime, nosuid, nodev,size= 4G
tmpfs /tmp tmpfs mode=1777,