All gentoo-*.rc-files in /usr/lib64/courier-imap/ are broken on hardened amd64. The libexecdir-variable in points initially to libexecdir=/usr/lib/courier-imap which is wrong on a amd64-system since the right libdir was /usr/lib64. There are several hardcoded paths in this files the suffer the same problem. Changing all /usr/lib to /usr/lib64 fixes the issue.
emerge info: Portage 2.1-r1 (hardened/amd64, gcc-3.4.6, glibc-2.3.5-r3, 2.6.14-hardened-r8 x86_64) ================================================================= System uname: 2.6.14-hardened-r8 x86_64 AMD Athlon(tm) 64 Processor 3500+ Gentoo Base System version 1.6.15 ccache version 2.3 [enabled] app-admin/eselect-compiler: [Not Present] dev-lang/python: 2.4.3-r1 dev-python/pycrypto: 2.0.1-r5 dev-util/ccache: 2.3 dev-util/confcache: [Not Present] sys-apps/sandbox: 1.2.17 sys-devel/autoconf: 2.13, 2.59-r7 sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2 sys-devel/binutils: 2.16.1-r3 sys-devel/gcc-config: 1.3.13-r3 sys-devel/libtool: 1.5.22 virtual/os-headers: 2.6.11-r5 ACCEPT_KEYWORDS="amd64 x86" AUTOCLEAN="yes" CBUILD="x86_64-pc-linux-gnu" CFLAGS="-march=athlon64 -O2 -pipe" CHOST="x86_64-pc-linux-gnu" CONFIG_PROTECT="/etc" CONFIG_PROTECT_MASK="/etc/env.d /etc/gconf /etc/revdep-rebuild /etc/terminfo" CXXFLAGS="-march=athlon64 -O2 -pipe" DISTDIR="/usr/portage/distfiles" FEATURES="autoconfig ccache distlocks metadata-transfer sandbox sfperms strict userpriv usersandbox" GENTOO_MIRRORS="ftp://update.pureserver.info/gentoo/gentoo/ http://update.pureserver.info/gentoo/gentoo/ http://mirrors.sec.informatik.tu-darmstadt.de/gentoo/ ftp://mirror.nutsmaas.nl/gentoo/ http://195.56.77.10/ http://194.149.10.102/" MAKEOPTS="-j2" PKGDIR="/usr/portage/packages" PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --delete-after --stats --timeout=180 --exclude='/distfiles' --exclude='/local' --exclude='/packages'" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/portage" SYNC="rsync://rsync.de.gentoo.org/gentoo-portage" USE="amd64 apache2 berkdb crypt dlloader hardened justify logrotate nls pam pic pie readline sse sse2 ssl tcpd userlocales vhosts xorg zlib elibc_glibc input_devices_mouse input_devices_keyboard kernel_linux userland_GNU" Unset: CTARGET, EMERGE_DEFAULT_OPTS, INSTALL_MASK, LANG, LC_ALL, LDFLAGS, LINGUAS, PORTAGE_RSYNC_EXTRA_OPTS
Seems like you're hitting http://bugs.gentoo.org/show_bug.cgi?id=125034 Personally i think that libexecdir should stay to /usr/lib since it always points to the right place (at least it should)
Created attachment 98939 [details, diff] proposed changes The files should use the real libdir, because lib will NOT always point at the right dir. The attached patch fixes the issue for 4.0.6: The new initd and .rc files contain /usr/GENTOO_LIBDIR instead of /usr/lib which then gets replaced with the correct value in the ebuild. Robin, it'd be cool if you could look over and test the patch before I go and apply it as it's rather invasive, after all...
Assuming you're fine with me committing this, it's in the tree as 4.0.6-r1. Let's pray I didn't break anything.