升级至 21.04 后,APT 更新在配置 postfix 时遇到错误

升级至 21.04 后,APT 更新在配置 postfix 时遇到错误

我已经从 Ubuntu 20.10 升级到 21.04,现在运行时:

sudo apt update
sudo apt-get upgrade

我收到以下与 PostFix 相关的错误。

我怎么解决这个问题?

Hit:1 http://archive.ubuntu.com/ubuntu hirsute InRelease
Hit:2 http://archive.ubuntu.com/ubuntu hirsute-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu hirsute-backports InRelease
Hit:4 http://archive.ubuntu.com/ubuntu hirsute-security InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
  gcc-10-base:i386 gnome-shell-extension-desktop-icons libaom0:i386 libaribb24-0:i386 libasync-mergepoint-perl libavcodec-extra58:i386 libavutil56:i386
  libboost-date-time1.71.0 libboost-filesystem1.71.0 libboost-iostreams1.71.0 libboost-locale1.71.0 libboost-python1.71.0 libbrlapi0.7 libcodec2-0.9:i386
  libdav1d4:i386 libfuture-perl libgdk-pixbuf-xlib-2.0-0:i386 libgdk-pixbuf2.0-0:i386 libgomp1:i386 libio-async-loop-epoll-perl libio-async-perl libisl22 libjs-sizzle
  libjuh-java libjurt-java liblibreoffice-java liblinux-epoll-perl libmetrics-any-perl libmp3lame0:i386 libmysqlclient21 libmysqlclient21:i386 libnuma1:i386
  libopencore-amrnb0:i386 libopencore-amrwb0:i386 liborcus-0.15-0 liborcus-parser-0.15-0 libperl5.30 libperl5.30:i386 libpgm-5.2-0 libpodofo0.9.6 libpoppler102
  libpoppler102:i386 libpython3.8-dev libraw19 libre2-8 libreadline5 libridl-java libsereal-perl libshine3:i386 libsnappy1v5:i386 libsnmp35 libsnmp35:i386
  libsoxr0:i386 libspeex1:i386 libstd-rust-1.47 libstruct-dumb-perl libswresample3:i386 libtest-fatal-perl libtest-metrics-any-perl libtest-refcount-perl
  libtwolame0:i386 libunoloader-java libvdpau1:i386 libvo-amrwbenc0:i386 libvpx6:i386 libwavpack1:i386 libwebpmux3:i386 libx264-160:i386 libx265-192:i386
  libxml-writer-perl libxvidcore4:i386 libzvbi0:i386 linux-headers-5.8.0-49 linux-headers-5.8.0-49-generic linux-image-5.8.0-49-generic linux-modules-5.8.0-49-generic
  linux-modules-extra-5.8.0-49-generic mesa-vdpau-drivers:i386 mysql-common node-ansi-align node-arrify node-bl node-bluebird node-boxen node-builtin-modules
  node-call-limit node-camelcase node-ci-info node-cli-boxes node-cliui node-co node-concat-stream node-config-chain node-configstore node-cross-spawn
  node-crypto-random-string node-cyclist node-debbundle-es-to-primitive node-decamelize node-decompress-response node-deep-extend node-define-properties
  node-detect-indent node-detect-newline node-dot-prop node-duplexer3 node-duplexify node-editor node-end-of-stream node-errno node-es-abstract node-es6-promise
  node-execa node-find-up node-flush-write-stream node-from2 node-fs-vacuum node-genfun node-get-caller-file node-get-stream node-got node-has-symbol-support-x
  node-has-to-string-tag-x node-import-lazy node-invert-kv node-is-buffer node-is-npm node-is-obj node-is-object node-is-path-inside node-is-plain-obj
  node-is-retry-allowed node-is-stream node-isurl node-jquery node-json-buffer node-kind-of node-latest-version node-lazy-property node-lcid node-libnpx
  node-locate-path node-lodash node-lodash-packages node-lowercase-keys node-make-dir node-mem node-merge-stream node-mimic-fn node-mimic-response node-minimist
  node-mississippi node-npm-run-path node-object-inspect node-os-locale node-os-tmpdir node-p-cancelable node-p-finally node-p-is-promise node-p-limit node-p-locate
  node-p-timeout node-package-json node-parallel-transform node-path-exists node-path-is-inside node-pify node-prepend-http node-proto-list node-prr node-pseudomap
  node-pump node-pumpify node-qw node-rc node-registry-auth-token node-registry-url node-require-directory node-require-main-filename node-semver-diff node-sha
  node-shebang-command node-shebang-regex node-slide node-sorted-object node-stream-each node-stream-iterate node-stream-shift node-strict-uri-encode node-strip-eof
  node-strip-json-comments node-term-size node-through2 node-timed-out node-typedarray node-uid-number node-unique-string node-unpipe node-url-parse-lax
  node-url-to-options node-which-module node-widest-line node-wrap-ansi node-xdg-basedir node-xtend node-y18n node-yargs node-yargs-parser ocl-icd-libopencl1:i386
  perl-modules-5.30 python3.8 python3.8-dev python3.8-minimal python3.8-venv shim ure-java vdpau-driver-all:i386
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up postfix (3.5.6-1) ...

Postfix (main.cf) configuration was not changed.  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 'systemctl reload postfix'.

Running newaliases
newaliases: warning: valid_hostname: misplaced delimiter: kubernetes-worker..
newaliases: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: kubernetes-worker..
dpkg: error processing package postfix (--configure):
 installed postfix package post-installation script subprocess returned error exit status 75
Processing triggers for libc-bin (2.33-0ubuntu5) ...
Errors were encountered while processing:
 postfix
E: Sub-process /usr/bin/dpkg returned an error code (1)

答案1

Postfix 主配置文件包含无效条目。

您可以编辑它并修复错误的条目,或者您可以备份它并创建一个空的配置文件,如下所示:

sudo mv /etc/postfix/main.cf /etc/postfix/main.cf.old

然后运行:

sudo touch /etc/postfix/main.cf

然后运行:

sudo postfix reload

请参见这个答案有关如何配置 postfix 的更多信息。

答案2

我在 Ubuntu 21.04 上遇到了同样的问题。Postfix 无法正确安装,在 20.04 上从未出现过此问题:

newaliases: warning: valid_hostname: misplaced delimiter: RebuildAppV1
...
dpkg: error processing package postfix (--configure):
installed postfix package post-installation script subprocess returned error exit status 75
Processing triggers for libc-bin (2.33-0ubuntu5) ...
Errors were encountered while processing:
 postfix
E: Sub-process /usr/bin/dpkg returned an error code (1)

事实证明 Postfix 安装不能很好地处理你的系统主机名设置为域字符串以外的任何内容,例如 xxx.com

尽管我还没有该服务器的域名,但我所要做的就是将主机名更改为“whatever.com”(卸载并清除 Postfix 后):

sudo hostnamectl set-hostname whatever.com 

然后,检查它是否已经改变:

hostname -f

然后重新安装 Postfix。

相关内容