3

When issuing crontab -e as root , i always got messages like the following (partial) , however , executing vim directly doesn't have problems at all. $EDITOR was set to vim in /root/.bash_profile already.

%> sudo crontab -e
Error detected while processing /root/.vimrc:
line    2:
E319: Sorry, the command is not available in this version: autocmd! BufNewFile * silent! 0r ~/.vim/skel/tmpl.%:e
line   20:
E319: Sorry, the command is not available in this version: autocmd VimEnter * set vb t_vb=
line   57:
E518: Unknown option: autochdir
line   65:
E319: Sorry, the command is not available in this version: syn on
line   78:
E538: No mouse support: mouse=a
line   79:
E319: Sorry, the command is not available in this version: filetype plugin indent on
line   87:
E319: Sorry, the command is not available in this version: funct! CommentBlock(comment)
line   88:

2 Answers 2

2

When you use "sudo command" the root user profile is not loaded, use sudo -i and crontab -e instead.

5
  • no difference with sudo -i crontab -e
    – daisy
    Oct 16, 2011 at 15:48
  • Sorry, I was not very clear, you need to: "sudo -i" ENTER, then contrab -e. "sudo -i command" will not load the root's .bashrc, that is why the EDITOR is not being properly set. Oct 17, 2011 at 8:24
  • not work as well , also i tried to 'Default env_keep = EDITOR' with visudo , it's still not working , but 'sudo su -' , and then 'crontab -e' works
    – daisy
    Oct 17, 2011 at 15:24
  • [Running 14.04. Desktop LTS:] Isn't there a simpler way than $ sudo -i followed by $ crontab -e followed by choosing yr editor of choice ? It seems that loading root's .bashrc when invoking sudo + cmd should be accessible to permanent configuration. Should not there be at least an option for that ?
    – Cbhihe
    Jan 12, 2016 at 10:01
  • 12 years later, sudo -i crontab -e is exactly the command I was looking for, thanks
    – cryptarch
    Oct 20, 2023 at 0:00
-1

in ubuntu-14.04, use select-editor choose "vim-gnome" but not "vim-basic"

2
  • In 16.04 your options are 1. /bin/ed, 2. /bin/nano (recommended) and 3. /usr/bin/vim.tiny. Dec 28, 2016 at 4:22
  • The user is using the cli therefore suggesting to use vim-gnome would mean that he'd need the gnome libraries installed. They may not be available.
    – Mark D
    Oct 5, 2018 at 15:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .