インストールされているデバイスの注文サイクルの問題を解決するには?

インストールされているデバイスの注文サイクルの問題を解決するには?

Systemd-analyzeは、実行回数に応じて次Systemd-analyze verify mnt-HDDs.mountのような結果を得ます。

local-fs.target: Found ordering cycle on HDDs-unlock.service/start
local-fs.target: Found dependency on sysinit.target/start
local-fs.target: Found dependency on systemd-update-done.service/start
local-fs.target: Found dependency on local-fs.target/start
local-fs.target: Job systemd-update-done.service/start deleted to break ordering cycle starting with local-fs.target/start
local-fs.target: Found ordering cycle on HDDs-unlock.service/start
local-fs.target: Found dependency on sysinit.target/start
local-fs.target: Found dependency on systemd-journal-catalog-update.service/start
local-fs.target: Found dependency on local-fs.target/start
local-fs.target: Job systemd-journal-catalog-update.service/start deleted to break ordering cycle starting with local-fs.target/start
local-fs.target: Found ordering cycle on HDDs-unlock.service/start
local-fs.target: Found dependency on sysinit.target/start
local-fs.target: Found dependency on systemd-machine-id-commit.service/start
local-fs.target: Found dependency on local-fs.target/start
local-fs.target: Job systemd-machine-id-commit.service/start deleted to break ordering cycle starting with local-fs.target/start
local-fs.target: Found ordering cycle on HDDs-unlock.service/start
local-fs.target: Found dependency on sysinit.target/start
local-fs.target: Found dependency on local-fs.target/start
local-fs.target: Job local-fs.target/start deleted to break ordering cycle starting with local-fs.target/start
sysinit.target: Found ordering cycle on plymouth-read-write.service/start
sysinit.target: Found dependency on local-fs.target/start
sysinit.target: Found dependency on mnt-HDDs.mount/start
sysinit.target: Found dependency on HDDs-unlock.service/start
sysinit.target: Found dependency on sysinit.target/start
sysinit.target: Job plymouth-read-write.service/start deleted to break ordering cycle starting with sysinit.target/start
sysinit.target: Found ordering cycle on local-fs.target/start
sysinit.target: Found dependency on mnt-HDDs.mount/start
sysinit.target: Found dependency on HDDs-unlock.service/start
sysinit.target: Found dependency on sysinit.target/start
sysinit.target: Job local-fs.target/start deleted to break ordering cycle starting with sysinit.target/start
sysinit.target: Found ordering cycle on systemd-update-done.service/start
sysinit.target: Found dependency on local-fs.target/start
sysinit.target: Found dependency on HDDs-unlock.service/start
sysinit.target: Found dependency on sysinit.target/start
sysinit.target: Job systemd-update-done.service/start deleted to break ordering cycle starting with sysinit.target/start
sysinit.target: Found ordering cycle on systemd-machine-id-commit.service/start
sysinit.target: Found dependency on local-fs.target/start
sysinit.target: Found dependency on HDDs-unlock.service/start
sysinit.target: Found dependency on sysinit.target/start
sysinit.target: Job systemd-machine-id-commit.service/start deleted to break ordering cycle starting with sysinit.target/start
sysinit.target: Found ordering cycle on systemd-tmpfiles-setup.service/start
sysinit.target: Found dependency on local-fs.target/start
sysinit.target: Found dependency on HDDs-unlock.service/start
sysinit.target: Found dependency on sysinit.target/start
sysinit.target: Job systemd-tmpfiles-setup.service/start deleted to break ordering cycle starting with sysinit.target/start
sysinit.target: Found ordering cycle on plymouth-read-write.service/start
sysinit.target: Found dependency on local-fs.target/start
sysinit.target: Found dependency on HDDs-unlock.service/start
sysinit.target: Found dependency on sysinit.target/start
sysinit.target: Job plymouth-read-write.service/start deleted to break ordering cycle starting with sysinit.target/start
sysinit.target: Found ordering cycle on local-fs.target/start
sysinit.target: Found dependency on HDDs-unlock.service/start
sysinit.target: Found dependency on sysinit.target/start
sysinit.target: Job local-fs.target/start deleted to break ordering cycle starting with sysinit.target/start

mnt-HDDs.mountは作成されたデバイスに直接関連付けられます。

mnt-HDD.マウント:

[Unit]
Description=Mount unit for encripted device /mnt/HDDs
After=HDDs-unlock.service

[Mount]
Where=/mnt/HDDs
What=/dev/mapper/cryptHDDB
Type=btrfs
Options=noatime,compress-force=zstd,autodefrag,flushoncommit

HDDロック解除。サービス

[Unit]
Description=HDDB and HDDC unlock
After=media-key.mount umount.target local-fs-pre.target
Before=local-fs.target
Conflicts=umount.target

[Service]
Type=oneshot
RemainAfterExit=yes
KillMode=none
ExecStart=/usr/bin/HDDs-unlock.sh
ExecStop=/usr/bin/HDDs-lock.sh

[Install]
RequiredBy=mnt-HDDs.mount

メディアキー、マウント

[Unit]
Description=HDDs key
StopWhenUnneeded=true

[Mount]
Where=/media/key
What=/dev/disk/by-id/usb-SMI_USB_DISK_AA00000000065845-0:0
Options=ro,offset=952320
DirectoryMode=0400

[Install]
RequiredBy=HDDs-unlock.service

解決策を見つけるために再起動したときに、起動が特定のサービスをスキップし、時にはネットワークなしで起動する自動依存呼び出しを介してインストールされるfstab項目があります。この注文サイクルを修正することについて考えていますか?/mnt/HDDs/@mnt-HDDs.mount

答え1

いいですね。多くの検索を経て(複数回再訪した後)これStackExchangeの答え)は、私が直面しているのと同じ問題に対する答えと考えられています。

デフォルトでは、マウント単位はlocal-fs-pre.targeとlocal-fs.targetの間で暗黙的に発生します。あります。解決策は、デフォルトの依存関係を無効にすることです。

[Unit]
....
DefaultDependencies=no
....

関連情報