Debugging

no crontab for root.

This isn't a cron failure. It means the user you ran crontab as has no personal crontab file. Either you're looking at the wrong user, your jobs live in a system crontab, or there's simply nothing there yet.

Where the message comes from

When you run crontab -l, crontab tries to open the user's file in the spool directory. If the file doesn't exist it prints no crontab for <user> and exits with status 1. Debian cron and cronie both do this; we confirmed the exit code on Ubuntu 24.04.

$ crontab -l
no crontab for root
$ echo $?
1

With crontab -e you get a gentler version, and an empty file opens in your editor:

no crontab for root - using an empty one

Where the file would be

DistrocronUser crontab path
Debian, UbuntuDebian cron/var/spool/cron/crontabs/<user>
Fedora, RHEL, Rocky, Alma, Amazon Linux, Archcronie/var/spool/cron/<user>

Don't edit these files directly; always go through crontab -e so the syntax gets checked.

Four reasons you see it

1. You used sudo, so you're looking at root's crontab

sudo crontab -l lists root's crontab, not yours. If you added jobs as your normal user, list them without sudo, or name the user:

crontab -l                    # your own
sudo crontab -l -u alice      # someone else's

2. The jobs are in a system crontab

crontab -l only shows the per-user file. System jobs live in /etc/crontab, /etc/cron.d/ and the /etc/cron.{hourly,daily,weekly,monthly}/ folders. Check those:

cat /etc/crontab
ls -l /etc/cron.d/

See user crontab vs /etc/crontab for how they differ (system files have an extra username field), and how to list every cron job on the server.

3. It's a fresh server or container

Nobody has created a crontab yet. Make one with crontab -e (how to edit a crontab), or install one from a file:

crontab mycron.txt
crontab -l          # should now print your jobs and exit 0

4. Your script breaks because of the exit status

Scripts that add a job with crontab -l | … | crontab - fail under set -e or set -o pipefail on a machine with no crontab, because crontab -l returns 1. Make the listing step tolerant:

{ crontab -l 2>/dev/null || true; echo "*/5 * * * * /usr/local/bin/job.sh"; } | crontab -

Run it twice and you'll get the line twice. To keep it idempotent, filter the old line out first:

JOB="*/5 * * * * /usr/local/bin/job.sh"
{ crontab -l 2>/dev/null | grep -vF "/usr/local/bin/job.sh" || true; echo "$JOB"; } | crontab -
If you expected jobs to be there and they've vanished, check whether someone ran crontab -r (remove), or whether you're on a different server or container than you think (hostname).

Sources

Checked against these official sources and, where marked, tested on Ubuntu 24.04 (cron 3.0pl1-184ubuntu2). Last verified 18 November 2026.