Automating USBIP server

In a prior post we installed USBIP and used it manually, in this post I will set it up “the correct Debian(systemd) way”.

But first, for completeness sake, we will go through installation progress again, first install the package:

root@host:~# apt-get install usbip

Load the main module and make it persistent:

root@server:~# modprobe usbip_core
root@server:~# modprobe usbip_host
root@server:~# echo usbip_core >> /etc/modules
root@server:~# echo usbip_host >> /etc/modules

Create service-file for usbip-deamon, create /etc/systemd/system/usbipd.service with following content:


ExecStart=/usr/sbin/usbipd -D


Enable and start it:

root@server:~# systemctl enable usbipd --now
Created symlink /etc/systemd/system/ → /etc/systemd/system/usbipd.service.

Then we need a systemd service file for sharing usb-devices, create /etc/systemd/system/usbip-device@.service containing the following:

Description=USBIP Device %I

ExecStart=/usr/sbin/usbip bind --busid=%i
ExecStop=/usr/sbin/usbip unbind --busid=%i


And Finally start and enable this pseudo-service:

root@server:/etc/systemd/system# systemctl enable usbip-device@3-3 --now
Created symlink /etc/systemd/system/ → /etc/systemd/system/usbip-device@.service.

Try to reboot and verify from the client:

root@backup2:~# usbip list -r backup1
Exportable USB devices
 - backup1
        3-3: Sony Corp. : unknown product (054c:05b9)
           : /sys/devices/pci0000:00/0000:00:10.0/usb3/3-3
           : (Defined at Interface level) (00/00/00)
Dette indlæg blev udgivet i Linux. Bogmærk permalinket.