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
  • 1
  • 9

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.

  • You're a lifesaver, thanx! :D Do you have any idea how I can connect my controller wirelessly, cause when I try to pair the device is says "Device not available", altho scanning does find it in console (not in GUI). Thanx again :D – Qushy Jan 25 '19 at 22:29
  • I haven't tried to pair the controller over bluetooth. There are a few things to consider: is the controller a stock controller or a custom one (like the XBox Elite Controller)? Does the controller need to have a firmware update? Does the host computer need a kernel update? Try posting a new question. – engineerRed Jan 28 '19 at 17:57
  • Will do, thanx :D – Qushy Jan 29 '19 at 19:48
  • 1
    @engineerRed, in Ubuntu 22.04, after creating a new file with the above text, then enable with my xbox controller connected, and then start, I got the error in the output: Job for xboxdrv.service failed because of unavailable resources or another system error. See "systemctl status xboxdrv.service" and "journalctl -xeu xboxdrv.service" for details. – luisito_36 Nov 03 '22 at 03:59
  • 1
    Check it out: https://i.pinimg.com/originals/aa/a4/64/aaa464720171cda6a208b54b782272f2.jpg – luisito_36 Nov 03 '22 at 04:21
  • The image shows an error like "No such file or directory". Can you check that the file /etc/systemd/system/xboxdrv.service exists? Maybe there is a typo in the filename (or the file is located in a different directory). – engineerRed Nov 04 '22 at 16:14
  • @engineerRed, I'm pretty sure that the file /etc/systemd/system/xboxdrv.service already exists, I made it before! The problem is that the syntax of ExecStart= have many codes that It couldn't start xboxdrv, therefore I made a new answer below to fix it. – luisito_36 Nov 04 '22 at 18:49
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.