1

Having a trouble trying to install logwatch on Ubuntu 22.04 LTS. Here is the output when trying to install:

# apt install logwatch
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
logwatch is already the newest version (7.5.6-1ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up postfix (3.6.4-1ubuntu1.1) ...
postconf: warning: open /etc/postfix/master.cf: No such file or directory
postconf: warning: open /etc/postfix/master.cf: No such file or directory
postconf: warning: open /etc/postfix/master.cf: No such file or directory
usermod: user 'postfix' does not exist in /etc/passwd
dpkg: error processing package postfix (--configure):
 installed postfix package post-installation script subprocess returned error exit status 6
dpkg: dependency problems prevent configuration of logwatch:
 logwatch depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package logwatch (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: postfix logwatch needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)

I tried install the dependencies for and I am getting error for postfix as well.

# apt install postfix
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
postfix is already the newest version (3.6.4-1ubuntu1.1).
postfix set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up postfix (3.6.4-1ubuntu1.1) ...
postconf: warning: open /etc/postfix/master.cf: No such file or directory
postconf: warning: open /etc/postfix/master.cf: No such file or directory
postconf: warning: open /etc/postfix/master.cf: No such file or directory
usermod: user 'postfix' does not exist in /etc/passwd
dpkg: error processing package postfix (--configure):
 installed postfix package post-installation script subprocess returned error exit status 6
dpkg: dependency problems prevent configuration of logwatch:
 logwatch depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package logwatch (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: postfix logwatch needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)

Even when I try to install default-mta, I get the same error. Googling the web and trying many different suggestions have not worked either. As a last resort I decided to open create this question here.

# apt install default-mta
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'postfix' instead of 'default-mta'
postfix is already the newest version (3.6.4-1ubuntu1.1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n]
Setting up postfix (3.6.4-1ubuntu1.1) ...
postconf: warning: open /etc/postfix/master.cf: No such file or directory
postconf: warning: open /etc/postfix/master.cf: No such file or directory
postconf: warning: open /etc/postfix/master.cf: No such file or directory
usermod: user 'postfix' does not exist in /etc/passwd
dpkg: error processing package postfix (--configure):
 installed postfix package post-installation script subprocess returned error exit status 6
dpkg: dependency problems prevent configuration of logwatch:
 logwatch depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package logwatch (--configure): dependency problems - leaving unconfigured No apport report written because the error message indicates its a followup error from a previous failure. Errors were encountered while processing: postfix logwatch needrestart is being skipped since dpkg has failed E: Sub-process /usr/bin/dpkg returned an error code (1)

EDIT1: I tried as suggested below the commands:

# dpkg --configure -a
dpkg: dependency problems prevent configuration of logwatch:
 logwatch depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package logwatch (--configure): dependency problems - leaving unconfigured Errors were encountered while processing: logwatch

# apt autoremove
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postfix (3.6.4-1ubuntu1.1) ...
usermod: user 'postfix' does not exist in /etc/passwd
dpkg: error processing package postfix (--configure):
 installed postfix package post-installation script subprocess returned error exit status 6
dpkg: dependency problems prevent configuration of logwatch:
 logwatch depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package logwatch (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 postfix
 logwatch
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)
# apt install -f
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up postfix (3.6.4-1ubuntu1.1) ...
usermod: user 'postfix' does not exist in /etc/passwd
dpkg: error processing package postfix (--configure):
 installed postfix package post-installation script subprocess returned error exit status 6
dpkg: dependency problems prevent configuration of logwatch:
 logwatch depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package logwatch (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Errors were encountered while processing:
 postfix
 logwatch
needrestart is being skipped since dpkg has failed
E: Sub-process /usr/bin/dpkg returned an error code (1)

EDIT2: Here is the output of dpkg-reconfigure -a command:

# dpkg-reconfigure -a
Unknown option: a
Usage: dpkg-reconfigure [options] packages
  -u,  --unseen-only        Show only not yet seen questions.
       --default-priority   Use default priority instead of low.
       --force          Force reconfiguration of broken packages.
       --no-reload      Do not reload templates. (Use with caution.)
  -f,  --frontend       Specify debconf frontend to use.
  -p,  --priority       Specify minimum priority question to show.
       --terse          Enable terse mode.
Moasson
  • 21
  • 3

1 Answers1

1

OK, so the issue was not with apt or the packages themselves. Because on this system, I am using LDAP authentication with SSSD and the postfix was already a user in LDAP (doing id postfix returns a result), the postfix package was unable to create the postfix user and was throwing an error.

What I did to fix it is as follows in case someone else sees this:

  • Stop your SSSD: systemctl stop sssd.service
  • Remove the broken install: dpkg -r postfix & dpkg -r logwatch
  • Reinstall the postfix: apt install postfix & apt install logwatch

That's it!

Moasson
  • 21
  • 3