/etc/cryptab is precenting my Linux from boot

Support for security such as Firewalls and securing linux
Post Reply
sciencedicas
Posts: 12
Joined: 2014/07/21 15:01:48

/etc/cryptab is precenting my Linux from boot

Post by sciencedicas » 2014/07/21 15:11:14

Hey guys

I'm trying to encrypt a drive on my CentoOS7, this is in lab so far

I can encrypt the drive and mount it and it works fine. but as soon as I added into my /etc/crypttab and reboot the system, the server get stuck on the booting process.

below is what I'm adding to /etc/cryptab

safe /dev/sdb1 none

the process I'm following are:
modprobe md-crpt ---> to load the driver

also I'm making sure this module get stated during boot
by creating a dm-crypt.modules file in /etc/sysconfig/modules.d/

inside my file dm-crypt.modules I have
#!/bin/sh
exec /sbin/modprobe dm-crpt >/dev/null 2>&1

I'm also preparing the drive by using
dd if=/dev/urandom of=/dev/sdb1


cryptsetup luksFormat /dev/sdb1

crypsetup luksOpen /dev/sdb1 safe

mkfs -t ext4 /dev/mapper/safe

mkdir /safe
mount -t /dev/mapper/safe /safe
restorecon -r /safe

I'm able to verify this by using cryptsetup status

User avatar
TrevorH
Forum Moderator
Posts: 26576
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: /etc/cryptab is precenting my Linux from boot

Post by TrevorH » 2014/07/21 15:17:43

I've not used luks on el7 yet but you shouldn't need to do all those things. Once you've set the device up and made a filesystem on it and made sure it works then the only other things you need to alter are /etc/crypttab and /etc/fstab. You shouldn't need to tell it to load modules, all that should be be automatic.

If you set it up with a password field of "none" then you will be prompted for the passphrase during boot. I believe there is at least one bug report open about not receiving the prompt and the current solution i to remove 'rhgb quiet' from the kernel command line so that you can see the prompt when it appears. Do you think that might be your situation? I believe the current bug is specific to vmware and/or virtualbox installs but might be more widespread than that.
CentOS 5 died in March 2017 - migrate NOW!
CentOS 6 goes EOL sooner rather than later, get upgrading!
Full time Geek, part time moderator. Use the FAQ Luke

sciencedicas
Posts: 12
Joined: 2014/07/21 15:01:48

Re: /etc/cryptab is precenting my Linux from boot

Post by sciencedicas » 2014/07/21 19:22:18

I've made the file system and I'm also able to mount it and work with it.

but as soon as I add the statement to /etc/crpttab and /etc/fstab and reload the machine, the server worn't but, and I have to destroy the vm and try it again.

I will try the 'rhgb quiet' you suggested and see .

I'm not using GUI, not splash on my boot process, so I'm able to see the message as they kernel is being loaded. so I'm not sure if rhgb quit will work.

thank you for the reply.
will try that option and let you know.

sciencedicas
Posts: 12
Joined: 2014/07/21 15:01:48

Re: /etc/cryptab is precenting my Linux from boot

Post by sciencedicas » 2014/07/21 23:17:05

tried this option and the boot is stuck on

[***] (1 of 2) A start job is running for dev-mapper-safe.device
[***] (1 of 2) A start job is running for cryptoghraphy setup for safe

drk
Posts: 397
Joined: 2014/01/30 20:38:28

Re: /etc/cryptab is precenting my Linux from boot

Post by drk » 2014/07/22 05:31:13

I just tried this with my CentOS7 VM and it worked as expected. I used UUIDs in /etc/crypttab and /etc/fstab instead of actual devices or mapper names.

drk
Posts: 397
Joined: 2014/01/30 20:38:28

Re: /etc/cryptab is precenting my Linux from boot

Post by drk » 2014/07/22 05:41:11

below is what I'm adding to /etc/cryptab

safe /dev/sdb1 none
You've typo'd "crypttab" a few times here - did you do it on your system? ;)

viljoviitanen
Posts: 1
Joined: 2014/07/31 09:37:24

Re: /etc/cryptab is precenting my Linux from boot

Post by viljoviitanen » 2014/07/31 09:42:10

Here's the related bug: http://bugs.centos.org/view.php?id=7293 . Note, it doesn't happen with all hardware, and mostly (or especially) with virtual machines. I ran into this with vmware workstation 10.

sciencedicas
Posts: 12
Joined: 2014/07/21 15:01:48

Re: /etc/cryptab is precenting my Linux from boot

Post by sciencedicas » 2014/09/05 13:55:19

it was indeed a bug, I tried this on a different environment and had no issues.
thank you all for the help

Post Reply

Return to “CentOS 7 - Security Support”