AlexSSD7 / linsk

📂 Access Linux-native file systems (including LVM and LUKS) on Windows and macOS with help of a lightweight Alpine Linux VM. x86/ARM supported.
GNU General Public License v3.0
303 stars 13 forks source link

Can't access mount from host (Windows 11 SMB and FTP) while LUKS is properly mounted inside VM #20

Closed JaneX8 closed 2 months ago

JaneX8 commented 2 months ago
./linsk.exe ls dev:\\.\PHYSICALDRIVE1 --luks-container vdb1
time=2024-09-11T18:08:13.395+02:00 level=WARN msg="Using raw block device passthrough. Please note that it's YOUR responsibility to ensure that no device is mounted in your OS and the VM at the same time. Otherwise, you run serious risks. No further warnings will be issued." caller=vm
time=2024-09-11T18:08:13.584+02:00 level=INFO msg="Booting the VM" caller=vm
time=2024-09-11T18:08:29.737+02:00 level=INFO msg="The VM is up, setting it up" caller=vm
time=2024-09-11T18:08:36.962+02:00 level=INFO msg="The VM is ready" caller=vm
time=2024-09-11T18:08:37.285+02:00 level=INFO msg="Preopening a LUKS container" caller=file-manager container=/dev/vdb1
time=2024-09-11T18:08:37.295+02:00 level=INFO msg="Attempting to open a LUKS device" caller=file-manager vm-path=/dev/vdb1
Enter Password:
time=2024-09-11T18:08:44.038+02:00 level=INFO msg="LUKS device opened successfully" caller=file-manager vm-path=/dev/vdb1
NAME                SIZE FSTYPE      LABEL
vda                   1G
├─vda1              300M ext4
├─vda2              256M swap
└─vda3              467M ext4
vdb                 9.1T
└─vdb1              9.1T crypto_LUKS
  └─cryptcontainer  9.1T ext4        10TB
time=2024-09-11T18:08:44.877+02:00 level=WARN msg="Canceling the VM context" caller=vm
time=2024-09-11T18:08:44.939+02:00 level=WARN msg="Sending poweroff command to the VM" caller=vm
time=2024-09-11T18:08:44.964+02:00 level=INFO msg="Shutting the VM down safely" caller=vm
./linsk.exe run --debug-shell --vm-unrestricted-networking dev:\\.\PHYSICALDRIVE1 --luks-container vdb1 mapper/cryptcontainer
time=2024-09-11T18:23:48.817+02:00 level=INFO msg="Created network tap" name=LinskTap-1726071827354740200
time=2024-09-11T18:23:48.879+02:00 level=INFO msg="Configured network tap" name=LinskTap-1726071827354740200 cidr=fe8f:5980:3253:7df4:f4b:6db1:1661:eb6a/127
time=2024-09-11T18:23:48.893+02:00 level=WARN msg="Using unrestricted VM networking" caller=vm
time=2024-09-11T18:23:48.927+02:00 level=WARN msg="Using raw block device passthrough. Please note that it's YOUR responsibility to ensure that no device is mounted in your OS and the VM at the same time. Otherwise, you run serious risks. No further warnings will be issued." caller=vm
time=2024-09-11T18:23:49.119+02:00 level=INFO msg="Booting the VM" caller=vm
time=2024-09-11T18:24:06.272+02:00 level=INFO msg="The VM is up, setting it up" caller=vm
time=2024-09-11T18:24:15.111+02:00 level=INFO msg="The VM is ready" caller=vm
time=2024-09-11T18:24:15.523+02:00 level=INFO msg="Mounting the device" dev=mapper/cryptcontainer fs=<auto> luks=false
time=2024-09-11T18:24:15.586+02:00 level=INFO msg="Preopening a LUKS container" caller=file-manager container=/dev/vdb1
time=2024-09-11T18:24:15.596+02:00 level=INFO msg="Attempting to open a LUKS device" caller=file-manager vm-path=/dev/vdb1
Enter Password:
time=2024-09-11T18:24:21.537+02:00 level=INFO msg="LUKS device opened successfully" caller=file-manager vm-path=/dev/vdb1
time=2024-09-11T18:24:23.679+02:00 level=INFO msg="Started the network share successfully" backend=smb
===========================
[Network File Share Config]
The network file share was started. Please use the credentials below to connect to the file server.

Type: SMB
URL: \\xxxx-xxxx-xxxx-xxxx-xxxx-xxxx-1661-eb6b.ipv6-literal.net\linsk
Username: linsk
Password: xx
===========================
time=2024-09-11T18:24:23.679+02:00 level=WARN msg="Starting a debug VM shell"
Welcome to Alpine!

The Alpine Wiki contains a large amount of how-to guides and general
information about administrating Alpine systems.
See <https://wiki.alpinelinux.org/>.

You can setup the system with the command: setup-alpine

You may change this message by editing /etc/motd.

localhost:~# ←[6nls /mnt
←[1;34mdatadump1←[m   ←[1;34mdatastore1←[m  ←[1;34mdatastore3←[m  ←[1;34mdatastore5←[m  ←[1;34mlost+found←[m  ←[1;34mtmp←[m

But mapping in Windows 11 results in the following error: image

I've also run --vm-debug and findmnt but the mount seemed to have worked fine inside the container. And I can ping the IPv6 from the host to the VM as well. I don't understand what goes wrong, also I tried using FTP using FileZilla client instead which resulted in the following:

Status: Disconnected from server
Status: Connecting to 127.0.0.1:9000...
Status: Connection established, waiting for welcome message...
Status: Insecure server, it does not support FTP over TLS.
Command:    USER linsk
Response:   331 Please specify the password.
Command:    PASS ****************
Response:   500 OOPS: cannot change directory:/mnt
Error:  Critical error: Could not connect to server
AlexSSD7 commented 2 months ago

This is likely a permission issue.

Check that files on the mounted disk are accessible by 1000:1000, which is the UID and GID (User ID and Group ID) of the Linsk SMB user.

You can use this one-liner to fix permissions (to be executed in run --debug-shell as root):

chown -R 1000:1000 /mnt
JaneX8 commented 2 months ago

This is likely a permission issue.

Check that files on the mounted disk are accessible by 1000:1000, which is the UID and GID (User ID and Group ID) of the Linsk SMB user.

You can use this one-liner to fix permissions (to be executed in run --debug-shell as root):

chown -R 1000:1000 /mnt

Thank worked. Thank you.