sbradnick/hyper-v-enhanced-session

Drive sharing

Closed this issue ยท 12 comments

Is there a way to enable drive sharing? Right now in KDE it doesn't seem to work.
shared-drives folder doesn't get created and Chansrv doesn't seem to exist.

That may have more to do w/ https://build.opensuse.org/package/show/Virtualization/hyper-v than what this package does. "hyper-v" is included during the installation process when the installing system is detected as Hyper-V. I'm not sure what provides the mechanism for such a thing, or what would be done w/in "Hyper-V Manager" to setup/enable it. Basically, seeing a working version of it - even in Windows - would be helpful in determining what's potentially missing.

Following the instructions for Ubuntu 20.04 yields a working shared-drive fuse mount folder in home directory containing the shared drives.

I believe I've seen that one before. I don't see anything (obvious) in https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/20.04/install.sh which is missing in openSUSE. But I'm testing a 'Quick Create' Ubuntu 20.04 VM and following those steps now, I'll see if that results in something positive.

Putting aside the weird fact that "Ubuntu 20.04.4 LTS" has to be "Save"d, then started back up for "Enhanced Session" to work - I do see a 'shared-drives' folder. It's empty - so I'm not exactly clear at this point what it's for? Copy/paste from Win11 desktop to the Ubuntu VM does work (doesn't work in openSUSE, but maybe it's related to this?).

This is the only hv_ difference between the two:

Ubuntu:   hv_vmbus              122880  8 hv_balloon,hv_utils,hv_netvsc,hid_hyperv,hv_storvsc,hyperv_keyboard,hv_sock,hyperv_fb
openSUSE: hv_vmbus              151552  8 hv_balloon,hv_utils,hv_netvsc,hid_hyperv,hv_storvsc,hyperv_keyboard,hyperv_drm,hv_sock

So maybe it boils down to something between hyperv_drm and hyperv_fb?

Steps to reproduce shared drive working in Windows 10 21H2 Hyper-V:

  1. Create a VM named ubuntu, Gen 2 with all Integration services enabled
  2. Install ubuntu 20.04.4 with auto login disabled, update and reboot after installation
  3. Verify that there is no shared-drives folder
    no_folder
  4. Run the following commands:
wget https://raw.githubusercontent.com/Hinara/linux-vm-tools/ubuntu20-04/ubuntu/20.04/install.sh
chmod +x install.sh
sudo ./install.sh
  1. Reboot ubuntu
  2. Run the following commands (it wasn't necesarry for me):
sudo ./install.sh
  1. Shutdown ubuntu
  2. Close Virtual Machine Connection window
  3. Run in powershell as admin: Set-VM -VMName "ubuntu" -EnhancedSessionTransportType HvSocket
  4. To verify that it was set correctly run (Get-VM -VMName "ubuntu").EnhancedSessionTransportType , it should report HvSocket
  5. Start VM
  6. Select drives to share drives
  7. See that shared-drive folder exists
    folder_present and has the shared drives as it's content
    folder_contents and drives show their contents:
    c_drive_contents
  8. Try reading and writing to a drive
  • Read:
    usb_contents
  • Write:
    writing_in_ubuntu
  1. Observe results in windows
    result_in_windows
  2. mounts in ubuntu vm
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,noexec,relatime,size=4035068k,nr_inodes=1008767,mode=755,inode64)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,noexec,relatime,size=814060k,nr_inodes=1017570,mode=755,inode64)
/dev/sda2 on / type ext4 (rw,relatime,errors=remount-ro)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,size=4070280k,nr_inodes=1017570,inode64)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k,nr_inodes=1017570,inode64)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,size=4070280k,nr_inodes=1017570,mode=755,inode64)
cgroup2 on /sys/fs/cgroup/unified type cgroup2 (rw,nosuid,nodev,noexec,relatime,nsdelegate)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
efivarfs on /sys/firmware/efi/efivars type efivarfs (rw,nosuid,nodev,noexec,relatime)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,rdma)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices)
cgroup on /sys/fs/cgroup/misc type cgroup (rw,nosuid,nodev,noexec,relatime,misc)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=28,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=21860)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,pagesize=2M)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
/var/lib/snapd/snaps/bare_5.snap on /snap/bare/5 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gnome-3-38-2004_99.snap on /snap/gnome-3-38-2004/99 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/gtk-common-themes_1519.snap on /snap/gtk-common-themes/1519 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snapd_14978.snap on /snap/snapd/14978 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/snap-store_558.snap on /snap/snap-store/558 type squashfs (ro,nodev,relatime,x-gdu.hide)
/var/lib/snapd/snaps/core20_1328.snap on /snap/core20/1328 type squashfs (ro,nodev,relatime,x-gdu.hide)
/dev/sda1 on /boot/efi type vfat (rw,relatime,fmask=0077,dmask=0077,codepage=437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
tmpfs on /run/user/125 type tmpfs (rw,nosuid,nodev,relatime,size=814056k,nr_inodes=1017570,mode=700,uid=125,gid=130,inode64)
gvfsd-fuse on /run/user/125/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=125,group_id=130)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=814056k,nr_inodes=1017570,mode=700,uid=1000,gid=1000,inode64)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
xrdp-chansrv on /home/xxx/shared-drives type fuse.xrdp-chansrv (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
  1. lsmod output
Module                  Size  Used by
nls_iso8859_1          16384  1
intel_rapl_msr         20480  0
intel_rapl_common      24576  1 intel_rapl_msr
crct10dif_pclmul       16384  1
ghash_clmulni_intel    16384  0
aesni_intel           376832  0
crypto_simd            16384  1 aesni_intel
cryptd                 24576  2 crypto_simd,ghash_clmulni_intel
rapl                   20480  0
serio_raw              20480  0
efi_pstore             16384  0
joydev                 28672  0
hv_balloon             36864  0
hyperv_fb              20480  2
mac_hid                16384  0
sch_fq_codel           20480  9
hv_sock                20480  1
vsock                  45056  5 hv_sock
ipmi_devintf           20480  0
ipmi_msghandler       114688  1 ipmi_devintf
msr                    16384  0
parport_pc             45056  0
ppdev                  24576  0
lp                     20480  0
parport                65536  3 parport_pc,lp,ppdev
drm                   557056  0
ip_tables              32768  0
x_tables               49152  1 ip_tables
autofs4                45056  2
hv_storvsc             24576  2
hid_generic            16384  0
scsi_transport_fc      77824  1 hv_storvsc
hid_hyperv             16384  0
hv_netvsc              86016  0
hv_utils               49152  0
hid                   139264  2 hid_hyperv,hid_generic
hyperv_keyboard        16384  0
crc32_pclmul           16384  0
hv_vmbus              122880  8 hv_balloon,hv_utils,hv_netvsc,hid_hyperv,hv_storvsc,hyperv_keyboard,hv_sock,hyperv_fb

I'm so used to just picking a display resolution when opening the VM console I didn't think to look @ "Show Options", "Local Resources", "Local devices and resources", "More...", "Drives".

That all appears to work for me w/ the Quick Create Ubuntu VM.

I copied over sesman.ini & xrdp.ini from the Ubuntu VM but it didn't make any difference ; a vimdiff didn't show any glaring differences to begin with (and IIRC, I kinda picked apart that Ubuntu setup - and this one - initially when putting this together).

It's also quite possible that SUSE's xrdp package doesn't support fuse:

[   78s] xrdp will be compiled with:
[   78s] 
[   78s]   mp3lame         no
[   78s]   opus            no
[   78s]   fdkaac          no
[   78s]   jpeg            no
[   78s]   turbo jpeg      no
[   78s]   rfxcodec        yes
[   78s]   painter         yes
[   78s]   pixman          no
[   78s]   fuse            no
[   78s]   ipv6            yes
[   78s]   ipv6only        no
[   78s]   vsock           yes
[   78s]   auth mechanism  PAM
[   78s]   debug           no
[   78s]   rdpsndaudin     no

In the somewhat near future, I'll branch X11:RemoteDesktop/xrdp and try to rebuild with --enable-fuse and cross my fingers that's all it is ;)

That was it.

image

Thankfully, in terms of [re]building xrdp w/ fuse support - it wasn't too involved:

$ PAGER=more osc diff
Index: xrdp.spec
===================================================================
--- xrdp.spec	(revision 3d705b227afe4eec52f55f2036764ec7)
+++ xrdp.spec	(working copy)
@@ -56,6 +56,7 @@
 BuildRequires:  autoconf
 BuildRequires:  automake
 BuildRequires:  fdupes
+BuildRequires:  fuse-devel
 BuildRequires:  libX11-devel
 BuildRequires:  libXfixes-devel
 BuildRequires:  libXrandr-devel
@@ -116,7 +117,8 @@
    --enable-ipv6 \
    --enable-painter \
    --with-systemdsystemunitdir=%{_unitdir} \
-   --enable-vsock
+   --enable-vsock \
+   --enable-fuse
 make %{?_smp_mflags} V=1
 
 %install

I suppose we have 1-3 options, depending on your interest level in the fix:

  1. You can branch X11:RemoteDesktop/xrdp yourself in OBS and make those simple changes.
  2. I can check this updated xrdp version into my home:sbradnick:branches:X11:RemoteDesktop project and you can add it to your repo list whereever you're using SUSE (just let me know which arch/flavor you'd need builds for).
  3. I can submit an SR to the devel project and we can attempt to get this in the mainline xrdp package.

I'm fine w/ all 3 options ๐Ÿ‘

I think it would be for the best to submit it to the devel project so it can trickle down to other users, rather than to have a "one off".

Since you found the solution you could submit it to the devel package, or if you don't have the time I'll be happy to try (although I'm not well versed in obs submissions).

PS. Would it be possible to change the order of [Xorg] and [Xvnc] session type in xrdp.ini (aka to put the Xorg session as the default session) since, and I may be wrong on this, Xvnc performance is not up to par to Xorg (at least in nested opensuse host -> win 10 vm -> opensuse vm in win 10 vm).
I could be completely off base here though.

Very good :) ==> https://build.opensuse.org/request/show/964905 ; maybe the maintainer(s) will come back and say 'this is the reason we don't' - but we'll have to see.

I did notice Ubuntu has them in a different order in xrdp.ini ; that wasn't a conscious decision on my part - and I believe it comes from the the xrdp.ini file used in the base package. I do [re?]include it in mine, so I suppose I could flip them there. But I have no idea if that makes a difference.

https://github.com/neutrinolabs/xrdp/blob/devel/xrdp/xrdp.ini.in shows [Xorg] then [Xvnc] ; if you swap them, is there a noticable difference?

Xvnc seems to be a bit sluggish, like it's running at 30-40 fps and having standard vnc hitches, while Xorg feels more fluid and has a lower cpu impact (20% lower in my case).

However, I'm not sure how it would work with Gnome since they seem to be mainly targeting Wayland and not Xorg (maybe there would be some regressions).

I've switched them up in the xrdp.ini file this package is providing and will push it forward. Also, 964905 was accepted into the devel package and is currently testing in Factory.

Excellent, thank you for your time and effort.