Apt install postfix fails with bad demiliter

Bug #1931801 reported by Mark Petersen
This bug report is a duplicate of:  Bug #1906970: [SRU] dpkg hook hostname error. Edit Remove
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
postfix (Ubuntu)
Incomplete
Undecided
Unassigned

Bug Description

# Trying to install postfix keeps on adding a delimiter (two dots at end of hostname) making newaliases and then the postfix installation fail
# i have tried fixing it a lot of times by changing hostname and info in the hosts file

# And also changing the myhostname in /etc/postfix/main.cf and running apt install --fix-broken
# But it just changes myhostname to rpi4-ubuntudesktop.. (Note the two dots at the end)

# It just continuously fail's to install
# I believe i need help to fix this or quite possible a bug

# here are my steps and info

sudo apt install postfix
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
postfix is already the newest version (3.5.6-1).
0 upgraded, 0 newly installed, 0 to remove and 1 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) ...

# ->

# Here is the info in the interactive part

choose internet

choose mail name -> rpi4-ubuntudesktop

# -<

sudo apt install postfix
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Suggested packages:
  procmail postfix-mysql postfix-pgsql postfix-ldap postfix-pcre postfix-lmdb postfix-sqlite sasl2-bin
  | dovecot-common postfix-cdb postfix-doc
The following packages will be REMOVED:
  lsb-invalid-mta
The following NEW packages will be installed:
  postfix
0 upgraded, 1 newly installed, 1 to remove and 1 not upgraded.
Need to get 0 B/1,200 kB of archives.
After this operation, 4,233 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
dpkg: lsb-invalid-mta: dependency problems, but removing anyway as you requested:
 lsb-core depends on lsb-invalid-mta (>= 11.1.0ubuntu2) | mail-transport-agent; however:
  Package lsb-invalid-mta is to be removed.
  Package mail-transport-agent is not installed.
  Package lsb-invalid-mta which provides mail-transport-agent is to be removed.
 lsb-core depends on lsb-invalid-mta (>= 11.1.0ubuntu2) | mail-transport-agent; however:
  Package lsb-invalid-mta is to be removed.
  Package mail-transport-agent is not installed.
  Package lsb-invalid-mta which provides mail-transport-agent is to be removed.

(Reading database ... 162385 files and directories currently installed.)
Removing lsb-invalid-mta (11.1.0ubuntu2) ...
Selecting previously unselected package postfix.
(Reading database ... 162379 files and directories currently installed.)
Preparing to unpack .../postfix_3.5.6-1_arm64.deb ...
Unpacking postfix (3.5.6-1) ...
Setting up postfix (3.5.6-1) ...
Adding group `postfix' (GID 135) ...
Done.
Adding system user `postfix' (UID 128) ...
Adding new user `postfix' (UID 128) with group `postfix' ...
Not creating home directory `/var/spool/postfix'.
Creating /etc/postfix/dynamicmaps.cf
Adding group `postdrop' (GID 136) ...
Done.
setting myhostname: rpi4-ubuntudesktop..
setting alias maps
setting alias database
mailname is not a fully qualified domain name. Not changing /etc/mailname.
setting destinations: $myhostname, rpi4-ubuntudesktop, localhost.localdomain, , 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
setting inet_protocols: all

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

Running newaliases
newaliases: warning: valid_hostname: misplaced delimiter: rpi4-ubuntudesktop..
newaliases: fatal: file /etc/postfix/main.cf: parameter myhostname: bad parameter value: rpi4-ubuntudesktop..
dpkg: error processing package postfix (--configure):
 installed postfix package post-installation script subprocess returned error exit status 75
Processing triggers for ufw (0.36-7.1) ...
Rules updated for profile 'Samba'
Skipped reloading firewall
Processing triggers for man-db (2.9.4-2) ...
Processing triggers for rsyslog (8.2102.0-2ubuntu1) ...
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)

----

nano /etc/hostname

rpi4ubuntudesktop

----

nano /etc/hosts

127.0.0.1 localhost

127.0.1.1 rpi4-ubuntudesktop

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters

Revision history for this message
Mark Petersen (rambus666) wrote :

i of couse made a typo

The steps in taking is valid from

# ->

# Here is the info in the interactive part

choose internet

choose mail name -> rpi4-ubuntudesktop

# -<

----

And

nano /etc/hostname

# Is really

rpi4-ubuntudesktop

Revision history for this message
Lucas Kanashiro (lucaskanashiro) wrote :

Thank you for taking the time to file a bug report.

I'd like to ask which Ubuntu release you are using. I see you are installing postfix version 3.5.6-1 but this version is available in Ubuntu Groovy, Hirsute and Impish (development release). This info is important for us to try to reproduce the bug and make it actionable. Moreover, if you could share any local change you have made to /etc/postfix/main.cf that'd be great.

Since there is not enough information in your report to begin triage or to
differentiate between a local configuration problem and a bug in Ubuntu, I
am marking this bug as "Incomplete". We would be grateful if you would:
provide a more complete description of the problem, explain why you
believe this is a bug in Ubuntu rather than a problem specific to your
system, and then change the bug status back to "New".

For local configuration issues, you can find assistance here:
http://www.ubuntu.com/support/community

Changed in postfix (Ubuntu):
status: New → Incomplete
Revision history for this message
Mark Petersen (rambus666) wrote :

The Ubuntu version i am Using is Hirsute.

Im on a RPI4.

On previus installs it used the "mail name" during install etc. "rpi4-ubuntudesktop"
To generate the myhostname = rpi4ubuntudesktop and it would just work.

Now myhostname is created as "rpi4ubuntudesktop.." (Notice the two added dots)
Which it didt do before

----

# My main.cf file is not manually edited yet since i have a failed package install
# Everytime i try to install something after installing postfix i get an

1 not fully installed or removed.

Running

Apt install --fix-missing

Reverts me back to the origional install error of postfix

Running

apt remove --purge postfix
# Then
apt install postfix

gives me the same errors as posted before.

----

This is my /etc/postfix/main.cf file after a failed install
I havent edited anything

->

# See /usr/share/postfix/main.cf.dist for a commented, more complete version

# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_tls_security_level=may

smtp_tls_CApath=/etc/ssl/certs
smtp_tls_security_level=may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = rpi4-ubuntudesktop..
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, rpi4-ubuntudesktop, localhost.localdomain, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

Changed in postfix (Ubuntu):
status: Incomplete → New
Revision history for this message
Paride Legovini (paride) wrote :

Hi Mark,

My guess is that you have a `search .` line in your /etc/resolv.conf. The postfix postinst script tries to guess the machines FQDN in several ways, and one way is concatenating with a '.' the local hostname and the resolv.conf "search" domain. You can see this logic here:

https://git.launchpad.net/ubuntu/+source/postfix/tree/debian/postfix.postinst?h=applied/ubuntu/hirsute#n40

If this is the case, then this bug report is a duplicate of LP: #1906970.

The reporter of LP: #1906970 claims that `search .` is valid syntax, but I failed to find a reference for this claim, with a definition of what `search .` would mean. My suggestion here is to amend your /etc/resolv.conf, you should be able to safely drop the `search .` line, then please mark this bug as a duplicate of LP: #1906970.

If you don't agree with my analysis here please comment back and we'll look at this again. Thanks!

Changed in postfix (Ubuntu):
status: New → Incomplete
Revision history for this message
Mark Petersen (rambus666) wrote :

Your assessment was correct.

Commenting out "search ." and then installing Postfix resulted in a successful install.

----

I'm just not sure fixing it like this is the right way though.

I have and ubuntu 20.04 that didn't fail install or upgrade of postfix.

And I have a friend whos on 20.10 that didn't fail install or upgrade of postfix.

This seems like being a Hirsute problem.

Even found this on the net. (He decided to null the man.cf file though instead of finding a solution)

https://askubuntu.com/questions/1333199/apt-update-encounters-an-error-configuring-postfix-after-upgrade-to-21-04/1346306#1346306

My point being one should rather figure out why this happens.
And figure out a possible fix it.
Or more will probably show up with the bug.

Best Regards,
Mark

Revision history for this message
Paride Legovini (paride) wrote :

@Mark happy that it worked and thanks for marking this as a duplicate. It seems that `search .` should be supported after all, I'm adding more information to LP: #1906970, in case you want to follow.

Revision history for this message
cL0h (c-lovin) wrote (last edit ):

moving comment to original bug

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.