Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 349944 - mail-mta/postfix should not touch main.cf
Summary: mail-mta/postfix should not touch main.cf
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Net-Mail Packages
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-12-28 10:14 UTC by Benedikt Böhm (RETIRED)
Modified: 2011-06-13 16:23 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Stop postfix post-install to alter installed files (postfix-conf.diff,390 bytes, patch)
2011-02-28 09:39 UTC, Guillaume Castagnino
Details | Diff
Log of postfix upgrade on host #1, where main.cf dissappears (mail-mta:postfix-2.7.3:20110314-205827.log,230.09 KB, text/plain)
2011-03-14 22:45 UTC, Jesse Adelman
Details
Host #2 mail-mta:postfix-2.7.2:20110314-183745.log (mail-mta:postfix-2.7.2:20110314-183745.log,24.09 KB, text/plain)
2011-03-14 22:53 UTC, Jesse Adelman
Details
Host #2 mail-mta:postfix-2.7.3:20110314-183454.log (mail-mta:postfix-2.7.3:20110314-183454.log,255.54 KB, text/plain)
2011-03-14 22:56 UTC, Jesse Adelman
Details
postfix-2.8.2-r1.ebuild (postfix-2.8.2-r1.ebuild,7.58 KB, text/plain)
2011-05-07 21:52 UTC, Eray Aslan
Details
postfix-2.8.2-r1.ebuild (postfix-2.8.2-r1.ebuild,8.11 KB, text/plain)
2011-05-08 08:49 UTC, Eray Aslan
Details
Alternative 1 (alt-1.diff,531 bytes, patch)
2011-05-09 19:49 UTC, Eray Aslan
Details | Diff
Alternative 2 (alt-2.diff,2.10 KB, patch)
2011-05-09 19:50 UTC, Eray Aslan
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Benedikt Böhm (RETIRED) gentoo-dev 2010-12-28 10:14:01 UTC
please stop touching an already installed main.cf with useless directory parameters ... thanks
Comment 1 Torsten Veller (RETIRED) gentoo-dev 2010-12-28 10:29:01 UTC
You mean 'readme_directory' and 'html_directory' which get updated on version bumps?
Comment 2 Benedikt Böhm (RETIRED) gentoo-dev 2010-12-28 10:32:31 UTC
i mean these:

-readme_directory = /usr/share/doc/postfix-2.7.1/readme-sample_directory = /etc/postfix
-sendmail_path = /usr/sbin/sendmail
-html_directory = /usr/share/doc/postfix-2.7.1/html
-setgid_group = postdrop
-command_directory = /usr/sbin
-manpage_directory = /usr/share/man
-daemon_directory = //usr/lib64/postfix-newaliases_path = /usr/bin/newaliases
-mailq_path = /usr/bin/mailq-queue_directory = /var/spool/postfix
-mail_owner = postfix
-data_directory = /var/lib/postfix
Comment 3 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-02-08 03:21:04 UTC
I've also wondered why every remerge feels the need to set such "default" settings (useless) in main.cf. Literally, it is redefining the defaults as seen by "postconf -d" - I've never understood why it does this.
Comment 4 Tim Harder gentoo-dev 2011-02-25 21:53:04 UTC
Probably the easiest way would be to just check if main.cf exists in the filesystem and not install a new one in that case.

Does anyone have a problem with that method or a different idea?
Comment 5 Tim Harder gentoo-dev 2011-02-28 00:01:54 UTC
Fixed in 2.8.1 in CVS as per comment #4. If someone wants to come up with a better solution or patch to fix the issue, feel free to reopen.
Comment 6 Guillaume Castagnino 2011-02-28 09:39:26 UTC
Created attachment 264147 [details, diff]
Stop postfix post-install to alter installed files

The main.cf is not altered by the file installed by portage (managed with etc-update) but by the postfix post-install script that directly alter the file installed in /etc/postfix and not in ${D}etc/postfix...

