我尝试重新安装 Postfix,但出现以下错误:
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)
我尝试了 aptitude purge、remove、autoclean 和所有 dpkg 选项(configure、remove、purge),但都无济于事。/etc/mailname 存在(0644 root:root),内容为 ***.net(从 中获取hostname
)。我做错了什么?
答案1
可以尝试以下操作:
- 是不是你
/etc/mailname
在其他进程中打开了?用 检查一下lsof | grep mailname
。 - 如果我没记错的话,我曾经遇到过类似的错误,这是由于文件系统损坏造成的,所以也许
fsck
在你的系统上运行了一个。
答案2
您可以尝试将机器名称放入 /etc/mailname 中吗?类似 machinename.local 的内容应该足够了(只要它能解析)。如果需要,请将其添加到 /etc/hosts。
答案3
这让我想起了不久前 postgreSQL 的一个 aptitude 错误。如果您认为一切都应该正常,请尝试使用备用包管理器。也许是包管理器的问题。这解决了我不久前使用 postgreSQL 时遇到的问题。
答案4
dpkg 能否检查所有文件是否存在错误权限、所有者/组、selinux 上下文等?如果可以 - 检查...