Manjaro: Day 2

Manjaro: Day 2

Well this took a while. Work happened, then Manjaro itself got in the way too, so this project had to go on the back burner for a bit. I had a day available after building my new computer, which allowed me to continue the whole Manjaro journey. Let's dive in.

Continued from the first post, found here.

Drive Encryption

One thing I did not mention in my first post was that I selected the full drive encryption option, as I like to have my drives encrypted. Given that it's an easy to find option during installation I figured it would be safe to use it. Unfortunately, not so much. I am still not entirely sure what happened, but after trying to boot back into Manjaro on my Grandpa Hack the other day, it refused to boot.

I would get the screen to enter my password —which, side note, works horribly as it takes a while for it to respond. So you have no idea if it worked or if you made a typo until 5 or more seconds later— and then nothing but a black screen. No idea what caused it, I had not run any updates, no Grub changes, nothing. Cool.

And so, with me seemingly having to reinstall the OS anyway or otherwise try to figure out what magically killed it, and with me getting most of the parts of my new build in anyway, I decided to wait, build the new computer, and install a fresh copy of Manjaro on there. I basically followed each step from my own first post again, so what follows below is on new hardware but with the same software environment.

Video Drivers

By default Manjaro does a pretty good job of installing video drivers, relying on the open source versions if it can, with you being able to install the proprietary (or, "nonfree") drivers if so desired. For those who, like me, have an AMD-based GPU, I don't think there is any reason not to use the open source drivers, as they seem to give the best compatibility and performance. This might not be the case if you use certain older cards though, so try reading up on recommendations for your specific GPU, or just boot up a game and see how things fare.

Whatever you do though, do not install the video-vesa driver. I have no idea why it's so prominently displayed in the Manjaro Settings Manager, but installing that results in a black screen at boot for me, and it took me quite some time to figure out it was related to this driver.

I ended up booting from my live boot USB stick, manually removed the Xorg conf file for this specific driver, then rebooted into Manjaro and uninstalled it altogether. I suppose you could have also achieved this by booting into safe mode or whatever it's called. But the real issue is why this is even displayed so prominently, and why it results in just a black screen instead of an error message at the very least, or an automatic fallback or so.

I must admit, it's not really smooth sailing so far. Contrary to how easy and smooth it was to actually install Manjaro, the experience of actually using it leaves a lot to be desired.

Trackpad bluetooth pairing

This was a bit wonky, but this have more to do with Apple's "it just works" normal pairing style for the trackpad —plug USB wire in, you have paired. It's that easy— rather than Manjaro being picky. It took quiet a bit of fiddling for it to actually pair, although it did work immediately while plugged in and was properly recognized as a trackpad too. I wish my keyboard was properly recognized that easily.

Showing the task bar on more than one display

This one had me scratching my head for a bit, as I couldn't find a checkbox or dropdownbox or so to specify which display to show it on. As it turns out, you need to effectively create additional task bars for each display, and manually populate them (or create a template first, if that's possible. I'm not sure).

To add an additional task bar, right click on your desktop (on an empty spot) and select » add panel » default. I assumed the task bar (or "panel" as they call it, apparently) that came preinstalled with Manjaro was the default, but as it turns out that's not actually the case, so I had to modify it to match it visually.

For one, the "default" task bar has a full text version of the task manager (the area that shows all running applications), whereas the preinstalled task bar has the "icon only" one. So I removed the default one and added the icon only one, making sure to place it in the center of the, uh, panel.

In my case even though I right-clicked on the right display, when I added a new panel it insisted on showing up on my primary display. So I had to move it to the right display first. You get the option to move a panel one you enter its edit mode. Basically just start dragging that move button and place it where you like.

Optionally, depending on your setup, you might want to modify its behavior so that only applications actually displayed on that screen show up. If you do, right click on the task manager area and select » Configure » Behavior » Show only tasks from current screen.

Lastly I also had to adjust the height of the task bar as the pre-installed one was a bit bigger. Not entirely sure why the default isn't the default, but at least you have the option to fix it.

Perhaps this is in some small way a good analogy for the Manjaro experience, or indeed Arch; It's powerful, you have many options, but you also need to use these many options to make it work, and have it work consistently and predictably.

Some more macOS conveniences

A few more  that I wanted to bring over or find equivalents to.

Clear Terminal screen

I use the Terminal (or, iTerm) clear scroll buffer keyboard shortcut quite frequently on macOS, often right before I list out something so I don't have to figure out until where exactly I should scroll back/look up to. On macOS the shortcut is command+k. On Linux the shortcut seems to be standardized to be control+shift+k.

pbcopy and pbpaste terminal commands

In case you are not aware, these two commands allow you to store and fetch what's in your system clipboard via command line, which can be super handy in certiain cases, especially when combined with piping.

