VirtualHere USB Server wont run as daemon on CentOS 8 (Fixed)

1 post / 0 new
lifesbrain
VirtualHere USB Server wont run as daemon on CentOS 8 (Fixed)

I ran into a few issues while trying to set up VirtualHere to run as a daemon and at boot on CentOS 8. It's a simple fix, so I thought I'd post it in case anyone runs into the same issue.

In the latest version of CentOS "networking.service" doesn't exist.
If you run the service as described on the Linux FAQ page you'll get the error message "Failed to start virtualhere.service: Unit networking.service not found.".
In CentOS 8 "networking.service" has been replaced by "NetworkManager.service". Switching these out in your systemd script will fix the error and VirtualHere will run at boot.

Your "/etc/systemd/system/virtualhere.service" file should look like below:

[Unit]
Description=VirtualHere USB Sharing
Requires=NetworkManager.service
After=NetworkManager.service
[Service]
ExecStartPre=/bin/sh -c 'logger VirtualHere settling...;sleep 1s;logger VirtualHere settled'
ExecStart=/usr/sbin/vhusbdx86_64
Type=idle
[Install]
WantedBy=multi-user.target

Reload your daemon with the changed file and you're good to go:

systemctl daemon-reload
systemctl restart virtualhere

I hope this saves someone a little bit of time.