The patch attached seems to fix the issue by passing to the post-install script the path in ${D}
I do not see side effects, but please recheck.
Comment 7 Jesse Adelman 2011-03-14 22:41:54 UTC
OK, I emerged 2.7.3, and found main.cf gone after the install (this is not a critical MTA host, and I can put the default main.cf in place, so I'm not really put out). I will attach the log.
Comment 8 Jesse Adelman 2011-03-14 22:45:18 UTC
Created attachment 265891 [details]
Log of postfix upgrade on host #1, where main.cf dissappears
Comment 9 Jesse Adelman 2011-03-14 22:48:58 UTC
Ah, and it has happened on a second host of mine! Here's the ls:

"dell-gx620 portage # ls /etc/postfix/
master.cf  saslpass
dell-gx620 portage # "

Same on seocond host:

"fuji ~ # ls /etc/postfix/
master.cf  saslpass
fuji ~ # "

I have another Portage update in progress, on a backup "true" MTA. I'm backing up /etc/postfix for this one...

I'll post a log for this, too.
Comment 10 Jesse Adelman 2011-03-14 22:53:32 UTC
Created attachment 265893 [details]
Host #2 mail-mta:postfix-2.7.2:20110314-183745.log

This shows the main.cf file being DELETED on unmerge or "previous" version.
Comment 11 Jesse Adelman 2011-03-14 22:56:01 UTC
Created attachment 265897 [details]
Host #2 mail-mta:postfix-2.7.3:20110314-183454.log

Log of install of 2.7.3
Comment 12 Jesse Adelman 2011-03-14 22:59:38 UTC
So, after closer inspection, the unmerge of 2.7.2 appears to delete main.cf. However, 2.7.3's ebuild, still seeing /etc/postfix/main.cf before 2.7.2 deletes it, doesn't install a default file. It would still be bad to install default over already configured file (without etc-update merging), but as it is, it instantly makes any postfix tasks fail. I send mails after completed emerge upgrades, so I saw the dreaded "send-mail: fatal: open /etc/postfix/main.cf: No such file or directory" and "Can't send mail: sendmail process failed with error code 75".

So, this bug should be reopened.
Comment 13 Tim Harder gentoo-dev 2011-03-15 02:38:16 UTC
(In reply to comment #12)
> So, after closer inspection, the unmerge of 2.7.2 appears to delete main.cf.
> However, 2.7.3's ebuild, still seeing /etc/postfix/main.cf before 2.7.2 deletes
> it, doesn't install a default file. It would still be bad to install default
> over already configured file (without etc-update merging), but as it is, it
> instantly makes any postfix tasks fail. I send mails after completed emerge
> upgrades, so I saw the dreaded "send-mail: fatal: open /etc/postfix/main.cf: No
> such file or directory" and "Can't send mail: sendmail process failed with
> error code 75".
> 
> So, this bug should be reopened.

Alright, I'll revert that change for 2.7.3 and look into this again when I have time.
Comment 14 Tim Harder gentoo-dev 2011-03-15 03:10:38 UTC
(In reply to comment #12)
> So, this bug should be reopened.

Also, can you post your emerge --info? I can't reproduce this bug on a stable system when upgrading from 2.7.2 to 2.7.3. Thanks.
Comment 15 Tim Harder gentoo-dev 2011-03-15 03:19:59 UTC
(In reply to comment #12)
> So, after closer inspection, the unmerge of 2.7.2 appears to delete main.cf.
> However, 2.7.3's ebuild, still seeing /etc/postfix/main.cf before 2.7.2 deletes
> it, doesn't install a default file.

This sounds like you may have something like CONFIG_PROTECT="-*" or CONFIG_PROTECT_MASK="/etc/postfix" set in your make.conf since with the default config file protection portage won't delete any files from a protected directory when a package is unmerged.
Comment 16 Jesse Adelman 2011-03-15 03:26:05 UTC
emerge --info's:

http://paste.pocoo.org/show/353825/
http://paste.pocoo.org/show/353826/

Thanks!
Comment 17 Dirkjan Ochtman (RETIRED) gentoo-dev 2011-03-15 08:47:20 UTC
This failed for me too: postfix-2.7.3 now won't work correctly, apparently because there's no main.cf to be found. This is on a fairly vanilla stable amd64 system, with an unmodified CONFIG_PROTECT_MASK, so this seems like a pretty bad bug.
Comment 18 Tim Harder gentoo-dev 2011-03-15 09:54:57 UTC
(In reply to comment #17)
> This failed for me too: postfix-2.7.3 now won't work correctly, apparently
> because there's no main.cf to be found. This is on a fairly vanilla stable
> amd64 system, with an unmodified CONFIG_PROTECT_MASK, so this seems like a
> pretty bad bug.

I already reverted the temporary fix I made which caused that problem so anyone syncing since a few hours ago shouldn't hit the issue.

Also, I'm just guessing, but I think the difference may be that I was using an ~arch marked portage and didn't see any problems so perhaps CONFIG_PROTECT handling changed a bit between 2.1.9.25 and 2.1.9.42.
Comment 19 Markos Chandras (RETIRED) gentoo-dev 2011-03-15 10:55:37 UTC
stable portage does NOT remove /etc/* stuff by default
Comment 20 Jeremy Olexa (darkside) (RETIRED) archtester gentoo-dev Security 2011-03-30 14:26:31 UTC
I don't get why qa@ was added, the maintainer(s) clearly were active and fixed it quickly.
Comment 21 Eray Aslan gentoo-dev 2011-05-07 15:23:43 UTC
(In reply to comment #2)
> i mean these:
[...]

from postfix-install:

# Save the installation parameters to main.cf even when they haven't
# changed from their current default. Defaults can change between
# Postfix releases, and software should not suddenly be installed in
# the wrong place when Postfix is being upgraded.

bin/postconf -c $CONFIG_DIRECTORY -e \
    "daemon_directory = $daemon_directory" \
    "data_directory = $data_directory" \
    "command_directory = $command_directory" \
    "queue_directory = $queue_directory" \
    "mail_owner = $mail_owner" \
    "setgid_group = $setgid_group" \
    "sendmail_path = $sendmail_path" \
    "mailq_path = $mailq_path" \
    "newaliases_path = $newaliases_path" \
    "html_directory = $html_directory" \
    "manpage_directory = $manpage_directory" \
    "sample_directory = $sample_directory" \
    "readme_directory = $readme_directory" \
|| exit 1


Closing as invalid.  Please reopen if you disagree.
Comment 22 Guillaume Castagnino 2011-05-07 19:02:17 UTC
I cannot reopen but sorry, I completely disagree...

1) From an admin sys point of view, silently altering configuration files into the root filesystem is simply a *HELL*. Configuration files are generally centralized (and backuped and/or versionned), at least by serious admin sys. Altering files silently is a nonsense and cannot be correctly managed, and will lead to unattended breakages and wrong re-deployments.

2) From a Gentoo point of view, this is illegal. Config files should not be altered inside root filesystem !
I can understand the postfix devs point of view, but for the gentoo package, the right way is: config file should be "fixed" *INSIDE ${D}* then managed with etc-update, but certainly not silently overwritten inside the root filesystem...

This is the aim of the patch I posted some month ago, unless I did not see some side effects...
Comment 23 Benedikt Böhm (RETIRED) gentoo-dev 2011-05-07 19:17:47 UTC
i completely agree with comment 22
Comment 24 Eray Aslan gentoo-dev 2011-05-07 21:52:25 UTC
Created attachment 272439 [details]
postfix-2.8.2-r1.ebuild

(In reply to comment #22)
> 2) From a Gentoo point of view, this is illegal. Config files should not be
> altered inside root filesystem !

I don't think anyone disputes this.

Anyhow, please check the attached ebuild to see if it solves the problem.
Comment 25 Eray Aslan gentoo-dev 2011-05-08 08:49:36 UTC
Created attachment 272461 [details]
postfix-2.8.2-r1.ebuild

Please test this ebuild as well.  It should work if I am reading it correctly and is somewhat less of a hack.  Thanks.
Comment 26 Tim Harder gentoo-dev 2011-05-09 03:26:40 UTC
(In reply to comment #25)
> Created attachment 272461 [details]
> postfix-2.8.2-r1.ebuild
> 
> Please test this ebuild as well.  It should work if I am reading it correctly
> and is somewhat less of a hack.  Thanks.

Attach a diff please, thanks.
Comment 27 Eray Aslan gentoo-dev 2011-05-09 19:49:25 UTC
Created attachment 272669 [details, diff]
Alternative 1
Comment 28 Eray Aslan gentoo-dev 2011-05-09 19:50:44 UTC
Created attachment 272671 [details, diff]
Alternative 2

Prefer alt-2 if both of them work.
Comment 29 Tim Harder gentoo-dev 2011-05-15 07:32:10 UTC
Are people still seeing this with the latest ~arch versions in the tree?

On my machines, I haven't seen this problem since I added the doc and examples use flags and made a few other changes to the 2.8.1 and 2.7.3 ebuilds to try to alleviate the problem.
Comment 30 Benedikt Böhm (RETIRED) gentoo-dev 2011-05-18 07:57:14 UTC
still an issue with both 2.7.4 and 2.8.3
Comment 31 Tim Harder gentoo-dev 2011-05-18 20:47:32 UTC
(In reply to comment #30)
> still an issue with both 2.7.4 and 2.8.3

Do you have the doc USE flag enabled?
Comment 32 Benedikt Böhm (RETIRED) gentoo-dev 2011-05-19 06:05:21 UTC
(In reply to comment #31)
> (In reply to comment #30)
> > still an issue with both 2.7.4 and 2.8.3
> 
> Do you have the doc USE flag enabled?

no:

$ emerge --info
Portage 2.2.0_alpha33 (default/linux/amd64/10.0, gcc-4.4.5, glibc-2.11.3-r0, 2.6.38-gentoo-r1 x86_64)
=================================================================
System uname: Linux-2.6.38-gentoo-r1-x86_64-Intel-R-_Atom-TM-_CPU_D525_@_1.80GHz-with-gentoo-2.0.2
Timestamp of tree: Mon, 16 May 2011 06:15:01 +0000
app-shells/bash:          4.1_p9
dev-lang/python:          2.7.1-r1
dev-util/cmake:           2.8.4-r1
sys-apps/baselayout:      2.0.2
sys-apps/openrc:          0.8.2-r1
sys-apps/sandbox:         2.4
sys-devel/autoconf:       2.65-r1
sys-devel/automake:       1.11.1
sys-devel/binutils:       2.20.1-r1
sys-devel/gcc:            4.4.5
sys-devel/gcc-config:     1.4.1-r1
sys-devel/libtool:        2.2.10
sys-devel/make:           3.81-r2
sys-kernel/linux-headers: 2.6.36.1 (virtual/os-headers)
sys-libs/glibc:           2.11.3
Repositories: gentoo hollow betagarden
Installed sets: 
ACCEPT_KEYWORDS="amd64"
ACCEPT_LICENSE="*"
CBUILD="x86_64-pc-linux-gnu"
CFLAGS="-march=athlon64 -O2 -pipe"
CHOST="x86_64-pc-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/texmf/language.dat.d /etc/texmf/language.def.d /etc/texmf/updmap.d /etc/texmf/web2c"
CXXFLAGS="-march=athlon64 -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
EMERGE_DEFAULT_OPTS="--quiet-build --with-bdeps=y --binpkg-respect-use=y --rebuilt-binaries=n --keep-going --usepkg"
FEATURES="assume-digests binpkg-logs buildpkg collision-protect distlocks ebuild-locks fixlafiles fixpackages news noinfo parallel-fetch preserve-libs protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox"
FFLAGS=""
GENTOO_MIRRORS="ftp://ftp.spline.de/pub/gentoo http://distfiles.gentoo.org http://www.ibiblio.org/pub/Linux/distributions/gentoo"
LANG="en_US.UTF-8"
LDFLAGS="-Wl,-O1 -Wl,--as-needed"
LINGUAS="en"
MAKEOPTS="-j1"
PKGDIR="/usr/portage/packages/amd64"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/var/lib/layman/hollow /var/lib/layman/betagarden"
SYNC="rsync://rsync.spline.de/gentoo-portage"
USE="acl amd64 bash-completion berkdb bzip2 caps cli cracklib crypt cxx dri fontconfig fortran gdbm gpm gs iconv idn ipv6 jpeg mmx modules mudflap multilib ncurses nls nptl nptlonly openmp pam pcre perl png pppd python readline session sse sse2 ssl svg sysfs tcpd tiff truetype unicode urandom vhosts vim-syntax xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="ptp2" COLLECTD_PLUGINS="df interface irq load memory rrdtool swap syslog" ELIBC="glibc" GPSD_PROTOCOLS="ashtech aivdm earthmate evermore fv18 garmin garmintxt gpsclock itrax mtk3301 nmea ntrip navcom oceanserver oldstyle oncore rtcm104v2 rtcm104v3 sirf superstar2 timing tsip tripmate tnt ubx" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en" PHP_TARGETS="php5-3" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="fbdev glint intel mach64 mga neomagic nouveau nv r128 radeon savage sis tdfx trident vesa via vmware dummy v4l" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 
Unset:  CPPFLAGS, CTARGET, INSTALL_MASK, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 33 Eray Aslan gentoo-dev 2011-06-13 09:35:39 UTC
# stat /etc/postfix/main.cf 
  File: `/etc/postfix/main.cf'
  Size: 26282     	Blocks: 56         IO Block: 4096   regular file
Device: 807h/2055d	Inode: 466455      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-13 11:03:08.000000000 +0300
Modify: 2011-06-13 11:03:08.000000000 +0300
Change: 2011-06-13 11:03:15.000000000 +0300
 Birth: -
# emerge -va =mail-mta/postfix-2.8.3-r1
[...]
# stat /etc/postfix/main.cf 
  File: `/etc/postfix/main.cf'
  Size: 26282     	Blocks: 56         IO Block: 4096   regular file
Device: 807h/2055d	Inode: 466455      Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2011-06-13 11:03:08.000000000 +0300
Modify: 2011-06-13 11:03:08.000000000 +0300
Change: 2011-06-13 11:03:15.000000000 +0300
 Birth: -

which is the requested behavior if I am not mistaken.  Can someone please check and confirm with postfix-2.8.3-r1?  Thank you.
Comment 34 Benedikt Böhm (RETIRED) gentoo-dev 2011-06-13 10:59:28 UTC
(In reply to comment #33)
> which is the requested behavior if I am not mistaken.  Can someone please check
> and confirm with postfix-2.8.3-r1?  Thank you.

works, thanks a lot!
Comment 35 Guillaume Castagnino 2011-06-13 12:04:40 UTC
Great, confirmed too, works perfectly now.
Thanks !
Comment 36 Eray Aslan gentoo-dev 2011-06-13 16:23:23 UTC
Thanks.  Closing.