1

I'm using init.d to start a Python script on boot. The script employs hardware PWM. When I run the Python manually as the pi user, it works fine. When I start the script manually, calling the daemon from the commandline, it works fine.

At boot things are a little different. When start-stop-daemon --user pi is called, the script runs and most features work perfecnt,y except I get no hardware PWM output. Instead, if start-stop-daemon --user root is called, the script doesn't appear to run at all and status_of_proc reports:

● lcdtemp.service - LSB: LCD multi temperature display
     Loaded: loaded (/etc/init.d/lcdtemp.sh; generated)
     Active: active (exited) since Sun 2023-07-09 15:55:32 BST; 4min 29s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 252 ExecStart=/etc/init.d/lcdtemp.sh start (code=exited, status=0/SUCCESS)
        CPU: 1.479s

which I think means it quit for some reason, but there's no error message from my Python.

I suspect running it as user root doesn't work because root isn't in the GPIO group, and running it as pi doesn't work because we need to be root to get GPIO.

Am I up the right street? How can I figure out what's going on?

1 Answer 1

0

In all probability this is a deprecation issue. This is exemplified by other answers.

I didn't realise init.d methods were a thing of the past.

This is a fresh install of a program I wrote years ago. It works OKay on BUSTER, but this was a results of my trying it on BULLSEYE.

Heavy deprecation could also explain some other odd behaviours: when I use update-rc.d with remove, for example, it still tries to run at boot time!

It's time to look at systemd.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.