neunr wants to merge 1 commit from /u/neunr/sispmctl/ to master, 2024-12-16
I tried to set up sispmctl as a systemd service and the service failed because the sispm device could not be detected.
Running a stack trace on sispmctl in a shell revealed, that AF_NETLINK and AF_UNIX are also used:
socket(AF_NETLINK, SOCK_RAW|SOCK_CLOEXEC|SOCK_NONBLOCK, NETLINK_KOBJECT_UEVENT) = 5
strace: Process 93496 attached
Server goes to listen mode now.
[pid 93495] socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) = 7
[pid 93495] socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0) = 8
After adding these AFs to the systemd unit, the service works.
Thank you for reporting the issue that you faced and suggesting a fix.
Neither on Ubuntu nor on Debian I am able to reproduce your problem. I would not know where sispmctl would be sending messages via a socket to the kernel (AF_NETLINK) or locally via socket (AF_UNIX) to another process.
Could you, please, describe which operating system and which architecture you are using.
Best regards
Heinrich
Hi, thanks for your response.
I encountered the issue on nixOS x86_64.
The stack trace above was acquired by running
strace -f -e socket sispmctl -LOn nixos, when running sispmctl as login user the usb-device is detected, but when creating a systemd service based on the example from this repo the device is only detected when the two additional AF_s are added. Without them the unit fails like this:
nixos seems to deviate a lot from other Linux distros.
I could not get PKG_CONFIG_MODULES to work.
After installing sispmctl is not in the path.
Please, provide a description:
Ah, yeah sorry. nix(OS) might be a bit confusing on first contact. %)
To test the behavior quickly the easiest way would be to use the attached system configuration.
You can run & build the configuration by either booting into a nixOS live iso or by using the nix package manager (available on ubuntu and debian with the
nix-binpackage).After saving the
configuration.nixto a directory you can use this command to create a qemu vm image based on the configuration:nix-build '<nixpkgs/nixos>' -A vm -I nixpkgs=channel:nixos-unstable -I nixos-config=./configuration.nix --show-traceAfter the build is complete, that image can be launched with this command:
./result/bin/run-sispmctltest-vm(If you run ^the command with sufficient permission (sudo) a gembird device attached to the host will be available inside the VM). You might have to adjust the vendor and product ids in the
configuration.nixto your device.User inside the VM is
alice, password istest123In the VM the
sispmctl.serviceis configured andsispmctlis available on the shell. You can interact with the systemd unit with thesystemctlyou know from other distros (iesystemctl cat sispmctl).You can test the behavior with/without the to additional address families available to the systemd unit by commenting the lines in the
configuration.nixand rerunning thenix-buildabove. Of course you will have to restart the VM after a rebuild.Last edit: neunr 2024-11-22
ps: The requirement for AF_NETLINK seem to come from libusb -> https://github.com/libusb/libusb/blob/master/libusb/os/linux_netlink.c#L100
Any progress?