Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL: Hard to find encrypted block devices when attached to Ubuntu 22.04.x instances through WSL #14430

Open
neuroretransmit opened this issue Oct 17, 2024 · 0 comments

Comments

@neuroretransmit
Copy link

While using WSL to mount encrypted backup drives, I noticed a strange behavior that doesn't emulate bare-metal installations very well. When opening an encrypted backup, I'd generally expect to find the device in /dev/sgX(Y) or the opened LUKS container in /dev/mapper. I ended up having to search through many /dev/* directories to find what is shown below and did end up getting it to work - however, this will be confusing for those coming from a primarily Linux world.

To mount the device in WSL from powershell:

GET-CimInstance -query "SELECT * from Win32_DiskDrive"
wsl --mount \\.\PHYSICALDRIVE3 --bare

From Ubuntu WSL (apologies for misfires and searching, but I believe it shows the problem nicely.

   16  cryptsetup luksOpen /dev/sdg1 cryptbackup
   17  sudo apt install cryptsetup-bin
   18  cryptsetup luksOpen /dev/sdg1 cryptbackup
   19  lsblk
   20  cryptsetup luksOpen sdg cryptbackup
   21  /dev/disk/
   22  ls /dev/block/
   23  ls
   24  ls /dev/disk
   25  ls /dev/disk/by-path/
   26  cd /dev/
   27  ls
   28  cd virtio-ports/
   29  ls
   30  cd ..
   31  ls
   32  cd mapper/
   33  ls
   34  cd ..
   35  ls
   36  ls dri/
   37  ls block
   38  ls disk
   39  ls disk/by-*
   40  lsblk
   41  sudo cryptsetup luksOpen '/dev/disk/by-partuuid/Linux\x20LUKS' luksbup
   42  sudo cryptsetup luksOpen '/dev/disk/by-partlabel/Linux\x20LUKS' luksbup
   43  mkdir /tmp/cryptbup
   44  ls /dev/
   45  cd /dev/mapper/
   46  ls
   47  cd ..
   48  ls
   49  mv /tmp/cryptbup/ /tmp/luksbup
   50  ls
   51  mount /dev/mapper/luksbup /tmp/luksbup/
   52  sudo mount /dev/mapper/luksbup /tmp/luksbup/
   53  ls /tmp/luksbup/
   54  ls
   55  cd /tmp/luksbup/
   56  ls
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant