xe5700 / kvmd-armbian

KVMD For Armbian Install Script
GNU General Public License v2.0
176 stars 46 forks source link

Applying MSD patches doesn't work #4

Closed srepac closed 1 year ago

srepac commented 1 year ago

When running the installer script, applying kernel patch for MSD doesn't work.

Here's the extracted output during install:

-> Apply patches using /root/kvmd-armbian/patches/custom/old-kernel-msd/*.patch files
error: patch failed: kvmd/aiohelpers.py:40
error: kvmd/aiohelpers.py: patch does not apply
error: patch failed: kvmd/plugins/msd/otg/__init__.py:241
error: kvmd/plugins/msd/otg/__init__.py: patch does not apply
-> Add otgmsd unlock link
-> Add sudoer
-> Apply old kernel msd patch done.

As you can see, none of the patches got applied. Also, after resize root partition, create/format MSD partition as ext4, then enabling MSD by deleting

    msd:
        type: disabled

entries in /etc/kvmd/override.yaml and rebooting the orange pikvm, I also updated /etc/fstab to the following and made sure /var/lib/kvmd/msd is mounted properly.

/dev/mmcblk0p1 / ext4 defaults,noatime,commit=600,errors=remount-ro 0 1
/dev/mmcblk0p2 /var/lib/kvmd/msd  ext4  nodev,nosuid,noexec,ro,errors=remount-ro,data=journal,X-kvmd.otgmsd-root=/var/lib/kvmd/msd,X-kvmd.otgmsd-user=kvmd  0 0
tmpfs /tmp tmpfs defaults,nosuid 0 0

As a result, MSD menu shows up in webui, but mass storage drive shows offline due to an error:

[root@orangepizero ~]# journalctl -fu kvmd-otg
Aug 14 14:12:07 orangepizero kvmd-otg[2275]:     _chown(join(func_path, "lun.0/forced_eject"), user)
Aug 14 14:12:07 orangepizero kvmd-otg[2275]:   File "/usr/lib/python3/dist-packages/kvmd/apps/otg/__init__.py", line 59, in _chown
Aug 14 14:12:07 orangepizero kvmd-otg[2275]:     shutil.chown(path, user)
Aug 14 14:12:07 orangepizero kvmd-otg[2275]:   File "/usr/lib/python3.10/shutil.py", line 1340, in chown
Aug 14 14:12:07 orangepizero kvmd-otg[2275]:     os.chown(path, _user, _group)
Aug 14 14:12:07 orangepizero kvmd-otg[2275]: FileNotFoundError: [Errno 2] No such file or directory: '/sys/kernel/config/usb_gadget/kvmd/functions/mass_storage.usb0/lun.0/forced_eject'
Aug 14 14:12:07 orangepizero systemd[1]: kvmd-otg.service: Main process exited, code=exited, status=1/FAILURE
Aug 14 14:12:07 orangepizero systemd[1]: kvmd-otg.service: Failed with result 'exit-code'.
Aug 14 14:12:07 orangepizero systemd[1]: Failed to start PiKVM - OTG setup.

At this point in time, MSD is not supported working on kvmd-armbian.

xe5700 commented 1 year ago

This msd patch only for old linux kernel, maybe new version of kvmd makes my patch not working, I will try fix it.

srepac commented 1 year ago

I don't believe the kernel patch for forced_eject functionality has been applied to armbian kernel. Here's the link to the actual patch

https://github.com/pikvm/packages/blob/master/packages/linux-rpi-pikvm/2002-usb-gadget-f_mass_storage-forced-eject.patch

xe5700 commented 1 year ago

Fixed