I am trying to get Aegir working on CentOS 5. I followed the manual instructions and everything was going well until I tried to start apache. When I run the command:

/sbin/service httpd start

I get the following error:

Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Could not open configuration file /etc/httpd/conf.d/aegir.conf: Permission denied

I have been all over the Internet trying to find out what I'm doing wrong and I cannot find anything that has helped me solve this. I have tried different permission settings and I cannot get anything to work with that either. I have also tried wiping everything and reinstalling everything using the manual process and I go through everything just fine, until I try to start the httpd service.

If I remove the symlink mentioned in the manual then I can start the httpd service fine and I get the Apache test page showing in my browser. However, I'd really like to get Aegir working.

Does anyone have any advice/tips for me to get this working?

Thanks!

Comments

Steven Jones’s picture

Odd, what are the permissions on the synlinked file, i.e. could you post the results of:

ls -l /var/aegir/config/apache.conf

and

ls -l /var/aegir/config/server_master/apache.conf
bocaj’s picture

Hi Steven,
Thanks for your quick response! I meant to post the permissions in my initial post and completely spaced it out. Here is what you requested:

ls -l /var/aegir/config/apache.conf

lrwxrwxrwx 1 aegir aegir 43 Sep 21 10:59 /var/aegir/config/apache.conf -> /var/aegir/config/server_master/apache.conf
ls -l /var/aegir/config/server_master/apache.conf

-rw-rw-r-- 1 aegir aegir 854 Sep 21 10:59 /var/aegir/config/server_master/apache.conf

Also here is the aegir.conf symlink in /etc/httpd/conf.d/ (in case that's helpful at all):

ls -l /etc/httpd/conf.d/aegir.conf

lrwxrwxrwx 1 root root 29 Sep 21 10:31 /etc/httpd/conf.d/aegir.conf -> /var/aegir/config/apache.conf

Before posting initially I tried changing /var/aegir/config/server_master/apache.conf permissions to 777 just to see if that was the issue and I still received the same permission denied error when trying to restart apache.

Also, while trying to figure things out I copied the apache.conf file from /var/aegir/config/server_master/ to /etc/httpd/conf.d/ and removed the aegir.conf symlink. I then got the following permission denied error:

Starting httpd: httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Syntax error on line 21 of /etc/httpd/conf.d/apache.conf: Could not open config directory /var/aegir/config/server_master/apache/pre.d: Permission denied

Here is the permissions for pre.d:

drwx------ 2 aegir aegir 4096 Sep 21 10:58 pre.d

All directories in /var/aegir/config/server_master have this permission. I'm not sure (obviously) if that is intended or not.

Thanks again for your help! I'm very excited to begin using Aegir!

theMusician’s picture

I ran into this error as well when doing an install on a RedHat6 VM. If you run the command with sudo I bet the error goes away. When I installed Aegir on my production VM I didn't get the error. It took me several install attempts to make it work properly. Are you starting Apache as the Aegir user or as your normal user? Don't forget to give your Aegir user sudo permissions for httpd. I am not sure if Cent OS 5 supports the apachectl syntax but give apachectl -k start a try and see if you get the same error.

bocaj’s picture

@theMusician: Thanks for your reply. I have already tried starting apache as all users on the system (including root). No matter what user I use, I get the same permission denied error. I did try again just now just to make sure and it is still the same. All of the permissions seem to be fine so I don't know what I'm missing. Thanks again for your suggestion!

I did try restarting the entire server multiple times as well, just in case that's what was hanging me up, but the issue still persists.

theMusician’s picture

Hmmm... Well just to see if this can be narrowed down. Does the same error occur for all of the following commands, please forgive me if this is erroneous syntax for centOS5.

httpd -k start
httpd -k stop

apachectl -k graceful
apachectl -k start
apachectl -k stop

Please give it a whirl as both the aegir user and as a super user. Thanks. Once this is solved, it runs great and it really is worth it.

theMusician’s picture

@bocaj I looked back through my install notes, most of which I posted here as RedHat6 specific steps but I did see that when I created my aegir user through the gui and assigned it to the apache group it never worked. Only when I created my user on the command line and assigned a group with -g etc... did it work. I am not sure how you have your OS setup but staying out of the gui worked for me.

bocaj’s picture

@theMusician: Thanks for your continued help!
Here is the response from each of the commands you asked about:

httpd -k start
httpd -k stop
(both had the same result)

httpd: Could not reliably determine the server's fully qualified domain name, using itspecialistsdevhost.itspecialistsdevhost.com for ServerName
apachectl -k graceful
apachectl -k start
apachectl -k stop
(all three had the same result)

httpd: Syntax error on line 209 of /etc/httpd/conf/httpd.conf: Could not open configuration file /etc/httpd/conf.d/aegir.conf: Permission denied

Regarding comment #6, I do not have a GUI installed on this server. Everything I have done has been through the command line.

Any other suggestions/ideas would be greatly appreciated. I'm excited to get started with Aegir!

bocaj’s picture

Status: Active » Fixed

I finally got this working!! For anyone else that stumbles across this with the same issue, this is the post that I found that finally gave me the "green light": http://forums.fedoraforum.org/archive/index.php/t-106655.html.

Basically, all I needed to do was run this command:

chcon -t httpd_config_t apache.conf

on the apache.conf file in /var/aegir/config/server_master directory and everything is now working beautifully! (Maybe this should be included in the "Common installation problems" document on Aegir's website? Or maybe it's not common, but it sure made me pull my hair out for several hours!)

Maybe turning off SELinux would have done the same thing (or a better alternative?), but I'm just glad it's all working!

Now on to learning Aegir! Any tips?! ;)

Steven Jones’s picture

@bocaj I'm glad that you got to the bottom of your issues, anyone can edit the documentation on the community site, you can just sign up and edit away! Please add your note if you feel others would benefit.

cridenour’s picture

Status: Fixed » Active

Having the same issue as the OP. However, using
httpd -k start
works!

I'm afraid that when Aegir needs to reboot apache, it won't be able to. How could httpd (from root) work but apachectl (from root) not work?

Running on RHEL 5.7, Apache 2.2.3.

Thanks!

theMusician’s picture

#8 Great to see another solution bubble up. This still seems like a permissions error at some point in the installation. chcon is a new command for me.

#10 What does httpd -k restart do? For each server, you can set the command to use for apache. I personally, really like graceful. Have you installed Apache the standard way on RH?

Best of luck

anarcat’s picture

Component: Code » Documentation
Status: Active » Needs work

This seems like a documentation issue, related to security contexts in Selinux. I encourage @bocaj to update the documentation and close this support request.

bocaj’s picture

Status: Needs work » Fixed
cridenour’s picture

I updated my provision module to use httpd -k instead of apachectl and it worked great. Thanks for the help.

anarcat’s picture

Thanks for the quick update!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.