Skip to main content
Topic solved
This topic has been marked as solved and requires no further attention.
Topic: [SOLVED] Dinit service does not start (Read 318 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[SOLVED] Dinit service does not start

There is a program X written in rust, which is run by the root user via sudo X run or doas X run. It is located in /usr/bin/ with the following permissions:
Code: [Select]
-rwxr-xr-x 1 root root    3714208 Oct 10 12:31 X

Okay, now we create a file /etc/dinit.d/X with the following contents:
Code: [Select]
type            = process
command         = /usr/bin/X run
logfile         = /var/log/dinit/X.log

Startup:
Code: [Select]
~ ❯ doas dinitctl start X 
Service 'X' started.
~ ❯ doas dinitctl status X
Service: X
    State: STOPPED (terminated; unknown reason)

In /var/log/dinit/X.log there is only this:

Code: [Select]
thread 'main' panicked at src/daemon.rs:450:67:
called `Result::unwrap()` on an `Err` value: Os { code: 25, kind: Uncategorized, message: "Inappropriate ioctl for device" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Where do I add this "RUST_BACKTRACE=1" and what do I do next?

Re: Dinit service does not start

Reply #1
Hi.

This program works outside of Dinit environment? (E.g. manual running from shell)

Re: Dinit service does not start

Reply #2
mobin2008, Hi! Yes, it is a simple utility that runs from the terminal using the commands above. It has this systemd service for starting (I have not tested it):

Code: [Select]
[Unit]
Description=Description program

[Service]
ExecStart=/usr/bin/X run

[Install]
WantedBy=multi-user.target

Re: Dinit service does not start

Reply #3
I would guess from the error message ("inappropriate ioctl for device") that it is expecting to be run with input/output connected to a terminal (tty). Does that seem like it would be the case?

I'd also guess from the source filename ("demon.rs") that it might be trying to background itself. This is not the ideal for how programs should behave under dinit (or any other modern service manager); you might want to check if there is a command line option to inhibit that.

(I know nothing about this "X" other than what I've been able to infer here and can't find a git repo or website for it, so I'm really mostly guessing).

Re: Dinit service does not start

Reply #4
The problem was in the source code.