Community Packages

Please read this before reporting a bug:

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!

FS#50056 - [usb_modeswitch] usb_modeswitch@.service is not installed

Attached to Project: Community Packages
Opened by felix (fstirlitz) - Friday, 15 July 2016, 22:24 GMT
Last edited by Sergej Pupykin (sergej) - Monday, 18 July 2016, 11:04 GMT
Task Type Feature Request
Category Packages
Status Closed
Assigned To Sergej Pupykin (sergej)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


The file usb_modeswitch@.service from the source package is not installed, preventing the package from working under systemd.

This can be fixed by setting SYSDIR= appropriately in package() after making sure the desired target directory exists.
This task depends upon

Closed by  Sergej Pupykin (sergej)
Monday, 18 July 2016, 11:04 GMT
Reason for closing:  Fixed
Comment by T (archery1234) - Sunday, 17 July 2016, 14:39 GMT
I am trying to understand what's happening here. I am affected by this bug:, where there is a link to this issue. In order to get usb_modeswitch to work again, I downgraded to the previous version (2.3.0-1) and used the opportunity to check for the installed files. I do not see the file you claim to be missing in 2.4.0-1 either, yet 2.3.0-1 works.

> $ pacman -Qi usb_modeswitch
Name : usb_modeswitch
Version : 2.3.0-1
Description : Activating switchable USB devices on Linux.
Architecture : x86_64
Licenses : GPL
Groups : None
Provides : None
Depends On : libusb tcl
Optional Deps : None
Required By : None
Optional For : None
Conflicts With : None
Replaces : None
Installed Size : 319.00 KiB
Packager : Sergej Pupykin <>
Build Date : Mon 15 Feb 2016 06:02:21 PM CET
Install Date : Sun 17 Jul 2016 03:56:30 PM CEST
Install Reason : Explicitly installed
Install Script : No
Validated By : Signature

> $ pacman -Qlk usb_modeswitch | awk '{print $2}' | grep -v "^/usr/share/usb_modeswitch/"
Comment by felix (fstirlitz) - Sunday, 17 July 2016, 14:59 GMT
It's simple. When a device with a supported VID:PID pair is connected, udev runs /usr/lib/udev/usb_modeswitch with some arguments on the command line, which (if systemd is running) in turn executes

systemctl --no-block start usb_modeswitch@$p1'_'$p2.service

but that line won't succeed if the service file specified in this bug report is missing. This defect can be worked around by running /usr/bin/usb_modeswitch manually.
Comment by T (archery1234) - Sunday, 17 July 2016, 17:11 GMT
Thank you for your response.

I was not aware of the fact that udev in turn calls a systemd service. Still I don't seem to get my head around this.

* as shown above, 2.3.0 did *not* come with a service file and *did* work
* 2.4.0 does not come with a service file either and *does not* work

Moreover, neither the upstream Makefile, nor the the Arch PKGBUILD contain changes other than versions or checksums, see your commit


> $ wget --quiet{2.3,2.4}.0.tar.bz2

> $ for i in {2.3,2.4}; do tar -jxvf usb-modeswitch-$i.0.tar.bz2 usb-modeswitch-$i.0/Makefile; done
tar: A lone zero block at 2616

> $ diff usb-modeswitch-{2.3,2.4}.0/Makefile
< VERS = 2.3.0
> VERS = 2.4.0

Accordingly, the SYSDIR variable in the Makefile is as much set (or not) as before. As a consequence, the service file should get installed in either of the two versions in question or in none. And for what I think I have found out, it gets installed in none of them, yet still works in 2.3.0.

Therefore: Are you sure, this is SYSDIR related? And why would you set it in the PKGBUILD when it is already set in the Makefile?

Sorry if I'm bothering you, just really curious to find out what's going on.
Comment by viktor (dviktor) - Sunday, 17 July 2016, 18:01 GMT
Check this ticket
Seems like the problem with hwids or device-mapper packages
Comment by T (archery1234) - Sunday, 17 July 2016, 19:53 GMT
@dviktor: I doubt that:

> $ pacman -Q usb_modeswitch linux device-mapper
usb_modeswitch 2.4.0-1
linux 4.6.4-1
device-mapper 2.02.160-2

My package versions correspond to yours - still not working.
Comment by felix (fstirlitz) - Sunday, 17 July 2016, 20:13 GMT
> Therefore: Are you sure, this is SYSDIR related?
Yes, I'm bloody sure.

--- usb-modeswitch-2.3.0/
+++ usb-modeswitch-2.4.0/
- if [ -e "/etc/systemd/system/usb_modeswitch@.service" ]; then
- exec systemctl --no-block start usb_modeswitch@$p1'_'$p2.service
+init_path=`readlink /sbin/init`
+if [ `basename $init_path` = "systemd" ]; then
+ systemctl --no-block start usb_modeswitch@$p1'_'$p2.service

> And why would you set it in the PKGBUILD when it is already set in the Makefile?
Because it points to /usr/lib/systemd in the actual system root, and not to the mock root in $pkgdir.

But more importantly, I know this fixes the problem because I actually tested it.

If you're going to do some research, do it a little more thoroughly, will you? Maybe you wouldn't need to ask such questions.
Comment by Sergej Pupykin (sergej) - Sunday, 17 July 2016, 20:57 GMT
should be fixed in usb_modeswitch-2.4.0-2