You are not logged in.

#1 2022-04-24 16:22:58

Lord Bo
Member
Registered: 2012-11-11
Posts: 168

[SOLVED] cryptsetup - Error mounting LUKS encrypted drive

I recently tried to create and mount an encrypted partition using the following steps:

1. Created an ext4 partition using gparted (on /dev/sdb)
2. cryptsetup -s 512 luksFormat /dev/sdb1 (entered password)
3. cryptsetup open /dev/sdb1 private (entered password)
4. mount /dev/mapper/private /mnt

The last command however exited with an error:
mount: /mnt: special device /dev/mapper/private does not exist.
       dmesg(1) may have more information after failed mount system call.
(dmesg shows /dev/mapper/private: Can't open blockdev)

Also tried to use another USB-drive - same results.

What am I doing wrong?

Last edited by Lord Bo (2022-04-24 17:07:51)

Offline

#2 2022-04-24 16:31:23

loqs
Member
Registered: 2014-03-06
Posts: 18,968

Re: [SOLVED] cryptsetup - Error mounting LUKS encrypted drive

The error is referencing /dev/mapper/private while the cryptsetup command created /dev/mapper/safe ?

Offline

#3 2022-04-24 16:35:01

Lord Bo
Member
Registered: 2012-11-11
Posts: 168

Re: [SOLVED] cryptsetup - Error mounting LUKS encrypted drive

Thank You for your quick reply. I had several tries and used several labels. I corrected that in my post.

Offline

#4 2022-04-24 16:37:00

loqs
Member
Registered: 2014-03-06
Posts: 18,968

Re: [SOLVED] cryptsetup - Error mounting LUKS encrypted drive

Is there any output from either of the cryptsetup commands?  What is in dmesg after the cryptsetup commands?

Offline

#5 2022-04-24 16:39:24

ua4000
Member
Registered: 2015-10-14
Posts: 561

Re: [SOLVED] cryptsetup - Error mounting LUKS encrypted drive

There are some things unclear:
a) you put an ext4 filesystem on entire sdb in step 1, but later you use sdb1 ???
b) there is no filesystem on /dev/mapper/private, first put ext4 or btrfs on /dev/mapper/private after step 3, before mounting it in step 4.

Offline

#6 2022-04-24 16:54:42

Lord Bo
Member
Registered: 2012-11-11
Posts: 168

Re: [SOLVED] cryptsetup - Error mounting LUKS encrypted drive

Messages after cryptsetup open:

[13532.753975] audit: type=1338 audit(1650818773.222:602): module=crypt op=ctr ppid=30208 pid=30665 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=2 comm="cryptsetup" exe="/usr/bin/cryptsetup" dev=254:0 error_msg='success' res=1
[13532.754667] audit: type=1300 audit(1650818773.222:602): arch=c000003e syscall=16 success=yes exit=0 a0=6 a1=c138fd09 a2=560051dda510 a3=7ffc66966462 items=6 ppid=30208 pid=30665 auid=1000 uid=0 gid=0 euid=0 suid=0 fsuid=0 egid=0 sgid=0 fsgid=0 tty=pts4 ses=2 comm="cryptsetup" exe="/usr/bin/cryptsetup" key=(null)
[13532.754673] audit: type=1307 audit(1650818773.222:602): cwd="/home/ben"
[13532.754676] audit: type=1302 audit(1650818773.222:602): item=0 name=(null) inode=38 dev=00:07 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
[13532.754680] audit: type=1302 audit(1650818773.222:602): item=1 name=(null) inode=165645 dev=00:07 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=CREATE cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
[13532.754683] audit: type=1302 audit(1650818773.222:602): item=2 name=(null) inode=27 dev=00:07 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
[13532.754687] audit: type=1302 audit(1650818773.222:602): item=3 name=(null) inode=165646 dev=00:07 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=CREATE cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
[13532.754690] audit: type=1302 audit(1650818773.222:602): item=4 name=(null) inode=165646 dev=00:07 mode=040755 ouid=0 ogid=0 rdev=00:00 nametype=PARENT cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
[13532.754693] audit: type=1302 audit(1650818773.222:602): item=5 name=(null) inode=165647 dev=00:07 mode=0100444 ouid=0 ogid=0 rdev=00:00 nametype=CREATE cap_fp=0 cap_fi=0 cap_fe=0 cap_fver=0 cap_frootid=0
[13532.754697] audit: type=1327 audit(1650818773.222:602): proctitle=63727970747365747570006F70656E002F6465762F736462320073616665

There was no output in dmesg after cryptsetup -s 512.

@ua4000:
a) No, I meant, that I used gparted on /dev/sdb. (Actually I have two sticks. For the first one I created one partition (/dev/sdb1) and for the second two partitions of which I encrypted only the second.)
b) Ah, may that be my error? I read several instructions, which first partitioned and formated the drive and then encrypted the partitions. If it is to be done the other way, then this explains why I can't mount /dev/mapper/private. I'll try that.

Edit Regarding b): fdisk -l doesn't show /dev/mapper/private, only /dev/sdb1 (and /dev/sdb2). How shall I proceed. Do I have format /dev/sdb2 (the encrypted partition) after mapping it or before or do I have to do it differently?

Last edited by Lord Bo (2022-04-24 17:04:06)

Offline

#7 2022-04-24 17:02:17

loqs
Member
Registered: 2014-03-06
Posts: 18,968

Re: [SOLVED] cryptsetup - Error mounting LUKS encrypted drive

Mapping_LUKS_partitions_with_the_device_mapper
After you opened the LUKS container the mapping in /dev/mapper should exist and that is what you format.

Offline

#8 2022-04-24 17:07:29

Lord Bo
Member
Registered: 2012-11-11
Posts: 168

Re: [SOLVED] cryptsetup - Error mounting LUKS encrypted drive

Thank You, both of You! That solved it!

Offline

Board footer

Powered by FluxBB