[go: up one dir, main page]

Menu

Git Merge Request #3: Add missing address families to systemd unit example (open)

Merging...

Merged

Something went wrong. Please, merge manually

Checking if merge is possible...

Something went wrong. Please, merge manually

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.

Commit Date  
[74b44c] (HEADmaster) by 9R 9R

add required address families to example systemd unit

2024-11-18 21:34:43 Tree

Discussion

  • xypron

    xypron - 2024-11-21

    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

     
  • neunr

    neunr - 2024-11-21

    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 -L
    On 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:

    systemd[1]: Starting Run sispmctl http server...
    sispmctl[59466]: No GEMBIRD SiS-PM found. Check USB connections, please!
    systemd[1]: sispmctl.service: Control process exited, code=exited, status=1/FAILURE
    systemd[1]: sispmctl.service: Failed with result 'exit-code'.
    systemd[1]: Failed to start Run sispmctl http server.
    
     
  • xypron

    xypron - 2024-11-22

    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:

    • Which packages are needed?
    • How to build?
    • How to install?
    • How to setup the service?
     
  • neunr

    neunr - 2024-11-22

    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-bin package).

    After saving the configuration.nix to 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-trace

    After 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.nix to your device.

    User inside the VM is alice, password istest123

    In the VM the sispmctl.service is configured and sispmctl is available on the shell. You can interact with the systemd unit with the systemctl you know from other distros (ie systemctl 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.nix and rerunning the nix-build above. Of course you will have to restart the VM after a rebuild.

     

    Last edit: neunr 2024-11-22
  • neunr

    neunr - 2024-12-16

    Any progress?

     

Log in to post a comment.