You are not logged in.

#1 2019-05-22 01:43:20

cowile
Member
Registered: 2019-05-01
Posts: 15

[SOLVED] Systemd .mount unit times out after disk is unplugged...

I have an encrypted boot partition on a usb disk with an fstab entry for which systemd generates a mount unit.

This unit works as expected, but if I ever unplug the disk and plug it back in, the mount unit fails. For some reason, the disk it depends on times out even though I can successfully mount it manually with mount.

Here is the tail of journalctl:

May 21 19:58:31 HOST systemd[1]: Timed out waiting for device /dev/disk/by-uuid/3d31adff-543c-4b53-a0a9-cbaa8901bc60.
-- Subject: A start job for unit dev-disk-by\x2duuid-3d31adff\x2d543c\x2d4b53\x2da0a9\x2dcbaa8901bc60.device has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit dev-disk-by\x2duuid-3d31adff\x2d543c\x2d4b53\x2da0a9\x2dcbaa8901bc60.device has finished with a failure.
-- 
-- The job identifier is 624 and the job result is timeout.
May 21 19:58:31 HOST systemd[1]: Dependency failed for /boot.
-- Subject: A start job for unit boot.mount has failed
-- Defined-By: systemd
-- Support: https://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- A start job for unit boot.mount has finished with a failure.
-- 
-- The job identifier is 620 and the job result is dependency.
May 21 19:58:31 HOST systemd[1]: boot.mount: Job boot.mount/start failed with result 'dependency'.
May 21 19:58:31 HOST systemd[1]: dev-disk-by\x2duuid-3d31adff\x2d543c\x2d4b53\x2da0a9\x2dcbaa8901bc60.device: Job dev-disk-by\x2duuid-3d31adff\x2d543c\x2d4b53\x2da0a9\x2dcbaa8901bc60.device/start failed with result 'timeout'.
May 21 19:58:31 HOST sudo[3589]: pam_unix(sudo:session): session closed for user root

systemctl show boot.mount:

