Booting USB Over IP

In a Sharing USB 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:

[Unit]
Description=Usbipd
After=network.target

[Service]
Type=forking
ExecStart=/usr/sbin/usbipd -D

[Install]
WantedBy=multi-user.target

Enable and start it:

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

Then we need a systemd service file for sharing usb-devices, create /etc/systemd/system/[email protected] containing the following:

[Unit]
Description=USBIP Device %I
Requires=usbipd.service
After=usbipd.service

[Service]
RemainAfterExit=yes
ExecStart=/usr/sbin/usbip bind --busid=%i
ExecStop=/usr/sbin/usbip unbind --busid=%i

[Install]
WantedBy=multi-user.target

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/multi-user.target.wants/[email protected] → /etc/systemd/system/[email protected].

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)
This entry was posted in Data and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *