Race condition in mounting /tmp at boot

Bug #1891858 reported by Panther
This bug report is a duplicate of:  Bug #1891867: zfs not correctly imported at boot. Edit Remove
8
This bug affects 1 person
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=aes-xts-plain64,size=256,tmp,discard
and mounted via an fstab entry
  /dev/mapper/vol-tmp_crypt /tmp ext2 defaults 0 2
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-cryptsetup@vol\x2dtmp_crypt.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on systemd-random-seed.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-mount.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import.target/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import-cache.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on cryptsetup.target/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Job systemd-cryptsetup@vol\x2dtmp_crypt.service/start deleted to break ordering cyc>
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-cryptsetup@vol\x2dtmp_crypt.service: Found ordering cycle on systemd-random-seed.service/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on zfs-mount.service/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on zfs-import.target/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on zfs-import-cache.service/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on cryptsetup.target/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on systemd-cryptsetup@vol\x2dtmp_crypt.>
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Job systemd-random-seed.service/start deleted to break or>
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found ordering cycle on systemd-random-seed.service/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on zfs-mount.service/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on zfs-import.target/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on zfs-import-cache.service/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on cryptsetup.target/start
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Found dependency on systemd-cryptsetup@vol\x2dtmp_crypt.>
Aug 17 07:11:02 hostname systemd[1]: systemd-cryptsetup@vol\x2dtmp_crypt.service: Job cryptsetup.target/start deleted to break ordering cyc>
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found ordering cycle on systemd-cryptsetup@vol\x2dtmp_crypt.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on systemd-random-seed.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-mount.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import.target/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on zfs-import-cache.service/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Found dependency on cryptsetup.target/start
Aug 17 07:11:02 hostname systemd[1]: cryptsetup.target: Job systemd-cryptsetup@vol\x2dtmp_crypt.service/start deleted to break ordering cyc>
###############
Only in a unsuccessful boot up i see:
Aug 17 07:11:02 hostname systemd[1]: Reached target Block Device Preparation for /dev/mapper/vol-tmp_crypt.
Aug 17 07:11:02 hostname systemd[1]: Stopped target Block Device Preparation for /dev/mapper/vol-tmp_crypt.
[...]
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-hierarchy=hybrid

Revision history for this message
Panther (panther-physik) wrote :

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
tmpfs /tmp tmpfs mode=1777,strictatime,nosuid,nodev,size=4G

Revision history for this message
Dan Streetman (ddstreet) wrote :

I'm going to mark this as a dup of your other bug 1891867, but if you really think this isn't the same as that one, please feel free to comment in this bug.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.