Where=/boot
What=/dev/disk/by-uuid/3d31adff-543c-4b53-a0a9-cbaa8901bc60
Options=rw,relatime,space_cache,subvolid=5,subvol=/
Type=btrfs
TimeoutUSec=1min 30s
ControlPID=0
DirectoryMode=0755
SloppyOptions=no
LazyUnmount=no
ForceUnmount=no
Result=success
UID=[not set]
GID=[not set]
ExecMount={ path=/usr/bin/mount ; argv[]=/usr/bin/mount /dev/disk/by-uuid/3d31adff-543c-4b53-a0a9-cbaa8901bc60 /boot -t btrfs -o rw,relatime,space_cache,subvolid=5,subvol=/ ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }
ExecUnmount={ path=/usr/bin/umount ; argv[]=/usr/bin/umount /boot -c ; ignore_errors=no ; start_time=[n/a] ; stop_time=[n/a] ; pid=0 ; code=(null) ; status=0/0 }
Slice=system.slice
MemoryCurrent=[not set]
CPUUsageNSec=[not set]
TasksCurrent=[not set]
IPIngressBytes=[no data]
IPIngressPackets=[no data]
IPEgressBytes=[no data]
IPEgressPackets=[no data]
Delegate=no
CPUAccounting=no
CPUWeight=[not set]
StartupCPUWeight=[not set]
CPUShares=[not set]
StartupCPUShares=[not set]
CPUQuotaPerSecUSec=infinity
CPUQuotaPeriodUSec=infinity
IOAccounting=no
IOWeight=[not set]
StartupIOWeight=[not set]
BlockIOAccounting=no
BlockIOWeight=[not set]
StartupBlockIOWeight=[not set]
MemoryAccounting=yes
MemoryMin=0
MemoryLow=0
MemoryHigh=infinity
MemoryMax=infinity
MemorySwapMax=infinity
MemoryLimit=infinity
DevicePolicy=auto
TasksAccounting=yes
TasksMax=4915
IPAccounting=no
UMask=0022
LimitCPU=infinity
LimitCPUSoft=infinity
LimitFSIZE=infinity
LimitFSIZESoft=infinity
LimitDATA=infinity
LimitDATASoft=infinity
LimitSTACK=infinity
LimitSTACKSoft=8388608
LimitCORE=infinity
LimitCORESoft=infinity
LimitRSS=infinity
LimitRSSSoft=infinity
LimitNOFILE=524288
LimitNOFILESoft=1024
LimitAS=infinity
LimitASSoft=infinity
LimitNPROC=63118
LimitNPROCSoft=63118
LimitMEMLOCK=65536
LimitMEMLOCKSoft=65536
LimitLOCKS=infinity
LimitLOCKSSoft=infinity
LimitSIGPENDING=63118
LimitSIGPENDINGSoft=63118
LimitMSGQUEUE=819200
LimitMSGQUEUESoft=819200
LimitNICE=0
LimitNICESoft=0
LimitRTPRIO=0
LimitRTPRIOSoft=0
LimitRTTIME=infinity
LimitRTTIMESoft=infinity
OOMScoreAdjust=0
Nice=0
IOSchedulingClass=0
IOSchedulingPriority=0
CPUSchedulingPolicy=0
CPUSchedulingPriority=0
TimerSlackNSec=50000
CPUSchedulingResetOnFork=no
NonBlocking=no
StandardInput=null
StandardInputData=
StandardOutput=journal
StandardError=inherit
TTYReset=no
TTYVHangup=no
TTYVTDisallocate=no
SyslogPriority=30
SyslogLevelPrefix=yes
SyslogLevel=6
SyslogFacility=3
LogLevelMax=-1
LogRateLimitIntervalUSec=0
LogRateLimitBurst=0
SecureBits=0
CapabilityBoundingSet=cap_chown cap_dac_override cap_dac_read_search cap_fowner cap_fsetid cap_kill cap_setgid cap_setuid cap_setpcap cap_linux_immutable cap_net_bind_service cap_net_broadcast cap_net_admin cap_net_raw cap_ipc_lock cap_ipc_owner cap_sys_module cap_sys_rawio cap_sys_chroot cap_sys_ptrace cap_sys_pacct cap_sys_admin cap_sys_boot cap_sys_nice cap_sys_resource cap_sys_time cap_sys_tty_config cap_mknod cap_lease cap_audit_write cap_audit_control cap_setfcap cap_mac_override cap_mac_admin cap_syslog cap_wake_alarm cap_block_suspend
AmbientCapabilities=
DynamicUser=no
RemoveIPC=no
MountFlags=
PrivateTmp=no
PrivateDevices=no
ProtectKernelTunables=no
ProtectKernelModules=no
ProtectControlGroups=no
PrivateNetwork=no
PrivateUsers=no
PrivateMounts=no
ProtectHome=no
ProtectSystem=no
SameProcessGroup=yes
UtmpMode=init
IgnoreSIGPIPE=yes
NoNewPrivileges=no
SystemCallErrorNumber=0
LockPersonality=no
RuntimeDirectoryPreserve=no
RuntimeDirectoryMode=0755
StateDirectoryMode=0755
CacheDirectoryMode=0755
LogsDirectoryMode=0755
ConfigurationDirectoryMode=0755
MemoryDenyWriteExecute=no
RestrictRealtime=no
RestrictSUIDSGID=no
RestrictNamespaces=no
MountAPIVFS=no
KeyringMode=shared
ProtectHostname=no
KillMode=control-group
KillSignal=15
FinalKillSignal=9
SendSIGKILL=yes
SendSIGHUP=no
WatchdogSignal=6
Id=boot.mount
Names=boot.mount
Requires=-.mount system.slice
BindsTo=dev-disk-by\x2duuid-3d31adff\x2d543c\x2d4b53\x2da0a9\x2dcbaa8901bc60.device
RequiredBy=local-fs.target boot-EFI.mount
Conflicts=umount.target
Before=umount.target boot-EFI.mount local-fs.target
After=-.mount local-fs-pre.target dev-disk-by\x2duuid-3d31adff\x2d543c\x2d4b53\x2da0a9\x2dcbaa8901bc60.device system.slice systemd-journald.socket
RequiresMountsFor=/ /dev/disk/by-uuid/3d31adff-543c-4b53-a0a9-cbaa8901bc60
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
Description=/boot
LoadState=loaded
ActiveState=inactive
SubState=dead
FragmentPath=/run/systemd/generator/boot.mount
SourcePath=/etc/fstab
UnitFileState=generated
UnitFilePreset=disabled
StateChangeTimestamp=Tue 2019-05-21 20:22:30 CDT
StateChangeTimestampMonotonic=1737707691
InactiveExitTimestamp=Tue 2019-05-21 20:22:24 CDT
InactiveExitTimestampMonotonic=1731090868
ActiveEnterTimestamp=Tue 2019-05-21 20:22:24 CDT
ActiveEnterTimestampMonotonic=1731090868
ActiveExitTimestamp=Tue 2019-05-21 20:22:30 CDT
ActiveExitTimestampMonotonic=1737707691
InactiveEnterTimestamp=Tue 2019-05-21 20:22:30 CDT
InactiveEnterTimestampMonotonic=1737707691
CanStart=yes
CanStop=yes
CanReload=yes
CanIsolate=no
StopWhenUnneeded=no
RefuseManualStart=no
RefuseManualStop=no
AllowIsolate=no
DefaultDependencies=yes
OnFailureJobMode=replace
IgnoreOnIsolate=yes
NeedDaemonReload=no
JobTimeoutUSec=infinity
JobRunningTimeoutUSec=infinity
JobTimeoutAction=none
ConditionResult=yes
AssertResult=yes
ConditionTimestamp=Tue 2019-05-21 19:56:11 CDT
ConditionTimestampMonotonic=158319124
AssertTimestamp=Tue 2019-05-21 19:56:11 CDT
AssertTimestampMonotonic=158319124
Transient=no
Perpetual=no
StartLimitIntervalUSec=10s
StartLimitBurst=5
StartLimitAction=none
FailureAction=none
SuccessAction=none
InvocationID=d2d603e2c42b470582c66b8e8fddc55f
CollectMode=inactive

