1

The cron log at /var/log/cron gives me the following when I reboot the system or manually start cron (with /etc/init.d/cron start command):

Jul  2 10:17:31 monserver /usr/sbin/cron[17386]: (CRON) INFO (pidfile fd = 3)
Jul  2 10:17:31 monserver /usr/sbin/cron[17387]: (CRON) STARTUP (fork ok)
Jul  2 10:17:31 monserver /usr/sbin/cron[17387]: (CRON) DEATH (Can't create reboot check file)

Verified that cron is truly not running with ps aux | grep cron

This server has recently had permissions issues with other applications (nagios for one). I wouldn't be surprised if that's the case here, but I haven't been able to track down the location of this "reboot check file". It's an older Debian system (ver 5.0.2).

Please let me know if more info is required

3 Answers 3

1

This is by the way the Debian specific code being triggered. As karmawhore already have stated, it does seem like you have permission problems with /var/run, preventing /var/run/crond.reboot from being created.

#ifdef DEBIAN
#define REBOOT_FILE "/var/run/crond.reboot"
       /* Run on actual reboot, rather than cron restart */
       if (access(REBOOT_FILE, F_OK) == 0) {
               /* File exists, return */
               log_it("CRON", getpid(),"INFO",
                      "Skipping @reboot jobs -- not system startup");
               return;
       }
       /* Create the file */
       if ((rbfd = creat(REBOOT_FILE, S_IRUSR&S_IWUSR)) < 0) {
               /* Bad news, bail out */
               log_it("CRON",getpid(),"DEATH","Can't create reboot check file");
               exit(0);
       } else {
               close(rbfd);
               log_it("CRON", getpid(),"INFO", "Running @reboot jobs");
       }


        Debug(DMISC, ("[%d], Debian running reboot jobs\n",getpid()));

#endif
2
  • The /var/run directory does have the 755 permissions set. The owner:group is set to root, is this correct? What is this checking for " if ((rbfd = creat(REBOOT_FILE, S_IRUSR&S_IWUSR)) < 0) "?
    – locustpocust
    Jul 2, 2010 at 17:07
  • 1
    The creat() system call will return -1 if it fails for any reason (see man 2 creat). It's supposed to set errno so you know the exact reason it failed, but Debian apparently doesn't check for it or log it. You might try running cron by hand under strace to get the exact error code. The creat(2) manpage shows the errors it can return, and you can map those to the error numbers in /usr/include/asm-generic/errno-base.h or /usr/include/asm-generic/errno.h. Jul 2, 2010 at 18:03
0

Cron appears to be running after manually creating an empty /var/run/crond.reboot file and restarting cron (with /etc/init.d/cron start). Bizarre. Probably just a temporary fix. It survives being restarted, but it remains to be seen whether it will survive a system reboot (fun for another day). Thanks karmawhore and andol for your much needed advice.

0

It sounds like /var/run has incorrect permissions, 755 is what the base debian installer sets /var/run

Alternatively, perhaps /var/run/crond.reboot has become immutable.

Run

lsattr /var/run/crond.reboot

to see if the i or a bits are set.

Run

chattr -ia /var/run/crond.reboot 

if either or both are set.

1
  • Thanks for the response. The /var/run/crond.reboot file is not being created at all. The crond.pid file is being created. /var/run has the 755 permissions set: drwxr-xr-x 10 root root 4096 2010-07-02 11:49 run
    – locustpocust
    Jul 2, 2010 at 17:03

You must log in to answer this question.