[systemd-devel] One shot service failure on Fedora 37
Bill Steinberg
bill at ponusridge.com
Wed Apr 19 18:48:56 UTC 2023
Thanks, I will try using forking, setting ExecStart and EnvironmentFile as you suggested.
> On Apr 18, 2023, at 1:46 PM, Barry <barry at barrys-emacs.org> wrote:
>
>
>
>> On 18 Apr 2023, at 14:54, Bill Steinberg <bill at ponusridge.com> wrote:
>>
>>
>>>
>>> "Directly" means *not using wrapper scripts.* You can put command line arguments in ExecStart.
>>
>> Is there a way to run a shell script in a systemd which runs this type of command: "eval $DCC_LIBEXEC/dccifd $DCCIFD_ARGS”. The Distributed Checksum Clearinghouses shell scripts end up running this command. I’d rather use their scripts directly instead of having to extract the necessary parts required for a systemd forking type.
>
> Yes. You do not need the eval.
>
> You do need to read the file that sets the env var using EnvironmentFile=.
> Then you can use ExecStart=${DDC_LIB}/ddcifd $DDCIFD_ARGS
> Note the use of {} in only one place.
>
> Barry
>>
>>> On Apr 18, 2023, at 12:02 AM, Mantas Mikulėnas <grawity at gmail.com> wrote:
>>>
>>> On Tue, Apr 18, 2023, 02:59 Bill Steinberg <bill at ponusridge.com <mailto:bill at ponusridge.com>> wrote:
>>>>
>>>> Hi Barry,
>>>>
>>>> Thanks for the response. Answers inline below.
>>>>
>>>>> On Apr 17, 2023, at 5:09 PM, Barry <barry at barrys-emacs.org <mailto:barry at barrys-emacs.org>> wrote:
>>>>>
>>>>>
>>>>>
>>>>>> On 17 Apr 2023, at 19:05, Bill Steinberg <bill at ponusridge.com <mailto:bill at ponusridge.com>> wrote:
>>>>>>
>>>>>> Hello systemd devel,
>>>>>>
>>>>>> I have a systemd service that I’ve run on prior versions of fedora which fails to start via systemd on Fedora release 37. It is a oneshot service that starts the distributed checksum clearing house’s dccifd service via a shell script. Here is the definition of the service:
>>>>>>
>>>>>> [Unit]
>>>>>> Description=Distributed Checksum Clearinghouses dccifd daemon
>>>>>> After=syslog.target network.target
>>>>>>
>>>>>> [Service]
>>>>>> Type=oneshot
>>>>>
>>>>> Oneshot seems wrong.
>>>>>
>>>>>> RemainAfterExit=yes
>>>>>> ExecStart=/var/dcc/libexec/rcDCC -m dccifd start
>>>>> Does this run a background daemon?
>>>>
>>>> Yes, the rcDCC shell script starts and runs a linux executable, a background daemon as you call it.
>>>
>>>
>>> A "background daemon" is just Type=forking.
>>>
>>>>
>>>>> Can you just run that daemon directly?
>>>>
>>>> I could run the shell script directly to start the dccifd executable however if the fedora linux server is rebooted I would need to remember to run the shell script manually. I’d like the dccifd daemon to start automatically when the fedora linux server is started. Isn’t systemd meant for this?
>>>
>>>
>>> "Directly" means *not using wrapper scripts.* You can put command line arguments in ExecStart.
>>>
>>>>
>>>>> Hopefully that program can be run without demonising.
>>>>>
>>>>>
>>>>>> ExecStop=/var/dcc/libexec/rcDCC -m dccifd stop
>>>>> If it is oneshot it does not need a stop
>>>>
>>>> Is there another type that should be used besides oneshot? I may want to run systemctl stop dccifd.service, for example when dccifd is being upgraded to a new version.
>>>>
>>>> The dccifd executable is started and stopped using a shell script. It is not run directly. One reason is that the shell script contains the arguments that are passed to the dccifd linux executable.
>>>
>>>
>>> That's still just Type=forking.
>>>
>>> Make sure the script `exec`s the main process rather than spawning it underneath as usual.
>>>
>>> But why put those arguments in a shell script? Isn't systemd meant for this?
>>>
>>>>
>>>>>
>>>>>> Restart=no
>>>>>>
>>>>>> [Install]
>>>>>> WantedBy=multi-user.target
>>>>>>
>>>>>>
>>>>>> The error in the journalctl log is:
>>>>>>
>>>>>> systemd[1]: Starting dccifd.service - Distributed Checksum Clearinghouses dccifddaemon…
>>>>>> systemd[1]: dccifd.service: Main process exited, code=killed, status=11/SEGV
>>>>>> systemd[1]: dccifd.service: Failed with result 'signal’.
>>>>>> systemd[1]: Failed to start dccifd.service - Distributed Checksum Clearinghouses dccifddaemon.
>>>>>>
>>>>>> The two scripts in ExecStart and ExecStop run successfully outside of systemd. Any info as to why systemd fails when executing these scripts would be appreciated.
>>>>>>
>>>>>> Best,
>>>>>> Bill Steinberg
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20230419/1f6a92bf/attachment.htm>
More information about the systemd-devel
mailing list