Pages : 1
#1 Le 28/05/2026, à 08:27
- iznobe

apache log en ram ubuntu 26.04
Bonjour , sur U 24.04 , j ' utilisais cette méthode pour stocker les logs en RAM :
sudo nano /usr/bin/apache2ram-prestart.sh
#!/usr/bin/env sh
[ -d /var/log/apache2 ] || mkdir /var/log/apache2 && chown root:adm /var/log/apache2 && chmod 750 /var/log/apache2le rendre exécutable bien sur :
sudo chmod +x /usr/bin/apache2ram-prestart.shpuis editer le service apache comme suit :
sudo systemctl edit apache2.serviceen y inserant cela :
## Editing /etc/systemd/system/apache2.service.d/override.conf
### Anything between here and the comment below will become the new contents of the file
[Service]
ExecStartPre=/usr/bin/apache2ram-prestart.sh
...ça ne fonctionne plus , ça renvoie une erreur de namespace je sais plus trop tant quoi ...
par contre , cette méthode fonctionne toujours pour mysql , aller comprendre ![]()
bref , j ' ai fait autrement pour le moment :
sudo nano /etc/init.d/apache2:
# Now, set defaults:
[ -d $APACHE_LOG_DIR ] || mkdir $APACHE_LOG_DIR && chown root:adm $APACHE_LOG_DIR && chmod 750 $APACHE_LOG_DIRça crée bien le dossier , et ça a l' air de fonctionner , pour le moment .
Cependant , ça ne me parait être la méthode la plus perenne , il doit y avoir moyen de faire ça plus propre , mais je n' ai pas trouvé comment...
Des idées ?
Hors ligne
#2 Le 29/05/2026, à 08:34
- iznobe

Re : apache log en ram ubuntu 26.04
Finalement , j ' ai tout remis d' aplomb , puis j' ai modifié le fichier suivant :
sudo nano /usr/sbin/apache2ctldans lequel j ' ai ajouté la ligne ( 161 ) :
158 [ ! -d ${APACHE_RUN_DIR:-/run/apache2} ] && mkdir -p ${APACHE_RUN_DIR:-/run/apache2}
159 [ ! -d ${APACHE_RUN_DIR:-/run/apache2}/socks ] && mkdir_chown ${APACHE_RUN_USER:-www-data} ${APACHE_RUN_DIR:-/run/apache2}/socks
160 [ ! -d ${APACHE_LOCK_DIR:-/run/lock/apache2} ] && mkdir_chown ${APACHE_RUN_USER:-www-data} ${APACHE_LOCK_DIR:-/run/lock/apache2}
161 [ ! -d $APACHE_LOG_DIR ] && mkdir $APACHE_LOG_DIR && chown root:adm $APACHE_LOG_DIR && chmod 750 $APACHE_LOG_DIR
Le seul truc , c ' est que chaque fois que ce fichier sera réécrit , il faudra que je refasse la manip .
Ce qui n' était pas le cas avec la modification d' origine ![]()
Dernière modification par iznobe (Le 29/05/2026, à 08:37)
Hors ligne
#3 Le 01/06/2026, à 08:01
- iznobe

Re : apache log en ram ubuntu 26.04
Bonjour , et bien , retour à la case départ ![]()
toujours la meme erreur au lancement du service apache :
iznobe@iznobe-PC-U26:~$ sudo systemctl status apache2
[sudo: authenticate] Mot de passe :
× apache2.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/apache2.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Mon 2026-06-01 07:35:16 CEST; 25min ago
Invocation: c68cd106d397444b8aada63f559d413c
Docs: https://httpd.apache.org/docs/2.4/
Process: 2398 ExecStart=/usr/sbin/apachectl start (code=exited, status=226/NAMESPACE)
Main PID: 2398 (code=exited, status=226/NAMESPACE)
Mem peak: 2.2M
CPU: 11ms
juin 01 07:35:16 iznobe-PC-U26 systemd[1]: Starting apache2.service - The Apache HTTP Server...
juin 01 07:35:16 iznobe-PC-U26 (apachectl)[2398]: apache2.service: Failed to set up mount namespacing: /var/log/apache2: No such file or directory
juin 01 07:35:16 iznobe-PC-U26 (apachectl)[2398]: apache2.service: Failed at step NAMESPACE spawning /usr/sbin/apachectl: No such file or directory
juin 01 07:35:16 iznobe-PC-U26 systemd[1]: apache2.service: Main process exited, code=exited, status=226/NAMESPACE
juin 01 07:35:16 iznobe-PC-U26 systemd[1]: apache2.service: Failed with result 'exit-code'.
juin 01 07:35:16 iznobe-PC-U26 systemd[1]: Failed to start apache2.service - The Apache HTTP Server.
iznobe@iznobe-PC-U26:~$ Hors ligne
#4 Le 01/06/2026, à 08:59
- steph810

Re : apache log en ram ubuntu 26.04
Bonjour,
essaye ceci !!! POUR 26.04!!!:
Dernière modification par steph810 (Le 01/06/2026, à 09:03)
En ligne
#5 Le 01/06/2026, à 10:06
- iznobe

Re : apache log en ram ubuntu 26.04
Bonjour , si j ' ai bien compris le script , hors mis le fait de changer le dossier de stockage des logs ( et donc de modifier les conf pour ça ) , il suffirait d ' ajouter la ligne :
MemoryDenyWriteExecute=noau service pour que ça fonctionne ...
En tout cas merci pour la piste , je testerai dés que je rentre .
Hors ligne
Pages : 1