The process of randomly try things till it works sucks

This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the workflows category.

Last Updated: 2022-12-01

I spent hours trying to get clipboard working on a guest Ubuntu running with Virtualbox. I installed a clipboard manager, without thinking much, that supposedly supports Ubuntu.

However when I tried to copy/paste within Vim in an Ubuntu shell, it complained that $DISPLAY was none and failed. So I embarked on a long journey of trying every possible combination of settings to get DISPLAY set, all under the assumption that Virtualbox was suppressing it due to a config failure.

I tried:

After a huge amount of blind trial and error, I eventually just looked up the docs on DISPLAY: it turns out that it's only set when there's a window manager. Being on the command line, this of course would be unset. Nor did I want it to be true, since I only wanted command-line access.

My error was that I had blindly chose the wrong clipboard manager, one that expected a windows-like GUI instead of just the terminal.

Lesson

The lesson here is an important one, since I've fallen into such traps often:

The first port of call (e.g. here when the DISPLAY was said to be missing), should be to read the docs and thoroughly understand the behavior. Uninformed, flailing trial and error is never the solution.