Recently, after booting up my laptop after it ran out of power, I ran into this error after being dumped into the initramfs emergency shell:
mount: mounting /dev/mapper/vg0-root on /sysroot failed: I/O errorThis ended up happening because of some invalid blocks on my lvm partition (I have a fully encrypted LVM on LUKS setup on my machine). Here's how I was able to fix it (this was on Alpine Linux, hopefully it helps with other distros too):
apk add lvm2 cryptsetup e2fsprogs
/dev/sda2was my LUKS container partition:
cryptsetup luksOpen /dev/sda2
vgscan --mknodesAnd running
blkid, I found three new entires, one of them being:
/dev/dm-3This entry had the same UUID as my
/dev/mapper/vg0-rootpartition, so I knew this is the one I needed to repair.
fsck -t ext4 /dev/dm-3In my case, this detected some journal checksum errors that this program was able to fix. After fixing them, I was able to boot into my machine again. I hope this helps anyone running into this problem!