[LFS Trac] #2160: Bootscript functions handle stale pid files poorly

LFS Trac trac at linuxfromscratch.org
Sun May 25 16:01:23 PDT 2008

#2160: Bootscript functions handle stale pid files poorly
 Reporter:  dnicholson at linuxfromscratch.org  |        Owner:  lfs-book at linuxfromscratch.org
     Type:  defect                           |       Status:  new                          
 Priority:  normal                           |    Milestone:  7.0                          
Component:  Bootscripts                      |      Version:  SVN                          
 Severity:  critical                         |   Resolution:                               
 Keywords:                                   |  
Comment (by dnicholson at linuxfromscratch.org):

 I think I figured out the reason why cleanfs isn't doing the right thing
 for me on some occasions. My TZ is UTC-8 (PDT) and the hwclock is stored
 in localtime. When mountkernfs runs, setclock has not been run yet. So,
 /proc and /sys both have modification times 8 hours (7 w/DST) prior to the
 current time. cleanfs checks for files in /var/run that are older than
 /proc. In this case, the faulty file is within that 7 hour window because
 I'd rebooted this morning, too:

 $ ls -ld /proc /sys /var/run/NetworkManager.pid
 dr-xr-xr-x 127 root root 0 2008-05-25 08:22 /proc
 drwxr-xr-x  11 root root 0 2008-05-25 08:22 /sys
 -rw-r--r--   1 root root 4 2008-05-25 10:09 /var/run/NetworkManager.pid

 So, cleanfs doesn't remove the stale file. I don't know the correct
 solution to this, but a couple things I think might help cleanfs:

 1. Don't use /proc as the marker. Since mounting this (and /sys and /dev)
 are the very first things, it's very likely the system clock is not
 accurate. Maybe /etc/mtab is a good file to use as the marker since we
 know we've just run checkfs and mountfs.

 2. Don't use any time marker, i.e., drop the ! -newer in the find command.
 This would make the assumption that nothing useful would be put in
 /var/run before cleanfs has been run. FWIW, on fedora they do this.

Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/2160#comment:5>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.

More information about the lfs-book mailing list