I wanted to find a Linux equivalent or bring them over somehow. While there is a way to do this very same thing, it requires a slightly more convoluted command, so I created two aliases that do exactly what I needed. First, install a tool called xcopy: pacman -S xcopy, as that's one of the tools that provides this exact functionality.

Bash aliases are often stored in a file called .bash_aliases, but if you use a different shell (like ZSH) you should find that shell's equivalent. you can use nano or vim to open (or create if it doesn't exist already) this file, and then add the following aliases:

# Copy & Paste
alias pbcopy="xclip -selection c"
alias pbpaste="xclip -selection c -o"

You'll have to load this file for these aliases to become available, or you can restart your session (log out, log back in). To reload, just run . ~/.bash_aliases (that's a period, space, then path to the file).

To give this a try, try echo "hi" | pbcopy for example. This should copy the word hi into your clipboard. You can then paste it anywhere, even in GUI applications. To try the inverse, copy a piece of text from somewhere, then run echo $(pbpaste) to have it be printed out. Not very exciting examples, I know, but at least you'll know whether it worked or not :-).

Generating an SSH key

Not very Manjaro-specific, but I always forget the exact command, so I'll include it here anyway.  GitHub's recommended way includes your email address, and while it's optional it doesn't hurt to add this, so let's follow their lead:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

If you followed along with the previous step and set up the pbcopy alias, you can now run cat ~/.ssh/id_rsa.pub | pbcopy to copy your newly created SSH key to your clipboard, so you can easily paste it on Github.com and take care of that step right away too.

Fix screen tearing

Somehow in 2020 we still have to deal with screen tearing over in Linux land, and the GUI option to enable vsync does not seem to do (enough? anything? I can't tell) to fix this. So we have to create an Xorg config file.

Note: This fix described here is specific for AMD GPUs using the open source drivers. For NVidia you'll have to find their equivalent, or use their proprietary driver's built-in feature if that works for you.

Create an Xorg config file using sudo nano /etc/X11/xorg.conf.d/20-amdgpu.conf (substitute nano with your editor of choice), and add the following to this file:

Section "Device" 
	Identifier "AMD" 
	Driver "amdgpu" 
	Option "TearFree" "true" 
EndSection

If you already have a configuation file for your AMD GPU, you only really need to make sure the TearFree option is added in the right place, so place that in your existing file and you should be good to go.

If you want to experiment more with the just created pbcopy and pbpaste commands, try to see if you can use them here to create this file, it might be a fun experiment :-).

I would recommend after taking these kinds of steps to do a full reboot, to ensure everything still works as it should. I've had times where I just logged out-and-back-in and things appeared to be fine until a later reboot, so why risk it is my thinking here.

Now even though I don't think it solved the problem on its own, I did the following steps as-well. If just the above step did not solve it for you, try doing the following while also keeping the Xorg config file in place:

Go to System Settings » Display and Monitor » Compositor and set Tearing prevention ("vsync") to Full-screen repaints. There will be a notice about the performance cost, but if you're like me and watching web pages constantly being ripped apart when scrolling gives you a headache, who the heck cares.

While in this settings panel, I also set Rendering backend to OpenGL 3.1 and the Animation Speed to the second-fasest option. These are not directly related to screen tearing, but they can help smoothen out the experience a bit nonetheless.

Again, I recommend you reboot to ensure things still work as they should. Try scrolling through a webpage or two, playing a higher-resolution video on YouTube and/or through VLC, or even booting up a game to ensure performance is adequate and screen tearing is a thing of the past.

Docker

Alright, finally back to something easy. And this is one of the reasons why you might want to use Linux as your main OS if you're a developer, as you'll get the full, native experience just like on the servers you (might) actually run your containers on. That, or if you're planning to set up your own media center system I suppose.

Alright, let's do this:

  1. Install docker using sudo pacman -S docker
  2. Create a docker user group (if it doesn't exist already) using sudo groupadd docker
  3. Add your user to the docker group using sudo usermod -aG docker $(whoami)
    (you need to log out and back in again for this to take effect, somehow)
  4. Enable docker to start at system boot using sudo systemctl enable docker
  5. Start docker now using sudo systemctl start docker

If everything went according to plan you should now be able to use docker without using sudo. Try spinning up a container, or perhaps just run docker stats just to make sure you're not getting a permission denied error.

Portainer

I like using Portainer as it's a quick and easy way to get a graphical overview of your running containers. To be honest I don't use it for anything other than viewing running containers and starting/stopping/deleting existing ones. For creating new container I almost always rely on the command line and/or docker-compose.

Regardless, getting started is super easy. Just create a persistent volume first, then create the container. Portainer's own getting started code is pretty much exactly how I use it, so let's copy/paste those:

# Create a persistent volume
docker volume create portainer_data

# Create the container which automatically restarts and runs at system launch
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

Visit http://localhost:9000 and follow the steps to finish installation. Make sure to select the local connection using socket option when you get to that step. I personally don't use its permission system so I turn that off too, but it's up to you of course.

Continued in part 3 here.