Skip to contentSkip to conversation

Need help with sync'ing dmsetup info to disk

dm-crypt Johann Burkard 3 participants 7 messages Jul 12, 2011 – Jul 15, 2011

lore
Share & tools
lore
#0 lore raw

Hello,

I have a big problem with one of my machines: Upon booting, there are no entries in /dev/mapper and the system doesn't start. It looks like this:

ls -l /dev/mapper
crw------- 1 10, 59 control

Fortunately, I was able to read the dmsetup tables from a backup of the disk. They look like this:

sda2_crypt: 0 234241709 crypt twofish-cbc-essiv:sha256 0000000000000000000000000000000000000000000000000000000000000000 0 8:2 2056
data-drive: 0 216662016 linear 252:0 17572224
data-swap: 0 17571840 linear 252:0 384

Now, I tried a Ubuntu live CD to restore them. I edited the table definitions to point to /dev/sda2 (which is the crypto partition) and called dmsetup create sda2_crypt ..., dmsetup create data-drive ..., dmsetup create data-swap ...

However, once I reboot into the original OS on the disk, the entries are gone again.

When I try to create the entries with dmsetup in the initrd, I get this error:

(initramfs) dmsetup create sda2_crypt --table '0 1234....'
device-mapper: reload ioctl failed: Invalid argument Command failed

How can I save the dmsetup tables to disk from the Ubuntu live CD?

Thanks for any help.

Johann

#1 lore raw

The first question would be: What did you change?
Also, tbis liiks like a problem with dmsetup, not
cryptsetup.

More info needed:
- What Distribution?
- What configuration?
- What did you do immediately before ot borke? Nay updated?

Arno

Quoted 43 lines · Johann Burkard

Hello,

I have a big problem with one of my machines: Upon booting, there are no entries in /dev/mapper and the system doesn't start. It looks like this:

ls -l /dev/mapper
crw------- 1 10, 59 control

Fortunately, I was able to read the dmsetup tables from a backup of the disk. They look like this:

sda2_crypt: 0 234241709 crypt twofish-cbc-essiv:sha256 0000000000000000000000000000000000000000000000000000000000000000 0 8:2 2056
data-drive: 0 216662016 linear 252:0 17572224
data-swap: 0 17571840 linear 252:0 384

Now, I tried a Ubuntu live CD to restore them. I edited the table definitions to point to /dev/sda2 (which is the crypto partition) and called dmsetup create sda2_crypt ..., dmsetup create data-drive ..., dmsetup create data-swap ...

However, once I reboot into the original OS on the disk, the entries are gone again.

When I try to create the entries with dmsetup in the initrd, I get this error:

(initramfs) dmsetup create sda2_crypt --table '0 1234....'
device-mapper: reload ioctl failed: Invalid argument Command failed

How can I save the dmsetup tables to disk from the Ubuntu live CD?

Thanks for any help.

Johann
_______________________________________________
dm-crypt mailing list
[email protected]
http://www.saout.de/mailman/listinfo/dm-crypt

Signature · 7 lines
Arno Wagner, Dr. sc. techn., Dipl. Inform., CISSP -- Email: [email protected] 
GnuPG:  ID: 1E25338F  FP: 0C30 5782 9D93 F785 E79C  0296 797F 6B50 1E25 338F
----
Cuddly UI's are the manifestation of wishful thinking. -- Dylan Evans

If it's in the news, don't worry about it.  The very definition of 
"news" is "something that hardly ever happens." -- Bruce Schneier 
#2 lore raw

Hello,

Am 13.07.2011, 14:51 Uhr, schrieb Arno Wagner <[email protected]>:

Quoted 1 line

The first question would be: What did you change?

I think Xubuntu did an update before I couldn't start the computer anymore but I'm not sure.

Quoted 2 lines

More info needed:
- What Distribution?

Xubuntu 10.10 (which is Ubuntu 10.10 with XFCE FWIK).

Quoted 1 line

- What configuration?

It's a notebook that has a 128 GB Samsung SSD in it. /dev/sda1 is mounted at /boot. I use GRUB.

/dev/sda2 is the crypto partition which houses / and swap. Here's the layout:

Quoted 7 lines
Quoted 5 lines

sda2_crypt: 0 234241709 crypt twofish-cbc-essiv:sha256 0000000000000000000000000000000000000000000000000000000000000000 0 8:2 2056
data-drive: 0 216662016 linear 252:0 17572224
data-swap: 0 17571840 linear 252:0 384

- What did you do immediately before ot borke? Nay updated?

Can't remember exactly.

Do you know how I can save the dmsetup tables to disk?

Signature · 6 lines
Regards,

Johann Burkard

<http://johannburkard.de>
<http://twitter.com/johannburkard>
#3 lore raw
Quoted 1 line · Johann Burkard

Do you know how I can save the dmsetup tables to disk?

That's not how it works. dmsetup does not save tables to disk.

cryptsetup reads the LUKS header off disk (if you use LUKS). See the FAQ for the layout of this header (and where the key slots go). But if you use non-luks, there is no metadata saved anywhere; the initrd will have to reconstruct everything from its configuration (and possibly keys read from the user).

#4 lore raw

Hello,

Am 14.07.2011, 05:36 Uhr, schrieb Bryan Kadzban <[email protected]>:

Quoted 4 lines

That's not how it works. dmsetup does not save tables to disk.

cryptsetup reads the LUKS header off disk (if you use LUKS). See the FAQ for the layout of this header (and where the key slots go).

thanks Bryan. Would you say that I should restore the LUKS header from the old backup? Would that work?

Signature · 6 lines
Regards,

Johann Burkard

<http://johannburkard.de>
<http://twitter.com/johannburkard>
#5 lore raw
Quoted 11 lines · Johann Burkard

Hello,

Am 14.07.2011, 05:36 Uhr, schrieb Bryan Kadzban
<[email protected]>:

Quoted 4 lines

That's not how it works. dmsetup does not save tables to disk.

cryptsetup reads the LUKS header off disk (if you use LUKS). See the FAQ for the layout of this header (and where the key slots go).

thanks Bryan. Would you say that I should restore the LUKS header from the old backup? Would that work?

Depends on what changed. If you have a backup, it may help. I'd grab a backup of the current bits on disk before changing anything permanent, though.

#6 lore raw

Hello,

Am 15.07.2011, 05:13 Uhr, schrieb Bryan Kadzban <[email protected]>:

Quoted 3 lines

Depends on what changed. If you have a backup, it may help. I'd grab a backup of the current bits on disk before changing anything permanent, though.

thanks Bryan, I did that but the LUKS headers of both the backup and the disk are identical. What to do now?

Signature · 6 lines
Regards,

Johann Burkard

<http://johannburkard.de>
<http://twitter.com/johannburkard>