Menu

#127 logwatch cron uses erroneous path in newer EL versions.

v7.14
open
nobody
None
5
2026-07-02
2026-04-23
Reio Remma
No

0logwatch cron script seems to point to /usr/sbin/logwatch however in newer EL versions sbindir in RPM spec files points to /usr/bin and logwatch executable is installed there.

This has resulted in a broken daily script on AlmaLinux 9.7

/etc/cron.daily/0logwatch:
LOGWATCH_SCRIPT="/usr/sbin/logwatch"

Actual path:
/usr/bin/logwatch

Related

Bugs: #127

Discussion

  • Reio Remma

    Reio Remma - 2026-04-23

    So maybe sed the path in 0logwatch replacing the path with sbindir variable during build.

    Just manually ran sed to get things working again:

    sed -i 's/LOGWATCH_SCRIPT="\/usr\/sbin\/logwatch"/LOGWATCH_SCRIPT="\/usr\/bin\/logwatch"/' /etc/cron.daily/0logwatch

     
    • Mike Tremaine

      Mike Tremaine - 2026-04-23

      If RHEL 9.x+ and children have changed the path of the logwatch script in the rpm spec (which is normally a symlink in any case) from sbin to bin, then whatever solution also needs handle all instances of the path….

      A simple grep shows we have 4 files which have the hardcoded /usr/sbin/logwatch

      README:ln -s /usr/share/logwatch/scripts/logwatch.pl /usr/sbin/logwatch
      install_logwatch.sh:ln -f -s $BASEDIR/scripts/logwatch.pl /usr/sbin/logwatch
      install_logwatch.sh:printf "Created symlink for /usr/sbin/logwatch \n"
      scheduler/logwatch.service:ExecStart=/usr/sbin/logwatch $LOGWATCH_OPTIONS
      scheduler/logwatch.cron:LOGWATCH_SCRIPT="/usr/sbin/logwatch”

      -Mike

      On Apr 23, 2026, at 12:33 AM, Reio Remma whataboutpereir@users.sourceforge.net wrote:

      So maybe sed the path in 0logwatch replacing the path with sbindir variable during build.

      Just manually ran sed to get things working again:

      sed -i 's/LOGWATCH_SCRIPT="\/usr\/sbin\/logwatch"/LOGWATCH_SCRIPT="\/usr\/bin\/logwatch"/' /etc/cron.daily/0logwatch

      [bugs:#127] https://sourceforge.net/p/logwatch/bugs/127/ logwatch cron uses erroneous path in newer EL versions.

      Status: open
      Group: v7.14
      Created: Thu Apr 23, 2026 07:19 AM UTC by Reio Remma
      Last Updated: Thu Apr 23, 2026 07:19 AM UTC
      Owner: nobody

      0logwatch cron script seems to point to /usr/sbin/logwatch however in newer EL versions sbindir in RPM spec files points to /usr/bin and logwatch executable is installed there.

      This has resulted in a broken daily script on AlmaLinux 9.7

      /etc/cron.daily/0logwatch:
      LOGWATCH_SCRIPT="/usr/sbin/logwatch"

      Actual path:
      /usr/bin/logwatch

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/logwatch/bugs/127/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #127

  • Scott D-S

    Scott D-S - 2026-05-28

    I believe this is related/similar so replying here vs. creating a new bug.

    First install of v7.14 on a (new) RockyLinux 9.7 VM yesterday and received this error overnight:
    /etc/cron.daily/0logwatch: line 14: /usr/sbin/logwatch: No such file or directory

    Confirmed the file was missing:

    ls -lrt /usr/sbin/logwatch
    ls: cannot access '/usr/sbin/logwatch': No such file or directory
    

    On other RL8/RL9 installs using prior versions (both v7.9 and v7.13), this appears to be a link:

    ls -lrt /usr/sbin/logwatch
    lrwxrwxrwx. 1 root root 39 Jul 21  2025 /usr/sbin/logwatch -> /usr/share/logwatch/scripts/logwatch.pl
    

    Confirmed the file still exists where expected:

    ls -lrt /usr/share/logwatch/scripts/logwatch.pl
    -rwxr-xr-x. 1 root root 63666 Jan 21 18:00 /usr/share/logwatch/scripts/logwatch.pl
    

    So I created the link:

    ln -s /usr/share/logwatch/scripts/logwatch.pl /usr/sbin/logwatch
    ls -lrt /usr/sbin/logwatch
    lrwxrwxrwx. 1 root root 39 May 28 08:49 /usr/sbin/logwatch -> /usr/share/logwatch/scripts/logwatch.pl
    

    Waiting to see what happens overnight tonight...

     
  • Bjorn

    Bjorn - 2026-05-31

    There appears to be a push among some distributions/packages to move to /usr/bin, and eventually remove /usr/sbin.

    So my inclination would be to change all references and installation of logwatch to /usr/bin. In both the logwatch.spec and install_logwatch.sh file, we can test if the /usr/sbin directory exists. If so, then add a symbolic link from /usr/sbin/logwatch to /usr/bin/logwatch, for those that have hard-coded the path in their own scripts.

    That's not the end of the story, however. Some of the service scripts look for hard-coded paths that may include /usr/sbin, /sbin, and /usr/local/sbin (for other, non-logwatch executables). If those executable paths change (which can be distribution-specific), then we might need to make further changes.

     
  • Bjorn

    Bjorn - 2026-07-02

    Pushed change to /usr/bin rather than /usr/sbin as executable for logwatch (which is a symbolic link to the /usr/share/logwatch/scripts/logwatch.pl script).
    Does not delete any links under /usr/sbin/logwatch. For existing systems, the old link continues to work. For new installations, only the new /usr/bin/logwatch link will work.
    Also deleted the requirement for crontabs package, as newer installations may use alternate scheduling tools (most notably systemd timers).

     

Log in to post a comment.