Community Packages

Please read this before reporting a bug:
http://wiki.archlinux.org/index.php/Reporting_Bug_Guidelines

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!
Tasklist

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

Details

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: https://bugs.archlinux.org/task/50055?project=5&cat%5B0%5D=33&string=usb_modeswitch, 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
URL : http://www.draisberghof.de/usb_modeswitch/
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 <pupykin.s+arch@gmail.com>
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/"
/etc/
/etc/usb_modeswitch.conf
/etc/usb_modeswitch.d/
/etc/usb_modeswitch.setup
/usr/
/usr/bin/
/usr/bin/usb_modeswitch
/usr/bin/usb_modeswitch_dispatcher
/usr/lib/
/usr/lib/udev/
/usr/lib/udev/rules.d/
/usr/lib/udev/rules.d/40-usb_modeswitch.rules
/usr/lib/udev/usb_modeswitch
/usr/share/
/usr/share/man/
/usr/share/man/man1/
/usr/share/man/man1/usb_modeswitch.1.gz
/usr/share/man/man1/usb_modeswitch_dispatcher.1.gz
/var/
/var/lib/
/var/lib/usb_modeswitch/
450
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

https://git.archlinux.org/svntogit/community.git/commit/trunk?h=packages/usb_modeswitch&id=3c2885a101e93a0873e7e1e7c1f9d49f252d58fb

and

> $ wget --quiet http://www.draisberghof.de/usb_modeswitch/usb-modeswitch{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
usb-modeswitch-2.3.0/Makefile
usb-modeswitch-2.4.0/Makefile
tar: A lone zero block at 2616

> $ diff usb-modeswitch-{2.3,2.4}.0/Makefile
2c2
< 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 https://bugs.archlinux.org/task/50055
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.sh
+++ usb-modeswitch-2.4.0/usb_modeswitch.sh
[SNIP]
- if [ -e "/etc/systemd/system/usb_modeswitch@.service" ]; then
- exec systemctl --no-block start usb_modeswitch@$p1'_'$p2.service
[SNIP]
+init_path=`readlink /sbin/init`
+if [ `basename $init_path` = "systemd" ]; then
+ systemctl --no-block start usb_modeswitch@$p1'_'$p2.service
[SNIP]

> 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

Loading...