Cron do not execute @reboot entries in MX18

Report Bugs, Issues and non- package Requests
Post Reply
Message
Author
zimbodel
Posts: 140
Joined: Sun Jan 20, 2019 7:24 pm

Cron do not execute @reboot entries in MX18

#1 Post by zimbodel »

SOLVED:

How to replicate problem:
--------------------------------

Do the following as root user
create a crontabfile with the following entry

@reboot touch /root/crontest.tst
(remember a newline after entry)

Load the crontabfile with
$] crontab crontabfile

Check if it was loaded with
$] crontab -l

If so reboot.

Upon reboot there will be no file in /root called crontest.tst as there should be.

I now tried it on two MX18 installs on two different computers.
On both of them cron doesnt execute @reboot.
I suggest the MX18 developers look at which runlevel cron executes crontab.
This cron bug is as old as 2011 and keeps reappearing.



System:
----------------------------------------------------------

$ cat /proc/version
Linux version 4.19.0-1-amd64 (stevep@mxlinux.org) (gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)) #1 SMP Debian 4.19.5-2~mx17+1 (2018-12-12)

$ cat /etc/*release*
NAME="MX"
VERSION="18 (Continuum)"
ID="mx"
VERSION_ID="18"
PRETTY_NAME="MX 18 (Continuum)"
ANSI_COLOR="0;34"
HOME_URL="https://mxlinux.org"
BUG_REPORT_URL="https://mxlinux.org"
PRETTY_NAME="MX 18 Continuum"
DISTRIB_ID=MX
DISTRIB_RELEASE=18
DISTRIB_CODENAME=Continuum
DISTRIB_DESCRIPTION="MX 18 Continuum"
PRETTY_NAME="Debian GNU/Linux 9 (stretch)"
NAME="Debian GNU/Linux"
VERSION_ID="9"
VERSION="9 (stretch)"
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
Last edited by zimbodel on Tue Jan 22, 2019 7:46 pm, edited 1 time in total.

User avatar
Eadwine Rose
Administrator
Posts: 11895
Joined: Wed Jul 12, 2006 2:10 am

Re: Cron do not execute @reboot entries in MX18

#2 Post by Eadwine Rose »

Please post config things like this between code tags. Select all and then click the </> button up top. That keeps things nicely formatted for you :)

Welcome!
MX-23.2_x64 July 31 2023 * 6.1.0-18-amd64 ext4 Xfce 4.18.1 * 8core AMD Ryzen 7 2700
Asus TUF B450-Plus Gaming UEFI * Asus GTX 1050 Ti Nvidia 525.147.05 * 2x16Gb DDR4 2666 Kingston HyperX Predator
Samsung 860EVO * Samsung S24D330 & P2250 * HP Envy 5030

User avatar
fehlix
Developer
Posts: 10310
Joined: Wed Apr 11, 2018 5:09 pm

Re: Cron do not execute @reboot entries in MX18

#3 Post by fehlix »

zimbodel wrote: Sun Jan 20, 2019 8:46 pm How to replicate problem:
...
This cron bug is as old as 2011 and keeps reappearing.
Works fine here. Have a look:
Example crontab entry for user "root"

Code: Select all

$ sudo crontab -l  | grep touch
@reboot /usr/bin/touch /root/touched_by_crontab_4_root
Example crontab entry for user "fehlix"

Code: Select all

fehlix@mx18kvm:~/Desktop
$  crontab -l  | grep touch
@reboot /usr/bin/touch /home/fehlix/touched_by_crontab_4_fehlix
after reboot:

Code: Select all

$ fehlix@mx18kvm:~/Desktop
$ sudo ls -l /root/touched_by_crontab_4_root $HOME/touched_by_crontab_4_fehlix
-rw-r--r-- 1 fehlix fehlix 0 Jan 21 17:02 /home/fehlix/touched_by_crontab_4_fehlix
-rw-r--r-- 1 root   root   0 Jan 21 17:02 /root/touched_by_crontab_4_root
The only diff to your not working example seems to me that you have not used the full path to your executable "touch".
You cannot rely on some magics that the PATH env-variable is always set properly.
:puppy:
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

zimbodel
Posts: 140
Joined: Sun Jan 20, 2019 7:24 pm

Re: Cron do not execute @reboot entries in MX18

#4 Post by zimbodel »

I tried both full path and without path and it fails miserably in both cases.
I have tried it now with 3 MX reinstalls absolutely vanilla.
Cron didnt work 3/3 .
It executed everythng except @reboot.

User avatar
fehlix
Developer
Posts: 10310
Joined: Wed Apr 11, 2018 5:09 pm

Re: Cron do not execute @reboot entries in MX18

#5 Post by fehlix »

zimbodel wrote: Tue Jan 22, 2019 1:57 pm I tried both full path and without path and it fails miserably in both cases.
I have tried it now with 3 MX reinstalls absolutely vanilla.
Cron didnt work 3/3 .
It executed everythng except @reboot.
If you share with us, what you have tried, somebody might find the show stopper.
You might also consider to watch for cron entries within system log,
perhabs this might give you an indication what's the issue with your crontab.
Here are mine on the system with those two example entries:

Code: Select all

sudo grep -i cron /var/log/syslog
Jan 22 20:03:44 mx18kvm anacron[2078]: Anacron 2.3 started on 2019-01-22
Jan 22 20:03:44 mx18kvm cron[2123]: (CRON) INFO (pidfile fd = 3)
Jan 22 20:03:44 mx18kvm anacron[2078]: Normal exit (0 jobs run)
Jan 22 20:03:44 mx18kvm cron[2142]: (CRON) STARTUP (fork ok)
Jan 22 20:03:44 mx18kvm cron[2142]: (CRON) INFO (Running @reboot jobs)
Jan 22 20:03:44 mx18kvm CRON[2250]: (root) CMD (/usr/bin/touch /root/touched_by_crontab_4_root)
Jan 22 20:03:44 mx18kvm CRON[2252]: (fehlix) CMD (/usr/bin/touch /home/fehlix/touched_by_crontab_4_fehlix)
Have a nice day.
:puppy:
fehlix
Gigabyte Z77M-D3H, Intel Xeon E3-1240 V2 (Quad core), 32GB RAM,
GeForce GTX 770, Samsung SSD 850 EVO 500GB, Seagate Barracuda 4TB

zimbodel
Posts: 140
Joined: Sun Jan 20, 2019 7:24 pm

Re: Cron do not execute @reboot entries in MX18

#6 Post by zimbodel »

Solved it using this.
"https://www.nixcraft.com/t/solved-cron- ... ebian/1858"

anacron was running the same time as cron on a default MX18 installation.

ps -A |grep -i cron
1044 ? 00:00:00 anacron
1051 ? 00:00:00 cron
Happens with Debian Stretch too, but the scary thing is it varies from pc to pc. On some anacron wont show up as daemon and on others it will with same install media and clean install. Anyway, it is all in the link.

If both cron and anacron runs as daemons then @reboot is not executed but all timed * * * * * entries in crontabfile are still executed. Very sneaky.
Its clearly a Debian bug long in the running.

After completely uninstalling anacron on MX18, cron could do its job and all worked great and @reboot commands were executed.
Last edited by zimbodel on Tue Jan 22, 2019 10:02 pm, edited 4 times in total.

skidoo
Posts: 753
Joined: Tue Sep 22, 2015 6:56 pm

Re: Cron do not execute @reboot entries in MX18

#7 Post by skidoo »

zimbodel, thanks for explaining the solution!

Post Reply

Return to “Bugs and Non-Package Requests Forum”