Error when removing Sendmail packages in Solaris 11.2

Hi,

I would like to completely remove the Sendmail packages from Solaris 11.2. I know how to disable Sendmail but as stated, I would like the packages to be removed from the system. I tried to remove the two packages (SUNWsndmu and SUNWsndmr) by using pkgrm. It doesn't work that well because I get:

root@solaris:~# pkgrm SUNWsndmu

The following package is currently installed:
   SUNWsndmu  Sendmail (/usr)
              (i386) 11.11,REV=2009.11.11

Do you want to remove this package? [y,n,?,q] y
pkgrm: ERROR: unable to change current working directory to </var/sadm/pkg/SUNWsndmu/install>

Removal of <SUNWsndmu> failed (internal error).
No changes were made to the system.

The same goes for the other package SUNWsndmr. I looked in the file system:

root@solaris:~# ls -l /var/sadm/pkg/SUNWsndmu/install
/var/sadm/pkg/SUNWsndmu/install: No such file or directory

I have tried the above on two fresh Solaris 11.2 installs (on different hardware) and in a virtual machine. All the same. I have used the Solaris 11.2 x86 text installer ISO (md5sum: c09f40ed91d43b0adf109c124154a2b4 sol-11_2-text-x86.iso).

Can someone please help me out with removing the Sendmail packages?

Background info on why I would like to uninstall Sendmail:
I am going to run the Solaris box as a file server (will use ZFS with it's included encryption) and I would like to get email notifications from scripts, cron jobs etc. On Linux I have been using sSMTP (a simple MTA) for many years. It is very light weight and simple and I only need to _send_ emails (using e.g. gmail servers as relay) so sSMTP is enough for me. I have managed to compile sSMTP for Solaris and it works fine when called manually from scripts etc. but I would like it to also send system emails e.g. from cron jobs. But when e.g. a cron job tries to send an email it will start Sendmail although I have disabled sendmail through:

root@solaris:~# svcadm disable svc:/network/sendmail-client:default
root@solaris:~# svcadm disable svc:/network/smtp:sendmail
root@solaris:~# svcs -a | grep -i send
disabled       20:36:34 svc:/network/smtp:sendmail
disabled       20:36:37 svc:/network/sendmail-client:default
root@solaris:~# ps aux | grep -i send
root      2292  0.0  0.1 8612 3044 pts/1    S 21:57:05  0:00 grep -i send

The above looks fine BUT when the cron job tries to send the email it starts Sendmail (instead of sSMTP):

root@solaris:~# ps aux | grep send
mike      2282  0.0  0.1 5096 2536 ?        S 21:56:00  0:00 /usr/lib/sendmail
root      2286  0.0  0.1 8612 3044 pts/1    S 21:56:08  0:00 grep send

I do not receive any email (to my external address e.g. someone@gmail.com) since I have not configured Sendmail. sSMTP (that is configured) does not seem to be run for system emails (e.g. cron job emails).

I have changed the symbolic link /usr/sbin/sendmail so:

root@solaris:~# ls -l /usr/sbin/sendmail
lrwxrwxrwx   1 root     root           5 Mar 25 00:20 /usr/sbin/sendmail -> ssmtp
root@solhp:~# which ssmtp
/usr/sbin/ssmtp

Still /usr/lib/sendmail is started.

So that is the reson I would like to completely remove Sendmail from the system.

If anyone has a solution to my problem (with or without removing Sendmail from the system) feel free to tell me. The only thing I want is to let sSMTP handle the sending of system emails, e.g. notifications, cron job email etc.

Thank you very much in advance!

BR,
tubiman

The main issue is you are running a legacy SVR4 packaging command which is only supported to handle legacy packages which sendmail is not.

The supported way to remove a Solaris package under Solaris 11 and newer is:

pkg uninstall <package> ...

In that particular case, you would also need to remove the smtp-notify package which depends on sendmail.

You can run this command to see if no other dependency is present on you machine:

# pkg uninstall -n sendmail smtp-notify

Note that the -n tell pkg not to actually remove any package (trial run)

If you are fine with removing sendmail, simply run the command without the -n option.

# pkg uninstall sendmail smtp-notify
1 Like

jlliagre, you solved my problem! :b:

Thank you very much!

./t