Replacement package for "daemonize" in Rocky Linux 9

Hi,

I am trying to update an ansible playbook by including Rocky Linux 9 servers.
I have a list of rhel 8 server packages that need to be install on those Rocky 9 servers.
In this list I have the “daemonize” package and I am not able to find on the web the replacement package for Rocky Linux 9 release.

daemonize in EL8 was packaged by EPEL repository, so you could make a request to EPEL for them to package this for EL9.

Another alternative is to download the daemonize src rpm from Fedora: Overview - rpms/daemonize - src.fedoraproject.org

For example, the src.rpm I downloaded from Fedora 36: https://kojipkgs.fedoraproject.org//packages/daemonize/1.7.8/3.fc36/src/daemonize-1.7.8-3.fc36.src.rpm

Of which I then installed and ran mock to build the rpm myself:

mock daemonize-1.7.8-3.fc36.src.rpm

this way, you can at least build it yourself and use it, at least until it is requested and appears in EPEL.

Wrote: /builddir/build/RPMS/daemonize-debuginfo-1.7.8-3.el9.x86_64.rpm
Wrote: /builddir/build/RPMS/daemonize-1.7.8-3.el9.x86_64.rpm
Wrote: /builddir/build/RPMS/daemonize-debugsource-1.7.8-3.el9.x86_64.rpm
Finish: rpmbuild daemonize-1.7.8-3.fc36.src.rpm
Finish: build phase for daemonize-1.7.8-3.fc36.src.rpm
INFO: Done(daemonize-1.7.8-3.fc36.src.rpm) Config(default) 2 minutes 46 seconds
INFO: Results and/or logs in: /var/lib/mock/rocky+epel-9-x86_64/result
Finish: run

[ian@rocky9 ~]$ ls /var/lib/mock/rocky+epel-9-x86_64/result/
build.log                         daemonize-debuginfo-1.7.8-3.el9.x86_64.rpm    installed_pkgs.log
daemonize-1.7.8-3.el9.src.rpm     daemonize-debugsource-1.7.8-3.el9.x86_64.rpm  root.log
daemonize-1.7.8-3.el9.x86_64.rpm  hw_info.log                                   state.log

and package install:

[root@rocky9 result]# dnf localinstall daemonize-1.7.8-3.el9.x86_64.rpm 
Last metadata expiration check: 4:43:42 ago on Thu 05 Jan 2023 12:38:20 PM CET.
Dependencies resolved.
====================================================================================================
 Package               Architecture       Version                    Repository                Size
====================================================================================================
Installing:
 daemonize             x86_64             1.7.8-3.el9                @commandline              24 k

Transaction Summary
====================================================================================================
Install  1 Package

Total size: 24 k
Installed size: 36 k
Is this ok [y/N]: y
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                            1/1 
  Installing       : daemonize-1.7.8-3.el9.x86_64                                               1/1 
  Running scriptlet: daemonize-1.7.8-3.el9.x86_64                                               1/1 
  Verifying        : daemonize-1.7.8-3.el9.x86_64                                               1/1 

Installed:
  daemonize-1.7.8-3.el9.x86_64                                                                      

Complete!
[root@rocky9 result]# daemonize --help
daemonize: illegal option -- -
Bad option: --
daemonize, version 1.7.8
Usage: daemonize [OPTIONS] path [arg] ...

OPTIONS

-a             Append to, instead of overwriting, output files. Ignored 
               unless -e and/or -o are specified.
-c <dir>       Set daemon's working directory to <dir>.
-e <stderr>    Send daemon's stderr to file <stderr>, instead of /dev/null.
-E var=value   Pass environment setting to daemon. May appear multiple times.
-o <stdout>    Send daemon's stdout to file <stdout>, instead of /dev/null.
-p <pidfile>   Save PID to <pidfile>.
-u <user>      Run daemon as user <user>. Requires invocation as root.
-l <lockfile>  Single-instance checking using lockfile <lockfile>.
-v             Issue verbose messages to stdout while daemonizing.

thanks for the numerous suggestions.
I will explore each one of them and try to make the best choice for my use case.

1 Like

It’s also worth asking yourself why it’s not in Rocky 9. Maybe there’s a newer better way.

As you can see from the output you’ve got: All parameters of the “daemonize” binary have a single dash. You tried --help (two dashes). And the shown helptext doesn’t list -h either, but you can see what options are there.

As gerry66uk hinted: These days there are much better options available out of the box in Systemd.

Say you have a binary that can run as a daemon? You want to run it as a system service, chrooted, not as “root” but as an unprivileged user? Here is a sample Systemd Unit-File for that.

]# cat /usr/lib/systemd/system/monitor.service 
[Unit]
Description=Monitor
Documentation=man:monitor(8)
After=network-online.target
Requires=network-online.target

[Service]
Type=forking
#Type=simple
EnvironmentFile=-/etc/sysconfig/monitor
ExecStartPre=-/usr/sausalito/bin/monitor_prep.sh
ExecStart=/usr/bin/monitor -c /etc/monitor/monitor.conf -p /run/monitor.pid $OPTIONS
PIDFile=/run/monitor.pid
Restart = on-failure

User=monitor
Group=monitor

PrivateTmp=true
NonBlocking=yes
# this will make /usr /boot /etc read only for service
ProtectSystem=full
ProtectHome=no
PrivateDevices=true


[Install]
WantedBy=multi-user.target

Just a suggestion. Other than that: Daemonize should still work fine on EL9.

Yeah, I think my copy from the console didn’t work too good, since I tried --help first, and then -h to get the results. The main thing was just really to show that the mock build that I did, built OK and then was installable, and to show it works from the console. I could fix my post for that, but then our subsequent posts wouldn’t make sense :slight_smile: , so I’ll leave it as is and just add that the command should have been:

daemonize -h

everytime I use -h then it tells me to use --help. Would be great if they could decide on a standard of -h or --help or at least allow both.

Hi,
I was also able to build and install the daemonize package like @iwalker did on my Rocky 9 server.
As @mstauber showed I understand why it is not in the EPEL repository for Rocky 9.
Thanks for the suggestions and explanations.