[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#697465: apache2.2-common: initial install fails: Could not read /etc/apache2/envvars

Quoting Jean-Michel Vourgère (2013-01-07 16:58:08)
> On Sunday 06 January 2013 11:29:55 Arno Töll wrote:
> > (...)
> > > Seems that error comes from a2ensite call, so I suspect the cause 
> > > might be some dependency of that script has not yet been 
> > > configured.
> > 
> > a2ensite does not call a shell to read /etc/apache2/envvars. Your 
> > output makes me suspect this is rather coming from the init script 
> > which is invoked from postinst. What makes you think a2ensite is the 
> > problem?
> Arno:
> a2ensite reads /etc/apache2/envvars in function read_env_file on line 
> 331:
> env - sh -c '. /etc/apache2/envvars && env'

Thanks, Jean-Michel.

Sorry if I was unclear earlier: I am talking about postinst too: 
postinst calls a2ensite calls perl loads modules.

Since those modules are not yet configured, postinst fails.

Package needs to pre-depend on perl, not just depend on it.

Below test indicates that this bug is independent from that lack of 
predependency on perl - so do you guys want me to file a separate bug 
about the perl predependency?

> Jonas:
> What does the command line above yield?
> What is the result code ? ($?)
> What shell do you use? dash? (ls -l /bin/sh)
> Can you send us your envvars file?

As I wrote before, it occurs using multistrap.  Multistrap is like 
debootstrap but postpones all postinst calls till later.  Therefore 
envvars file is the file shipped with the package itself.

Also, I tried manually switching sh to use bash, but that caused 
exact same failure.

Attached is the exact commands I used myself, and below is excerpt of 
output when I (after failure of attached script) add the following near 
the top of /var/lib/dpkg/info/apache2.2-common.postinst inside the 

set +e
set -x
env - sh -c '. /etc/apache2/envvars && env'
echo $?
ls -l /bin/sh
cat /etc/apache2/envvars
set -e

...and then re-run make (which calls all postinst scripts again):

+ env - sh -c '. /etc/apache2/envvars && env'
sh: 1: .: Can't open /etc/apache2/envvars
+ echo 2
+ ls -l /bin/sh
lrwxrwxrwx 1 root root 4 Jan  7 18:53 /bin/sh -> bash
+ cat /etc/apache2/envvars
# envvars - default environment variables for apache2ctl

# this won't be correct after changing uid
unset HOME

# for supporting multiple apache2 instances
if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then

# Since there is no sane way to get the parsed apache2 config in scripts, some
# settings are defined via environment variables and then used in apache2ctl,
# /etc/init.d/apache2, /etc/logrotate.d/apache2, etc.
export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data
export APACHE_PID_FILE=/var/run/apache2$SUFFIX.pid
export APACHE_RUN_DIR=/var/run/apache2$SUFFIX
export APACHE_LOCK_DIR=/var/lock/apache2$SUFFIX
# Only /var/log/apache2 is handled by /etc/logrotate.d/apache2.
export APACHE_LOG_DIR=/var/log/apache2$SUFFIX

## The locale used by some modules like mod_dav
export LANG=C
## Uncomment the following line to use the system default locale instead:
#. /etc/default/locale

export LANG

## The command to get the status for 'apache2ctl status'.
## Some packages providing 'www-browser' need '--dump' instead of '-dump'.
#export APACHE_LYNX='www-browser -dump'

## If you need a higher file descriptor limit, uncomment and adjust the
## following line (default is 8192):
#APACHE_ULIMIT_MAX_FILES='ulimit -n 65536'

 - Jonas

 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

set -e

# This script works with normal user, except installing needed packages
#sudo aptitude install git fai-client multistrap fakechroot

# Setup boxer
git clone git://git.debian.org/git/collab-maint/boxer.git
cd boxer
git submodule update --init

# Enable a few classes, use local proxy, and explicitly set target suite
bin/boxerenclass ipv4ll webchat
echo "source = http://proxy:9999/debian"; > config.mk
echo "suite = wheezy" >> config.mk

# Create system

# Install system onto /media/boxer (formattet but not mounted device)
make install

Attachment: signature.asc
Description: signature

Reply to: