Debugging “crontab -e” Signal 9 Error: Fixing Killed Editor Issue in Ubuntu Linux


8 views

When attempting to edit crontab entries on an Ubuntu 11.04 system, many users encounter this frustrating sequence:

user@server:~$ crontab -e
no crontab for user - using an empty one
Select an editor... [2]: 2
crontab: "/usr/bin/sensible-editor" killed; signal 9 (no core dumped)
Error writing /tmp/crontab.qcuMPr/crontab.save: No such file or directory

Signal 9 (SIGKILL) indicates the system forcibly terminated the editor process. Common triggers include:

1. Insufficient memory (OOM killer intervention)
2. Broken $TMPDIR configuration
3. Corrupted editor binaries
4. SELinux/AppArmor restrictions
5. Filesystem permission issues

Try these commands to bypass the default editor selection:

# Force use of nano directly
EDITOR=nano crontab -e

# Alternatively with vim
EDITOR=vim crontab -e

# For systems with busybox
EDITOR=busybox vi crontab -e

To fix the underlying issues:

# 1. Verify tmp directory permissions
sudo mkdir -p /tmp/crontab.XXXXXX
sudo chmod 1777 /tmp

# 2. Reinstall editor packages
sudo apt-get --reinstall install nano vim-tiny

# 3. Check memory constraints
free -m
sudo sysctl vm.overcommit_memory=1

# 4. Alternative crontab syntax
echo "0 * * * * /path/to/command" | crontab -

This helper script attempts to select an appropriate editor based on:

1. $VISUAL environment variable
2. $EDITOR environment variable
3. /etc/alternatives/editor
4. Hardcoded fallback options

When troubleshooting, examine its behavior with:

strace -f /usr/bin/sensible-editor
ltrace /usr/bin/sensible-editor

For managed environments, consider these system-wide settings:

# /etc/environment
export EDITOR=/usr/bin/nano
export VISUAL=/usr/bin/nano

# /etc/profile.d/editor.sh
[ -x /usr/bin/vim ] && export EDITOR=vim || export EDITOR=nano

When all else fails, manipulate crontab directly:

# Export current crontab
crontab -l > mycron

# Edit with any working editor
nano mycron

# Import modified crontab
crontab mycron

# Verify changes
crontab -l

When attempting to edit crontab entries on an Ubuntu 11.04 system, you might encounter this frustrating error:

crontab: "/usr/bin/sensible-editor" killed; signal 9 (no core dumped)
Received SIGHUP or SIGTERM
Error writing /tmp/crontab.qcuMPr/crontab.save: No such file or directory

Signal 9 (SIGKILL) typically indicates a forced process termination. In this case, several factors could be at play:

  • Temporary directory permission issues (/tmp/crontab.*)
  • Resource constraints (memory/CPU)
  • Corrupted editor configuration
  • Outdated packages in Ubuntu 11.04

Try these quick fixes first:

# Method 1: Specify editor directly
EDITOR=/usr/bin/vim crontab -e

# Method 2: Use nano explicitly
sudo update-alternatives --config editor
(Then select /bin/nano)

# Method 3: Clean temp files
sudo rm -rf /tmp/crontab.*

For a more robust fix:

# Step 1: Verify disk space
df -h

# Step 2: Check memory limits
free -m

# Step 3: Reset editor configuration
sudo rm /var/lib/dpkg/alternatives/editor
sudo dpkg --configure -a

# Step 4: Alternative crontab method
echo "0 * * * * /path/to/script.sh" | crontab -

If the issue persists, examine system logs:

# Check kernel logs
dmesg | grep -i kill

# Monitor process creation
strace -f -o /tmp/crontab.strace crontab -e

# Verify inotify limits
cat /proc/sys/fs/inotify/max_user_watches
  • Maintain regular system updates
  • Monitor /tmp directory permissions
  • Consider using a modern Ubuntu LTS version
  • Document editor preferences in ~/.selected_editor