Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Socket not created due disappearing folder on reboot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
kilburna
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2004
Posts: 107

PostPosted: Fri Jun 22, 2018 2:24 am    Post subject: Socket not created due disappearing folder on reboot Reply with quote

Hi

Just a strange one. I run apache in event mpm and use php-fpm. When I reboot the computer the /var/run/php-fpm folder I manually created gets removed. So during bootup, the /etc/init.d/php-fpm cannot start because the /var/run/php-fpm folder is not present. If I manually create the folder, start it and all is fine. So what is causing the /var/run/php-fpm folder to be deleted.

www.conf
Code:

[www]
user = apache
group = apache
listen = /var/run/php-fpm/www.sock
listen.owner = apache
listen.group = apache
listen.mode = 0660
php_admin_value[error_log] = /var/log/fpm-php.www.log


[Moderator edit: changed [quote] tags to [code] tags to preserve output layout. -Hu]
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21607

PostPosted: Fri Jun 22, 2018 3:10 am    Post subject: Reply with quote

For several years now, /var/run has been a symlink to /run. Around the same time, /run was made a tmpfs, which means it discards all contents on reboot.

The init script should create the directory as part of startup.
Back to top
View user's profile Send private message
kilburna
Tux's lil' helper
Tux's lil' helper


Joined: 20 Sep 2004
Posts: 107

PostPosted: Fri Jun 22, 2018 3:44 am    Post subject: Reply with quote

That is also what I thought but the init script does not create the folder. I just hard coded mkdir in the init script and all is good, but I will file a bug.
Back to top
View user's profile Send private message
sabel
n00b
n00b


Joined: 27 Nov 2003
Posts: 13

PostPosted: Tue Aug 07, 2018 5:37 pm    Post subject: Reply with quote

Did you already file a bug?
This hit me today, too.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Tue Aug 07, 2018 6:10 pm    Post subject: Reply with quote

sabel wrote:
Did you already file a bug? This hit me today, too.

sabel, kilburna, et al ... it won't be classed as a bug, app-eselect/eselect-php[fpm] installs /usr/lib/tmpfiles.d/php-fpm.conf containing the following:

cat ~portdir/app-eselect/eselect-php/files/php-fpm.conf:
d /run/php-fpm 755 root root

So, if tempfiles.dev is in the runlevel this directory should be created on each reboot. If tmpfiles.dev is set to run and yet this isn't created prior to apache starting then /etc/init.d/apache should have 'after tmpfiles.dev'.

best ... khay
Back to top
View user's profile Send private message
sabel
n00b
n00b


Joined: 27 Nov 2003
Posts: 13

PostPosted: Tue Aug 07, 2018 6:59 pm    Post subject: Reply with quote

Thanks a lot!

Adding opentmpfiles-setup and opentmpfiles-dev to the default runlevel fixes the issue.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 21607

PostPosted: Wed Aug 08, 2018 12:23 am    Post subject: Reply with quote

In my opinion, if php relies on a directory created by opentmpfiles, then the php init script should need opentmpfiles.dev or similar, so that openrc is forced to run these in the right order.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Aug 08, 2018 8:55 am    Post subject: Reply with quote

Hu wrote:
In my opinion, if php relies on a directory created by opentmpfiles, then the php init script should need opentmpfiles.dev or similar, so that openrc is forced to run these in the right order.

Hu ... you're right, but if the initscript had 'mkdir -p -m 0755 /run/php-fpm || return $?' then issues like this simply wouldn't occur (and that's the problem I have with tmpfilesd).

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum