Opened 5 years ago

Closed 3 years ago

#12595 closed enhancement (fixed)

Create new version of systemd units

Reported by: Douglas R. Reno Owned by: Douglas R. Reno
Priority: lowest Milestone: hold
Component: BOOK Version: systemd
Severity: normal Keywords:
Cc:

Description

This will primarily be a cleanup release. Currently on my todo list for this:

=================
BLFS SYSTEMD UNITS FIXES
=================

- Remove obsolete kdm unit
- Remove obsolete tor unit
- Remove obsolete xinetd unit
- Remove obsolete nscd unit
- Samba AD Daemon (samba.service): Fix the PIDFile
- Fix PID file in rpc-statd.service
- Add conflicts to Postfix for exim and sendmail
- Fix git-daemon to use /usr/libexec/git-core instead of /usr/lib/git-core
- Add conflicts to Exim for postfix and sendmail
- Add conflicts to dhclientat for dhcpcdat
- Remove nscd.conf file since it's installed in LFS
- NTPD (In NTP page itself) - correct PID file in /etc/ntp.conf
- Add DJ's LSB Compliance stuff (LFS Ticket #4521)

For BLFS purposes, we should only have services/units for the packages which are in the book, and NSCD is also installed in glibc in LFS now rather than in BLFS (which was the case in around 2014 I think). Also, as noted above, add some conflicts:

For postfix, prevent installation of the unit if sendmail OR exim are installed. For Exim, prevent installation of the unit if sendmail OR postfix are installed. For dhclientat (dhclient@eth0), prevent installation of the unit if dhcpcd (dhcpcd@eth0) is installed.

There are a couple of PID File adjustments here for RPC-STATD (part of nfs-utils) and Samba (the AD server unit added by DJ). This is primarily to address incompatibilities with systemd-243.

The git-daemon executable has been moved to /usr/libexec/git-core from /usr/lib/git-core, so the unit file needs to be updated for that.

There are also a couple units that will get removed because their packages are either no longer in BLFS or never were in the first place.

I'll also analyze my logs for the packages that we have units for to see if any further changes need to be made as part of 243.

Change History (12)

comment:1 by Douglas R. Reno, 5 years ago

Owner: changed from blfs-book to Douglas R. Reno
Status: newassigned
Version: SVNsystemd

comment:2 by Douglas R. Reno, 5 years ago

acpid (acpid.service) needs a fix as well:

renodr [ /sources ]$ sudo systemctl enable acpid.service
The unit files have no installation config (WantedBy=, RequiredBy=, Also=,
Alias= settings in the [Install] section, and DefaultInstance= for template
units). This means they are not meant to be enabled using systemctl.
 
Possible reasons for having this kind of units are:
• A unit may be statically enabled by being symlinked from another unit's
  .wants/ or .requires/ directory.
• A unit's purpose may be to act as a helper for some other unit which has
  a requirement dependency on it.
• A unit may be started when needed via activation (socket, path, timer,
  D-Bus, udev, scripted systemctl call, ...).
• In case of template units, the unit is meant to be enabled with some
  instance name specified.

In this case, we need to add the following to acpid.service:

[Install]
WantedBy=sockets.target

comment:3 by Douglas R. Reno, 5 years ago

  • Fixed systemd unit for acpid (added WantedBy=sockets.target)
  • Removed nscd unit
  • Removed tor unit
  • Removed xinetd unit
  • Removed kdm unit

at r22218.

comment:4 by Douglas R. Reno, 5 years ago

  • Samba unit updated at r22254 to fix paths and PID file
  • Removed git-daemon unit at r22253
  • Updated httpd unit at r22253 to no longer use PID file

comment:5 by Douglas R. Reno, 5 years ago

Status update:

From my todo list for this release:

- Fix PID file in rpc-statd.service
- Add conflicts to Postfix for exim and sendmail
- Add conflicts to Exim for postfix and sendmail
- Add conflicts to dhclientat for dhcpcdat
- Add conflicts to dhcpcdat for dhclientat
- Add conflicts to proftpd for vsftpd
- Add conflicts to vsftpd for proftpd
- NTPD (In NTP page itself) - correct PID file in /etc/ntp.conf
- Add DJ's LSB Compliance stuff

Left to verify:

