date
int64
1,220B
1,719B
question_description
stringlengths
28
29.9k
accepted_answer
stringlengths
12
26.4k
question_title
stringlengths
14
159
1,532,142,916,000
If I do an mv command from the command line in OneFS (Isilon, FreeBSD based), what exactly happens in the background and on the disks? Will the data be physically moved from sectors to other sectors on the disks, or is it just a change to the links to those files in the files system? Does the data on the physical disk...
No, there are no copy of the whole file. Each file is described by a structure (on most UNIX file system, it is called an inode). This structure contains the informations about the file (length, date, where to find its blocks, right permission...), excepted the name. The name of a file is in a directory which does the...
What exactly happens in the OneFS (FreeBSD) files system if I move files from one directory to another?
1,532,142,916,000
When I do a directory listing of a python installation the include directory appears twice and each one has a different inode. ╰─○ ls -i1 2282047 bin 2641630 include 2642559 include 2282048 lib 2641850 share I assume that their contents may be different as the inodes are different. Is there away to use the ls comman...
It is not possible to have directories or files with duplicate names in Unix and so there would be no reason for ls to have an option to handle that use case. The reason you are seeing what appears to be duplicates is because one directory actually has a trailing space (inode 2642559). BusyBox's ls, unlike GNU's ls, d...
How can you list a directory using the inode not the directory name? I have the same directory name appearing twice with different inodes
1,532,142,916,000
we notices about some of our RHEL machines that inode information show 100% the following for example show that /dev/sdb is 100% df -i Filesystem Inodes IUsed IFree IUse% Mounted on /dev/sdc 2621440 231603 2389837 9% /data/sdc /dev/sdd 2621440 2616856 ...
As per the man page for mkfs.ext4: Be warned that it is not possible to expand the number of inodes on a filesystem after it is created, so be careful deciding the correct value for this parameter. You have a couple choices. Reduce inodes in use (remove files or directories) Back up the data and recreate the filesy...
linux + list inode information show 100% used
1,532,142,916,000
I'm studying the Ext4 filesystem and am confused by the 128 byte inode size because it appears to conflict with the last metatdata value it stores which is supposed to be offset at byte 156. In this documentation it states that inodes are 128 bytes in length. I called dumpe2fs on an unmounted /dev/sdb1. The dumpe2fs...
it states that inodes are 128 bytes in length No. It states that [emphasis mine]: […] each inode had a disk record size of 128 bytes. Starting with ext4, it is possible to allocate a larger on-disk inode at format time for all inodes in the filesystem to provide space beyond the end of the original ext2 inode. The ...
Why do inode offset values appear to exceed inode size?
1,532,142,916,000
This page on inodes has been exceptional help in grasping the surface-level concept of file systems. On the same page, the author has inserted this snippet demonstrating that each file or directory has at least 2 names (and hard links): /tmp/junk$ ls -id .. 327681 .. /tmp/junk$ cd .. /tmp$ ls -id . 327681 . We can s...
The initial number of hard links is 1 for a file and 2 for a directory (the first link is its name in the parent folder, and the second hard link is .). The link count for a directory goes up by one each time a subdirectory is created in it (due to .. in each subdirectory). This count can be easily viewed with ls -l. ...
Can every file really own at least 2 names (and thus 2 hard links)?
1,532,142,916,000
I read a couple of articles about Linux inode and understand that each file created always have a corresponding inode number. Since one of our servers is using ext4 there is no way to increase the inode to an already running production server. There are two solutions we can do one is to delete older files and the oth...
Collecting multiple files in a single archive file reduces inode consumption to that required to handle that file. The number of blocks used is not correspondingly guaranteed to be reduced (but it usually will be regardless).
Does archiving files reduces number of inode
1,532,142,916,000
I am currently studying device drivers in an operating systems course and am getting confused regarding the difference between the "inode" structs and "cdev" structs. Could someone clarify the differences between these two structures and what they're meant to achieve?
Your question doesn’t mention any specific context; this answer describes struct cdev and struct inode. The two are fundamentally different. struct cdev represents a character device, giving access to a driver; it points to the implementations of the various operations supported by a character device. struct inode rep...
What's the difference between structures "cdev" and "inode" in the context of device driver programming?
1,532,142,916,000
We are using Logstash to ingest our logs and we are facing some issues due inodes being reused. We tried all possible options on Logstash side so we are exploring the OS side. As far as I can see, if I create a file, drop it and later on I create a new one, most of the time it will get the same inode [root@XXXX~]# tou...
The only way to prevent the creation of a file with a given inode number is if there is already one (or if the inode value is one that the filesystem won't use, of course). You can't reserve an inode value. This is true through generic interfaces (i.e. through interfaces that aren't specific to a particular filesystem...
prevent inode reuse
1,532,142,916,000
I synchronize data with rsync --delete --backup --backup-dir=[some directory] -avz [source] [destination]. On the machine where rsync is executed, both [source] and [destination] directories are NFS exports mounted locally (i.e. the machine running rsync is a NFS client). after a succesfull rsync + some checks, the b...
It's almost impossible to refer to a file by its inode. To open a file, it is necessary to open a reference to a file name in a directory. Then you have a file handle which is now independent of the file name (which is why a file can be removed from the filesystem but still be open and active). So, let's assume the fi...
How does rsync's --inplace option work with --backup?
1,532,142,916,000
The following output (from a Vagrant VM running CentOS 6.6) mostly speaks for itself: [root@localhost ~]# echo 131072 > /proc/sys/fs/inode-max -bash: /proc/sys/fs/inode-max: No such file or directory [root@localhost ~]# sysctl -q -p [root@localhost ~]# echo 'fs.inode-max = 131072' >> /etc/sysctl.conf [root@localhost ~...
The man page in man7.org and in Debian has a more useful description: /proc/sys/fs/inode-max (only present until Linux 2.2) This file contains the maximum number of in-memory inodes. This value should be 3-4 times larger than the value in file-max, since stdin, stdout and network sockets also need an inode to hand...
Why does the fs.inode-max kernel tunable not exist on version 2.6 of the Linux kernel?
1,532,142,916,000
My question deals with the relationship between the read and execute bits on a directory. I'm going to give my assumptions, first, all according to my current knowledge, then ask my question in bold in the context of those assumptions. Please feel free to correct any incorrect assumptions: Files and directories both ...
I had a slight misunderstanding, which invalidates my point 6 above. The execute (aka "search") bit on a directory is required in order to obtain the inode numbers of the files it contains, but not its own inode number. Quote: You can think of read and execute on directories this way: directories are data files that...
The relationship between execute permission on a directory and its inode structure
1,532,142,916,000
Let's assume I was very unlucky and ran out of inodes in my ext4 filesystem but left with enough free space. Inode usage is 100%, but it has 50% disk free space. How can I resolve it?
One option is to recreate your filesystem specifying bytes-to-inode ratio with -i option. Backup all of your data to another disk. List your filesystems and find the one you want to modify: $ df -h assuming that filesystem is /dev/sdX and is mounted on /mnt/mountpoint. Unmount that filesystem: $ umount /mnt/mountpo...
Inode limit reached with free space available
1,532,142,916,000
According to this SO question, when we open a file to read it we only check permissions once when we open it. And if we change the permissions of the file and say the user is no longer allowed to read from the file, the user will still be able to read the file. This raises a few questions: Don't we need to keep check...
Don't we need to keep checking permissions, since if for example we open a file to read it, and then try to use write, shouldn't we get an error? No, we shouldn't! This is intended. The permissions at the point of opening the file matter, not later. That's the API. When we update permissions, do we update the singl...
Changing file permissions in inodes while a user has the file open
1,532,142,916,000
I see there are two ways to create quotas, there is xfs_quota and then this suite of utilities like edquota and repquota. It seems all of these utilities can provide inode quotas. How does that tools relate to each other?
The XFS User Guide mentions that the generic quota tools work with XFS, but are unable to set project quotas on XFS. 8.11. Generic Quota Tools: In addition to xfs_quota, xfs also works with generic quota tools provided on Linux. These tools include quota, repquota, quotactl, edquota, quotacheck, setquota, quotaon/quo...
Are XFS quotas and linux quotas part of the same thing?
1,532,142,916,000
mkdir test echo "hi" > test/file1 tar -c -f archive.0.tar -g test.snar test touch -a test/file1 # changes atime and ctime, doesn't change mtime tar -c -f archive.1.tar -g test.snar test tar -t -G -vv -f archive.1.tar # lists Y for file1 So did GNU tar store the entire file again, even though only access time (atime...
Using gtar for incremental backups is unreliable, but this is not a result of handling time stamps incorrectly. Any backuptool that works in userland and thus cannot check internal filesystem structures as done by e.g. zfs send needs to handle time stamps the same way or it cannot grant a correct incremental backup. ...
Does GNU tar incremental backup save an entire file again, even if only atime or mtime is different?
1,532,142,916,000
As per my understanding kernel maintains 4 tables. Per process FD table. System wide open file table struct file Inode (in-memory) table struct vnode Inode (on-disk) table. struct file have one field named struct file_operations f_ops; which contains FS specific operations like ext2_read(), ext2_write(); struct vnod...
Okay, I have found the answer. In previous versions of Unix like SVR4, struct file does not contain file_operations field and all operations e.g. read, write etc. contained by vnode->v_op. However, in case of Linux struct file will contain file_operations field which will have functions like open, read, write etc. and...
struct file_operations vs struct vnodeops
1,532,142,916,000
On my server, the root partition is 73GB, but the disk says, it is full, although there are only about 6GB used on that device: # df -h Filesystem Size Used Avail Use% Mounted on udev 997M 0 997M 0% /dev tmpfs 202M 41M 162M 20% /run /dev/mapper...
There are two possibilities: 1. There are deleted files still open by some procesces You can see all open files with lsof. For example those are the TYPEs shown in lsof and how often they appear in the output: # lsof|cut -c50-54|sort|uniq -c 375 CHR 610 DIR 211 FIFO 32 IPv4 17 IPv6 40 link 419 node ...
Find out which process has data open on the hard drive that is no longer visible in the directory tree [duplicate]
1,532,142,916,000
I have an image that I know was ok. (image.jpg) A few days later when I open, image.jpg was corrupt. (not displaying properly) How to check if bit in hard disk drive where image is located is failing? I am ok with permanent destruction of image. Can I dd over file with all ones wait a few days and check if any of the ...
Try badblocks, which seems to work on regular files provided the files aren't open: badblocks -b 512 -vn image.jpg Example on a real 13K file: sudo badblocks -b 512 -vn \ /usr/share/texlive/texmf-dist/tex/latex/mwe/example-image.jpg Output: Checking for bad blocks in non-destructive read-write mode ...
Bad bit in file
1,532,142,916,000
Are there any files created and or broadened by the system besides mail and logs? AFAIK, the only files that are created and/or broadened by the system in default are /var/mail/ files and /var/log/ files (broadened by means of file size). To cope with that I've redirected `/dev/null on files in these directories. But ...
I'd recommend reading up on the Unix filesystem. The /var/ directory holds frequently changing files. The /etc/ directory holds configurations that don't typically grow too much. the /usr/ directory holds OS files that don't change too much outside of system upgrades. If you have third-party applications running off o...
Are there any files created and or broadened by the system besides mail and logs?
1,478,232,523,000
I recently upgraded my disk from a 128GB SSD to 512GB SSD. The / partition is encrypted with LUKS. I'm looking for help extending the partition to use all the free space on the new disk. I've already dd'd the old drive onto the new one: [root@localhost ~]# fdisk -l /dev/sda Disk /dev/sda: 477 GiB, 512110190592 byte...
OK! The definitive answer finally. My steps to expand a LUKS encrypted volume... cryptsetup luksOpen /dev/sda2 crypt-volume to open the encrypted volume. parted /dev/sda to extend the partition. resizepart NUMBER END. vgchange -a n fedora_chocbar. Stop using the VG so you can do the next step. cryptsetup luksClose ...
Extend a LUKS encrypted partition to fill disk
1,478,232,523,000
I have a luks-encrypted partition that was protected by a passphrase and a key file. The key file was for routine access and the passphrase was in a sealed envelope for emergencies. May months went by and I accidentally shredded the key file, so I recovered by using the passphrase from the envelope. Now I want to know...
As you've discovered, you can use cryptsetup luksDump to see which key slots have keys. You can check the passphrase for a particular slot with cryptsetup luksOpen --test-passphrase --key-slot 0 /dev/sda2 && echo correct This succeeds if you enter the correct passphrase for key slot 0 and fails otherwise (including i...
Detemine which luks slot a passphrase is in
1,478,232,523,000
I would like to change a LUKS password. I want to remove my old password, but I would like to try out my new password before removing the original. I obviously know the old password. I would like to use the terminal not GUI. I have sensitive data on the drive and would rather not have to use my backup so I need the me...
In LUKS scheme, you have 8 "slots" for passwords or key files. First, check, which of them are used: cryptsetup luksDump /dev/<device> |grep BLED Then you can add, change or delete chosen keys: cryptsetup luksAddKey /dev/<device> [/path/to/<additionalkeyfile>, optional] cryptsetup luksChangeKey /dev/<device> -S 6 ...
How do I change a LUKS password?
1,478,232,523,000
I have a Debian Wheezy server that's been running for a while with an encrypted drive. The password for the encrypted drive (/dev/sda5) was lost when my encrypted password file was corrupted. I'd like to be able to reboot this server, but that will of course require that password. Since the drive is clearly in a decry...
Yes, you can do this by accessing the master key while the volume is decrypted. The quick and dirty to add a new passphrase: device=/dev/sda5 volume_name=foo cryptsetup luksAddKey $device --master-key-file <(dmsetup table --showkeys $volume_name | awk '{ print $5 }' | xxd -r -p) device and volume_name should be set a...
Change password on a LUKS filesystem without knowing the password
1,478,232,523,000
If I mount a simple loop device, losetup -a give me the devices opened. Is something similar possible with cryptsetup?
dmsetup is useful for anything device mapper related. For Example: [root@localhost]~# dmsetup ls --target crypt luks-90dc732d-e183-4948-951e-c32f3f11b305 (253, 0) [root@localhost]~#
List open dm-crypt LUKS volumes
1,478,232,523,000
I tried removing LUKS encryption on my home directory using the following command: cryptsetup luksRemoveKey /dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd But it gives me an error saying: Device /dev/mapper/luks-3fd5-235-26-2625-2456f-4353fgdgd is not a valid LUKS device. Puzzled, I tried the following: crypts...
ANSWER FROM 2013 - See other answers for happy times Backup Reformat Restore cryptsetup luksRemoveKey would only remove an encryption key if you had more than one. The encryption would still be there. The Fedora Installation_Guide Section C.5.3 explains how luksRemoveKey works. That it's "impossible" to remove the e...
How to remove LUKS encryption?
1,478,232,523,000
I just received a new USB flash drive, and set up 2 encrypted partitions on it. I used dm-crypt (LUKS mode) through cryptsetup. With an additional non-encrypted partition, the drive has the following structure: /dev/sdb1, encrypted, hiding an ext4 filesystem labelled "Partition 1". /dev/sdb2, encrypted, hiding anothe...
For a permanent solution to change the label of the container, use: sudo cryptsetup config /dev/sdb1 --label YOURLABEL Edit: Notice that labeling only works with Luks2 headers. In any case, it is possible to convert a Luks1 header into Luks2 with: sudo cryptsetup convert /dev/sdb1 --type luks2 OBS: Please notice th...
How can I set a label on a dm-crypt+LUKS container?
1,478,232,523,000
What's the fastest method to backup and restore a luks encrypted device (e.g. a full encrypted usb-device to a image-file). The usb-device can be decrypted/accessed. I'm looking for a solution to mount the backup image as a file (encryped). Can it be possible? Keep it simple, stupid.
cryptsetup handles image files just as well as block devices, if that was your question. So if you make a dd image (which will be freaking huge) it will work. And if it didn't, you could just create the loop device yourself. Best practice (if you want to keep the backup encrypted) is to encrypt the backup disk also, t...
Best practice to backup a LUKS encrypted device
1,478,232,523,000
What command can be used to determine the used encryption on a LUKS partition (all the relevant information, initialization vector, generation scheme, mode of operation and block cipher primitive)?
If the decrypted volume is /dev/mapper/crypto then you can get the information with dmsetup table crypto 0 104853504 crypt aes-cbc-essiv:sha256 000[...]000 0 254:2 4096 If the encrypted volume is /dev/storage2/crypto then you get the information with cryptsetup luksDump /dev/storage2/crypto LUKS header information fo...
How to determine what encryption is being used a LUKS partition?
1,478,232,523,000
I am investigating a problem where encrypting a block device imposes a huge performance penalty when writing to it. Hours of Internet reading and experiments did not provide me with a proper understanding, let alone a solution. The question in short: Why do I get perfectly fast write speeds when putting a btrfs onto a...
The answer (as I now know): concurrency. In short: My sequential write, either using dd or when copying a file (like... in daily use), becomes a pseudo-random write (bad) because four threads are working concurrently on writing the encrypted data to the block device after concurrent encryption (good). Mitigation (for ...
Abysmal general dm-crypt (LUKS) write performance
1,478,232,523,000
I am in progress of resizing a LUKS encrypted partition that contains a single ext4 filesystem (no LVM or something). The cryptsetup FAQ recommends to remove the old partition and recreate it, but that sounds like wasting a lot time. Therefore I want to proceeed by manually, carefully resizing the partition. So far, I...
After backing up (step 1) and unmounting (between 2 and 3), run fsck to ensure that the filesystem is healthy: e2fsck -f /dev/mapper/ExistingExt4 Other than that, the steps are OK. Purpose of the cryptsetup resize command what should I choose for $SECTORS? Is this step even necessary? This step is necessary, otherw...
How can I shrink a LUKS partition, what does `cryptsetup resize` do?
1,478,232,523,000
I accidentally created a new physical volume over my LUKS partition; nothing else happened. The LUKS partition contains a LVM setup and the root partition (this setup was initially created by the debian installer). I can see that the LUKS partition is mostly intact: 00000200: 4c41 4245 4c4f 4e45 0100 0000 0000 0000 L...
cryptsetup repair, Part One — Magic Bytes Recovery See also: cryptsetup repair, Part Two — Full Header Recovery This looks like a LUKS 2 header that was directly overwritten with LVM metadata. So the LUKS device became a LVM Physical Volume. So this is a damaged LUKS header recovery problem. Depending on the damage,...
Restore a LUKS partition that was overwritten by pvcreate
1,478,232,523,000
How can I change the hash-spec and iter-time of an existing dm-crypt LUKS device? Clearly I can pass the options if I create a new device, for example something like this: sudo cryptsetup luksFormat --cipher aes-cbc-essiv:sha256 --key-size 256 --iter-time 2100 --hash sha512 /dev/loop0 But if the device already exist...
Each key slot has its own iteration time. If you want to change the number of iterations, create a new slot with the same passphrase and a new number of iterations, then remove the old slot. cryptsetup -i 100000 --key-slot 2 luksAddKey $device cryptsetup luksKillSlot $device 1 I think the hash algorithm cannot be con...
How to change the hash-spec and iter-time of an existing dm-crypt LUKS device?
1,478,232,523,000
The LUKS / dm-crypt / cryptsetup FAQ page says: 2.15 Can I resize a dm-crypt or LUKS partition? Yes, you can, as neither dm-crypt nor LUKS stores partition size. I'm befuzzled: What is "resized" if no size information is stored? How does a "resize" get remembered across open / closes of a encrypted volume?
It's about online resize. For example if you use LVM, create a LV of 1G size, and put LUKS on that, it's like this: # lvcreate -L1G -n test VG # cryptsetup luksFormat /dev/mapper/VG-test # cryptsetup luksOpen /dev/mapper/VG-test lukstest # blockdev --getsize64 /dev/mapper/VG-test 1073741824 # blockdev --getsize64 /dev...
What does `cryptsetup resize` do if LUKS doesn't store partition size?
1,478,232,523,000
I recently installed Fedora 20. I don't recall what exact options I chose for encrypting the disk/LVM during installation. It installed fine and I can log in etc. Here is the situation I have: I booted up with LiveCD and tried the following: (I have installed Fedora20 to /dev/sda3' partition). If I run cryptsetup ...
cryptsetup luksDump /dev/fedora/01 shows the LVM logical volume to be a LUKS encrypted volume. The output of pvs or pvdisplay would show the partition /dev/sda3 to be a physical volume. Thus you have LUKS over LVM. At a lower level, you have LVM over PC partition. The output of lsblk confirms this: sda is a disk, sda3...
How to identify LVM-over-LUKS or LUKS-over-LVM
1,478,232,523,000
Context Encrypting whole new external hard drive with Luks. I.e. it is not a system drive (will be used only to store data, not to boot the OS), and it is completely blank. Observation All descriptions that I found about how to achieve this go along the lines of: create a new partition, which is the same size as the ...
The cryptsetup FAQ mentions whole-disk encryption using LUKS. Basically, cryptsetup doesn’t care what the LUKS device is, partition, disk, or loop device, so you can use whichever is appropriate. sudo cryptsetup -v -y luksFormat /dev/sda will create a LUKS container using all of /dev/sda. Section 2.2 of the FAQ recom...
Encrypting whole disk with Luks (instead of one big encrypted partition)
1,478,232,523,000
How does bit rot affect a LUKS container and the filesystem inside? Suppose you have a filesystem that is well suited to deal with bit rot. Now put it inside a LUKS container. In case bit rot corrupted the container, I assume the decrypted filesystem will suffer huge amounts of corrupted raw bytes / blocks. How does L...
Bitrot in the LUKS header (key and otherwise critical material): it's *poof* gone. (There is a bit of redundancy and checksum for the LUKS2 header but it doesn't cover much, so chances are... it's still gone). Bitrot in encrypted data: it depends on the encryption mode, but in general, a single bit flip will result in...
Bit Rot within LUKS Encryption
1,478,232,523,000
Following the Kali Linux documentation for "Adding USB Persistence with LUKS Encryption", I created a persistent partition and encrypted the volume with: cryptsetup --verbose --verify-passphrase luksFormat /dev/sdb2 cryptsetup luksOpen /dev/sdb2 my_usb mkfs.ext3 -L persistence /dev/mapper/my_usb e2label /dev/mapper/my...
Forgetting the luksClose doesn't harm the data on the disk, after the umount, everything is flushed to the disk, so you are safe at this point. What the article you linked is talking about is that without the luksClose, the device mapper mapping for the crypt device is still lingering around, which blocks the name my_...
forgot to luksClose usb persistent partition, is this a problem?
1,478,232,523,000
My system is full of very sensitive data, so I need to encrypt as much of it as possible. I have an encrypted Debian installation which asks for a long password every time during boot. Is there a simple way to set it up so that I can input that password remotely? If some other distribution can do it, I don't mind inst...
You can enable this by installing dropbear-initramfs and following the instructions to configure your SSH keys. This will start an SSH server from the initramfs, allowing you to connect remotely and enter your encryption passphrase.
Turning encrypted system on remotely
1,478,232,523,000
I want to create a new encrypted LUKS-partition in GParted. I've searched the UI and the help, but the only thing I can find is how to open and close an existing LUKS partition and how to to copy and paste an existing one. However, I can find no way to create a new one. I can create a new partition e.g. for btrfs, but...
GParted doesn't support creating of encrypted partitions, you'll need to use either GNOME Disks or blivet-gui (shameless plug for my project) or you can just use cryptsetup directly if you are ok with using command line tools. See GParted Features page for details about supported features, LUKS is listed as not suppor...
How to create a new encrypted LUKS-partition in GParted?
1,478,232,523,000
I have a fully encrypted server running Debian 7 and have set up dropbear and busybox to unlock the LUKS container via SSH (as described in this tutorial and in this U&L answer). Unfortunately, whenever I try and SSH to the server (over the LAN) at reboot, I get a "Connection refused" error. I have tried telnet and nm...
I got this same problem a few weeks ago (Debian Wheezy 7.6) and after some days of troubleshooting I found out that there was a config file missing which was preventing to the cryptroot script on init-top to run correctly, hence it was not stopping to ask the password via ssh, killing the dropbear at the end of the se...
How to open a port early in boot process to unlock LUKS via SSH
1,478,232,523,000
When using LUKS full disk encryption, how would you go about protecting against evil maids ? The evil maid attack is when someone gets physical access to your computer while you're away and compromises the unencrypted /boot partition to capture your FDE password the next time you start your computer One of the solut...
Finally figured it out. This still feels really hacky and dirty because the system is never aware that /boot may not be mounted and you'll have to manually mount it before doing anything that might write to it (think system updates, etc), but other than that it works perfectly. prepare your flash drive with a single ...
Defending against the evil maid, how to handle removal of the /boot partition
1,478,232,523,000
I'm having problems unlocking a luks-encrypted disk with KDE dolphin, in a system with manjaro. The issue is not critical. It can be solved by rebooting, but sometimes it is not convenient to do so, and I find that it might be useful to understand why this problem appears in the first place. So the first time I unlock...
If, after looking at the output of dmsetup ls you find that you have stale devices you can remove them with dmsetup remove – ideally after carefully verifying that the device is indeed not in use. I had the same problem and after doing so I was able to unlock and mount my encrypted USB hard disk again: # dmsetup ls --...
Error unlocking a LUKS partition (failed to activate device:file exists)
1,478,232,523,000
In what I now know feel was a stupid decision, I attempted to dual boot Windows and linux by using the windows installer, After booting into the windows installer I chose one of a 2 cloned hard drives about 500GB in size to erase, as they were cloned it wouldn't matter if I picked one over the other. After doing so, t...
cryptsetup repair, Part Two — Full Header Recovery See also: cryptsetup repair, Part One — Magic Bytes Recovery In order to recover a partially overwritten LUKS2 header, you need at minimum two things: One, the key material of at least one of your keyslots. Two, the metadata describing how that key material is to be...
Overwritten LUKS with a partition table
1,478,232,523,000
I have read: Resize LUKS Volume(s) Increase the size of a LUKS encrypted partition Resizing LVM-on-LUKS And others. I'm trying to resize from 250 GB to 500 GB. Previously, the partition /dev/sda2, was 250 GB, I've now resized the partition to 500 GB. However, what about the LUKS device, which resides at /dev/sda2? H...
You still have to resize the filesystem using the resized block device. The precise method and possible limitations depend on each filesystem. Here are two examples to resize the filesystems to the whole available size for EXT4 and XFS. An other filesystem will require an other specific command. An EXT4 filesystem ca...
How to resize a LUKS device, revisited
1,478,232,523,000
I'm debugging a weird behavior of cryptsetup: Assume the correct password is stored in the file pw. I expected now that --test-passphrase would always succeed (i.e. printing no output) if it is passed in as stdin. But it turns out that it randomly fails: # cryptsetup luksOpen --test-passphrase /dev/nvme0n1p2 < pw # cr...
@frostschutz was correct. It turns out that the memory on my machine shows errors in a Memtest86+ run. The most likely explanation is that the computation works or fails depending on what part of the RAM is being used. And Argon2 - now the default for key derivation - uses a lot of memory during the computation. But i...
cryptsetup: verification in luksOpen is non-deterministic when reading the password from a file
1,478,232,523,000
Is it possible to convert LUKS2 to LUKS version 1, and by extension, change the use of features that would block such a conversion? Fedora 30 uses LUKS2 by default, however I ran into a situation where I need to stick with LUKS version 1. Specifically, Relax-and-Recover (rear) does not support LUKS2 at the moment. Do...
Converting LUKS1 to LUKS2, then back to LUKS1 works just fine. It's starting out with LUKS2 then converting to LUKS1 that causes problems. Apparently, cryptsetup convert is unable to convert between LUKS2 argon2i keys and LUKS1 pbkdf2 keys. Setup: # truncate -s 100M luks1.img # truncate -s 100M luks2.img # cryptsetup ...
Convert LUKS2 back to LUKS version 1
1,478,232,523,000
I want to extend my LUKS-encrypted lvm (volume group) with a new physical volume. In my previous question I was told - in respect to my actual setup - that I need to encrypt the new physical volume prior to add it to my existing volume group. I would like to know what steps I have to respect, to successfully add that ...
You’ll need to set up encryption on the new physical device: sudo cryptsetup luksFormat /dev/newdevice (replacing newdevice as appropriate). Then open it: sudo cryptsetup luksOpen /dev/newdevice newdevice_crypt You’ll need to add a matching line to /etc/crypttab so that it’s opened at boot, and update your initramfs...
How can I add a new physical volume to extend an existing LUKS-encrypted lvm (volume group) and maintain encryption?
1,478,232,523,000
I am working on my yocto distribution including cryptsetup in the 2.3.2 version I am running such distribution on a board with 1 GB RAM and I am incurring in an "out of memory" error trying to open an encrypted partition that I am not able to properly debug. Any ideas? My distro runs from an mSD with 3 partitions; the...
LUKS2 uses Argon2i key derivation function which is memory-hard -- meaning it requires a lot of memory to open the device to prevent (or at least make it harder) brute force attacks using GPUs. You can check how much memory you need to open your device using cryptsetup luksDump /dev/sda2, look for the line Memory: ...
Open: cryptsetup out of memory ("Not enough available memory to open a keyslot.")
1,478,232,523,000
I have used GRUB_ENABLE_CRYPTODISK=y in /etc/default/grub to allow LUKS encryption of everything except my EFI partition, which I mount to /boot/efi. This works fine. The only admittedly small problem is that, if I happen to mistype my password, I don't get a second chance. Instead, after 10 seconds or so, I'm left...
The simplest way is to just hit ctrl+alt+del to soft reset, but you do have to go through the POST again. Another way to go, from the rescue prompt: replace hd0,gpt2 with the appropriate value for your machine - on my system it is shown as part of the password prompt. I'm using btrfs without any lvm (and no separate ...
Odd wrong password behaviour with GRUB cryptodisk
1,478,232,523,000
I've an image backup file of my harddisk, which consists of three partitions (sudo fdisk -l /mnt/hdd/19_02.img): Device Start End Sectors Size Type /mnt/hdd/19_02.img1 2048 1050623 1048576 512M EFI System /mnt/hdd/19_02.img2 1050624 34686975 33636352 16G Linux swap /mnt/hdd/19...
fdisk is being a bit stupid here: when displaying device names for the partitions, it just takes the name of the whole-disk device given to it, and appends the partition number (prefixed with p if the last character of the whole-disk device name is also a number). It does this without checking if a device by that name...
Mount encrypted partition of an image file
1,478,232,523,000
I created an encrypted container via #!/bin/bash dd if=/dev/zero of=$1 bs=1 count=0 seek=$2 MAPPER=$(mktemp -up /dev/mapper) LOOPDEV=$(losetup --find --show $1) cryptsetup luksFormat $LOOPDEV cryptsetup luksOpen $LOOPDEV $(basename $MAPPER) mkfs.ext3 $MAPPER cryptsetup luksClose $MAPPER losetup -d $LOOPDEV i.e. a fil...
In fact, modifying mount is possible, as I learned from the existence of mount.ntfs-3g. I'm doing only guesswork, but I suspect mount -t sometype results in a call to mount.sometype $DEV $MOUNTPOINT $OPTIONS, feel free to correct me here or quote some actual documentation. Especially the option -o loop is already trea...
How to mount a cryptsetup container just with `mount`?
1,478,232,523,000
When you run luksDump on a LUKS device, I get this: $ sudo cryptsetup luksDump /dev/sda1 LUKS header information Version: 2 Epoch: 3 Metadata area: 16384 [bytes] Keyslots area: 16744448 [bytes] UUID: 4640c6e4-[…] Label: (no label) Subsystem: (no subsystem) Flags: (no...
The Epoch increases every time you change anything in your LUKS header (like when adding or removing keys, etc.). The LUKS2 header specification states: uint64_t seqid; // sequence ID, increased on update seqid is a counter (sequential number) that is always increased when a new update of the header is written. Th...
What is the epoch of LUKS that is shown when running luksDump?
1,478,232,523,000
I am struggling with setting up an encrypted NAS for some days now. The basic plan is to have btrfs on lvm on luks on raid1 with lvmcache in writeback mode thrown in for the root partition to reduce disk access. TL;DR: After setting up the partitions and filesystems GRUB fails to install with: grub-install: warning: A...
Hmm ... apparently this line was the clue: grub-install: warning: Attempting to install GRUB to a disk with multiple partition labels. This is not supported yet.. Previously I had installed btrfs directly on /dev/sda and /dev/sdb. That's why both of them had a FSTYPE and LABEL attached (as shown in lsblk). Solution:...
Grub-install: embedding is not possible in Bios/GPT
1,478,232,523,000
I'm trying to use cryptdisks_start to open a LUKS device that is defined in my /etc/crypttab. Unfortunately, the command fails with the following error message: martin ~ # cryptdisks_start luks-01a2e5d8-9211-40ce-b160-d3f973d1a155 * Starting crypto disk... * luks-01a2e5d8-9211-40ce-b160-d3f973d1a155 (starting).. * ...
It doesn't work because the /etc/crypttab line is missing the option keyword luks. Changing the line to this resolved the issue: luks-01a2e5d8-9211-40ce-b160-d3f973d1a155 UUID=01a2e5d8-9211-40ce-b160-d3f973d1a155 /etc/luks-keys/luks-01a2e5d8-9211-40ce-b160-d3f973d1a155 luks,nofail This is due to the fact that cryptdi...
cryptdisks_start: precheck failed: the device contains a filesystem type crypto_LUKS
1,478,232,523,000
I wiped the disk using wipefs -a /dev/sda. I happily formatted the disk, and it seems that when I'm about to mount /dev/sda3 it says "unknown file system type crypto_LUKS". I did no encryption on this partition, so it's like the previous configuration is saved somehow. If I apparently wiped or reset the disk, how ca...
wipefs -a /dev/sdx only wipes magic signatures on that device, not on its partitions. So at best, it only wipes your partition table, but if you then proceed to re-create the partitions at the same offsets at before, the old data is still there. You'd have to wipe the partitions as well. wipefs -a /dev/sdx[1-9]* # wip...
Partition still encrypted with luks after wipefs
1,478,232,523,000
I'm working on a script to create a fully encrypted washable system from debootstrap. It's doing some good, but the initramfs image that comes out does not pick up the cryptroot properly. After booting the image with qemu, I'm dropped to a busybox shell and I have to unlock the luks encryption manually with cryptsetup...
Using /etc/initramfs-tools/conf.d/cryptsetup is deprecated in stretch. The new preferred method is to set "CRYPTSETUP=y" in /etc/cryptsetup-initramfs/conf-hook. In buster and later, this configuration parameter appears to be redundant, as the default behaviour seems to be to configure cryptsetup in initramfs IFF the i...
Initramfs in debootstrap chroot of fully encrypted system
1,419,471,821,000
I'm trying to open a LUKS drive through SSH directly. ssh root@XX "cryptsetup luksOpen /dev/sdb3 secure But, no password prompt and it stuck. debug1: Sending command: cryptsetup luksOpen /dev/sdb3 secure debug2: channel 1: request exec confirm 1 debug2: callback done debug2: channel 1: open confirm rwindow 0 rmax 3276...
For the prompt to work, you need to add -t. ssh -t root@host cryptsetup luksOpen /dev/thing luksthing (It also works if you just type out your password when it's "stuck" waiting for input, but it will echo in your local terminal.) Alternatively, piping the passphrase works well enough: echo -n 'password' | ssh root@...
Cannot run cryptsetup throught SSH?
1,419,471,821,000
I've created a encrypted volume with LUKS at home and was looking to use it at work too. Unfortunately, that's not possible. Whyever, I'm unable to access the encrypted data on any other computer than my workstation at home. After entering the passphrase, I do recieve this error message: No key available with this pa...
LUKS sometimes gives the No key available error message when the cipher isn't supported. Which cipher did you use? For supported ciphers, check /proc/crypto. Also, passphrase may depend on keyboard layout and (if it has non-ascii characters) charset encoding. The keyboard layout problem can be worked around by adding ...
luksOpen: No key available with this passphrase
1,419,471,821,000
I already asked once about LUKS unlocking of multiple HDDs in Linux: LUKS and multiple hard drives. Now I would like to know how to secure store the keyfile used for the automatic unlock of the associated partitions. My plan is (if possible): Encrypt a small USB drive with LUKS that requires a passphrase Unlock it at...
Your approach looks good. Some remarks though: If you want to encrypt rootfs, you'll need to use initrd (to have some minimal unencrypted system that will process the encrypted partitions). If the USB device is removable, both initrd and kernel can be stored on the USB to heighten tamper resistance (supposing you mak...
LUKS storing keyfile in encrypted usb drive
1,419,471,821,000
I am using manjaro with full disk encrypt, however, the wait time at boot for decrypt is very long ( i assume because of a high difficulty setting) . How can I change encryption difficulty/ wait time of the encryption setup during install?
Too much passphrase hashing? If it's only slow because you're waiting for a lot of passphrase hashing iterations, you could add a new passphrase with a quicker --iter-time, but that could reduce security & allow faster guessing of passphrases. If you wanted to wait 1 second (1000ms) then use a command like: cryptsetu...
How to change luks encryption difficulty on manjaro full disk encrypt
1,419,471,821,000
I decided to encrypt my root partition with LUKS+LVM. My ThinkPad setup: Samsung 830 128GB SSD 750GB HDD Core 2 Duo 2,5 GHz P9500 8GB RAM But the more I read, the less I understand about those two following subjects: 1a. The cipher I was going to use SHA1 instead of 2/512 (as some suggest), because of that quote fro...
1a - it really doesn't matter all that much. which ever hash you use for the key derivation function, LUKS makes sure it will be computationally expensive. It will simply loop it until 1 second real time has passed. 1b - the key derivation method has no influence on performance. the cipher itself does. cryptsetup benc...
Trying to understand LUKS encryption
1,419,471,821,000
I'm trying to recover my files from a now broken Antergos install, and have run into trouble because the user/non-boot partition is encrypted with LUKS encryption. I'm booting from an Ubuntu 18.04 bootable USB drive so I can backup the directories where I had data I wanted, and didn't realize it was encrypted until ...
To recover your files you will first need to open your LUKS container. This will make your LVM logical volumes accessible. Then, you can mount the appropriate logical volume to gain access to the files. I'll assume that once you have access to the files you'll know what to do. Opening the LUKS container To open the LU...
How to mount and de-encrypt a LUKS encrypted partition to recover files [closed]
1,419,471,821,000
I have a 3TB disk, and I understand I have to use parted if I want to create a partition bigger than 2TB. All right then. parted /dev/sdb (parted) mklabel gpt (parted) mkpart primary File system type? [ext2]? Say what? It does not let me to create a partition without speci...
Parted prompts and goes into an interactive mode when you do not provide enough information to create the partition with the command. The following will create a partition that spans the entire disk and will not prompt for filesystem type: mkpart primary 1 -1
parted: create new partition
1,419,471,821,000
I have encrypted an external hard drive using LUKS2 on my machine running Fedora 34 using the cryptsetup command. When I now plug in the hard drive and enter the passphrase, the drive is unlocked successfully, and I can access my files. Additionally, I'd like to be able to unlock the drive using my FIDO2 security key....
You should be able to manually unlock the device with systemd-cryptsetup sudo /usr/lib/systemd/systemd-cryptsetup attach myLuks /dev/sdc1 - fido2-device=auto You can't use cryptsetup to unlock LUKS devices using FIDO (or TPM2) right now, support for these is in systemd only (it uses LUKS2 feature which allows adding ...
Mounting external hard drive using LUKS2 and FIDO2 Key
1,419,471,821,000
I have(had) the following setup: Full disk encryption with LUKS and a separately encrypted /home partition. Made the mistake to delete my /root but caught early enough so only changes to the partition table where made. Now I'm left with the following: sudo hexdump -C /dev/nvme0n1 |grep LUKS 3e900000 4c 55 4b 53 ba be...
WARNING: Make an image (backup) of the drive BEFORE you do all this. Read the documentation (e.g., "man pages") for all commands, and make sure you understand what they do, before using them. YOU HAVE BEEN WARNED For future reference, here's the solution: Find where the LUKS partition starts.  All LUKS partitions hav...
Recover deleted LUKS partition
1,419,471,821,000
I've created the following [email protected] service for systemd: [Unit] Description=Cryptography Setup for '%I' After=cryptsetup-pre.target After=dev-mapper-%i.device Before=cryptsetup.target Before=umount.target BindsTo=dev-mapper-%i.device BindsTo=dev-mapper-%i.luks.device Conflicts=umount.target DefaultDependencie...
An alternative solution would be to edit the sudoers file to add permissions for the user in question to run /usr/lib/systemd/systemd-cryptsetup with root permissions with NOPASSWD option enabled. You would then edit your (user-specific) service file above to read: ExecStart=/usr/bin/sudo /usr/lib/systemd/systemd-cryp...
How to decrypt LUKS-encrypted device on per user basis upon login?
1,419,471,821,000
I'm confused between the various ways that LUKS/dmcrypt/cryptsetup discard /TRIM operations can be enabled via the Linux kernel command line. The dracut manpage: rd.luks.allow-discards Allow using of discards (TRIM) requests on all LUKS partitions. The systemd-cryptsetup-generator manpage luks.options=, rd.luks.op...
It depends a little on the distribution you are using and what components are included by dracut in the initramfs. For example, the cryptdevice= option is interpreted by the encrypt hook. Thus, it's only relevant for initramfs images that include this hook. The disadvantage of rd.luks.allow-discards and rd.luks.allow-...
LUKS discard/TRIM: conflicting kernel command line options
1,419,471,821,000
Can scrypt be used as the hashing algorithm for LUKS? Can I tune its parameters? How can I do this?
No, LUKS 1 only supports PBKDF2 as the password-based key derivation function. PBKDF2 is built on a cryptographic hash function, and you can select the hash function with --hash, as well as the iteration count via --iter-time. All supported hash functions are equally secure for this use case; a higher iteration count ...
Can I use scrypt to hash for LUKS?
1,419,471,821,000
I have two hard drives in a volume group with LVM. All volumes in that volume group hold LUKS containers. If I add an SSD as an LVM cache to that volume group, is all data on the cache device encrypted? Bonus points for tools that confirm the cache's content.
If I add an SSD as an LVM cache to that volume group, is all data on the cache device encrypted? Yes, it's encrypted because LVM cache works with blocks directly. It has no idea what the underlying data is. Bonus points for tools that confirm the cache's content. Fire up any hex editor (hexedit, dhex, etc) and ope...
Is an LVM cache a security leak when using LUKS on LVM?
1,419,471,821,000
I'm looking for a way to make the following setup happen in Gentoo: /dev/sda1 -> /boot (ext2) /dev/sda2 -> Luks encrypted | +-lvm-vg1 | +- /dev/mapper/root-fs -> / (ext4) +- /dev/mapper/swap -> (swap) It's basically the same setup as Ubuntu would do when doing a graphical install. I do know how to manually...
So I did figure it out: I partitioned the disk partialy following the handbook: # parted -a optimal /dev/sda GNU Parted 2.3 Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands. (parted)mklabel gpt (parted)unit mib (parted)mkpart primary 1 3 (parted)name 1 grub (parted)set 1 bios_grub on (p...
Guide for Gentoo setup with full disk encryption using LUKS+LVM
1,419,471,821,000
I was wondering, if it was possible to use LUKS encryption with tape drives, QIC for instance. I'm using LUKS for USB drives and internal disks, even DVDs and CDROMs. But I was thinking of maybe using it to encrypt tape drives as well. Should I just use cryptsetup luksFormat directly to the tape drive and then enable ...
You are unlikely to be happy with the huge latencies introduced by LUKS on linear media. A better idea is to pipe the output of tar through OpenSSL, encrypting it with a streaming cipher, before sending it to the tape device.
LUKS encryption for tape media?
1,419,471,821,000
I have installed Arch Linux with LUKS on a btrfs file system. When logging in, I can't mount my filesystem on /dev/sda2 because the keyboard is US (I need a French key map). I try change /etc/vconsole.conf to FR and generate locale-gen but the keyboard don't change in next boot.
Your /etc/mkinitcpio.conf needs to look like this: HOOKS="... keyboard keymap encrypt..." You need to load the keymap during boot, which is done by an mkinitcpio hook. Make sure that the keymap or sd-vconsole hook (depending on whether you use sd-* style hooks) occurs before encrypt/sd-encrypt and regenerate your ...
Problem keyboard layout in boot with LUKS
1,419,471,821,000
How to run cryptsetup luksFormat non-interactively When LUKS formatting a partition, I recieve the message # cryptsetup luksFormat /dev/sdb WARNING! ======== This will overwrite data on /dev/sdb irrevocably. Are you sure? (Type uppercase yes): YES Followed by Enter passphrase:. How can I automatically answer YES to...
You could make use of the --batch-mode, -q option of cryptsetup to skip the question. $ cryptsetup -q luksFormat /dev/sdb This option also disables password verification, so one should use it with care or in an automated environment
How to answer YES automatically with a cryptsetup luksFormat command?
1,419,471,821,000
UPDATE 1: userone@desktop:~$ sudo umount "/media/userone/New Volume" umount: /media/userone/New Volume: mountpoint not found userone@desktop:~$ sudo cryptsetup luksClose /dev/mapper/luks-04cb4ea7-7bba-4202-9056-a65006fe52d7 Device /dev/mapper/luks-04cb4ea7-7bba-4202-9056-a65006fe52d7 is not active. userone@desktop:~...
It looks as though the journal has become corrupt, doing some searches over the past few days, this seems to not be uncommon on devices that use LUKS. You could try running an fsck on the device, acknowledging that any data on the device may not be accessible after - you may like to use dd to make a copy of the drive ...
Mount error when automounting a LUKS-encrypted USB flashdrive
1,419,471,821,000
I'm trying to determine if I should re-setup my RAID array due to poor IO performance. First off, the system: i7 920 4 4TB WD 5400 Green drives CentOS 6.3 host Secondly, the disk setup: /dev/sda2,b2,c2,d2 are individually LUKS encrypted /dev/mapper/a2,b2,c2,d2 are all part of a software RAID5 /dev/md1 /dev/md1 has ...
Your layering is suboptimal because putting the raid 5 on top of the encryption means that you increase the number of encrypt/decrypt operations by 25 % - since 4 * 4 TB are encrypted. When putting the encryption on top of the raid 5 only 3 * 4 TB are encrypted. The reasoning behind that is: you don't have to encrypt ...
Poor IO due to LUKS/Software RAID/LVM ordering?
1,419,471,821,000
I'm surprised that this question is not asked more frequently, but (in RHEL) does LUKS support TPM's the way that Windows BitLocker does? If so, how is this feature implemented, and does it provide the same type of protections that BitLocker for Windows provides? BitLocker is very popular among businesses, and now th...
I've implemented support for storing your LUKS key in TPM NVRAM, and RHEL6 happens to be the one platform where all features are fully tested, see this post: [1] https://security.stackexchange.com/a/24660/16522
RHEL6 LUKS with TPM support?
1,419,471,821,000
I am on the latest OpenSUSE Tumbleweed and this guide has not worked for me. I did everything like in the guide except I did not generate a new random key and added it to the harddisk but used the passphrase I always used and wrote that into /.root.key. But I am still asked for the password but it seems cryptsetup or ...
I did everything like in the guide except I did not generate a new random key and added it to the harddisk but used the passphrase I always used and wrote that into a file. Passphrase in file works fine, but it must not have newline at the end. Verify that it works with --key-file option: cryptsetup open --verbose -...
Grub2/LUKS How to avoid to type the passphrase twice?
1,419,471,821,000
I have been having a lot of issues getting an encrypted multi-disk root filesystem to boot up reliably under systemd on Debian Jessie while only having to enter the password once. Previously I've handled this in Debian by using the decrypt_derived keyscript in /etc/crypttab for every device except the first, and this ...
There is now a solution to this problem (at least in Ubuntu 18.04+, so I assume Debian, and CentOS-7). Described here. Quoting: Systemd ... will unlock all additional LUKS partitions if all of the partitions you want to unlock use the same password you enter the password for the root partition correctly the first ...
What is the proper way to unlock a root filesystem spanning two LUKS devices by only entering the password once, using systemd?
1,419,471,821,000
Can I use the same single LUKS detached header for multiple drives? What do I should keep in mind doing so? Is this also possible if the drives are fundamentally different (different size, manufacture etc.) ? Reason: I want to use multiple drives in a single system with LUKS but from security standpoint there is no be...
Technical Yes, you can absolutely copy a LUKS header from one disk to another. To be exact you can copy it from a block devise to another block device, this means you can safely copy the LUKS header from a partition (a block device) to a block device representing the whole disk. You can simply do: dd if=/path/to/blo...
Can I use a luks detached header for multiple drives?
1,419,471,821,000
With the default RHEL 6 installer, how can I choose the LUKS encryption? Afaik if I prepare the disk like cryptsetup luksFormat -c cast5-cbc-plain -s 128 /dev/$DEVICE could be the "fastest" encryption, but the installer only prompts for password, then later, at the partitioning it recognizes it as "unknown" partitio...
You might be stuck using a kickstart to define the partition with the encryption type instead of using the graphical install interface.
How to choose LUKS encryption when installing RHEL 6?
1,419,471,821,000
I'm trying to find out what happened to my laptop LUKS drive. I'm sure it ran out of battery since I forgot to plug it in. This morning I booted the system and the LUKS password does not work. I tried several reboots and every time it ends up offering emergency console after 3 tries because it can't decrypt the drive....
LUKS works by dedicating a small amount of space, typically on the encrypted partition, to the "LUKS header". That header contains a checksum, so it should detect corruption. Further, there are two copies; each with their own checksum, so it should automatically use the other copy if one is corrupted. Along with the h...
LUKS password is wrong after system power off
1,419,471,821,000
I have a new installation of ubuntu 22.04, with full disk encryption (LUKS) and ZFS picked from the ubuntu installer options. I need to make some edits to /etc/crypttab so that unlocking my drives works in an automatic way (fancy usb auto unlock), but the edits I'm making to /etc/crypttab aren't persisting to initramf...
I'm here because I ran into the same problem, found this question via Google, and have some information to add. I am attempting to auto-unlock a LUKS drive without having type a passphrase. First, I edited /etc/crypttab and changed its entry to the following: sda3_crypt UUID=2d661ff8-d6a8-49c9-ae96-4d6e234bffe2 /dev/z...
/etc/crypttab not updating in initramfs
1,419,471,821,000
I'm trying to use FIDO2 (YubiKey 5) with Fedora 36 to unlock the LUKS volume on system boot without success as it keeps asking for the regular LUKS passphrase and not using the token to unlock the LUKS volume. I followed Lennart Poettering's example on his blog and used systemd-cryptenroll to enrol the YubiKey and the...
TL;DR run dracut --regenerate-all --force So I found the problem, I didn't execute dracut --regenerate-all --force after modifying /etc/crypttab before rebooting. I believe on Debian based distros you would need to run update-initramfs -uinstead. When requiring a FIDO2 PIN it is entered at the Plymouth interface. It l...
FIDO2 (YubiKey) to unlock LUKS at boot on Fedora 36 not working
1,419,471,821,000
I try to decrypt my harddrive using the password that I 100% know. The password knowledge is not the problem. Last thing I remember doing is: installing texlive. Not having enough disk space. Removing texlive again. followed by apt update apt upgrade apt dist-upgrade I remember the update had an error due to missin...
In GRUB (or whatever you're using as your bootloader), add this boot option to your kernel command line: break=premount. It should give you a shell prompt while the system is still running on initramfs and the system has not yet made any attempts to mount the real root filesystem. You can use this shell prompt to che...
cryptsetup disc encryption “no key available with this passphrase” - but password known 100% [closed]
1,419,471,821,000
When unlocking a newly-formatted LUKS volume, I received a warning in the kernel log: kernel: device-mapper: table: 253:14: adding target device sdk1 caused an alignment inconsistency: physical_block_size=4096, logical_block_size=512, alignment_offset=0, start=33553920 According to another question, a false warning ...
It appears that dmsetup computes its alignment from the optimal I/O size, without bothering to check that that is actually a multiple of the physical block size. As mentioned in the false warning question, this optimal I/O size makes sense due to USB constraints. So the solution is simple: use --align-payload to overr...
dmsetup luksFormat creating an alignment inconsistency
1,419,471,821,000
I'm running Debian Buster on a ThinkPad T420 which is equipped with a 250 GB SSD. Since I needed more disk space I used Clonezilla to clone my current Debian installation from the internal 250 GB SSD to a new 500 GB SSD connected via an USB to SATA adapter. Afterwards I replaced the 250 GB SSD with the 500 GB SSD and ...
it's like Russian dolls: disk -> MBR partition scheme -> extended partition container -> logical partition -> LUKS -> PV -> VG -> LV-> filesystem. So the root filesystem isn't simply on /dev/sda5. What you already did: enlarge disk enlarge extended partition container (/dev/sda2) enlarge partition (/dev/sda5) What's...
How to increase LVM when using LUKS2 on Debian Buster
1,552,997,393,000
I'm in a (bad) situation where I have multiple correct passwords and used luks slots, but I can't tell which password belongs to which slot Decryption (during startup thanks to crypttab) works well, but I can't tell which slot has been used. In order to rationalize this situation, is there a way to determine which luk...
The open LUKS container does not tell which keyslot it was opened with. So no, you can't determine later which slot "has been used". However, if you know a valid key or passphrase, you can determine which slot it is located in, for example by re-running cryptsetup open with --test-passphrase, --key-slot or --verbose o...
Is it possible to determine which luks slot has been used to unlock an encrypted partition?
1,552,997,393,000
I'm running Arch Linux with systemd boot. In /boot/loader/entries/arch.conf I currently specify the luks crypto device with a line like this: options rw cryptdevice=/dev/sda1:ABC root=/dev/mapper/ABC I know I can also use UUID instead of /dev/sda1. In that case the kernel options line would look like this: opt...
If you're already using the new LUKS2 format, you can set a label: For new LUKS2 containers: # cryptsetup luksFormat --type=luks2 --label=foobar foobar.img # blkid /dev/loop0 /dev/loop0: UUID="fda16145-822e-405c-9fe8-fe7e7f0ddb5e" LABEL="foobar" TYPE="crypto_LUKS" For existing LUKS2 containers: # cryptsetup config --...
How to specify cryptdevice by label using systemd boot?
1,552,997,393,000
On my system, I have two encrypted disks: crypt containing the root partition of raspbian stretch usb-crypt is an external usb disk. LVM is used on that disk. Both disks are protected using the same passphrase, but the master key is different according to "cryptsetup luksDump". Neither of the two disks are configure...
Depends on what the init script that asks the password of you is doing with it. If it's systemd, it might just be a feature. systemd-ask-password comes with a cache functionality that might be responsible. https://www.freedesktop.org/software/systemd/man/systemd-ask-password.html --accept-cached If passed, accep...
Why is my LUKS partition mounted without asking for a passphrase?
1,552,997,393,000
I have HDD with my data (partial backup of most important data available on other HDD), currently it's formatted as Ext4 over LVM over LUKS. I want to remove LUKS layer, but reformatting and data restore from backup is too long/no fun. Is there any possibility/chance to overwrite LUKS partition with it's content witho...
You're going to have to copy all the data around anyway. You should definitely have a backup at this point. Unless your backup device is significantly slower than your active disk, restoring from backup is as fast as it can go. A LUKS volume starts with a header (up to 2MB). If you lose the header, the data in the vol...
Can I overwrite LUKS partition with it's decrypted content?
1,552,997,393,000
I'm using arch linux with an encrypted luks root partition (boot unencrypted), with a passphrase yet. Now I have a keyfile (3072 bytes), that's written to USB-Stick this way: sudo dd if=tempKeyFile.bin of=/dev/sdd bs=512 seek=1 count=6 and also set as additional pass sudo cryptsetup luksAddKey /dev/sdb6 tempKeyFile.bi...
From the ArchLinux encrypt hook (/lib/initcpio/hooks/encrypt): *) # Read raw data from the block device # ckarg1 is numeric: ckarg1=offset, ckarg2=length dd if="$resolved" of="$ckeyfile" bs=1 skip="$ckarg1" count="$ckarg2" >/dev/null 2>&1 ;; So while it supports reading a key from a raw block device, ...
Using space before 1st partition of USB-Stick as luks key
1,552,997,393,000
One day, when I turned on the computer, my passphrase for home part /dev/sda7 doesn't worked (I am 147% absolutely sure, that I was writing right pass)! After three times of tries, I have rebooted computer via force shutdown and tried to enter the same pass. That didn't worked. Then instead of default boot "Boot arch"...
If there is corruption in the LUKS header (more than just a single byte), it's pretty much impossible to recover. The LUKS header does not have a checksum for its key material, so - if it's damaged in any way, the cryptsetup luksDump will look same as always, but your passphrase simply won't work anymore. If you're un...
LUKS passphrase doesn't work
1,552,997,393,000
I have one physical disk (/dev/sda) which is divided in /dev/sda1 (which is /boot bootable GRUB2 partition used and setup with Arch) and /dev/sda2 which is my cryptroot that, when unlocked, is a single large lvmpool with the full size of the partition /dev/sda2. I have installed Arch on 3 lvs, as seen in the image bel...
With the help above from Alexander Batischev, and some very useful information from Reddit user cookie_enthusiast on the /r/linuxquestions page on Reddit, I managed to get this working. It turns out that GRUB2 works well with UUIDs, and not so well with device names. With this knowledge in mind, we need the following ...
NixOS installation on multi-boot system with GRUB (from Arch installation)
1,552,997,393,000
I'm curious if there is a filesystem that's unencrypted, making it readable by anyone, but employs a digital signature scheme so as to require that writes be digitally signed. I suspect the answer is "No because it'd be complicated and probably slower than simply encrypting the drive" but seemed interesting.
The two obvious candidates would be ZFS and Btrfs, but as far as I know, they don't do this. Btrfs currently has no crypto at all (for encryption, you're supposed to use LUKS, which provides encryption and optionally block-level integrity but not global integrity). ZFS has an integrity mode where it uses a tree of cry...
Is there an unencrypted but signed filesystems?
1,552,997,393,000
What am I trying to do? Install Arch with full system encryption (sans boot and media partition) using LVM on top of LUKS on an external hard drive (sdb) using: http://suddenkernelpanic.blogspot.com/2013/03/arch-linux-lvm-on-top-of-luks-2013-style.html What is my problem: System boots grub and it appears there is some...
Your problem seems to be in the difference of :crypt as volume group for /dev/sdb2 and using lvmpool- as volumegroup name as parameter for root. GRUB_CMDLINE_LINUX="root=/dev/mapper/lvmpool-root cryptdevice=/dev/sdb2:crypt ro" The example here: cryptdevice=/dev/partition:MyStorage root=/dev/mapper/MyStorage-rootvol ...
LVM Ontop of LUKS using Grub
1,552,997,393,000
I created an encrypted volume with LUKS and uploaded it to a remote directory on an untrusted host. I can mount it locally though. I first mount the remote directory locally with sshfs and then open my volume with cryptsetup as if it were a local file. $ sshfs user@host: remote/ # cryptsetup luksOpen remote/disk.img ...
The remote host sees nothing but the (encrypted) reads and writes to the file.
Are remote LUKS volumes mounted locally with sshfs made visible to remote users?
1,552,997,393,000
my girlfriend bought Lenovo Essential G500 i5-3230 and I installed Linux Mint 16 on it with full disk encryption. It is standard installation with encryption using dmcrypt and LUKS. But there is a problem with screen brightness, it is set to 0 before it even ask for password to encrypted partitions. I partly fixed it ...
You need to add that script to your initramfs. On Debian (I suspect Mint is the same), it appears that the password prompt comes from /usr/share/initramfs-tools/scripts/local-top/cryptroot. That script arranges itself to be called last out of the local-top scripts. There is a parallel set of directories in /etc intend...
How to set laptop screen brightness just after boot with full disk encryption
1,552,997,393,000
Is there any way to unlock LUKS partition using keyfile while not having root priviliges? (using sudo is not an option) I know that udisksctl can open LUKS partition, however it can do it only with a passphrase.
No. And even solutions that apparently do it without root privileges, actually do have root privileges. This is just a basic requirement for mounting or accessing raw disk data. If you could do those without root priveleges, you could read files you have no permission to read (by reading and searching the raw data), a...
Unlock LUKS partition using keyfile without root access?
1,552,997,393,000
So I'm trying to get a fully encrypted boot partition going. I'm running Funtoo, but mostly drawing from the Arch wiki for help. So I decided to do something crazy/controversial: not separate boot/root partitions. My setup looks like so: /dev/nvme0n1p1 - EFI parition /dev/nvme0n1p2 - Swap /dev/nvme0n1p3 - Encrypted...
Turns out on Gentoo/Funtoo, the device mapper for grub isn't enabled by default. I added the following to /etc/portage/package.use: sys-boot/grub device-mapper Then I re-emerged grub, ran grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id="Funtoo Linux [GRUB]" --recheck and rebooted to find a ...
How do I get Grub to automatically run cryptomount to load its config file (encrypted boot)
1,552,997,393,000
Disk/Partition Backup What are the backup options and good practice to make a solid and easy to use full system backup? With the following requirement: Live backup Image backup Encrypted backup Incremental backups Mount/access the backup disk/files easily Full system backup, restorable in one shot Can be scheduled au...
Linux system backup When targeting a true full system backup, disk image backup (as asked) offer substantial advantage (detailed bellow) compared to files based backup. With files based backup disk/partition structure is not saved; Most of the time for a full restore, the process is a huge time consumer in fact many ...
Serious backup options for linux disk (dmcrypt, luks, ext4, ext3, btrfs) normal and encrypted system