HEllo,

Thank you Robert and Ralph for your quick answers.

Le 2024-03-27 à 14:39, Ralph Corderoy a écrit :
Hello Thomas,

kre has given a good answer and I'd do what he suggested, but...

This issue comes from the fact that I wanted to use the
unattended-upgrades package on Debian which uses mailx to send
reports.  Since only nmh is detected as providing a compatible mailx
program, mailx redirects to /usr/bin/mh/mhmail.

Are you saying that Debian puts in the symlink from /usr/bin/mhmail to
/usr/bin/mh/mhmail when selecting nmh as one of the alternative packages
to provide a virtual package which unattended-upgrades depends upon?

Yes. To be extra clear, /usr/bin/mailx is a symlink to /etc/alternatives/mailx which itself is a symlink to /usr/bin/mh/mhmail.

That sounds flawed for the reason you gave.  Does Debian have a central
place to manipulate PATH to append /usr/bin/mh for unattended-upgrades?

unattended-upgrade(8) is configured via /etc/apt/apt.conf.d/50unattended-upgrades. In this file it is noted that to send email reports, mailx is used:

// Send email to this address for problems or packages upgrades
// If empty or unset then no email is sent, make sure that you
// have a working mail setup on your system. A package that provides
// 'mailx' must be installed. E.g. "u...@example.com"
Unattended-Upgrade::Mail "root";

I discovered the mailx issue while trying to use mailx with my user account which does have /usr/bin/mh in its PATH.

apt-file(1) here suggests there's
a /lib/systemd/system/unattended-upgrades.service so perhaps a local
file to override its PATH?

For the reason given above I don't think this would solve it. I think these results might be even more explicit:

$ echo $PATH
/usr/bin/mh:/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games:/snap/bin
$ cp /usr/bin/mh/mhmail ./test
$ ./test
./test: 1: /home/thomas/mhparam: not found
./test: 95: exec: /home/thomas/inc: not found

Which version of Debian is this?  ‘lsb_release -a’ shows this.

$ uname -a; lsb_release -a
Linux nuage 6.1.0-18-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.76-1 (2024-02-01) x86_64 GNU/Linux
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux 12 (bookworm)
Release:        12
Codename:       bookworm

Thank you for your help,

--
Thomas

Reply via email to