-rw-r--r-- 1 renodr renodr 182 Jul 20  2014 vsftpd.service
-rw-r--r-- 1 renodr renodr 154 Jul 31  2015 var-lib-nfs-rpc_pipefs.mount
-rw-r--r-- 1 renodr renodr 216 Jul 20  2014 unbound.service
-rw-r--r-- 1 renodr renodr 257 Jul 20  2014 svnserve.service
-rw-r--r-- 1 renodr renodr 214 Jul 20  2014 slapd.service
-rw-r--r-- 1 renodr renodr 277 Aug 24  2014 saslauthd.service
-rw-r--r-- 1 renodr renodr 131 Jul 20  2014 rsyncd.socket
-rw-r--r-- 1 renodr renodr 217 Jul 20  2014 rsyncd.service
-rw-r--r-- 1 renodr renodr 187 Jul 20  2014 rsyncdat.service
-rw-r--r-- 1 renodr renodr 372 Jul 31  2015 rpc-statd.service
-rw-r--r-- 1 renodr renodr 276 Jul 31  2015 rpc-statd-notify.service
-rw-r--r-- 1 renodr renodr 234 Jul 31  2015 rpc-mountd.service
-rw-r--r-- 1 renodr renodr 252 Jul 31  2015 rpc-idmapd.service
-rw-r--r-- 1 renodr renodr 133 Jul 31  2015 rpcbind.socket
-rw-r--r-- 1 renodr renodr 139 Sep 15  2018 rpcbind.service
-rw-r--r-- 1 renodr renodr 184 Jul 20  2014 proftpd.service
-rw-r--r-- 1 renodr renodr  98 Jul 31  2015 proc-fs-nfsd.mount
-rw-r--r-- 1 renodr renodr 593 Jul 20  2014 postgresql.service
-rw-r--r-- 1 renodr renodr 290 Jul 20  2014 postfix.service
-rw-r--r-- 1 renodr renodr 240 Jul 31  2015 ntpd.service
-rw-r--r-- 1 renodr renodr 130 Jul 20  2014 nfs-server.target
-rw-r--r-- 1 renodr renodr 618 Jul 31  2015 nfs-server.service
-rw-r--r-- 1 renodr renodr 477 Jul 20  2014 nfsd.service
-rw-r--r-- 1 renodr renodr 183 Jul 31  2015 nfs-client.target
-rw-r--r-- 1 renodr renodr 114 Jul 31  2015 nfs-client.service
-rw-r--r-- 1 renodr renodr 217 Jul 20  2014 mysqld.service
-rw-r--r-- 1 renodr renodr 341 Jan  5  2018 lightdm.service
-rw-r--r-- 1 renodr renodr 128 Jul 20  2014 krb5-kpropd.service
-rw-r--r-- 1 renodr renodr 129 Jul 20  2014 krb5-kdc.service
-rw-r--r-- 1 renodr renodr 137 Jul 20  2014 krb5-kadmind.service
-rw-r--r-- 1 renodr renodr 251 Jul 20  2014 iptables.service
-rw-r--r-- 1 renodr renodr 202 Jul 20  2014 haveged.service
-rw-r--r-- 1 renodr renodr 215 Jul 20  2014 exim.service
-rw-r--r-- 1 renodr renodr 235 Jul 20  2014 dhcpd.service
-rw-r--r-- 1 renodr renodr 449 Aug  1  2014 dhclientat.service

comment:6 by Pierre Labastie, 4 years ago

I know I should ask rather on support, since I am just a noob with systemd. But since this ticket is open, and I believe my issue is related. I report it here. After building lfs-systemd with jhalfs, the system fails to start nscd at boot. The relevant part of the journal is:

Jan 07 09:59:30 turboli systemd[1]: Starting Name Service Cache Daemon...
Jan 07 09:59:30 turboli nscd[480]: 480 /var/run/nscd/nscd.pid: No such file or directory
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring file `/etc/passwd` (1)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring directory `/etc` (2)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring file `/etc/group` (3)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring directory `/etc` (2)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring file `/etc/hosts` (4)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring directory `/etc` (2)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring file `/etc/resolv.conf` (5)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring directory `/etc` (2)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring file `/etc/services` (6)
Jan 07 09:59:30 turboli nscd[480]: 480 monitoring directory `/etc` (2)
Jan 07 09:59:30 turboli nscd[480]: 480 disabled inotify-based monitoring for file `/etc/netgroup': No such file or directory
Jan 07 09:59:30 turboli nscd[480]: 480 stat failed for file `/etc/netgroup'; will try again later: No such file or directory
Jan 07 09:59:30 turboli nscd[480]: 480 /var/run/nscd/socket: No such file or directory
Jan 07 09:59:30 turboli nscd[479]: child exited with status 1

I think (but remember I am a noob) the cause of the failure is that the /var/run/nscd directory does not exist (note that /var/run is a symlink to /run, and /run is a tmpfs).

Please tell me to move to support if I am wrong.

comment:7 by Douglas R. Reno, 4 years ago

This is very interesting. Can you run 'mount' and make sure that /run is mounted? It works well for me:

renodr [ /sources ]$ sudo systemctl status nscd
● nscd.service - Name Service Cache Daemon
     Loaded: loaded (/lib/systemd/system/nscd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2020-01-06 23:01:14 CST; 11h ago
    Process: 310 ExecStart=/usr/sbin/nscd (code=exited, status=0/SUCCESS)
   Main PID: 320 (nscd)
      Tasks: 11 (limit: 9364)
     Memory: 2.2M
        CPU: 28ms
     CGroup: /system.slice/nscd.service
             └─320 /usr/sbin/nscd

Jan 06 23:01:12 POOH nscd[320]: 320 stat failed for file `/etc/resolv.conf'; will try again later: No such file or directory
Jan 06 23:01:12 POOH nscd[320]: 320 monitoring file `/etc/services` (5)
Jan 06 23:01:12 POOH nscd[320]: 320 monitoring directory `/etc` (2)
Jan 06 23:01:12 POOH nscd[320]: 320 disabled inotify-based monitoring for file `/etc/netgroup': No such file or directory
Jan 06 23:01:12 POOH nscd[320]: 320 stat failed for file `/etc/netgroup'; will try again later: No such file or directory
Jan 06 23:01:14 POOH systemd[1]: Started Name Service Cache Daemon.
Jan 06 23:01:30 POOH nscd[320]: 320 monitored file `/etc/resolv.conf` changed (mtime)
Jan 06 23:01:30 POOH nscd[320]: 320 monitoring file `/etc/resolv.conf` (6)
Jan 06 23:01:30 POOH nscd[320]: 320 monitoring directory `/etc` (2)
Jan 06 23:01:32 POOH nscd[320]: 320 checking for monitored file `/etc/netgroup': No such file or directory

Note that I have resolved setup my resolv.conf file, and nscd.conf gets started before resolved does. That's what I get the about resolv.conf nor existing originally

Does /usr/lib/tmpfiles.d/nscd.conf exist? It should create the /run/nscd folder if it doesn't already exist (does /run/nscd exist?)

comment:8 by Pierre Labastie, 4 years ago

Thanks for answering, and as I had half anticipated, the issue is mine: / is not owned by root so I get, for example:

pierre [ ~ ]$ sudo systemd-tmpfiles --create /usr/lib/tmpfiles.d/nscd.conf
Detected unsafe path transition / → /run during canonicalization of /run.
pierre [ ~ ]$ echo $?
73

The explanation can be found here

Now, I have to investigate jhalfs to see why $BUILD_DIR is owned by user lfs (may be a very nasty bug!).

in reply to:  8 comment:9 by Pierre Labastie, 4 years ago

Now, I have to investigate jhalfs to see why $BUILD_DIR is owned by user lfs (may be a very nasty bug!).

Actually, until jhalfs revision 4037, the user needed write access to BUILDDIR. And it was not chown'ed to root at the end of the build. But since that commit, BUILDDIR can be owned by root all along. Problem is, I have kept the partitions I use for building unchanged...

So all my fault and sorry for the noise.

comment:10 by Douglas R. Reno, 4 years ago

I'm glad you got it figured out! :)

comment:11 by Douglas R. Reno, 4 years ago

Milestone: 9.1hold
Priority: normallowest

These are more "nice to haves" at this point, so move it to hold since I'll be busy a couple of days next week. I'll take a look at this again after 9.1.

comment:12 by Douglas R. Reno, 3 years ago

Resolution: fixed
Status: assignedclosed
Note: See TracTickets for help on using tickets.