cryptsetup.target 的依赖项作业失败。请参阅“journalctl -xe”了解详细信息

cryptsetup.target 的依赖项作业失败。请参阅“journalctl -xe”了解详细信息

我正在尝试在 20.04 安装后加密交换文件(我成功进行了主目录加密)。我创建了一个交换文件,带有一个 UUID,这些是我的

fstab:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda3 during installation
UUID=3b76b7a1-8e02-439b-982f-39f8954c4e6e /               ext4    errors=remount-ro 0       1
# /boot/efi was on /dev/sda1 during installation
UUID=FEFC-8940  /boot/efi       vfat    umask=0077      0       1
UUID=684f3c6e-907a-4a35-95b4-7b6cde21440b none swap sw 0 0

crypttab(开始之前):

# <target name> <source device>     <key file>  <options>

/dev/mapper 只是控制

BLKIDD:

dev/sda3: UUID="3b76b7a1-8e02-439b-982f-39f8954c4e6e" TYPE="ext4" PARTUUID="6a8896ab-92bb-4bd7-a405-7650cca8d9e6"
/dev/loop0: TYPE="squashfs"
/dev/loop1: TYPE="squashfs"
/dev/loop2: TYPE="squashfs"
/dev/loop3: TYPE="squashfs"
/dev/loop4: TYPE="squashfs"
/dev/loop5: TYPE="squashfs"
/dev/loop6: TYPE="squashfs"
/dev/loop7: TYPE="squashfs"
/dev/sda1: UUID="FEFC-8940" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="305bb9b1-cde6-4fa5-9702-491a4dcd71f4"
/dev/loop8: TYPE="squashfs"
/dev/loop9: TYPE="squashfs"
/swapfile: UUID="684f3c6e-907a-4a35-95b4-7b6cde21440b" TYPE="swap"

运行以下命令:

sudo swapoff -a
sudo /etc/init.d/cryptdisks start 
sudo swapon -a
sudo swapon -s

输出:

/swapfile                               file        16777212    0   -2

/dev/mapper 仍然只是控制。现在让我们使用以下方法加密:sudo ecryptfs-setup-swap!

输出:

WARNING:
An encrypted swap is required to help ensure that encrypted files are not leaked to disk in an unencrypted format.

HOWEVER, THE SWAP ENCRYPTION CONFIGURATION PRODUCED BY THIS PROGRAM WILL BREAK HIBERNATE/RESUME ON THIS SYSTEM!

NOTE: Your suspend/resume capabilities will not be affected.

Do you want to proceed with encrypting your swap? [y/N]: y

INFO: Setting up swap: [/swapfile]
WARNING: Commented out your unencrypted swap from /etc/fstab
A dependency job for cryptsetup.target failed. See 'journalctl -xe' for details.

---journalctl -xe 日志---

https://pastebin.com/yqJZ9tQj

新的 crypttab 是:

cryptswap1 /swapfile /dev/urandom swap,offset=1024,cipher=aes-xts-plain64

新的 fstab 为:

#UUID=684f3c6e-907a-4a35-95b4-7b6cde21440b none swap sw 0 0
/dev/mapper/cryptswap1 none swap sw 0 0

日志中只有一个红色错误,并且它会重复出现:

-- The unit UNIT has successfully entered the 'dead' state.
Mai 23 20:51:32 icbosk-X556UV systemd[1]: dev-disk-by\x2duuid-684f3c6e\x2d907a\x2d4a35\x2d95b4\x2d7b6cde21440b.device: Job dev-disk-by\x2duui>
Mai 23 20:51:32 icbosk-X556UV systemd[1]: Timed out waiting for device /dev/disk/by-uuid/684f3c6e-907a-4a35-95b4-7b6cde21440b.
-- Subject: A start job for unit dev-disk-by\x2duuid-684f3c6e\x2d907a\x2d4a35\x2d95b4\x2d7b6cde21440b.device has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
-- 
-- A start job for unit dev-disk-by\x2duuid-684f3c6e\x2d907a\x2d4a35\x2d95b4\x2d7b6cde21440b.device has finished with a failure.
-- 
-- The job identifier is 1992 and the job result is timeout.

答案1

当所有配置都井然有序时,只需运行即可轻松修复此问题sudo cryptdisks_start cryptswap1。请记住,如果您不大量使用加密交换,则可以使用加密交换。如果将其用作常规交换,则需要更多的 CPU 能力。

相关内容