Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

USB Hotplugging via UDEV Rules

Featured Replies

Sorry originally posted this in the general forum thread.

 

Before I updated to the latest build (6.3.2), I had a custom udev rule copied to /etc/udev/rules.d on boot.  It allowed me to use a mouse and keyboard hooked up via KVM like USB switch to be shared between my main PC and a VM in unRAID.  On the latest build however this doesn't seem to work anymore.  I can attach the mouse and keyboard manually when switching between my PC and VM but this is a major hassle.  I'm not sure if its an issue with the latest version of libvirt or udev that's causing the problem.

 

If anyone has a custom udev rule working in the latest build and can provide assistance with this it would be much appreciated.

  • 3 months later...
  • Author

I found this article on a blog site that explained why this isn't working in the latest version of unRAID

 

http://kicherer.org/joomla/index.php/en/blog/48-automatic-hotplugging-of-usb-devices-for-libvirt-managed-vms

 

It appears that when you run a command fired from a UDEV rule, the rule waits for the command to finish before completing the event such as mounting or attaching a USB device.  This is why my attach command kept failing as my USB device wasn't attached when it ran.  The clever blogger was able to workaround this issue by using systemd to run his command.  Unfortunately, unRAID is based on Slackware which still uses init so I instead wrote 2 scripts for each USB device.  One to attach/detach the device and another to call that script.  My UDEV rule now fires the 2nd script which calls the real script.

 

The call script looks something like this

#!/bin/bash

/boot/config/attach-keyboard.sh & disown

 

The key is the call script includes "& disown" which will run the script in the background and disassociate it from the shell.  Theoretically I should've just needed the "&" but it still didn't appear to work without the disown.  This allows the UDEV rule to not wait for the script to finish running before attaching the USB device.  I'm sure there's probably a cleaner way to do all of this, but this is what has been working for me.  I'm going to try and write an article on my blog and will post a link when I'm done.  In the interim, if anyone needs more info on how to automate USB Hotplugging for VM's, I'll be more than happy to help. 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.