DEV Community

Bruno Haible
Bruno Haible

Posted on

Ubuntu / Kubuntu 26.04 — Customizing the root account

The first thing one typically does in a new Linux installation is to edit a few text files, such as /etc/fstab or /etc/hosts, in some terminal window.

This is unfortunately the first bad experience with Ubuntu / Kubuntu: They broke vi in the root account!

Namely, after launching vi, you can't copy&paste text while editing a file. They have installed a mouse handling that breaks copy&paste.

Behind the scenes, what's happening: When you launch vi, it loads a customization file: $HOME/.vimrc if that file exists, or /etc/vim/vimrc otherwise. For the root account, there is no $HOME/.vimrc, so /etc/vim/vimrc gets loaded, and this file activates the insane mouse handling.

The fix is therefore to create a file $HOME/.vimrc, for instance with just one comment line:

" This file disables the nasty mouse handling in root's default vimrc.
Enter fullscreen mode Exit fullscreen mode

You can do this from vi, or with an echo command from the command line.

Then, you are ready to go ahead and edit /etc/fstab, /etc/hosts, and so on.

Top comments (0)