ecryptfs-setup-swap 冻结

ecryptfs-setup-swap 冻结

我的电脑开始死机,并显示 cryptswap 尚未准备好的消息,因此我尝试按照本教程操作

http://punygeek.blogspot.de/2012/10/ubuntu-1204-how-to-solve-disk-drive-for.html

一切正常,除了当我运行最后一个命令(加密我的交换)时,它会冻结

ubuntu-gnome@ubuntu-gnome:~$ 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: [/dev/sda5]
WARNING: Commented out your unencrypted swap from /etc/fstab
cryptdisks stop/waiting

我尝试在实时 CD 中并通过启动到控制台来运行它,但我仍然得到相同的结果。

fdisk-l

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1            2048    206847    204800  100M  7 HPFS/NTFS/exFAT
/dev/sda2  *       206848 191309823 191102976 91.1G  7 HPFS/NTFS/exFAT
/dev/sda3       191311872 820518903 629207032  300G  7 HPFS/NTFS/exFAT
/dev/sda4       820518910 976771071 156252162 74.5G  5 Extended
/dev/sda5       968962048 976771071   7809024  3.7G 82 Linux swap / Solaris
/dev/sda6       820518912 849815551  29296640   14G 83 Linux
/dev/sda7       849817600 968959999 119142400 56.8G 83 Linux

/dev/sda1: LABEL="System Reserved" UUID="0840DED940DECD16" TYPE="ntfs" PARTUUID="41a2ecc6-01" 
/dev/sda2: UUID="256353E503552314" TYPE="ntfs" PARTUUID="41a2ecc6-02" 
/dev/sda3: LABEL="userfiles" UUID="0462DB864AF41256" TYPE="ntfs" PARTUUID="41a2ecc6-03" 
/dev/sda6: UUID="c9c2da50-642e-4f3c-98e8-9614ac42c8d3" TYPE="ext4" PARTUUID="41a2ecc6-06" 
/dev/sda7: UUID="ebe11704-0f34-43a0-bd8b-23afc9cc6f18" TYPE="ext4" PARTUUID="41a2ecc6-07" 
/dev/sdb1: UUID="47C0-22BC" TYPE="vfat" PARTUUID="000f0dac-01" 
/dev/sda5: UUID="b7316db6-3032-4700-af08-584aadbe0bf1" TYPE="swap" PARTUUID="41a2ecc6-05"

文件系统

# /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/sda6 during installation
UUID=c9c2da50-642e-4f3c-98e8-9614ac42c8d3 /               ext4    errors=remount
-ro 0       1
# /home was on /dev/sda7 during installation
UUID=ebe11704-0f34-43a0-bd8b-23afc9cc6f18 /home           ext4    defaults      
  0       2
# swap was on /dev/sda5 during installation
#UUID=d35dd961-0ebb-47b0-a163-d487cd77d97f none            swap    sw           
   0       0
#/dev/mapper/cryptswap1 none swap sw 0 0

/dev/sda3 /mnt/userfiles ntfs-3g rw,auto,user,fmask=0111,dmask=0000 nls=utf8 0 0
/dev/sda2 /mnt/windows ntfs-3g rw,auto,user,fmask=0111,dmask=0000 nls=utf8 0 0

我的 crypttab 是空的

我遗漏了什么?为什么 ecryptfs 会冻结?

答案1

当守护程序停止时,会发出消息“cryptdisks stop/waiting”,/etc/init.d/cryptdisks 当尝试重新启动服务时,守护程序就会挂起。

我遇到了同样的问题(在全新安装 Ubuntu 14.10 并运行之后ecryptfs-setup-swap),只不过对我来说,我做过有一个新的条目添加到/etc/crypttab,我做过已将新条目添加至/etc/fstab

该问题似乎是由于与 UUID 相关的“已知错误”引起的,具体描述如下 使用加密主目录的全新 14.04 安装中交换不起作用

我建议您尝试以下操作:(警告:这些说明假设您的交换分区是/dev/sda5- 如有必要,请进行调整。如果输入错误,您可能会丢失数据。)

  1. 取消注释/etc/fstabfor中的行/dev/mapper/cryptswap1。它应为:

    /dev/mapper/cryptswap1 none swap sw 0 0
    
  2. 添加以下行到/etc/crypttab

    cryptswap1 /dev/sda5 /dev/urandom swap,cipher=aes-cbc-essiv:sha256
    
  3. 然后创建交换空间

    $ sudo mkswap /dev/sda5
    
  4. 重新启动 cryptdisks 守护进程:

    $ sudo /etc/init.d/cryptdisks stop
    cryptdisks stop/waiting # or you may get: Job is not running: cryptdisks
    $ sudo /etc/init.d/cryptdisks force-start
     * Starting remaining crypto disks...
     * cryptswap1 (running)...
    
  5. 检查 crypt 是否正在运行:

    $ sudo cryptsetup status cryptswap1
    /dev/mapper/cryptswap1 is active and is in use.
    
  6. 检查您是否有一些交换空间:

    $ swapon -s
    

我发现此时交换文件名是 /dev/dm-0。

现在进行全面测试。重新启动,再次检查 cryptswap1 是否仍然处于活动状态,并检查交换空间。这一次,您应该会发现交换空间文件名是 /dev/mapper/cryptswap1。祝你好运!

请注意,该gparted分区将显示为“未知”。

相关内容