[SOLVED] cant access encrypted partition after restoring image backup using dd
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
cant access encrypted partition after restoring image backup using dd
Hello,
today i upgraded firmware on my SSD, where I have linux installed. First I created a backup of the whole disk (dd if=/dev/sda of=/mnt/anotherdisk/sda.img), then upgraded the firmware a restored the disk contents (dd if=/mnt/anotherdisk/sda.img of=/dev/sda).
The SSD contains a small boot partition and an encrypted luks partition with lvm, which then contains two partitions (root and home). From a live distro (SystemResqueCD) a can access the boot partition but not the encyrpted one. When running `cryptsetup luksOpen /dev/sda2 crypt` i get 'Device /dev/sda2 is not a valid LUKS device.'.
Output from parted is
Code:
parted /dev/sda
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print
Model: ATA KINGSTON SV200S3 (scsi)
Disk /dev/sda: 128GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
3 1049kB 2097kB 1049kB bios_grub
1 2097kB 135MB 133MB ext2 Linux filesystem <-- this is my boot partition
2 135MB 128GB 128GB Linux filesystem <-- this is the encrypted partition
Not sure where the problem is, thank for any help.
That is not a good sign. By any chance was this a system that had been running for a long time without being rebooted prior to the time you shut it down and made the image? A system can, unfortunately, run for a long time with a corrupted LUKS header, and you don't find out about the problem until the next time you try to unlock the container.
Let's see what it looks like. Please post the output from "file -s /dev/sda2" and from "dd if=/dev/sda2 count=1 | hexdump -C".
No, I restart regularly. Today morning I started it, then shut down, booted SystemRescueCd and made the image. When i tried to boot from that disk, grub was working, but after selecting linux the computer restarted, Tried adding verbose and debug options to the kernel, but didn't show anything else. I have made backup of all my partitins (boot, root and home) using tar, so if this fails i can start with a new installation.
Tried creatin a new encrypted partition and both root and home partitions and restoring data from the tar archves, but the boot process ended the same way - isn't reinstaling grub or regenerating initrd requiered?
Restoring the image again, will post the result of those command when its done. If it's needed, I am running Debian testing.
That is a completely valid LUKS header with one enabled key slot. I can't imagine why you would get a "not a valid LUKS device" error.
When I take that same data, put it at the beginning of a partition on a USB stick, plug that USB stick into a machine running SystemRescueCD, and try to open it, it is recognized as a LUKS container and I am prompted for a password (which of course is never going to work since there is no key material present).
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.