You are not logged in.
Hello,
I have a second hard drive in my system that I only want to use as storage. I encrypted it with LUKS crypt command. I formatted the drive from a USB with GParted in ext4 format. When I try to mount the drive in Thunar it asks for the passphrase, I enter it. Then it asks for the sudo password, I enter it. Then the drive is mounted for a second and then disappears from the gui and I can't access it.
I can't mount it in the terminal because it says it's not in /etc/fstab.
lsblk output:
dayan@BunsenLabs:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 464.8G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 975M 0 part [SWAP]
sdb 8:16 0 298.1G 0 disk
└─luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998
254:0 0 298.1G 0 crypt
sr0 11:0 1 1024M 0 rom
dayan@BunsenLabs:~$ sudo mount /dev/sdb
[sudo] password for dayan:
mount: /dev/sdb: can't find in /etc/fstab.
dayan@BunsenLabs:~$ sudo mount /dev/sdb/luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998
mount: /dev/sdb/luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998: can't find in /etc/fstab.
OS: BunsenLabs GNU/Linux 10.5 (Lithium) x86_64
Host: OptiPlex 790 01
Kernel: 4.19.0-17-amd64
Packages: 2467 (dpkg), 17 (flatpak)
Shell: bash 5.0.3
Resolution: 1920x1080
DE: Xfce
WM: Openbox
Theme: BL-Lithium [GTK2/3]
Icons: Papirus-Bunsen-Dark-bluegrey [GTK2/3]
CPU: Intel i5-2400 (4) @ 3.400GHz
GPU: AMD ATI Radeon HD 8670 / R7 250/350
Memory: 1367MiB / 7933MiB
Last edited by nobody (2021-08-30 10:23:40)
Offline
From the state you're showing in lsblk, this should mount the crypto disk if it really contains a file system:
sudo mkdir -p /mnt/crypto
sudo mount /dev/mapper/luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998 /mnt/crypto
Does this work, and does the content of the encrypted filesystem appear in /mnt/crypto? If yes, then the only issue is the automounting of LUKS encrypted disks. If not, then there's more afoot.
Offline
Does this work,...
Terminal output:
dayan@BunsenLabs:~$ sudo mkdir -p /mnt/crypto
[sudo] password for dayan:
dayan@BunsenLabs:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 464.8G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 975M 0 part [SWAP]
sdb 8:16 0 298.1G 0 disk
sr0 11:0 1 1024M 0 rom
dayan@BunsenLabs:~$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 465.8G 0 disk
├─sda1 8:1 0 464.8G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 975M 0 part [SWAP]
sdb 8:16 0 298.1G 0 disk
└─luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998
254:0 0 298.1G 0 crypt
sr0 11:0 1 1024M 0 rom
dayan@BunsenLabs:~$ sudo mount /dev/mapper/luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998 /mnt/crypto
mount: /mnt/crypto: wrong fs type, bad option, bad superblock on /dev/mapper/luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998, missing codepage or helper program, or other error.
https://i.imgur.com/Ig0uo0N.png <---- what it looks like in GParted.
I don't understand why it is saying this when I formatted sdb as ext4 before encrypting it. Something to note: I was learning FreeBSD and OpenBSD on that hard drive before. Is it possible that since BSD formats drives with GPT and also can use Grub4Dos that it's interfering with the crypt?
I also don't want it to automount. This is going to be a machine I access remotely where I need to have a drive that only I can access. Other people are going to have physical access to the system.
Last edited by Dayan (2021-08-30 08:08:37)
Offline
I don't understand why it is saying this when I formatted sdb as ext4 before encrypting it.
Ah, this is it the problem then. LUKS does not work on top of an existing file system, it sits below the filesystem and works on the block layer, and the file system must be created on top of the encrypted block device. LUKS is file system agnostic and just encrypts block devices, but that allows it to host any kind of file system.
After creating the LUKS container using gparted (didn't even know it could do that), you now need to create a filesystem on top of the LUKS block device. In a terminal, just run:
sudo mkfs.ext4 -L FILESYSTEMNAMEOFYOURCHOICE /dev/mapper/luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998
to create the filesystem on top of the encrypted, secure block device (when you formatted /dev/sdb as a LUKS volume, it erased whatever was there, including the file sytem you previously created). Then, both the mount command I mentioned as well as the automatic mount in Thunar should work.
Linux file systems work as a stack. block layer < VFS layer < conrete file system implementation. LUKS inserts itself like so: physical block device < LUKS/dm-crypt < VFS layer < file system implementation.
The idea you previously had would be correct if you wouldn't use LUKS/dm-crypt but something like ecryptfs which would, differently from LUKS/dm-crypt, insert itself like so: physical block device < VFS layer < file system < ecryptfs. Ecryptfs is BTW what Android uses to encrypt its storage.
Offline
After creating the LUKS container using gparted (didn't even know it could do that)
GParted can't make LUKS containers. I just used GParted to do an ext4 format since I was in a live USB environment at the time. Then I encrypted the drive with LUKS via the terminal later. I didn't know that the filesystem has to be established after creating the LUKS container.
sudo mkfs.ext4 -L FILESYSTEMNAMEOFYOURCHOICE /dev/mapper/luks-a2537437-55ec-42c8-a4e7-2f7f9a72e998
This worked thank you so much.
Linux file systems work as a stack. block layer < VFS layer < conrete file system implementation. LUKS inserts itself like so: physical block device < LUKS/dm-crypt < VFS layer < file system implementation.
The idea you previously had would be correct if you wouldn't use LUKS/dm-crypt but something like ecryptfs which would, differently from LUKS/dm-crypt, insert itself like so: physical block device < VFS layer < file system < ecryptfs. Ecryptfs is BTW what Android uses to encrypt its storage.
This is all good information thank you so much for taking the time to explain. I'm looking forward to learning more.
Offline