cron @reboot rules fail for users wuth autofs homes, due to missing upstart dependancy
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cron (Ubuntu) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
Binary package hint: cron
If a user has a @reboot cron entry like:
===
@reboot date >> date.log
===
And their home directory is mounted by autofs into /home
then, the job will fail during a machine reboot because the
cron service starts before autofs service.
I think this is a missing dependency between in the cron upstart
configuration, to fix this I think that cron should be started after
autofs (only when autofs is enabled).
ProblemType: Bug
Architecture: amd64
Date: Fri Dec 31 12:32:49 2010
Dependencies:
adduser 3.112ubuntu1
base-files 5.0.0ubuntu23
base-passwd 3.5.22
coreutils 8.5-1ubuntu3
debconf 1.5.32ubuntu3
debconf-i18n 1.5.32ubuntu3
debianutils 3.2.3
dpkg 1.15.8.4ubuntu3
findutils 4.4.2-1ubuntu1
gcc-4.5-base 4.5.1-7ubuntu2
libacl1 2.2.49-3
libattr1 1:2.4.44-2
libbz2-1.0 1.0.5-4ubuntu1
libc-bin 2.12.1-0ubuntu10
libc6 2.12.1-0ubuntu10
libdb4.8 4.8.30-1
libgcc1 1:4.5.1-7ubuntu2
liblocale-
liblzma2 4.999.9beta+
libncurses5 5.7+20100626-
libpam-modules 1.1.1-4ubuntu2
libpam-runtime 1.1.1-4ubuntu2
libpam0g 1.1.1-4ubuntu2
libselinux1 2.0.94-1
libtext-
libtext-iconv-perl 1.7-2
libtext-
lsb-base 4.0-0ubuntu8
ncurses-bin 5.7+20100626-
passwd 1:4.1.4.2-1ubuntu3
perl-base 5.10.1-12ubuntu2
sed 4.2.1-7
sensible-utils 0.0.4ubuntu1
tzdata 2010o-0ubuntu0.
xz-utils 4.999.9beta+
zlib1g 1:1.2.3.
DistroRelease: Ubuntu 10.10
NonfreeKernelMo
Package: cron 3.0pl1-114ubuntu1
PackageArchitec
ProcEnviron:
PATH=(custom, no user)
LANG=en_US.UTF-8
SHELL=/bin/bash
ProcVersionSign
SourcePackage: cron
Tags: maverick
Uname: Linux 2.6.35-24-generic x86_64
/etc/init/cron.conf
===
# cron - regular background program processing daemon
#
# cron is a standard UNIX program that runs user-specified programs at
# periodic scheduled times
description "regular background program processing daemon"
start on runlevel [2345]
stop on runlevel [!2345]
expect fork
respawn
exec cron
===
ps aux | grep -E '(automount|cron)'
root 1542 0.0 0.0 21128 628 ? Ss Dec23 0:01 cron
root 1867 0.0 0.0 123208 1044 ? Ssl Dec23 0:02 /usr/sbin/automount
cron has a lower pid so it started first...
For an example of how automount of home is done:
Two parts, to get automount to manage directories in /home:
grep home /etc/auto.master
===
/home /etc/auto.home
===
To tell autofs what directories to attach to /home:
cat /etc/auto.home
===
* :/media/sdd1/home/& :/media/sdc1/home/& /some/other/place/&
===
Directories in those three source places will be mounted in /home automatically.
Since cron is running the @reboot rules for each user before the home
directory is mounted any cron job which relies on the home directory being
mounted will fail.
In the example the date.log should be written into the home directory,
in my real use cases I have daemon like scripts which are supposed to
be running all the time, live in my home directory and should get restarted
by cron after reboots.