LinuxQuestions.org
Go Job Hunting at the LQ Job Marketplace
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 09-06-2012, 04:21 AM   #1
malak33
Member
 
Registered: Dec 2011
Location: Amish Country PA, USA
Distribution: CentOS 6.2
Posts: 104

Rep: Reputation: 3
UUID in /etc/fstab for luks partition


hey,
I'm using CentOS and I'm banging my head on the wall as to how to get the luks partition to mount on boot while using the UUID of the device. It is working with using the /dev/mapper/cryptPart.

here is /etc/fstab right now
Code:
#
#
# /etc/fstab
# Created by anaconda on Wed Sep  5 08:38:18 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=13e31a3e-d1d6-4092-85ac-205e1b13ce11 /                       ext4    defaults        1 1
UUID=14ef3e84-2d3b-417a-be7f-a73cb06c56f2 /boot                   ext4    defaults        1 2
UUID=3de803fc-3e0d-43c8-821f-af3b957cd6e5 /home                   ext4    defaults        1 2
/dev/mapper/cryptPart /cryptDir                                   ext4    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
here is /etc/fstab with UUID
Code:
#
#
# /etc/fstab
# Created by anaconda on Wed Sep  5 08:38:18 2012
#
# Accessible filesystems, by reference, are maintained under '/dev/disk'
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info
#
UUID=13e31a3e-d1d6-4092-85ac-205e1b13ce11 /                       ext4    defaults        1 1
UUID=14ef3e84-2d3b-417a-be7f-a73cb06c56f2 /boot                   ext4    defaults        1 2
UUID=3de803fc-3e0d-43c8-821f-af3b957cd6e5 /home                   ext4    defaults        1 2
###/dev/mapper/cryptPart /cryptDir                                   ext4    defaults        1 2
UUID=713450fb-0c30-4ff6-a3a7-e88d4638c621 /cryptDir 
ext4    defaults        1 2
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
here is /etc/crypttab
Code:
cryptPart /dev/vda4
here is /etc/cryptab w/UUID
Code:
cryptPart UUID=713450fb-0c30-4ff6-a3a7-e88d4638c621
I've also tried this in /etc/crypttab
Code:
luks-713450fb-0c30-4ff6-a3a7-e88d4638c621 UUID=713450fb-0c30-4ff6-a3a7-e88d4638c621
the error that i keep on getting while trying to boot is this(it asks me for my password though first)
Code:
fsck.ext4: Device or resource busy while trying to open /dev/vda4
Filesystem mounted or opened exclusively by another program? [FAILED]
***An error occurred during the file system check.
***Dropping you to a shell; the system will reboot
***when you leave the shell.
***Warning - - SELinux is active
***Disabling security enforcement for system recover.
*** Run 'setenforce 1' to reenable.
Give root password for maintenance
(or type Control-D to continue):
edit: here is the output to cryptsetup luksDump /dev/vda4 | grep UUID
Code:
UUID=713450fb-0c30-4ff6-a3a7-e88d4638c621

Last edited by malak33; 09-07-2012 at 01:37 AM. Reason: added cryptsetup luksDump /dev/vda4, edit for /etc/fstab (posted wrong VM) :(
 
Old 09-11-2012, 11:22 PM   #2
malak33
Member
 
Registered: Dec 2011
Location: Amish Country PA, USA
Distribution: CentOS 6.2
Posts: 104

Original Poster
Rep: Reputation: 3
bump
 
Old 09-12-2012, 05:27 AM   #3
VDP76
Member
 
Registered: Apr 2010
Location: Bayreuth, Germany
Distribution: CrunchBang Linux (#!)
Posts: 111

Rep: Reputation: 19
I do not have experience with luks, but my wild guess would be to try the following entry in fstab...
Code:
UUID=luks-713450fb-0c30-4ff6-a3a7-e88d4638c621 /cryptDir   ext4    defaults        1 2
does it work?
 
Old 09-12-2012, 09:26 AM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,971

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
You still need /dev/mapper/ in your fstab.
What happens when you try:
/etc/fstab
Quote:
/dev/mapper/cryptPart /cryptDir ext4 defaults 1 2
/etc/cryptab
Quote:
cryptPart UUID=713450fb-0c30-4ff6-a3a7-e88d4638c621
 
2 members found this post helpful.
Old 09-12-2012, 11:11 AM   #5
doublejoon
Member
 
Registered: Oct 2003
Location: King George, VA
Distribution: RHEL/CentOS/Scientific/Fedora, LinuxMint
Posts: 366

Rep: Reputation: 44
michaelk is on to something here. I would do it his way.

In addition to avoid being prompted for passphrase on boot I would use a key file as a slot



cd /root
dd if=/dev/urandom of=.keyfile bs=1024 count=4
chmod 400 .keyfile
chattr +i .keyfile (Makes the file immutable to prevent accidential deletion)

cryptsetup luksAddKey /dev/vda4 /root/.keyfile

/etc/crypttab
cryptPart UUID=713450fb-0c30-4ff6-a3a7-e88d4638c621 /root/.keyfile luks
 
Old 09-12-2012, 11:20 PM   #6
malak33
Member
 
Registered: Dec 2011
Location: Amish Country PA, USA
Distribution: CentOS 6.2
Posts: 104

Original Poster
Rep: Reputation: 3
VDP76- tried what you suggested and it doesn't work for me

michaelk- i tried what you suggested and it works. However, the reason I'm trying to get this to work is for the RHCSA exam I'm taking on Monday this is about the only thing i don't know how to do on their list of Exam objectives
Quote:
Configure local storage

List, create, delete, and set partition type for primary, extended, and logical partitions.
Create and remove physical volumes, assign physical volumes to volume groups, and create and delete logical volumes.
Create and configure LUKS-encrypted partitions and logical volumes to prompt for password and mount a decrypted file system at boot.
Configure systems to mount file systems at boot by Universally Unique ID (UUID) or label.
Add new partitions and logical volumes, and swap to a system non-destructively.
thats from Red Hat
as you can see from my /etc/fstab everything else is using the UUID, do you think I'll be fine or am i overthinking this?
 
Old 09-13-2012, 08:02 AM   #7
michaelk
Moderator
 
Registered: Aug 2002
Posts: 11,971

Rep: Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752Reputation: 752
You will be fine. You also need /dev/mapper for mounting logical volumes. Have you tried LVM yet?
 
Old 11-23-2012, 05:20 PM   #8
rfreiberger
Member
 
Registered: Jul 2009
Location: Union City, CA, USA
Distribution: FreeBSD, Mint, CentOS
Posts: 35

Rep: Reputation: 16
Apologies for posting on a old thread but I was stuck on this issue studying for the RHCSA. I tried everything and know that the luks was working as I could mount it manually but not through /etc/fstab. I found that my fsck selection was too low, which I think caused some issues checking the mount before checking the passphrase.

All I did to this fix this was change the last /etc/fstab setting from 4 to 2. Below is the current setting which works, but when I had the fsck setting to 4 (the last column), I got the prompt to enter the passphrase, but right after that it reverts to maintenance mode.

Code:
UUID=83a523b1-71b5-4e59-926e-126086d47a9b /                       ext4    defaults        1 1
UUID=332e4077-dcfb-4da6-ad63-bf669c5f7042 /boot                   ext4    defaults        1 2
UUID=e2c66d36-f298-40f2-bd63-78eb2e25f72d swap                    swap    defaults        0 0
tmpfs                   /dev/shm                tmpfs   defaults        0 0
devpts                  /dev/pts                devpts  gid=5,mode=620  0 0
sysfs                   /sys                    sysfs   defaults        0 0
proc                    /proc                   proc    defaults        0 0
/dev/vg1/lv100          /lv100mnt               ext4    defaults        1 3
/dev/mapper/sdd1luks    /sdd1luks               ext4    defaults        1 2
As a side note, for any one stuck with the filesystem in read only, you can't edit the /etc/fstab file.
Code:
#mount -o remount,rw /
I am pretty sure this is the reason why it failed but not 100% sure. Maybe someone can post the real reason?

Thanks,
Rob
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] how to use UUID on fstab and grub nicolasdiogo Debian 3 08-24-2011 02:46 PM
Having issues with the changes to fstab (UUID's) Cage47 Linux - Hardware 4 01-15-2010 12:54 PM
fstab sdxx or uuid or ... jesses93 Linux - General 1 01-05-2010 03:02 PM
after copying partition, how to deal with fstab when it references by UUID ? lumix Linux - Newbie 5 12-09-2008 09:59 PM
UUID, grub, and fstab radiodee1 Debian 4 09-16-2008 05:56 AM


All times are GMT -5. The time now is 10:59 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration