Broken Postfix Package [SOLVED]

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Broken Postfix Package [SOLVED]

Post by mint_toronto »

I installed postfix and configured it as a sattelite to use my AWS SES (Amazon SMTP) credentials but received an error due to a dumb typo on my part.

So I did 'sudo apt remove postfix' and 'purge' command to remove and then tried 'sudo apt install postfix'.

But now I have a very strange error that I cannot recover from even though I have ran 'sudo dpkg --audit' and cleaned up everthing to the point where I do NOT get any reported errors or warnings with 'dpg --audit'.

Code: Select all

sudo apt install postfix

The following NEW packages will be installed:
  postfix
0 upgraded, 1 newly installed, 0 to remove and 9 not upgraded.
Need to get 0 B/1,245 kB of archives.
After this operation, 4,180 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Preconfiguring packages ...
Invalid [] range "s-e" in regex; marked by <-- HERE in m/(^|[\.])[email-smtp.us-e <-- HERE ast-1.amazonaws.com]:587$/ at /tmp/postfix.config.M3Dm0B line 244, <STDIN> line 16.
postfix failed to preconfigure, with exit status 255
(Reading database ... 413301 files and directories currently installed.)
Preparing to unpack .../postfix_3.6.4-1ubuntu1_amd64.deb ...
Invalid [] range "s-e" in regex; marked by <-- HERE in m/(^|[\.])[email-smtp.us-e <-- HERE ast-1.amazonaws.com]:587$/ at /var/lib/dpkg/tmp.ci/config line 244, <STDIN> line 16.
dpkg: error processing archive /var/cache/apt/archives/postfix_3.6.4-1ubuntu1_amd64.deb (--unpack):
 new postfix package pre-installation script subprocess returned error exit status 255
Errors were encountered while processing:
 /var/cache/apt/archives/postfix_3.6.4-1ubuntu1_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
This could be related to the MINT 21 distro that I am running or it could be Ubuntu 22.04 or it could be Debian Bullsye.

But I cannot resolve it and don't even know what to selectively restore from my BORG backup respositories/archives.

Thought I would start with you folks that maintain MINT. Surely there is a way to clean up the residual garbage.

Current state of my desktop (from neofetch):
OS: Linux Mint 21 x86_64
Kernel: 5.15.0-58-generic
Packages: 2620 (dpkg), 17 (flatpak)
Shell: bash 5.1.16
Resolution: 1920x1080, 1920x1080
DE: Xfce 4.16
WM: Xfwm4
Theme: Greybird [GTK2], Mint-Y [GTK3]
Icons: elementary-xfce-dark [GTK2], Mint-Y [GTK3]
Terminal: konsole
CPU: AMD Ryzen 5 2400G (8) @ 3.600GHz
GPU: AMD ATI Radeon RX 470/480/570/570X/580/580X/590
Memory: 1873MiB / 15904MiB
Last edited by LockBot on Sun Aug 06, 2023 10:00 pm, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
sleeper12
Level 21
Level 21
Posts: 14594
Joined: Thu May 25, 2017 3:22 pm

Re: Broken Postfix Package

Post by sleeper12 »

Try:

Code: Select all

sudo dpkg --configure -a
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

Thanks. But same error.
sleeper12
Level 21
Level 21
Posts: 14594
Joined: Thu May 25, 2017 3:22 pm

Re: Broken Postfix Package

Post by sleeper12 »

Try:

Code: Select all

sudo dpkg -i --force-overwrite /var/cache/apt/archives/postfix_3.6.4-1ubuntu1_amd64.deb

Code: Select all

sudo apt-get install -f
If that does nothing, wait for someone else to help.
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

Still no fix. Thanks.
sleeper12
Level 21
Level 21
Posts: 14594
Joined: Thu May 25, 2017 3:22 pm

Re: Broken Postfix Package

Post by sleeper12 »

Best I can suggest is maybe Solution 3 or 4 here:
https://ostechnix.com/fix-sub-process-u ... in-ubuntu/
User avatar
coffee412
Level 8
Level 8
Posts: 2266
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Broken Postfix Package

Post by coffee412 »

I have an idea.

Remove postfix like before:

Code: Select all

apt remove postfix
Then purge it:

Code: Select all

apt purge postfix
Then su to root and change to / :

Code: Select all

sudo su
cd / 
Now do a search for anything postfix and save the output to a text file:

Code: Select all

find -name postfix > postfix.txt
Post here what is in postfix.txt

Lets see what is all there.
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

Code: Select all

sudo find / -xdev -name "postfix*.*" -ls

19534029      8 -rw-r--r--   1 root     root         4458 Dec 12 14:34 /usr/lib/python3/dist-packages/twisted/protocols/__pycache__/postfix.cpython-310.pyc
15866702      4 -rw-r--r--   1 root     root         3633 Feb  7  2022 /usr/lib/python3/dist-packages/twisted/protocols/postfix.py
15731208   1216 -rw-r--r--   1 root     root      1245140 Mar 22  2022 /var/cache/apt/archives/postfix_3.6.4-1ubuntu1_amd64.deb

Still cannot find the source of the remnants that cause the install to crash with error as per the initial posting in this thread.
User avatar
coffee412
Level 8
Level 8
Posts: 2266
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Broken Postfix Package

Post by coffee412 »

Code: Select all

Dec 12 14:34 /usr/lib/python3/dist-packages/twisted/protocols/__pycache__/postfix.cpython-310.pyc
Feb  7  2022 /usr/lib/python3/dist-packages/twisted/protocols/postfix.py
I run a postfix to forward emails/invoice from my invoice program and also on servers to receive their logs every day. I went in and compared what is found above with their python3 install. I do not find "twisted" and I have no idea why that is there on your system except if somehow you have installed it.

I searched for twisted and found this:

https://pypi.org/project/Twisted/

I am not sure what twisted does. I do know I certainly do not need it to perform any operations with postfix. I also know that twisted has some bindings with postfix. If there is a reason you have this installed I would love to know. Otherwise, I would definitely suspect it as being a possible issue and if you do not know why its there then it should be considered for uninstalling.

Im not saying this is a definite fix. Its worth trying and I cannot think of anything standard in linux that would depend on it.
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

Thanks. I am not sure how Twisted got on my system but I uninstalled it.

Still exact same problem.
User avatar
coffee412
Level 8
Level 8
Posts: 2266
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Broken Postfix Package

Post by coffee412 »

Will you show me what is in your /tmp directory?

Code: Select all

ls /tmp

Code: Select all

Invalid [] range "s-e" in regex; marked by <-- HERE in m/(^|[\.])[email-smtp.us-e <-- HERE ast-1.amazonaws.com]:587$/ at /tmp/postfix.config.M3Dm0B
What repo are you getting postfix from?

Code: Select all

apt policy postfix
Does your /etc/hosts file contain anything about aws?
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

No trace of the tmp file that got created. It seems to get deleted during the erroneous exit.

Wish I could make the file immutable just after creation.

Anyways, I blew away the contents of /tmp and tried again.

Code: Select all

apt policy postfix
postfix:
  Installed: (none)
  Candidate: 3.6.4-1ubuntu1
  Version table:scp -P 1962 -i /home/mark/ssh-keys/Sept-2021.key /home/mark/BORG/status mark@ord1.symmes.net:~/BORG-status
  ssh -p 1962 -i /home/mark/ssh-keys/Sept-2021.key mark@ord1.symmes.net 'cat ~/BORG-status | mail -r mark@ord1.symmes.net -s "Borg Backup Status"
     3.6.4-1ubuntu1 500
        500 http://mirror.csclub.uwaterloo.ca/ubuntu jammy/main amd64 Packages

apt install postfix
Same error. Thanks for your persistence

And since Postix is a mess I email with one of my remote servers that does work well with AWS SES for now:

Code: Select all

scp -P 1962 -i /home/mark/.ssh/xxxx.key /home/mark/BORG/status mark@xxx.example.com:~/BORG-status
ssh -p 1962 -i /home/mark/.ssh/xxxx.key mark@xxx.example.com 'cat ~/BORG-status \
       | mail -r mark@xxx.example.com-s "Borg Backup Status" mark@my-monitor.example.com'
User avatar
coffee412
Level 8
Level 8
Posts: 2266
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Broken Postfix Package

Post by coffee412 »

Sorry. The only thing I can imagine is that some install of some software altered a non postfix config file that postfix references on install somewhere. Its just a hunch. Thats why I asked about your /etc/hosts file. That 'Twisted' install sure sticks in my mind. :(
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

I am inching closer.

Code: Select all

apt install debconf-utils
debconf-get-selections | grep postfix

postfix postfix/recipient_delim string  +
postfix postfix/protocols       select
postfix postfix/mailname        string  [email-smtp.us-east-1.amazonaws.com]:587
postfix postfix/destinations    string
postfix postfix/chattr  boolean false
postfix postfix/not_configured  error
postfix postfix/rfc1035_violation       boolean false
postfix postfix/newaliases      boolean false
postfix postfix/compat_conversion_warning       boolean true
postfix postfix/mynetworks      string  127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
postfix postfix/bad_recipient_delimiter error
postfix postfix/procmail        boolean
postfix postfix/main_mailer_type        select  Satellite system
postfix postfix/root_address    string
postfix postfix/relayhost       string
postfix postfix/mailbox_limit   string  0
postfix postfix/dynamicmaps_conversion_warning  boolean
postfix postfix/main_cf_conversion_warning      boolean true
So I found the remnants. Just need to find the so called debconf database that is mentioned when I do

Code: Select all

debconf-set-selections
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

Solution! Saw similar situation from 11 years ago at https://serverfault.com/questions/24363 ... selections

Code: Select all

echo "postfix postfix/mailname        string  temp.example.com" | debconf-set-selections
Still would like to now where that debconf database resides. At least I know how to configure it with standard input.
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

Lots of karma to those that helped here on the forum !!!
User avatar
coffee412
Level 8
Level 8
Posts: 2266
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Broken Postfix Package

Post by coffee412 »

Cool. Getting real close now...

/etc/debconf.conf and ~/.debconfrc

Above are the config files for debconf. The one in /etc/ is global and the other pertains to your user only I do believe. I think I saw the path for the database residing in the cache directory. Not sure.

Code: Select all

Filename: /var/cache/debconf/config.dat
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
mint_toronto
Level 1
Level 1
Posts: 12
Joined: Wed Dec 28, 2022 5:51 pm

Re: Broken Postfix Package

Post by mint_toronto »

I did look at

Code: Select all

/var/cache/debconf/config.dat
It contains lots of "postfix" lines.
I don't have a local ~/.debconfrc

Postfix installed !
User avatar
coffee412
Level 8
Level 8
Posts: 2266
Joined: Mon Nov 12, 2012 7:38 pm
Location: I dont know
Contact:

Re: Broken Postfix Package

Post by coffee412 »

mint_toronto wrote: Wed Feb 08, 2023 1:11 pm I did look at

Code: Select all

/var/cache/debconf/config.dat
It contains lots of "postfix" lines.
I don't have a local ~/.debconfrc

Postfix installed !
Fantastic!

I still wonder what that "Twister" was.... lol...
Ryzen x1800 Asus Prime x370-Pro 32 gigs Ram RX480 graphics
Dell PE T610, Dell PE T710
- List your hardware Profile: inxi -Fxpmrz
MeshCentral * Virtualbox * Debian * InvoiceNinja * NextCloud * Linux since kernel 2.0.36
sleeper12
Level 21
Level 21
Posts: 14594
Joined: Thu May 25, 2017 3:22 pm

Re: Broken Postfix Package

Post by sleeper12 »

👍 Edit your first post & add [SOLVED} to the Subject line.
Locked

Return to “Software & Applications”