起初,我的机器在关闭时发出以下消息。
Job usere1000.service/stop running (59s / no Limit): User job app-gnome-yandexx2ddisk-1908.scope/stop running (58s / no limit)...
然后我设置的KillUserProcesses=yes
是/etc/systemd/logind.conf
. 现在机器先关机但报错
Failed unmounting media-ismail-SSDWorking.mount - /media/ismail/SSDWorking.
顺便提一下,我Yandex.Disk
通过守护进程进行的同步位于此 SSD (/media/ismail/SSDWorking) 中,该 SSD 之前已发出消息。
也许是因为我的系统在卸载之前没有杀死进程(我不确定)。
更新1:
我发现/run/systemd/generator/media-ismail-SSDWorking.mount
有以下内容:
# Automatically generated by systemd-fstab-generator
[Unit]
Documentation=man:fstab(5) man:systemd-fstab-generator(8)
SourcePath=/etc/fstab
After=blockdev@dev-disk-by\x2dlabel-SSDWorking.target
[Mount]
What=/dev/disk/by-label/SSDWorking
Where=/media/ismail/SSDWorking
Options=nosuid,nodev,nofail,x-gvfs-show
我想如果我可以添加app-gnome-yandexx2ddisk-1908.scope
viaAfter=
用于systemd-fstab-generator
卸载那么它可能会解决问题。
更新2:
$ systemd-umount /dev/sda1
$ journalctl -xe
A stop job for unit media-ismail-SSDWorking.mount has begun execution.
░░
░░ The job identifier is 3897.
Jul 07 12:38:22 debian-i5 umount[10089]: umount: /media/ismail/SSDWorking: target is busy.
Jul 07 12:38:22 debian-i5 systemd[1]: media-ismail-SSDWorking.mount: Mount process exited, code=exited, status=32/n/a
░░ Subject: Unit process exited
░░ Defined-By: systemd
░░ Support: https://www.debian.org/support
░░
░░ An n/a= process belonging to unit media-ismail-SSDWorking.mount has exited.
░░
░░ The process' exit code is 'exited' and its exit status is 32.
Jul 07 12:38:22 debian-i5 systemd[1]: Failed unmounting media-ismail-SSDWorking.mount - /media/ismail/SSDWorking.
░░ Subject: A stop job for unit media-ismail-SSDWorking.mount has finished
░░
░░ The job identifier is 3897 and the job result is failed.
更新3:
如果我运行yandex-disk stop
,那么systemd-mount /dev/sda1
它就会卸载。所以问题是,系统yandex-disk
在尝试卸载之前没有停止。
更新4:
我已经运行了以下命令:
sudo tee /etc/systemd/system/run-before-shutdown.service << END
[Unit]
Description=Run my custom task at shutdown
Requires=network.target
DefaultDependencies=no
Before=reboot.target shutdown.target
[Service]
Type=oneshot
User=ismail
Group=ismail
ExecStart=/bin/true
ExecStop=/usr/bin/bash -c '/usr/bin/yandex-disk stop'
RemainAfterExit=yes
[Install]
WantedBy=multi-user.target
END
sudo systemctl daemon-reload
sudo systemctl start run-before-shutdown.service
sudo systemctl enable run-before-shutdown.service
仍然出现错误:
Failed unmounting media-ismail-SSDWorking.mount - /media/ismail/SSDWorking.
在这里。我将 yandex-disk 引入 systemd 后问题得到解决。