What are these default root crontabs and what do they do?

alex01763

Member
Feb 28, 2023
36
3
13
Hello everyone!
My server kept crashing around the same time every month or two. I run unraid as a vm and that's when my automatic parity checks are done so I thought it was some kind of compatibility issue with proxmox and unraid until now. It just happened again so I was going through the system logs, and I found out that just before the crash there were some notice about cron jobs running for root. I never noticed it so I checked it and found out there were these scripts that I never set up myself. It seems like it came with the proxmox installation and one of the hourly jobs says it's doing something like a parity check, and there seems to be many other like it, just references of references of other scripts.

My question is: what are these "factory" cron scripts and is it safe to turn them off? if not, are they all really neccessary?

1776162574815.png

I was about to share one of the actual scripts but on second thought, that didn't seem like a good idea. but in the /etc/cron.hourly script, it references some other script that references some other script, and so on.

the log referencing the cron job I was talking about. read bottom to up, and the [ code ] part is when it stops logging. same pattern every time before crashes:

Code:
Apr 14 16:52:40 node-main smartd[2035]: Device: /dev/sdb [SAT], SMART Usage Attribute: 194 Temperature_Celsius changed from 34 to 35
Apr 14 16:52:40 node-main smartd[2035]: Device: /dev/sdb [SAT], SMART Usage Attribute: 190 Airflow_Temperature_Cel changed from 66 to 65
Apr 14 16:17:01 node-main CRON[1263330]: pam_unix(cron:session): session closed for user root
Apr 14 16:17:01 node-main CRON[1263332]: (root) CMD (cd / && run-parts --report /etc/cron.hourly)
Apr 14 16:17:01 node-main CRON[1263330]: pam_unix(cron:session): session opened for user root(uid=0) by root(uid=0)
 
Last edited:
The directories/jobs are default Debian. Scripts can be put in the directories to run as indicated.

If your server is crashing at 16:52 (?) I’d think the cron 45m earlier isn’t related.
It looks like there is a cron set every 47 minutes so I thought that might be related to something. If i follow that script, it says it has to do something with parity checks. It doesn't really look debian, I daily drive linux mint, but i haven't seen anything like that. Also as i mentioned, I didn't write that, it came with the proxmox installation, so I want to know if it is safe to get rid of all this.
 
Code:
root@pve1:~# pveversion
pve-manager/9.1.7/16b139a017452f16 (running kernel: 6.17.13-2-pve)
root@pve1:~# cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.

SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

# Example of job definition:
# .---------------- minute (0 - 59)
# |  .------------- hour (0 - 23)
# |  |  .---------- day of month (1 - 31)
# |  |  |  .------- month (1 - 12) OR jan,feb,mar,apr ...
# |  |  |  |  .---- day of week (0 - 6) (Sunday=0 or 7) OR sun,mon,tue,wed,thu,fri,sat
# |  |  |  |  |
# *  *  *  *  * user-name command to be executed
17 *    * * *   root    cd / && run-parts --report /etc/cron.hourly
25 6    * * *   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.daily; }
47 6    * * 7   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.weekly; }
52 6    1 * *   root    test -x /usr/sbin/anacron || { cd / && run-parts --report /etc/cron.monthly; }
#
root@pve1:~# ls -l /etc/cron.hourly/
total 0
root@pve1:~#
 
  • Like
Reactions: alex01763
Code:
root@pve1:~# pveversion
pve-manager/9.1.7/16b139a017452f16 (running kernel: 6.17.13-2-pve)
root@pve1:~# cat /etc/crontab
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file
# and files in /etc/cron.d. These files also have username fields,
# that none of the other crontabs do.
root@pve1:~#

Hey thanks for sharing this! I just saw this and noticed this was way different than what I was looking at, and it turns out I was confused between two ssh terminals. The one I was asking was actually one of my other vms, so you saved me from messing up.
 
Linux Mint 22.3 has something similar in /etc/crontab (but uses anacron). You can remove it if you want to break this part of cron's functionality (and restore it by reinstalling cron).
Cron is not something that tends to crash your system. It does start other things (that should also not crash your system) and is therefore regularly found in the system logs. Crashing is usually cased by hardware issues or BIOS incompatibilities, unfortunately, there is not always a log from the crash itself (as it cannot always be reported before the power goes out or flushed to disk on time).
I guess I'm back to square one... I'm suspecting it's my cheap esata ata controller but I'll have to open a new post if I can find anything later. Thank you for the advice!
 
Note that there may be additional systemd-timers, which are not visible in the classic crontab context. Run systemctl list-timers -a instead.

You also did not mention user-specific crontabs, editable by everybody by crontab -e - including one for the "root"-user.