Last edited by cowile (2019-05-23 18:23:16)


The Linux motto is "Laugh in the face of danger." Oops, wrong one. "Do it yourself." Yes, that's it. -- Linus Torvalds

Offline

#2 2019-05-22 15:29:27

Zod
Member
From: Hoosiertucky
Registered: 2019-03-10
Posts: 630

Re: [SOLVED] Systemd .mount unit times out after disk is unplugged...

Have a look at this...

https://bbs.archlinux.org/viewtopic.php?id=196083

The jist, I think, is that the system timed out trying to mount a non-existent disk listed in either...

/etc/fstab

/etc/crypttab

Offline

#3 2019-05-23 16:27:29

cowile
Member
Registered: 2019-05-01
Posts: 15

Re: [SOLVED] Systemd .mount unit times out after disk is unplugged...

Zod wrote:

Have a look at this...

https://bbs.archlinux.org/viewtopic.php?id=196083

The jist, I think, is that the system timed out trying to mount a non-existent disk listed in either...

/etc/fstab

/etc/crypttab

That is true, and an oversight on my part. The device I wanted is on a LUKS partition, and I had assumed the systemd job would automatically use crypttab to decrypt it before mounting.

The mount is successful if I run systemctl start systemd-cryptsetup@boot_crypt first.

Is there a way to specify that dependency to systemd from fstab? I will research this later.


The Linux motto is "Laugh in the face of danger." Oops, wrong one. "Do it yourself." Yes, that's it. -- Linus Torvalds

Offline

#4 2019-05-23 16:33:41

loqs
Member
Registered: 2014-03-06
Posts: 17,513

Re: [SOLVED] Systemd .mount unit times out after disk is unplugged...

Possibly x-systemd.requires=systemd-cryptsetup@boot_crypt.service see man 5 systemd.mount.

Offline

#5 2019-05-23 18:22:14

cowile
Member
Registered: 2019-05-01
Posts: 15

Re: [SOLVED] Systemd .mount unit times out after disk is unplugged...

loqs wrote:

Possibly x-systemd.requires=systemd-cryptsetup@boot_crypt.service see man 5 systemd.mount.


That did it! Will mark solved.


The Linux motto is "Laugh in the face of danger." Oops, wrong one. "Do it yourself." Yes, that's it. -- Linus Torvalds

Offline

Board footer

Powered by FluxBB