Bring sanity to your desk by installing the Barrier KVM

; Date: Thu Oct 13 2022

Tags: Barrier KVM

Having multiple computers is great except for dealing with multiple keyboards and mice. Barrier is easy-to-use-and-install a software pseudo-KVM to control multiple computers from one keyboard/mouse.

We sometimes need to use more than one computer at the same time. Think about in the movie The Matrix when Neo finally got to meet The Architect. He was in this cubbyhole office with a zillion information screens tapping into everything. Most of us don't get to use that many computers at the same time, of course, but you get the idea. Maybe your home workspace has a company-supplied laptop for remote work, plus your personal computer, and another computer for your side gig work. That's three computers, right?

In my case, I have an Intel NUC (Ubuntu), a laptop running Ubuntu, and a MacBook Pro running macOS. I could easily be using them simultaneously, but I want to keep to one active keyboard and mouse.

Many of us face the same issue, and there are existing hardware devices to solve this problem.

What I've used for years is what might be called a USB Switch Selector, at least that's (www.amazon.com) the product name I find on Amazon (sponsored), but the device I have calls itself a USB 4-Port Switch. I connect a USB device to the input port for attaching a keyboard and mouse. There are four USB output ports which are connected to up to four computers. Pressing a button on the device selects between those computers and will connect my USB hub to the selected computer.

In other words, you can quickly switch the keyboard/mouse between up to four computers.

KVM's are a similar type of device, where KVM stands for Keyboard, Video and Mouse ( (www.amazon.com) browse KVM devices for examples -- sponsored). These KVM's have nothing to do with the KVM feature in Linux used by virtualization software. They are similar to the USB switches just described, but also support switching a video signal. In other words, on the input side is both video and USB ports, and on the output side are several pairs of video and USB ports. You attach both video cables and USB cables, then pressing a switch on the box selects between the attached computers.

I like the USB switch very much with one caveat -- remembering selection goes to which computer. Is the NUC on port 3 or port 4? But another issue is - what about times you have data on one computer that you simply want to copy and paste to another computer? Maybe it's a first world issue, since the data can be fairly easily saved to a file that's transferred over the LAN to the other computer, but it's more convenient to be able to directly copy/paste between computers.

A related issue is that the KVM's for HDMI are very expensive. Modern computer displays are all HDMI or DisplayPort.

Fortunately the open source world has a great software solution.

Barrier - the software KVM solution to eliminating barriers

The Barrier product is software that mimics the functionality of a KVM switch. As I said above that normally requires a piece of hardware, which can be very expensive. Barrier, in software, configures several computer displays into a large virtual display spread across multiple computers. Your mouse is free to roam from one computer to another, and keyboard interaction happens on the computer where your mouse is pointing.

This is better than a USB or KVM switch, since you easily move the mouse pointer from one computer to another. Further, it handles copy/paste between computers.

This requires installing the Barrier software on each computer you wish to interact with.

You will be using the keyboard/mouse on one of your computers. The Barrier installed on that computer will be called the Server. The other computers will be configured as Barrier client's.

The software is available through: (github.com) https://github.com/debauchee/barrier

BTW - to get that URL to paste into this article, I had been using a web browser on my other computer to read the Barrier GitHub repository. I just moved the mouse over to that laptop and hit COMMAND-C (macOS) to copy the URL. Then I moved the mouse back to the computer screen containing the editor, and clicked in the editor window then typed CONTROL-V (Linux) to paste the URL into the editor. It was fast and easy, and I can envision growing to love this software.

When I say "moved the mouse to that laptop", that's literally what I did. The keyboard/mouse is connected to the Ubuntu laptop, and moved the mouse pointer past the edge of the screen onto the screen of the macOS laptop. It's that fluid.

Barrier has a limitation since it is not a hardware KVM device. It cannot support interacting with computers that have not yet booted up. Instead, it requires running the Barrier client, which means the operating system is running well enough to launch applications. If you must interact with the boot-up process, then you need a hardware KVM solution.

Installing the Barrier software

For Windows and macOS, it is recommended to go to the GitHub repository, and to click on the Releases link. Navigate to the latest release - at the time of this writing that is v2.4.0 - and you'll find the EXE installer for Windows, and the DMG package for macOS. Since you are probably an experienced computer user, you know that on Windows you double-click the EXE to run the installer, and on macOS you double click the DMG to browse its contents, then drag the application to the Applications folder.

However, there is an alternative on both Windows and macOS. On macOS, I found Barrier in MacPorts, and on Windows I found it in Chocolatey. Both are package management systems allowing installation of open source software on the respective systems.

For Linux, you will probably find Barrier in the package management system for your preferred distro.

On my Ubuntu laptop, I simply typed this:

$ sudo apt-get install barrier

The Barrier website has a list of package names for each distro.

Configuring Barrier for two or more computers

Setting up Barrier is easy, but I found it non-intuitive, and there were several hurdles to overcome.

On macOS, the Barrier package is not properly signed. Therefore the first time you double-click the Barrier application, you'll be told macOS doesn't trust it, and it will offer to move the application to the trash. Don't do that. Instead, right-click on the Barrier icon, and select Open. You'll be shown a similar dialog, but this time it will have an Open button. Click that Open button and Barrier will launch. Once you've done that, macOS will in the future go ahead and launch Barrier.

Once you start Barrier on macOS you'll be asked to give it Accessibility permissions.

To configure this, click on the Lock icon at the bottom and enter your password. Then, select the checkbox next to Barrier in the list.

I did not install Barrier on Windows and do not know if any special setup is required. On Linux, no special setup was required.

On each computer, start the Barrier application. You'll first see a window that looks like this:

This screen gives you an overview, and lets you select the language. Click Next when ready.

The next window you see looks like this:

As it explains, the Server is the computer to which the keyboard and mouse is connected, and the Client is on all other computers.

In my case, the keyboard/mouse is connected to the Ubuntu laptop, and therefore it is declared to be the Server, and the macOS laptop is the Client.

The next screen will look like this. However, you will configure this screen differently for the Server or Client computers.

This particular case is for the Server, my Ubuntu laptop. Note the IP address that is shown. DO NOT CLICK THE START BUTTON YET.

On the client computers you'll see this version of the window:

Note the IP address and the screen name. You'll need the screen name back on the server computer. For now, make sure the Client section is checked, and do not select Auto Config. Instead, enter the IP address of the Server as shown here. DO NOT CLICK THE START BUTTON YET.

Once you've configured the client computers, go back to the server computer. Click on the Configure button, and you'll be shown this window.

Initially the only icon that shows is for the server window. To get other icons, drag down the computer icon in the upper-right into one of the boxes in the grid.

The grid sets up the relative screen positioning of each display on each computer.

Double click on the icon you just added to open up this window.

The required step is to enter the screen name as shown here. There are other settings for key mapping, if you want to fiddle with that.

Click on Ok to save this config, and then OK in the map window, and you'll be back to the main window.

Repeat the client setup for each computer you wish to control with Barrier.

AT THIS POINT YOU CAN CLICK THE START BUTTONS

Ideally it will automatically start up, and everything will be functioning.

In my case it did not start, and on the macOS client the log contained these messages:

[2022-10-13T22:19:39] INFO: OpenSSL 1.1.1g  21 Apr 2020
[2022-10-13T22:19:39] ERROR: ssl error occurred (system call failure)
[2022-10-13T22:19:39] ERROR: failed to connect secure socket

To view the log hunt around in the Barrier user interface for the menu, and select Show Log. The log contains useful status messages like this.

In this case it says it failed to connect with an SSL connection. Hurm..

After some searching, it turns out that Barrier can use an SSL connection between computers. This is an excellent idea for security, since SSL makes sure the data is encrypted. If you're sharing a network with others - like in an office setting - it's a great idea to encrypt the connections between Barrier server and client processes.

The ssl error failure here means the SSL certificates are not set up. A quick/easy fix is to disable SSL.

You turn off SSL support as is shown here. Make sure it's turned off on all computers.

You'll find a Settings choice in the same menu where you found Show Log. Click on that to get to this dialog.

This issue is a failing of Barrier. Shouldn't it offer a way to generate SSL certificates? Shouldn't the Barrier repository contain documentation on generating SSL certificates? I'm sure there's a simple command to run using a command from the openssl package, but I do not know what that is, and most of you people reading this will not know either.

Using Barrier between macOS and Linux

I cannot test usage on Windows because my Windows laptop is dual boot to Ubuntu, and I only use it for Ubuntu. Ergo, I cannot comment on Windows usage.

Scenarios to try:

  • Move the mouse from one computer to another - enjoy the freedom
  • Type text into applications on your computers
  • Copy/paste text between your computers
  • Drag a file from one computer to another

I was able to easily do the first three of those experiments. However, the last one doesn't work.

In the Configure Server window, you'll find a tab labeled Advanced Server Settings. There are several interesting settings including one for enabling drag-and-drop of files. I have this selected, but drag and drop of files is not working.

Instead, on the macOS laptop I enabled File Sharing and selected the Public folder to be a shared directory. That directory can be easily mounted on the Ubuntu laptop, and then it will serve as a place to pass files from one computer to the other.

Another issue is that several times mouse control on the macOS laptop went wonky. Each time I went to the main Barrier window on the macOS machine, and clicked the Reload button. Upon doing this the mouse started behaving correctly.

The last issue has to do with COMMAND-TAB for tabbing through windows. On Ubuntu both ALT-TAB and COMMAND-TAB are used for tabbing through windows, while on macOS COMMAND-TAB is used. I am using an Apple keyboard with a COMMAND key. I believe that on Windows keyboards, the WINDOWS key performs the same function.

Remember that my server is the Ubuntu laptop. The expectation is that when the mouse is on the macOS screen, COMMAND-TAB will cause window switching on the macOS screen. Instead, window switching happens on the Ubuntu screen. There may be a setting in Barrier to fix this, but I don't yet understand the key mapping stuff.

Summary

Barrier is easy-to-install and easy-to-setup open source software for controlling the keyboard/mouse of multiple computers. It works well, and functions well. But there are some rough spots, some of which I mentioned above.

An issue I did not mention earlier is to ask -- doesn't it seem like excess rigamarole to have to manually setup the connections between Barrier clients and the server? Shouldn't the clients auto-discover the server?

It isn't that hard to drag an icon into a grid, and to type the screen name of the client computer into a configuration dialog. Ergo, complaining about manual setup is a bit of a first world problem. I should instead focus on the joy of using Barrier, rather than relatively minor issues like this.

But, really, auto-discovery? Please?

Bottom line is that Barrier is highly recommended software for controlling multiple computers. The end result is you do not need multiple keyboards/mouses, because one keyboard/mouse will suffice. Sort of. During setup you may need an extra keyboard/mouse, but that's unavoidable. Let's instead focus on the joy of using Barrier, the freedom to move your mouse naturally from one computer screen to another, and to easily copy things back and forth as if your several computers are instead one unified computing environment.

About the Author(s)

(davidherron.com) David Herron : David Herron is a writer and software engineer focusing on the wise use of technology. He is especially interested in clean energy technologies like solar power, wind power, and electric cars. David worked for nearly 30 years in Silicon Valley on software ranging from electronic mail systems, to video streaming, to the Java programming language, and has published several books on Node.js programming and electric vehicles.