Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am trying to run gdb to debug my Ubuntu 9.10 Apache2 install and having a couple of problems:

  1. It seems like the package installed by Ubuntu for Apache2 does not include debugging symbols; is there a different version of the package I should be using for developing/debugging?

  2. When I try to run gdb, I get an error that looks to be caused by some missing environment variable. Are there additional options I should pass to "run" to get this to work?

Here is the output of the debugger session:

root@aj-ubuntu:/usr/sbin# gdb apache2
GNU gdb (GDB) 7.0-ubuntu
Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
Reading symbols from /usr/sbin/apache2...(no debugging symbols found)...done.
(gdb) run -X
Starting program: /usr/sbin/apache2 -X
[Thread debugging using libthread_db enabled]
apache2: bad user name ${APACHE_RUN_USER}

Program exited with code 01.

Thanks in advance, -aj

share|improve this question
up vote 1 down vote accepted

For the first Ubuntu run a symbol server:

For the second that looks like an apache config issue, does apache run peoperly when started by the init script?

share|improve this answer
a better link is – sendmoreinfo Feb 22 '11 at 22:30

Running the command source /etc/apache2/envvars in bash loaded the necessary variables for me.

share|improve this answer

You need to set the environment variables before calling the binary directly. If you want to do this from sudo in a Debian based distro you can use:

source /etc/apache2/envvars
sudo -E gdb /usr/sbin/apache2
share|improve this answer

There are some settings in apache2.conf which use environment variables. use ". /etc/apache2/envvars" prior apache2 start

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.