Reinstall Postfix

7,367

Some things to try:

  • Can it be that you have /etc/mailname open in some other process? Check with lsof | grep mailname.
  • If I remember correctly, I once had a similar error which was the result of a broken file system, so maybe run an fsck on your system.
Share:
7,367

Related videos on Youtube

J.vik
Author by

J.vik

Updated on September 18, 2022

Comments

  • J.vik
    J.vik almost 2 years

    I tried to reinstall Postfix, but I get this bunch of errors:

    root@***:/etc/init.d# sudo apt-get install -f postfix
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    Suggested packages:
      procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre resolvconf
      postfix-cdb mail-reader
    The following NEW packages will be installed:
      postfix
    0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
    Need to get 0B/1,389kB of archives.
    After this operation, 3,531kB of additional disk space will be used.
    Preconfiguring packages ...
    Selecting previously deselected package postfix.
    (Reading database ... 56122 files and directories currently installed.)
    Unpacking postfix (from .../postfix_2.7.1-1ubuntu0.1_amd64.deb) ...
    Processing triggers for ureadahead ...
    Processing triggers for ufw ...
    Processing triggers for man-db ...
    Setting up postfix (2.7.1-1ubuntu0.1) ...
    
    Configuration file `/etc/init.d/postfix'
     ==> File on system created by you or by a script.
     ==> File also in package provided by package maintainer.
       What would you like to do about it ?  Your options are:
        Y or I  : install the package maintainer's version
        N or O  : keep your currently-installed version
          D     : show the differences between the versions
          Z     : start a shell to examine the situation
     The default action is to keep your current version.
    *** postfix (Y/I/N/O/D/Z) [default=N] ? Y
    Installing new version of config file /etc/init.d/postfix ...
    Adding group `postfix' (GID 109) ...
    Done.
    Adding system user `postfix' (UID 106) ...
    Adding new user `postfix' (UID 106) with group `postfix' ...
    Not creating home directory `/var/spool/postfix'.
    Creating /etc/postfix/dynamicmaps.cf
    Adding tcp map entry to /etc/postfix/dynamicmaps.cf
    Adding group `postdrop' (GID 115) ...
    Done.
    setting myhostname: ***.net
    setting alias maps
    setting alias database
    setting myorigin
    setting destinations: ***.net, localhost.***.net, , localhost
    setting relayhost:
    setting mynetworks: 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
    setting mailbox_size_limit: 0
    setting recipient_delimiter: +
    setting inet_interfaces: all
    
    Postfix is now set up with a default configuration.  If you need to make
    changes, edit
    /etc/postfix/main.cf (and others) as needed.  To view Postfix configuration
    values, see postconf(1).
    
    After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.
    
    Running newaliases
    postalias: fatal: /etc/mailname: cannot open file: Permission denied
    dpkg: error processing postfix (--configure):
     subprocess installed post-installation script returned error exit status 1
    Processing triggers for libc-bin ...
    ldconfig deferred processing now taking place
    Errors were encountered while processing:
     postfix
    E: Sub-process /usr/bin/dpkg returned an error code (1)
    

    I tried aptitude purge, remove, autoclean and all of dpkg options (configure, remove, purge) but nothing did the trick. /etc/mailname exists (0644 root:root) with as content ***.net (fetched from hostname). What am I doing wrong?

    • Kyle Smith
      Kyle Smith about 13 years
      I just got curious enough to break apart the deb package, but it all looks ok. The problem is inside the run of 'newaliases', which is a symlink to postfix's sendmail. You might try running the dpkg -i (simpler than apt-get) on the .deb with strace and capture the open() system calls to see if the kernel is really denying permission to that file. wget http://us.archive.ubuntu.com/ubuntu/pool/main/p/postfix/post‌​fix_2.7.1-1ubuntu0.1‌​_amd64.deb; strace -etrace=open -omydebugfile dpkg -i postfix_2.7.1-1ubuntu0.1_amd64.deb
    • BJladu4
      BJladu4 about 13 years
      Got SELinux or something of the kind (AppArmor)?
    • J.vik
      J.vik about 13 years
      Yeah, both. SELinux and AppArmor.
  • J.vik
    J.vik about 13 years
    Still get that permission denied error for /etc/mailname when I try that.
  • vsltd
    vsltd about 13 years
    you say that your /etc/mailname is 0644 and owned by root? Could you try changing the perms to 777 to see if this works? If it does then we can try a few more things. If not then at least it's been eliminated :)
  • J.vik
    J.vik about 13 years
    No :(, that also doesn't work. Thanks you want to help me :). What can I try now?
  • J.vik
    J.vik about 13 years
    Thanks, but all package-managers are giving the same error (dpkg, aptitude, apt-get).
  • J.vik
    J.vik about 13 years
    Nope, doesn't work :(.
  • Lucas Kauffman
    Lucas Kauffman almost 12 years
    I'd say add an exception to them instead of disabling them :)