cryptsetup在启动时无法解锁


0

我有这两个文件:

的/ etc / crypttab中:

cry1    /dev/sda3   none                    luks
cry2    /dev/sda4   /mounted/sda3/keyfile   luks

/ etc / fstab中:

/dev/sda1           /boot    ext2   ro        0   2
/dev/sda2           /        ext4   defaults  0   0
/dev/mapper/cry1    /cry1    ext4   defaults  0   2
/dev/mapper/cry2    /cry2    ext4   defaults  0   2

Debian启动,我被提示输入sda3 / cry1文件系统的密码。它工作,它已安装。

但是sda4 / cry2没有安装,虽然我可以很容易地解密并将其挂载在命令行上,不仅使用密码,还可以使用密钥文件。

我最终把命令行放在/etc/rc.local上,但我对这个版本不满意。为什么crypttab / fstab机制不起作用?

另外:我担心重新启动或关闭系统不会干净地卸载和解密​​文件系统,这可能会破坏文件系统。我怎样才能确保一切都干净利落?

Answers:


0

所以/dev/sda3得到了luksOpen'ed /dev/mapper/cry1,它被安装到/cry1?什么/在哪里/mounted/sda3?听起来应该是sda3,也许这就是问题......

无论如何,如果挂载点是正确的,我听起来像安装的时间问题。crypttab应该按顺序遍历条目,但我不确定它们是否在下一个条目之前被挂载,在man crypttab这个声音中有几个选项很有希望。

尝试将此项添加到cry2条目中:

   noearly
       The cryptsetup init scripts are invoked twice during the boot process -
       once before lvm, raid, etc. are started and once again after that.
       Sometimes you need to start your encrypted disks in a special order.
       With this option the device is ignored during the first invocation of
       the cryptsetup init scripts.

并尝试此选项并检查日志以查看问题所在:

   loud
       Be loud. Print warnings if a device does not exist. This option
       overwrites the option quiet.

如果除了运行自己的自定义脚本之外没有找到任何其他方法,这是一个想法:

   keyscript=<path>
       The executable at the indicated path is executed with the key file from
       the third field of the crypttab as its only argument and the output is
       used as the key. This also works with encrypted root filesystems via
       initramfs if the executable is self-contained (i.e. an executable which
       does not rely on any external program which is not present in the
       initramfs environment).

在关机时,一切都应该卸载,如果某些文件系统不是,它可能是一个更普遍的搜索问题,我不确定它是否会自动与加密相关。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.