2

I installed the xbox controller drivers (for use with an XBox One controller) using

sudo apt install xboxdrv

However when I try to start/enable the service with

sudo systemctl start xboxdrv.service

I get the following error

Failed to start xboxdrv.service: Unit xboxdrv.service not found.

Any ideas?

Qushy
  • 65

2 Answers2

1

First, try to enable the service with the following command:

sudo systemctl enable xboxdrv.service

and then try starting it with:

sudo systemctl start xboxdrv.service

If the service is not found, then the service needs to be created.

Make a file called "xboxdrv.service" in the /etc/systemd/system and copy/paste the following in it:

[Unit]
Description=Xbox controller driver daemon

[Service]
Type=simple
User=root
PIDFile=/var/run/xboxdrv.pid
ExecStartPre=/usr/share/ubuntu-xboxdrv/xboxdrv-pre
EnvironmentFile=/usr/share/ubuntu-xboxdrv/uxvars
ExecStart=/usr/bin/xboxdrv --daemon --silent --pid-file /var/run/xboxdrv.pid --dbus disabled $XBOXDRV_OPTIONS $PAD_OPTIONS $CONTROLLER0_OPTIONS --next-controller $PAD_OPTIONS $CONTROLLER1_OPTIONS --next-controller $PAD_OPTIONS $CONTROLLER2_OPTIONS --next-controller $PAD_OPTIONS $CONTROLLER3_OPTIONS

[Install]
WantedBy=multi-user.target

Then enable the service: sudo systemctl enable xboxdrv.service

Followed by starting the service: sudo systemctl start xboxdrv.service

Make sure the Xbox controller is connected when you start the service.

1

For Ubuntu 22.04:

  • Note #1: If you have followed the previous answer, first stop and then disable the xboxdrv.service before editing the existing file to fix by the following steps:

$ sudo systemctl stop xboxdrv.service

$ sudo systemctl disable xboxdrv.service

  • Note #2: Before setting up the systemctl app, make sure if you have installed correctly the xboxdrv by the steps in this website.
  1. Make a new file called "xboxdrv.service" in the directory /etc/systemd/system and copy/paste the following text in it:
[Unit]
Description=Xbox controller driver daemon

[Service] Type=simple User=root ExecStart=/usr/bin/xboxdrv --silent

[Install] WantedBy=multi-user.target

  1. Enable the service:

$ sudo systemctl enable xboxdrv.service

  • Make sure the Xbox controller is connected before continuing the next steps.
  1. Start the service:

$ sudo systemctl start xboxdrv.service

  1. Check if xboxdrv is running by the service:

$ sudo systemctl status xboxdrv.service (Press "q" to end)

  • Note #3: If you have forgotten to connect the controller before or the controller has been disconnected by accident and you have to reconnect it, just type:

$ sudo systemctl restart xboxdrv.service

  • Note #4: If the previous command does not solve the problem to reconnect the controller, reboot the PC and try again.

  • Note #5: It's not necessary to type in Terminal sudo xboxdrv --silent if the xboxdrv is running by the service, besides it runs every time when Ubuntu boots.