Can't decrypt adopted storage Last night, I messed up my LineageOS 16 install on my Galaxy S5 and had to reinstall it, starting essentially from scratch. I wanted to see if there was any way I could decrypt the 128 GB microSD card I used as adopted storage and found this tutorial. I got the key from a backup made using TWRP and tried it on Linux Mint 20 MATE (booting from USB), but it didn't work. The following command gave me an error:
dmsetup create crypt1 --table &quot;0 `blockdev --getsize /media/mint/4B2E-1F13` crypt aes-cbc-essiv:sha256 [16-BYTE HEX KEY] 0 /media/mint/4B2E-1F13 0&quot;

blockdev: ioctl error on BLKGETSIZE: Inappropriate ioctl for device
/dev/mapper/control: open failed: Permission denied
Failure to communicate with kernel device-mapper driver.
Incompatible libdevmapper 1.02.167 (2019-11-30) and kernel driver (unknown version).

Doing it with sudo gave me this error:
blockdev: ioctl error on BLKGETSIZE: Inappropriate ioctl for device
Invalid format on line 1 of table.
Command failed.

I couldn't even mount the SD card with Termux when after putting it back into my phone. Is my data unrecoverable? Do I have the wrong key? Thanks.
Good news: trying the following command successfully decrypted my SD card without any errors:
sudo dmsetup create crypt1 --table &quot;0 `sudo blockdev --getsize /dev/mmcblk0p2` crypt aes-cbc-essiv:sha256 [16-BYTE HEX KEY] 0 /dev/mmcblk0p2 0&quot;

A couple of minor issues:

sudo mount -t /dev/mmcblk0p2/crypt1 /media/mint/sd returned the error mount: /media/mint/sd: can't find in /etc/fstab. I can view the content of the SD card in the file browser running as admin, however.
Copying the files over to my laptop's Windows 10 SSD, some files and directories didn't get copied due to the presence of invalid characters in their names (mainly asterisks and colons in file names and a period in a folder name). Not sure how to deal with these...

Thanks for all your help.