Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
/run/lock doesn't exist after reboot
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 43

PostPosted: Wed Nov 14, 2018 8:57 pm    Post subject: /run/lock doesn't exist after reboot Reply with quote

Hey guys, I'm having a weird day today with my Gentoo VPS. This is a server which doesn't get rebooted often.
Last time it was rebooted in February, all was fine. 3 days ago it was rebooted for some reason, and the problems started.

First of all, daemontools (supervise) didn't come up - so no DNS or mail or PHP (I'm using tinydns, qmail, FastCGI PHP).
Reason - this line mysteriously disappeared from /etc/inittab: sv:12345:respawn:/usr/bin/svscanboot
I don't remember doing that or approving an update to that config file, but who knows, maybe I did and didn't notice it some months ago...
Restored that line and supervise is working again.

Next thing I know, fcron is spamming my e-mail with messages saying that /run/lock doesn't exist. Since I don't keep up with all the latest fashions in Linux world, I didn't even know what is /run... So, I see that /run is a tmpfs mounted by who knows which part of the init process (I couldn't find it), and /var/lock is a symlink pointing to /run/lock, but that directory doesn't exist. My attempts to find the source of this led me to /etc/init.d/bootmisc which does some migrate_to_run thing, but looks like it's not entirely successful. I've made sure I updated openrc to the latest stable version, however after another reboot, /run/lock doesn't exist. What can be the reason?
Unfortunately I couldn't find anything on the forum by searching for "/run/lock", because the glorious search removes the special characters and the 3-letter word "run", leaving only "lock" as the search query.
Back to top
View user's profile Send private message
mike155
l33t
l33t


Joined: 17 Sep 2010
Posts: 661
Location: Frankfurt, Germany

PostPosted: Thu Nov 15, 2018 12:32 am    Post subject: Reply with quote

1) Gentoo forum's search function doesn't work well. Most people use Google to search Gentoo forums. Just add "site:forums.gentoo.org" to your search request.

2) "/run" isn't new - it has been around since 2011: https://lwn.net/Articles/436012/

3) If you use Systemd, you can define all directories and files that should be created during bootup in /etc/tmpfiles.d/*.conf, see: https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html

4) If you use OpenRC, you could install "sys-apps/opentmpfiles" to get this feature. See: https://github.com/openrc/opentmpfiles
Back to top
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 43

PostPosted: Thu Nov 15, 2018 7:26 am    Post subject: Reply with quote

Thanks a lot for the advice on using Google search. It does indeed work much better.
Ok I'll read some more about this /run and why we can't live without it, 2011 is a bit "new" in UNIX world :)
I'm one of those people who think systemd is one of the worst things to happen to Linux, so no, I don't use it.

Now, I do already have opentmpfiles installed (I suppose it might have been pulled in by openrc automatically, because I don't remember installing it).
However, none of the files in /usr/lib/tmpfiles.d/ mention /run/lock.
I'm looking at the initial post here: https://forums.gentoo.org/viewtopic-t-1039864-start-0.html
And it seems that it should be created by openrc quite early in the boot process, is it not?
Apparently something on my system is not properly updated, maybe some config file is missing, or a file in /usr/lib/tmpfiles.d?
Back to top
View user's profile Send private message
mike155
l33t
l33t


Joined: 17 Sep 2010
Posts: 661
Location: Frankfurt, Germany

PostPosted: Thu Nov 15, 2018 11:46 am    Post subject: Reply with quote

Below is the contents of the file '/usr/lib/tmpfiles.d/gentoo-run.conf', which is part of 'sys-apps/gentoo-systemd-integration':
Code:
# New OpenRC versions replace /var/lock with a symlink to /run/lock.
# We just create that directory for now, just in case.
# Of course, it's not guaranteed that'll satisfy all relevant packages.

d /run/lock 0775 root uucp -

You wrote that opentmpfiles is installed on your machine. You could just copy this file to your computer.
Back to top
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 43

PostPosted: Thu Nov 15, 2018 2:50 pm    Post subject: Reply with quote

Thanks Mike.
That would solve my issue.
But I'm curious, if one is installing a fresh Gentoo, without systemd, one wouldn't install that sys-apps/gentoo-systemd-integration package, would they?
Would they have the same problem with non-existent /run/lock then? Is it a bug in Gentoo or there would be some alternative package to that one? Or is it installed regardless of using systemd?
--Gene
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13021

PostPosted: Fri Nov 16, 2018 2:41 am    Post subject: Reply with quote

For me:
Code:
# grep -r /run/lock /lib/
/lib/rc/sh/init.sh:checkpath -d -m 0775 -o root:uucp /run/lock
# equery b /lib/rc/sh/init.sh
 * Searching for /lib/rc/sh/init.sh ...
sys-apps/openrc-0.34.11 (/lib64/rc/sh/init.sh)
What is the output of emerge --pretend --verbose sys-apps/openrc on the affected system(s)?
Back to top
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 43

PostPosted: Fri Nov 16, 2018 9:32 am    Post subject: Reply with quote

Hey Hu,
Thanks for pointing out /lib/rc to me, I didn't know to look there.

Now that I've tried that checkpath command in a shell, the problem became immediately obvious.

Some time ago I've deleted a few user accounts which I deemed not necessary on a modern system which doesn't run the associated services.
E.g. like described in this article: https://linux-audit.com/unused-linux-users-delete-or-keep/
I've deleted those users: adm, lp, news, uucp, operator, smmsp
And a few groups: adm, disk, lp, news, uucp, smmsp

So, checkpath was failing due to non-existent uucp group.

I find it a bit strange that /run/lock has to be owned by uucp group, even on a system where uucp is irrelevant.
Isn't Gentoo all about choice? But this is hardcoded deep within openrc...

P.S. If you notice any of the other users/groups I've deleted as important, please tell me :) Who knows what else might be a bit broken on my system?
Back to top
View user's profile Send private message
mike155
l33t
l33t


Joined: 17 Sep 2010
Posts: 661
Location: Frankfurt, Germany

PostPosted: Fri Nov 16, 2018 12:09 pm    Post subject: Reply with quote

Quote:
And a few groups: adm, disk, lp, news, uucp, smmsp

There are some files/devices in /dev which should have the group 'disk':
Code:
crw-rw----  1  root  disk  10, 237  Nov 16 12:35  loop-control
brw-rw----  1  root  disk   7,   0  Nov 16 12:35  loop0
...
brw-rw----  1  root  disk   7,   7  Nov 16 12:35  loop7
brw-rw----  1  root  disk   8,   0  Nov 16 12:35  sda
brw-rw----  1  root  disk   8,   1  Nov 16 12:35  sda1
...
crw-rw----  1  root  disk  21,   0  Nov 16 12:35  sg0

If you run cups, you will need group 'lp'.
Back to top
View user's profile Send private message
heilong
n00b
n00b


Joined: 23 May 2005
Posts: 43

PostPosted: Fri Nov 16, 2018 12:58 pm    Post subject: Reply with quote

Thanks Mike.
As this is a VPS I don't have any of these special files in /dev, but I guess I'll restore the disk group for good measure.
I don't have cups on my VPS.
Back to top
View user's profile Send private message
Hu
Moderator
Moderator


Joined: 06 Mar 2007
Posts: 13021

PostPosted: Fri Nov 16, 2018 11:21 pm    Post subject: Reply with quote

heilong wrote:
I find it a bit strange that /run/lock has to be owned by uucp group, even on a system where uucp is irrelevant.
This is probably a historical artifact related to early usage of /var/lock. It may not need to be owned by that group, but changing it would mean validating everything that currently uses that directory.
heilong wrote:
Isn't Gentoo all about choice? But this is hardcoded deep within openrc...
That is a common meme whenever someone hits some hardcoded rule they don't like. ;) The choice aspect is that you're welcome to change it, and Gentoo makes it easy to do so locally by patching the relevant packages. You get to keep the pieces if it doesn't work though.
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2685
Location: Illinois, USA

PostPosted: Fri Nov 16, 2018 11:37 pm    Post subject: Reply with quote

Code:
tony@MSI ~ $ ls -l /var/lock
lrwxrwxrwx 1 root root 9 Sep  3  2014 /var/lock -> /run/lock
tony@MSI ~ $ ls -l /run/lock
total 4
-rw-r--r-- 1 root root  22 Nov 16 17:09 asound.state.lock
drwxr-xr-x 3 root root 320 Nov 16 17:22 samba

This is from a system running very early openrc (not in tree). Root as an owner does seem to make more sense than uucp.
Back to top
View user's profile Send private message
mike155
l33t
l33t


Joined: 17 Sep 2010
Posts: 661
Location: Frankfurt, Germany

PostPosted: Sat Nov 17, 2018 12:11 am    Post subject: Reply with quote

Tony0945, you showed us the group of the link '/var/lock'. But you didn't show us the group of '/run/lock'. I guess it's uucp, isn't it?

Here is what I get on my machine:
Code:
$ ls -la /var/lock
lrwxrwxrwx 1 root root 9 Nov 24  2012 /var/lock -> /run/lock
$ ls -la /run/lock
drwxrwxr-x  3 root uucp  80 Nov 17 00:40 .     # <-- group uucp
drwxr-xr-x 17 root root 560 Nov 16 12:41 ..
-rw-r--r--  1 root root  22 Nov 16 12:35 asound.state.lock
drwx------  2 root root  40 Nov 16 12:35 lvm


Last edited by mike155 on Sat Nov 17, 2018 12:16 am; edited 1 time in total
Back to top
View user's profile Send private message
Tony0945
Advocate
Advocate


Joined: 25 Jul 2006
Posts: 2685
Location: Illinois, USA

PostPosted: Sat Nov 17, 2018 12:13 am    Post subject: Reply with quote

mike155 wrote:
Tony0945, you didn't show us the group of /run/lock. I guess it's uucp, isn't it?


You're right!
Code:
~ $ ls -al /run/lock
total 4
drwxrwxr-x  3 root uucp  80 Nov 16 18:10 .
drwxr-xr-x 10 root root 480 Nov 16 17:09 ..
-rw-r--r--  1 root root  22 Nov 16 17:09 asound.state.lock
drwxr-xr-x  3 root root 320 Nov 16 17:22 samba


EDIT: But it's the only one:
Code:
~ $ ls -al /run|grep uucp
drwxrwxr-x  3 root uucp     80 Nov 16 20:20 lock

`Curiouser and curiouser!'
Code:
 ~ $ grep uucp /etc/group
uucp:x:14:uucp,mythtv
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo 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