Debian

systemd 等待設備 dev-mapper-vg 超時

  • February 22, 2020

我有一個 Debian Jessie 系統,我正在嘗試使用 LVM 將其恢復到 RAID 1 上。

我有一個超過兩個 2TB NVMe 驅動器的 RAID1,我的 /boot 是在一個以傳統模式引導到 Grub2 的 USB 上。那一點有效,當核心嘗試掛載 /home 時它超時並且我收到此錯誤;

    : Dec 12 15:33:34 ltsp systemd[1]: Job dev-mapper-vg\x2dhome.device/start timed out.
    : Dec 12 15:33:34 ltsp systemd[1]: Timed out waiting for device dev-mapper-vg\x2dhome.device.
    : -- Subject: Unit dev-mapper-vg\x2dhome.device has failed
    : -- Defined-By: systemd
    : -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    : -- 
    : -- Unit dev-mapper-vg\x2dhome.device has failed.
    : -- 
    : -- The result is timeout.
    : Dec 12 15:33:34 ltsp systemd[1]: Dependency failed for /home.
    : -- Subject: Unit home.mount has failed
    : -- Defined-By: systemd
    : -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    : -- 
    : -- Unit home.mount has failed.
    : -- 
    : -- The result is dependency.
    : Dec 12 15:33:34 ltsp systemd[1]: Dependency failed for Local File Systems.
    : -- Subject: Unit local-fs.target has failed
    : -- Defined-By: systemd
    : -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    : -- 
    : -- Unit local-fs.target has failed.
    : -- 
    : -- The result is dependency.
    : Dec 12 15:33:34 ltsp systemd[1]: Triggering OnFailure= dependencies of local-fs.target.
    : Dec 12 15:33:34 ltsp systemd[1]: Dependency failed for File System Check on /dev/mapper/vg-home.
    : -- Subject: Unit systemd-fsck@dev-mapper-vg\x2dhome.service has failed
    : -- Defined-By: systemd
    : -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
    : -- 
    : -- Unit systemd-fsck@dev-mapper-vg\x2dhome.service has failed.

然後我被丟在緊急控制台。

我用 blkid 檢查了 UUID,它們是相同的;

/etc/fstab

/dev/mapper/vg-root /               ext4    noatime,errors=remount-ro 0 1
UUID=d276a0d4-c95f-4792-a222-6d1451899de2 /home ext4    noatime,errors=remount-ro 0 1
UUID=4308b9dd-3319-47f4-b303-1bfdd928c25e  /boot  ext4  noatime,errors=remount-ro 0 2

將 root 密碼輸入緊急控制台後,我可以看到 /home 已安裝。

為什麼啟動時會失敗?

更新

root@ltsp:/# sudo systemctl status dev-mapper-vg\\x2home.device
● dev-mapper-vg\x2home.device
  Loaded: loaded
  Active: inactive (dead)

我有類似的問題,但沒有找到任何合適的解決方案。我只能給出一些解決方法:

為要掛載的每個卷創建單元文件。例如

[Unit]
Description=Start home

[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/mount /dev/mapper/vg-home
ExecStop=/bin/umount /dev/mapper/vg-home

[Install]
WantedBy=local-fs.target

或者x-systemd.device-timeout為您的 fstab 掛載規則添加選項。例如

UUID=d276a0d4-c95f-4792-a222-6d1451899de2 /home ext4    noatime,x-systemd.device-timeout=60s,errors=remount-ro 0 1

這將給 systemd 一些時間來完成這項工作。

OpenSuse設備的官方解決方法在啟動時超時,但稍後出現

編輯:

您也可以玩弄:

[Install]
WantedBy=dev-mapper-vg\x2dhome.device

用於觸發單元文件。

要獲得轉義路徑,請使用systemd-escape

引用自:https://unix.stackexchange.com/questions/556819