Errors in crontab file, can't install
You will see this when crontab refuses to install a file it cannot parse. The previous crontab is left in place.
What causes this error
A crontab is a short file with a strict format. Each line is one of:
- a blank line
- a comment, starting with
# - an environment assignment, such as
MAILTO="" - a schedule followed by a command
The file has to end with a newline. System crontab files (/etc/crontab and files in /etc/cron.d) need a username between the schedule and the command. A user crontab from crontab -e does not have that field.
On Debian and Ubuntu, crontab -e prints a line before the error, then asks if you want to try the edit again:
crontab: installing new crontab
"/tmp/crontab.gLfS38/crontab":10: bad minute
errors in crontab file, can't install.
Do you want to retry the same edit? (y/n)
Answer y and the editor opens again. The quoted path is a temporary copy, and only crontab -e uses it: a file named crontab inside a directory like /tmp/crontab.gLfS38. crontab /path/to/file names the file you passed, and it does not print the installing line or the retry prompt. On Debian and Ubuntu the number is the line before the broken one. The example says 10, so the broken line is 11. cronie usually reports the broken line itself. A line that is only one word, such as notaminute, is that line on Debian and Ubuntu, and the line before it on cronie. A path such as /usr/bin/foo is the other way around.
cronie (Red Hat, Fedora, and cronie installed elsewhere) uses a temporary file for crontab -e, named like /tmp/crontab.XXXXXX, not a directory. The first error line has the same shape. On RHEL 8 the closing line is errors in crontab file, can't install. On RHEL 9 and current Fedora it is Invalid crontab file, can't install.
If a bad line is already in the spool, Debian and Ubuntu cron log Syntax error, this crontab file will be ignored and run none of the jobs in that file. cronie still runs the other jobs in the file.
How to fix this error
The line with the quoted path names the problem. Two of them are common enough to have their own pages:
The five schedule fields are in Cron job schedule syntax. If you are still stuck, man 5 crontab on the host is the local reference.
Want alerts if your cron jobs stop working?
Monitor your cron jobs with Cronitor to easily collect output, capture errors and alert you when something goes wrong.