
I just upgraded ubuntu on one of my Lightsail instances and ran into a problem with apache.
The upgrade was going from Ubuntu 25.10 to 26.04.
After the upgrade, every time I tried to start apache, I kept getting this error:
(30)Read-only file system: AH00091: apache2: could not open error log file /home/apache2/web_server_dir/error_log.
AH00015: Unable to open log
Searching google returned results about permission errors, a corrupt file system, or SELinux issues.
I determined that there were no permissions issues with the log directory (www-data had read/write access to the logs directory) & the file system was fine. I’m not super familiar with SELinux, but I really didn’t think that was the cause.
After digging for a while, I was able to determine the issue.
Turns out, it was systemd preventing writing the apache server from writing to the logs directory.
I put all my web content in a specific directory that is NOT under /var … and systemd was preventing the server from writing the logs to anywhere except /var/log/apache2. For this post, we’ll call it /home/apache2.
The solution was to update the apache2 configuration in systemd to allow read & write to the /home/apache2 directory.
To do this, I edited the apache2 configuration using sudo systemctl edit apache2 and added the following …
### Editing /etc/systemd/system/apache2.service.d/override.conf
### Anything between here and the comment below will become the contents of the drop-in file
[Service]
ReadWritePaths=/home/apache2
### Edits below this comment will be discardedCode language: PHP (php)
Then ran sudo systemctl restart apache2.
The apache server started correctly and the content was being served as it should be.
Further investigation showed that the new version of ubuntu added additional protections to apache’s processes.
These can be disabled by adding ProtectSystem=no to the systemd configuration instead of using ReadWritePaths.