大网数据广告活动
服务器运维问答

Cryptsetup luks - Check that kernel supports aes-xts-plain64 cipher

· 52CE 我爱测

I encrypted a bunch of hard drives with cryptsetup luks encryption on CentOS 5. Everything was fine, until I upgraded my system to CentOS 6. Now I cannot mount the disks anymore. To mount with my keyphrase: sudo cryptsetup luksOp…

问题原文

原帖链接 · Crash Override · CC BY-SA 3.0

I encrypted a bunch of hard drives with cryptsetup luks encryption on CentOS 5. Everything was fine, until I upgraded my system to CentOS 6. Now I cannot mount the disks anymore.

To mount with my keyphrase:

sudo cryptsetup luksOpen /dev/sdc1 d2

I get this error:

device-mapper: reload ioctl on  failed: Invalid argument
Failed to setup dm-crypt key mapping for device /dev/sdc1.
Check that kernel supports aes-xts-plain64 cipher (check syslog for more info).
Failed to read from key storage.

In /var/log/messages:

Feb  3 23:43:23 data kernel: device-mapper: table: 253:0: crypt: Device lookup failed
Feb  3 23:43:23 data kernel: device-mapper: ioctl: error adding target to table

Any thoughts on how I can mount??

已采纳解答

原帖链接 · Crash Override · CC BY-SA 3.0

Solution found.

The problem was the drives were encrypted with an interactive keyphrase of about 512 characters long (copy/paste from a key file). For some reason, the new kernel module in CentOS 6 would not properly read encrypted keys of 512-characters when created by an older version. Only seems to affect differing versions of the kernel or cryptsetup, since a 512-character key will work when created and opened on the same system.

In summary...

kernel -> create luks key of 512 characters -> can open in same kernel

old kernel -> create luks key of 512 characters -> cannot open in new kernel

512-characters is just too long. Not sure what the threshold is, but I decided to change my keys to 50-characters, and it worked.

To resolve, I re-installed the old CentOS 5 operating system I was previously using, used cryptsetup luksAddKey, entered the original (long) 512-character key, and created a new key of 50 characters long.

Then I re-installed CentOS 6, and successfully mounted each disk with cryptsetup luksOpen using the 50-character key (not the original key).

So a note to someone who gets a similar error. If you encrypted your drives with a super-long key, change to a new kernel or cryptsetup, and you get a kernel module error when trying to luksOpen your encrypted volume, you may have to go back to the old kernel version to use luksAddKey and add shorter keys before using in the new kernel. This could be a bug, or some mismatch in the maximum allowed interactive keys in the kernel models used by LUKS.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-02-04)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。