Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 603460 - sys-process/cronbase: run-crons should recover from bad /var/spool/crontab/lastrun/ state
Summary: sys-process/cronbase: run-crons should recover from bad /var/spool/crontab/la...
Status: RESOLVED INVALID
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Cron Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-12-22 12:55 UTC by Rafal Lalik
Modified: 2017-01-13 14:49 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rafal Lalik 2016-12-22 12:55:04 UTC
I found a problem with cron tab. After each restart of the computer, the /var/spool/crontab/lastrun directory is missing from the system.

Additionally, in /usr/sbin/run-crons of sys-process/cronbase there is a line 177:

touch "${LASTRUNDIR}"

which causes that a file is created in place of missing directory. It ends up with following error messages in my logs:

touch: cannot touch '/var/spool/cron/lastrun/cron.hourly': Not a directory
touch: cannot touch '/var/spool/cron/lastrun/cron.daily': Not a directory
touch: cannot touch '/var/spool/cron/lastrun/cron.weekly': Not a directory
touch: cannot touch '/var/spool/cron/lastrun/cron.monthly': Not a directory

and it requires manual removal of lastrun file and creation of directory.


My workaround solution is to add a line:

mkdir -p "${LASTRUNDIR}"

just before the touch command mentioned above, but it is always created after the first run-crons calls, so always first time ends up with the error.

Another solution would be maybe to add in line 124 following code:

test -d "{LASTRUNDIR}" || mkdir -p "${LASTRUNDIR}"


I use sys-process/vixie-cron-4.1-r14 and sys-process/cronbase-0.3.7-r6
Comment 1 c.cboldt 2017-01-13 12:56:54 UTC
I am going to guess that this problem is not with cronbase, but with a mixed bag of mounts when cronbase was installed.

If /var/spool/cron/lastrun/ was created on whatever device is mounted root (/), and later, a device is mounted at /var, where that "later device" doesn't have a spool/cron/lastrun directory, your mounts as a whole will show no /var/spool/cron/lastrun/

Show the output of your `df` command.  If there is a mount at /var, or at /var/spool, umount that and check to see if var/spool/cron/lastrun/ was created on the device mounted as "/"
Comment 2 Rafal Lalik 2017-01-13 14:49:46 UTC
Good hit. Now I realized that my /var/spool was on tmpfs. It was old issue related to my SSD disk, I found some advice to put /var/spool on tmpfs, but it doesn't work for Gentoo.