APT update encounters an error configuring postfix after upgrade to 21.04
I have upgraded from Ubuntu 20.10 to 21.04 and now when I run:
sudo apt update
sudo apt-get upgrade
I get this error below related to PostFix.
How can I solve this problem?
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)
Solution 1:
The postfix main configuration file contains invalid entries.
You can edit it and fix wrong entries or you can back it up and create an empty configuration file like so:
sudo mv /etc/postfix/main.cf /etc/postfix/main.cf.old
Then run:
sudo touch /etc/postfix/main.cf
Then run:
sudo postfix reload
Please see this answer for more information on how to configure postfix.