I recently installed virt-manager on an Arch Linux install, and unlike under Ubuntu, I was not prompted to choose a text editor on the first launch of virsh-edit. Instead, the XML file was opened in vi (or vim, not sure). From this thread in the RedHat archives, I thought that if I just added to ~/.bashrc: export EDITOR=/usr/bin/nano that would solve the problem, but it did not.

Also, launching it with EDITOR=geany sudo virsh edit myWINVM gave the same result, as did trying to use a different editor: EDITOR=geany sudo virsh edit myWINVM as described here

and I see that the variable has in fact been set:

[~]$ printenv

However virsh edit MYVM still opens the XML in vi.

Is there something different I need to do in Arch? Has the method of changing this setting been changed in recent updates of virsh?

  • Is the path correct? My nano is /bin/nano. – Freddy Feb 24 at 13:08
  • Yes, /usr/bin/nano opens nano. I also have it at /bin/nano. Both paths have the same effect. – Thoughtcraft Feb 24 at 13:12

I had to add the editor to sudoers by putting Defaults editor=/bin/nano at the end of /etc/sudoers AND THEN I could use sudo EDITOR=nano virsh edit myWINVM.

  • I'm not sure how the sudoers change (of editor) solved your problem, since that's only the editor that visudo will use, and should have no bearing on virsh's EDITOR value. – Jeff Schaller Feb 24 at 15:12
  • You might have better luck with a sudoers change of env_keep += "EDITOR" – Jeff Schaller Feb 24 at 15:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.