Bug 670116

Summary: [systemd] service crond loaded but inactive
Product: [Fedora] Fedora Reporter: Joachim Frieben <jfrieben>
Component: cronieAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: lpoetter, metherid, mmaslano, mschmidt, notting, pertusus, plautrba, tmraz
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: cronie-1.4.7-2.fc15 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-05-09 04:04:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Joachim Frieben 2011-01-17 08:59:13 UTC
Description of problem:
$ service crond status
crond.service - Command Scheduler
	  Loaded: loaded (/lib/systemd/system/crond.service)
	  Active: inactive (dead)
	  CGroup: name=systemd:/system/crond.service

As a consequence, cron jobs like mlocate.cron never get run.

Version-Release number of selected component (if applicable):
systemd-16-1.fc15

How reproducible:
Always

Steps to Reproduce:
1. Install "rawhide" system from recent desktop live CD.
2. Wait a couple of days.
3. Run 'locate <file_name>'.
  
Actual results:
locate: can not stat () `/var/lib/mlocate/mlocate.db': No such file or directory

Expected results:
Command 'locate <file_name>' returns files which correspond to the argument.

Additional info:
- Service cron is enabled and should be operational as shown by
  $ chkconfig --list | grep cron
  crond  0:off  1:off  2:on  3:on  4:on  5:on  6:off
- System got already installed with the current systemd-16-1.fc15.

Comment 1 Joachim Frieben 2011-01-17 09:14:27 UTC
It is possible though to start crond manually:

$ service crond status
crond.service - Command Scheduler
	  Loaded: loaded (/lib/systemd/system/crond.service)
	  Active: active (running) since Sat, 15 Jan 2011 18:12:18 +0100; 2s ago
	Main PID: 26656 (crond)
	  CGroup: name=systemd:/system/crond.service
		  └ 26656 /usr/sbin/crond -n

Comment 2 Marcela Mašláňová 2011-01-17 13:26:53 UTC
I added into post new line, just to be sure crond will be added:
/bin/systemctl enable crond.service >/dev/null 2>&1 || :

But I'm also seeing Active: inactive (dead). I suppose cron daemon should be running after installation, especially when I have jobs to be executed.

Comment 3 Petr Lautrbach 2011-01-17 13:44:37 UTC
(In reply to comment #2)
> But I'm also seeing Active: inactive (dead). I suppose cron daemon should be
> running after installation, especially when I have jobs to be executed.

No, it should not. "Installations can be in changeroots, in an installer context, or in other situations where you don't want the services started."

Comment 4 Joachim Frieben 2011-01-17 14:07:01 UTC
(In reply to comment #3)
Since 'chkconfig --list crond' does return
  crond  0:off  1:off  2:on  3:on  4:on  5:on  6:off
which was the default setting, systemd should actually bring up cron: if not it is a bug.

Comment 5 Bill Nottingham 2011-01-17 17:08:26 UTC
On reboot, yes. Directly after package installation... no.

Comment 6 Lennart Poettering 2011-01-18 20:57:23 UTC
Hmm, my guess is that the spec file of the cronie package is missing the right %triggerun directives to make sure that when upgrading from a cronie package that only has sysv scripts to one that ships both sysv scripts and systemd unit files cronie is enabled in systemd if and only if the sysv service was previously enabled. 

See https://fedoraproject.org/wiki/TomCallaway/Systemd_Revised_Draft#Unit_files_in_spec_file_scriptlets for details, specifically the part about "To facilitate upgrades from older packages carrying SysV scripts, add the following scriptlet:".

Does the cronie package contain such a directive?

Comment 7 Marcela Mašláňová 2011-01-19 10:32:10 UTC
(In reply to comment #6)
> Hmm, my guess is that the spec file of the cronie package is missing the right
> %triggerun directives to make sure that when upgrading from a cronie package
> that only has sysv scripts to one that ships both sysv scripts and systemd unit
> files cronie is enabled in systemd if and only if the sysv service was
> previously enabled. 
> 
> See
> https://fedoraproject.org/wiki/TomCallaway/Systemd_Revised_Draft#Unit_files_in_spec_file_scriptlets
> for details, specifically the part about "To facilitate upgrades from older
> packages carrying SysV scripts, add the following scriptlet:".
> 
> Does the cronie package contain such a directive?

I'd like to remind you that's only a draft. You should really start cooperating with FPC people sooner and rawhide would be working better at the moment.

Are you saying that all daemons will need this ugly hack to be safely updated? Usually we are trying to avoid triggers at all because errors in them is hard to fix and make specfiles unreadable. I'll wait with fix until final decision of FPC.

Comment 8 Lennart Poettering 2011-02-16 23:01:20 UTC
(In reply to comment #7)
> (In reply to comment #6)
> > Hmm, my guess is that the spec file of the cronie package is missing the right
> > %triggerun directives to make sure that when upgrading from a cronie package
> > that only has sysv scripts to one that ships both sysv scripts and systemd unit
> > files cronie is enabled in systemd if and only if the sysv service was
> > previously enabled. 
> > 
> > See
> > https://fedoraproject.org/wiki/TomCallaway/Systemd_Revised_Draft#Unit_files_in_spec_file_scriptlets
> > for details, specifically the part about "To facilitate upgrades from older
> > packages carrying SysV scripts, add the following scriptlet:".
> > 
> > Does the cronie package contain such a directive?
> 
> I'd like to remind you that's only a draft. You should really start cooperating
> with FPC people sooner and rawhide would be working better at the moment.

I have been talking to Spot all the time. I am not sure what gets you to the conclusion I wasnt cooperating with them.

> Are you saying that all daemons will need this ugly hack to be safely updated?

Yes.

> Usually we are trying to avoid triggers at all because errors in them is hard
> to fix and make specfiles unreadable. I'll wait with fix until final decision
> of FPC.

Well, that part has already been agreed on (not officially though).

Comment 9 Lennart Poettering 2011-02-16 23:15:24 UTC
Anyway, reassigning to cronie, since this should be fixed in the cronie .spec file.

Comment 10 Marcela Mašláňová 2011-02-21 12:04:04 UTC
It wasn't fixed yet.

Comment 11 Joachim Frieben 2011-02-21 12:41:57 UTC
(In reply to comment #10)
For me, the issue was resolved some time ago. It never occurred again after installing TC2 from scratch. And finally, what is this?

* Mon Jan 17 2011 Marcela Mašláňová <mmaslano redhat com> - 1.4.6-8
- enable crond even with systemctl

Comment 12 Marcela Mašláňová 2011-02-21 15:43:26 UTC
But there is still missing daemon-reload line, which could be crucial in some cases. I'm still waiting for approval of packaging draft.

Comment 13 Fedora Update System 2011-05-06 07:02:12 UTC
cronie-1.4.7-2.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/cronie-1.4.7-2.fc15

Comment 14 Fedora Update System 2011-05-07 15:05:46 UTC
Package cronie-1.4.7-2.fc15:
* should fix your issue,
* was pushed to the Fedora 15 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing cronie-1.4.7-2.fc15'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/cronie-1.4.7-2.fc15
then log in and leave karma (feedback).

Comment 15 Fedora Update System 2011-05-09 04:04:45 UTC
cronie-1.4.7-2.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.