Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
2  
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/postfix_2.7.1-1ubuntu0.1‌​_amd64.deb; strace -etrace=open -omydebugfile dpkg -i postfix_2.7.1-1ubuntu0.1_amd64.deb –  Kyle Smith Apr 22 '11 at 11:33
    
Got SELinux or something of the kind (AppArmor)? –  ℝaphink Apr 22 '11 at 12:25
    
Yeah, both. SELinux and AppArmor. –  Kevin Apr 22 '11 at 12:36

7 Answers 7

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|improve this answer
    
Nope, doesn't work :(. –  Kevin Apr 22 '11 at 12:35

Can you try putting your machine name in /etc/mailname? Something like machinename.local should suffice(as long as it resolves). Add it to /etc/hosts if needs be.

share|improve this answer
    
Still get that permission denied error for /etc/mailname when I try that. –  Kevin Apr 22 '11 at 10:03
    
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 :) –  vsltd Apr 22 '11 at 10:15
    
No :(, that also doesn't work. Thanks you want to help me :). What can I try now? –  Kevin Apr 22 '11 at 10:40

This reminds me of an aptitude bug with postgreSQL a while ago. If you think, everything should work, try the alternate package manager. Maybe it's a package-manager problem. This solved my problem with postgreSQL a while ago.

share|improve this answer
    
Thanks, but all package-managers are giving the same error (dpkg, aptitude, apt-get). –  Kevin Apr 22 '11 at 10:46

Disable SELinux and Apparmor and try again.

share|improve this answer
    
I'd say add an exception to them instead of disabling them :) –  Lucas Kauffman Jul 22 '12 at 19:19

Have you tried kyle's suggestion as to run it with strace?? have you tried renaming the file and installing postfix again??

share|improve this answer

Is dpkg able to check all files for wrong permissions, owner/groups, selinux contexts et cetera? If yes - check...

share|improve this answer

Are you sure that /etc/mailname is a file ? Not a link or something else ? You can maybe remove it because Postfix installer recreate it. You run the install process as root ? In my case,

-rw-r--r-- 1 root root 14 01-07-2011 22:13:47 /etc/mailname

You could remove sudo to test...

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.