Author Topic: cronie / cronie-anacron update deletes crontab file[s]  (Read 1350 times)

Offline Almost-retired

  • Sr. Member
  • ****
  • Posts: 252
    • What keeps Gene out of the bars
cronie / cronie-anacron update deletes crontab file[s]
« on: March 21, 2011, 01:06:11 AM »
Greetings;

I just had to re-compose all of my various users crontabs.  This after letting the package manager update cronie this morning.

Made particularly difficult for my backup program amanda because I can't run the desktop configuration tool as amanda while logged in as gene, and as gene, it is invisible in the task managers display.  Heck, amanda doesn't even have an assigned passwd so I have to sudo, then su amanda before I can edit that crontab.

I think I have most of them regenerated, but it remains to be see if the custom logrotations and such happen.  And I think all my automatic spam training scripts are gone too!  That sucks, about a 10-33 tor vacuum.  :(

Was this intended?  If so, it should have had warning labels so I could pop off to another shell and make backup copies before allowing it to wipe all the crontabs clean & reset to defaults.

Sign me not a happy camper.

Gene

Offline mrloy

  • New Friend
  • *
  • Posts: 2
cronie / cronie-anacron update deletes crontab file[s]
« Reply #1 on: March 21, 2011, 01:16:09 AM »
There was recently an update to cronie-1.4.1-3pclos2010.i586 and cronie-anacron-1.4.1-3pclos2010.i586.

When I updated the packages on my home and work systems I noticed that rsnapshot, scheduled by cron,
was no longer being run. When I check /var/spool/cron the directory is empty. Luckily, /var is backed up so
I could restore root's crontab file. This is a rather serious bug IMHO.

Offline YouCanToo

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 5337
  • Location: Lebanon, OR., USA
    • Spreading the word.......
Re: cronie / cronie-anacron update deletes crontab file[s]
« Reply #2 on: March 21, 2011, 02:55:38 AM »
what path are you looking at. I noticed that there are two different paths to the cron folder.

/var/spool/cron
/var/lib/spool/cron.

The one that you should have your files in, is the latter /var/lib/spool/cron otherwise it isn't going to work.  My solution was to make a soft link as root  IE: ln -s /var/lib/spool/cron /var/spool/cron
« Last Edit: March 30, 2011, 02:38:32 PM by YouCanToo »




Be sure to visit the NEW Knowledge Base


Linux is user-friendly- it's just picky who its friends are!

Offline mrloy

  • New Friend
  • *
  • Posts: 2
Re: cronie / cronie-anacron update deletes crontab file[s]
« Reply #3 on: March 21, 2011, 04:46:14 AM »
Thanks for the reply.

what path are you looking at. I noticed that they are two different paths to the cron folder.

/var/spool/cron
/var/lib/spool/cron.

The one that you should have your files in, is the latter /var/lib/spool/cron otherwise it isn't going to work.  My solution was to make a soft link as root  IE: ln -s /var/lib/spool/cron /var/spool/cron

I've never heard of /var/lib/spool/cron before. I've just checked and the old root crontab is there. However, cron doesn't appear to use it. From the cron man page:

Quote
Cron  searches  /var/spool/cron for crontab files which are named after accounts
in /etc/passwd; The found crontabs are loaded into the memory.

The fact that my cron jobs stopped running after the /var/spool/cron/root disappeared implies to me that that is indeed where cron expects to find user crontab files. Also, 'crontab -e' places crontab files in /var/spool/cron. The soft link would fail as well if the package update deletes files in /var/spool/cron as then the files in /var/lib/spool/cron would be deleted. Why there should be 2 locations for crontabs seems very strange.


Offline Almost-retired

  • Sr. Member
  • ****
  • Posts: 252
    • What keeps Gene out of the bars
Re: cronie / cronie-anacron update deletes crontab file[s]
« Reply #4 on: March 21, 2011, 06:21:18 AM »
2 paths for crontabs?  Hell, I never knew they went anyplace but /etc/cron.*.  Been using linux too damned long I guess.  Next thing I know I'm a mushroom, kept in the dark & fed ...

So now I have the new files I created, in /var/spool/cron, and all the old files are in /var/lib/spool/cron.  I'll copy the old ones to the new path, but this needs fixed.

Sigh...  Many thanks for the replies folks, I don't know what I'd do w/o you all.

Cheers, Gene

Online kjpetrie

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 4001
Re: cronie / cronie-anacron update deletes crontab file[s]
« Reply #5 on: March 30, 2011, 04:56:42 AM »
Looks as if the location has been changed and then changed back over time, as my cron jobs reverted to what they had been before I installed 2010 (must have been from a restored backup and lying around unused until this latest change)!

Certainly confused me to see my system go back in time a year.
-----------
KJP
-----------------------------------------------------------
PClos64 RC1 on Intel D945GCLF2 motherboard (Atom 330), 2GB DDR2 RAM, Maxtor STM325031, HL-DT-ST DVDRAM GSA-H42N, Amilo LSL 3220T monitor. Also Acer 5810TG (with custom kernel) and Asus eeePC 2G surf

Offline YouCanToo

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 5337
  • Location: Lebanon, OR., USA
    • Spreading the word.......
Re: cronie / cronie-anacron update deletes crontab file[s]
« Reply #6 on: March 30, 2011, 02:57:43 PM »
Thanks for the reply.

what path are you looking at. I noticed that they are two different paths to the cron folder.

/var/spool/cron
/var/lib/spool/cron.

The one that you should have your files in, is the latter /var/lib/spool/cron otherwise it isn't going to work.  My solution was to make a soft link as root  IE: ln -s /var/lib/spool/cron /var/spool/cron

I've never heard of /var/lib/spool/cron before. I've just checked and the old root crontab is there. However, cron doesn't appear to use it. From the cron man page:

Quote
Cron  searches  /var/spool/cron for crontab files which are named after accounts
in /etc/passwd; The found crontabs are loaded into the memory.

The fact that my cron jobs stopped running after the /var/spool/cron/root disappeared implies to me that that is indeed where cron expects to find user crontab files.

Well that assumption  could well indeed be true for cronnie, but since this is relatively new to synaptic. The version of cron that was being used before may not of used that path though.

Quote
Also, 'crontab -e' places crontab files in /var/spool/cron. The soft link would fail as well if the package update deletes files in /var/spool/cron as then the files in /var/lib/spool/cron would be deleted.

No they would not be removed. It would just act the same as if it were the folder at /var/spool/cron.

Quote
Why there should be 2 locations for crontabs seems very strange.


It could be that we were using a different cron program before cronnie was added and the original program used /var/lib/spool/cron.  No matter the solution to the issue is really quite simple. Either create a soft link as mentioned, which does work quite well, or just move the files in /var/lib/spool/cron to /var/spool/cron




Be sure to visit the NEW Knowledge Base


Linux is user-friendly- it's just picky who its friends are!

Offline craesz

  • PCLinuxOS Tester
  • Hero Member
  • *******
  • Posts: 983
Re: cronie / cronie-anacron update deletes crontab file[s]
« Reply #7 on: April 18, 2011, 05:47:33 AM »
Just ran into this issue from a little different angle. In case you want to know about it, http://www.pclinuxos.com/forum/index.php/topic,89991.msg754329.html#msg754329. Cheers.
Desktop1: AMD64 8450 [3 core]; 8GB; 3.2.18-pclos2.pae.bfs; KDE
Desktop2: AMD64 5400 [8 core]; 16GB; 3.2.16-a64; KDE
Netbook: EeePC 901; Atom N270; 1GB; 2.6.33.7-pclos6.bfs; KDE