Opened 3 years ago

Last modified 2 years ago

#1542 closed defect

update-smart-drivedb doesn't kill it's gpg-agent and throws errors on systems with root on NFS — at Version 1

Reported by: rwofyiyj.awdawdq Owned by:
Priority: minor Milestone: Release 7.3
Component: all Version: 7.2
Keywords: Cc:

Description (last modified by Christian Franke)

I use smartd daemon on machines with root filesystem.

update-smart-drivedb doesn't kill it's gpg-agent process and tries to remove it's home dir (line 494).
On NFS it doesn't work. Directory cannot be removed because nfs preserves delete open sockets/files. (script would have to rm -rf the directory twice)

This error causes stderr message which creates additional mail (false positive) when cron is configured to send mail.

This small patch kills the gpg-agent and allows for error free $gnupgtmp deletion.

diff -c backup /usr/sbin/update-smart-drivedb
*** backup	2021-11-04 14:29:14.665707108 +0100
--- /usr/sbin/update-smart-drivedb	2021-11-04 14:31:08.927219722 +0100
***************
*** 491,496 ****
--- 491,497 ----
      echo "$out" >&2
    fi
  
+   kill $(ps ax | awk '$5=="gpg-agent" && /smartmontools/{print $2}')
    rm -f -r "$gnupgtmp"
    return $r

Reproducible: Always

Steps to Reproduce:

  1. run /etc/cron.monthly/smartmontools-update-drivedb on machine with root on NFS

Actual Results:

LC_ALL=C /etc/cron.monthly/smartmontools-update-drivedb
rm: cannot remove '/var/db/smartmontools/.gnupg.139163.tmp': Directory not empty

Script executes normal but has problem deleting it's gpg directory.

Expected Results:
There should be no stderr output when scripts executes normally.

Script doesn't delete it's temporary directory.

Change History (1)

comment:1 by Christian Franke, 3 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.