LUKS Boot error: can’t read superblock

Hi Community!

I’m suffering with an “Can’t read superblock” issue after logging in with GRUB with my luks-encrypted HDD. It happens after a power failure.

I can decrypt the luks-Partition from a USB-Linux:

sudo cryptsetup open /dev/sda1 crypto

runs well.

But after that I’m stuck.

sudo mount /dev/mapper/crypto /mnt

Says “Bad Superblock”.

I’m not really a Linux-Expert so I’m thankfull for any advice to make my system boot again. (Or even get access to the partition to save the latest data ;o)

Thanks in advance!

Hello @f_lux :wink:

If it is ext4, then the first superblock is corrupt. You need to check the file system with another suberblock:

Instead of /dev/sda5 use /dev/mapper/crypto.

Hey Megavolt!

Thx 4 your quick reply!

This is the output of

dumpe2fs -h /dev/mapper/crypto
Filesystem volume name:   <none>
Last mounted on:          /
Filesystem UUID:          074ae4c1-cb01-4238-8cc7-8c57327bbac8
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      has_journal ext_attr resize_inode dir_index filetype needs_recovery extent 64bit flex_bg sparse_super large_file huge_file dir_nlink extra_isize metadata_csum
Filesystem flags:         signed_directory_hash 
Default mount options:    user_xattr acl
Filesystem state:         clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              60473344
Block count:              241882372
Reserved block count:     12094118
Overhead clusters:        4078171
Free blocks:              187419531
Free inodes:              59904692
First block:              0
Block size:               4096
Fragment size:            4096
Group descriptor size:    64
Reserved GDT blocks:      1024
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8192
Inode blocks per group:   512
Flex block group size:    16
Filesystem created:       Sun Apr 18 15:25:17 2021
Last mount time:          Tue Aug 31 13:51:27 2021
Last write time:          Tue Aug 31 13:51:27 2021
Mount count:              261
Maximum mount count:      -1
Last checked:             Mon Apr 26 07:28:57 2021
Check interval:           0 (<none>)
Lifetime writes:          689 GB
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     32
Desired extra isize:      32
Journal inode:            8
First orphan inode:       45619293
Default directory hash:   half_md4
Directory Hash Seed:      f0d71e13-c039-43c1-8ed7-4b85e3394fdb
Journal backup:           inode blocks
Checksum type:            crc32c
Checksum:                 0xd1d59abb
Journal features:         journal_incompat_revoke journal_64bit journal_checksum_v3
Total journal size:       1024M
Total journal blocks:     262144
Max transaction length:   262144
Fast commit length:       0
Journal sequence:         0x000aa0ad
Journal start:            1
Journal checksum type:    crc32c
Journal checksum:         0x04a61eb9

Which entrys are the “superblock”-backups I have to use?

An well, yes, its ext4

Seems there changed something in the code or I made a mistake there… However, this should display it:

LANG=C sudo dumpe2fs /dev/mapper/crypto | grep -i superblock

This is my

sudo dumpe2fs /dev/mapper/crypto | grep -i superblock

Output:

Illegal block number passed to ext2fs_mark_block_bitmap #5226077461718260773 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #13651645614301301791 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #12595942493672616290 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #14645335420504974825 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #10072002517370665981 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #1752149066609342841 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #7190106265735448415 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #7873875386962603264 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #3403445120102809709 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #14043753746309486185 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #14649079976496093918 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #690396004654180565 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #5783314249158287372 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #13559547385824256304 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #1813511074410412626 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #720335521950401567 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #6669190058244424297 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #7105116799863360566 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #5192936692069940048 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #8349572122462118418 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #11538410855975775488 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #5030694150573982560 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #5468374690071020471 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #12967513178455050479 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #4725089721210717993 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #5210536449567075156 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #18239724053703962131 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #4521208374437781480 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #1563680391884738378 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #10135875637113008983 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #445607863422464378 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #16608474675953798019 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #9310491083921194983 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #11449932432613944592 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #4921970503471470787 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #13660515395626356667 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #2428183638273429182 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #12108474408317219737 for block bitmap for /dev/mapper/crypto
Illegal block number passed to ext2fs_mark_block_bitmap #1439035655824226557 for block bitmap for /dev/mapper/crypto
  Primary superblock at 0, Group descriptors at 1-116
  Backup superblock at 32768, Group descriptors at 32769-32884
  Backup superblock at 98304, Group descriptors at 98305-98420
  Backup superblock at 163840, Group descriptors at 163841-163956
  Backup superblock at 229376, Group descriptors at 229377-229492
  Backup superblock at 294912, Group descriptors at 294913-295028
  Backup superblock at 819200, Group descriptors at 819201-819316
  Backup superblock at 884736, Group descriptors at 884737-884852
  Backup superblock at 1605632, Group descriptors at 1605633-1605748
  Backup superblock at 2654208, Group descriptors at 2654209-2654324
  Backup superblock at 4096000, Group descriptors at 4096001-4096116
  Backup superblock at 7962624, Group descriptors at 7962625-7962740
  Backup superblock at 11239424, Group descriptors at 11239425-11239540
  Backup superblock at 20480000, Group descriptors at 20480001-20480116
  Backup superblock at 23887872, Group descriptors at 23887873-23887988
  Backup superblock at 71663616, Group descriptors at 71663617-71663732
  Backup superblock at 78675968, Group descriptors at 78675969-78676084
  Backup superblock at 102400000, Group descriptors at 102400001-102400116
  Backup superblock at 214990848, Group descriptors at 214990849-214990964
dumpe2fs: Block bitmap checksum does not match bitmap while trying to read '/dev/mapper/crypto' bitmaps

I start with the 1rst Superblock (Primary?):

sudo fsck -b 0 /dev/mapper/crypto

Output:

2fsck 1.46.2 (28-Feb-2021)
/dev/mapper/crypto: recovering journal
fsck.ext4: Input/output error while trying to re-open /dev/mapper/crypto
/dev/mapper/crypto: ********** WARNING: Filesystem still has errors **********

And then I stuck on the second Superblock:

sudo fsck -b  32768 /dev/mapper/crypto

Output:

e2fsck 1.46.2 (28-Feb-2021)
fsck.ext2: Input/output error while trying to open /dev/mapper/crypto
The superblock could not be read or does not describe a valid ext2/ext3/ext4
filesystem.  If the device is valid and it really contains an ext2/ext3/ext4
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
    e2fsck -b 8193 <device>
 or
    e2fsck -b 32768 <device>

It’s for sure ext4 and I do have only one partition for the whole system. So: no swap & no ufs…

Try every superblock, until it works. If non works, then the data is bascally gone. At least it would be really difficult to rescue any data…

When pasting terminal output, add three backticks ` OR 3 tilde ~ above and below the text:

text

I did it this time for you. Please do it like this in the future.

Thank you :bowing_man:

Maybe try it with

sudo fsck.ext4 -b  32768 /dev/mapper/crypto

No idea why there is a I/O Error… Is the drive defect? If so, then I would rather suggest, to create an image of the partition.

sudo dd if=/dev/sda1 of=/path/to/sda1.img conv=sync,noerror bs=64K 

It’s not looking good. :frowning_face:

You can also try to add the block size (-B 4096), force (-f), and verbose (-v) options while you’re at it. Looks like your ext4 filesystem is using 4K block size.

sudo fsck.ext4 -v -f -b 32768 -B 4096 /dev/mapper/crypto

What is the health of this disk? Is it an external HDD? Did you run a short and/or extended SMART test on it?

2 Likes

Hi folks!

Maybe I’m truly facing a hardware failure. :dizzy_face:

It’s a internal Samsung 860 EVO 1TB SSD, bought in April 2021. So it’s a very new piece of hardware.

Anyway. My output of

smartctl

is nothing good:

Short INQUIRY response, skip product id

Output of

sudo dd if=/dev/sda1 of=/path/to/sda1.img conv=sync,noerror bs=64K

says

dd: error reading '/dev/sda1': Input/output error

So, I guess the sdd is gone? :frowning_face:

Sadly saying: Unfortunately yes. I hope you have a backup :slight_smile:

Another victim of an electrical outage / power loss? :cold_sweat:

I guess this is as good a time as any to vouch for a UPS battery backup for any desktop / server computer. :battery: :electric_plug:


But to better understand, you can’t even successfully dd from the SSD, even in a live session using sudo? What about if you make the output null? (i.e, of=/dev/null)?

Hey there!

sudo fsck.ext4 -v -f -b 32768 -B 4096 /dev/mapper/crypto

did it!

It’s probably adding the blocksize…?! Dunno.

After that process I was able to chroot into the system and rewrite grub.

Thank you so much folks, for your support!

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.