How to debug a crash in a /etc/init.d script? Works OK when run from command line, worked in 22.04.

Colin Watson cjwatson at ubuntu.com
Mon Jun 10 15:54:53 UTC 2024


On Sat, Jun 08, 2024 at 01:11:21PM +0100, Chris Green wrote:
> On Sat, Jun 08, 2024 at 12:02:43PM +0200, Ralf Mardorf via ubuntu-users wrote:
> > 2. Since it worked before, it could be a race condition. Systemd could
> > be running the init script before the dependencies are ready for use.
> 
> Yes, that's what I've been thinking is the most likely cause.  I
> suspect that a time delay in a /etc/init.d script is not a good idea
> though.  I'll have to try a wrapper script that returns immediately
> after starting a script with a delay in it.

systemd-sysv-generator supports specifying dependencies via LSB headers.
See systemd-sysv-generator(8) and
https://refspecs.linuxbase.org/LSB_3.1.1/LSB-Core-generic/LSB-Core-generic/initscrcomconv.html.

(However, systemd-sysv-generator is deprecated, so to be future-proof
you should convert this into a proper systemd service.  It should end up
much shorter and simpler.)

-- 
Colin Watson (he/him)                              [cjwatson at ubuntu.com]



More information about the ubuntu-users mailing list