Thales Grilo


horizontal

Linux as a Dev and Musician

Do not run the command above. Thank you.

Friends often tell me how they want to try Linux, but are afraid or unsure about it. For the last 5 years, I’ve been a heavy Linux user, so I thought this was a good opportunity to look back on past mistakes and share some tips for those who want to try it. I broke it many times over so you don’t have to!

Being a dev is tough, linux is tough, and being a musician is tough. I sometimes wonder why I had to pick these three at once. Anyway, as the title suggests, it may also be helpful for devs or people doing audio production as well. Linux is a minefield, and this is my survival kit. I hope it’s helpful.

warning: if it gets too technical, try skimming it! there’s a bunch of cool stuff at the end

Why Linux?

As of 2020, I really think linux is the only feasible OS. Without getting into detail, it comes down to these 3 aspects:

Other than that, it makes life a lot easier for developers - this is mostly true, but depends, of course, on your area and stack of preference.

One thing to know though: Linux isn’t an Operating System per-se, it is a branching family of OSs, which we call distros (short for distribution). Ubuntu, for instance, is a distro built on top of Debian, which is another distro. There are hundreds and hundreds, but in the end most of them boil down to the Debian, Arch, Fedora or RedHat families. Further down I made a list of distros I’ve used and my impression of them, in case you want to know more.

How to begin

This is the easy and fun part: creating a live installer. This is what you’ll need:

There are many tutorials you can follow for creating a live boot usb drive, but it’s really simple using etcher. Just plug your flash disk, run etcher, select your ISO file, and your flash disk, and burn the image. Done.

Coming from Windows, you will need to do some tweaking on the BIOS (if you’re on a laptop, mostly). Don’t sweat it, there’s more than enough info on the web to get you going, Unfortunately though, it usually varies based on manufacturer and model.

How to Survive

The optimal mindset when working on linux is that it can break at any moment, specially if you’re trying it for the first time. In other words, you should be ready to format and reinstall your system from scratch without much pain - it’s possible, trust me on this. I found myself formatting my notebook every 6 months at some point - a bit more often than my previous Windows system.

In order to acheive that, though, I strongly recommend taking these steps:

  1. Back your shit up: Google Drive, Syncthing, OneDrive, DropBox, I don’t care, just put your important shit somewhere safe.

  2. Learn about config files: This is important! They also called dotfiles because their names usually begin with a dot. By the way, filenames starting with dot make the files “hidden” in linux - knowing this from the get go can spare you from a headache trying to find them. For instance, suppose you’re a musician, and you use MuseScore (which you should!). Maybe you adjusted the font size for your screen, the default folders for your scores, maybe you set it to dark mode by default, etc. All these configurations are stored in a file called MuseScore3.ini, meaning you can save this file and never having to make these adjustments again!! The key point is

    • Know what programs you use
    • Find their config files
    • Save them with you, in a folder (I’ll call it ~/dots for future usage). Methods above work fine but if you’re a dev it might be better to use source control. Feel free to check out my personal dotfiles folder (and maybe star it on github if you can?)
  3. Learn about package managers: these come pre-installed and the program depends on the distro. Ubuntu uses apt-get, while Arch uses PacMan. Some are even available online: homebrew for MacOS, Chocolatey for Windows, etc.

  4. Learn the terminal basics: Knowing how to use a shell can save you when shit goes bad. When facing a problem, instructions on the web will usually tell you to run one or two commands in the command line, and it helps a lot if you’re already familiar. It also enables you to do a lot of fun and helpful stuff too. Yeah, I know, not comfort zone and stuff, but it’s important. Engineer Man has great tutorials on this (older linux users, check this out). A quick checklist of what you should know:

    • How to install / uninstall software (apt-get, pacman, etc.)
    • How to navigate the filesystem (cd, ls)
    • How to move / delete files and folders (mv, cp, rm, mkdir, rmdir)
  5. Careful with Updates: This applies mostly to Ubuntu/Debian-based distros. Updating from Ubuntu 14 to 18 can break things sometimes, like your wi-fi connectivity on WPA2-secured connections - which just so happens to be the kind of wi-fi available at the university I attend to. I lost a couple of hairs to that already :) (if you’re using manjaro/arch you should be good though)

  6. Don’t push yourself too hard: A.K.A. Be Kind to Yourself - you really don’t need to use a hipster, source-compiled, tarball-installed tiling window manager under an Arch Linux fork when your objective is to be a live-streamer, producer or video editor, for instance. It’s shooting yourself in the foot with a .12.

  7. Don’t run any command you find on the web: Specially if they begin with sudo. When in doubt, ask a friend. Some to watch out for:

    • Anything with chmod, chown, rmdir
    • Anything with ”/”, “/root”, “/dev” or “/sys”
    • In case you come accross this, know that it will crash your pc: **:(){ :|: & };: **

How to Migrate

There’s not much to say about this, it’s just an overview of the process of migrating to a new OS. It’s very important to have a second computer available with internet access though, cause otherwise you’ll be in trouble if something goes wrong.

  1. Install your OS of choice: use the flash disk mentioned above. The process should be fairly straightforward and there’s plenty of info online in case you need help.
  2. Install the programs you’ll need
  3. Copy your config
  4. Download your backup files and put them in place

Steps 2 and 3 are the most cumbersome (usually), and below I’ll describe a method of automating it. It is totally optional, and requires a bit of tech know-how, but oh boy does it speed things up.

How to Automate Stuff (optional)

This is a bit more advanced stuff - it can be acheived using DotBot. This magical tool allows you to create references to your configuration files (links) on the location they should be. This means that programs will read your configuration successfully, while keeping everything neatly organized within the same folder. How cool is that?

Suppose you followed the MuseScore example, and now you want MuseScore to read the config file from your dotfiles folder. You can make a link through the terminal:

ln -s ~/dots/MuseScore3.ini ~/.local/share/MuseScore/MuseScore3/

Though this works, you clearly don’t want to run it manually for each config file you got. Thankfully you don’t have to:

# install.conf.yaml
- link:
  ~/.config/MuseScore/MuseScore3.ini:
    path: common/MuseScore3.ini
    force: true

This is how a config file looks life for dotbot - install.conf.yaml is the default name for the config file. Running dotbot on a folder with this file will automatically make all links and run all commands on it.

It also allows you to run generic commands, which is very handy for installing programs. This is an excerpt of my own config script:

# Media Tools
- shell:
  - [echo Installing Media Tools]
  - [sudo apt-get install -y obs-studio, Installing OBS]
  - [sudo apt-get install -y musescore3, Installing Musescore]
  - [sudo apt-get install -y cmus, Installing cmus]

These five lines automate the installation of OBS (the streaming software I use), MuseScore (my sheet notation software of choice) and cmus (a lightweight music player).

You can read more about it on dotbot’s repository, or use my current config file as a starting point. Alternatively, you can write your own shell script to do everything above, but frankly, I did it, and I don’t recommend it. If you want to automate your configuration, create a dotbot config file, and gradually populate your dotfile folder, updating it however necessary. It’s a much saner and organized way of managing machine configuration.

Distros

Completely different subject: I thought it would be fun to make a list of all linux distributions I’ve used so far! I won’t get into much detail about them, so check out some videos before you choose to try any.

Mint

Baby’s first linux distro: I used it way back when I was like 13 or so. Worked pretty nice at the time, and it’s a good distro for beginners. Might look prettier today, though, but I never messed much with it.

Deepin

My first distro after I decided to make the jump. Worked fantastically for the first 12 months: The UI looked great and it ran smoothly. Then, I went and run this command: sudo chmod 755 -R /. Now everything went to shambles (this destroys any linux installation by the way, do not do this). While figuring what to do, I found out that Deepin is a Chinese distro, and at the time most of its tutorials and support were in chinese. So there I was, stuck with a broken system and no sensible instructions on how to fix it. I quickly gave it up after learning that.

Ubuntu Studio

My experience with Ubuntu Studio was really unpleasant. It was basically Ubuntu with an uglier UI and a lot of software I didn’t ask for. In case you’re a producer tempted to install it, go for something lighter, and check my instructions at the end of the post. I took it for a trip (circa 2017) to record and write some music, but honestly didn’t fall in love with it, at all.

Pop!

Pop! is amazing. It’s kind of heavy because of the interface, but on a regular notebook it works pretty well. It’s a solid OS, I spent a lot of time with it, and highly recommend it. This one broke when I tried to install proprietary graphics drivers and broke everything. I’d still go back though, but I was tempted to try something new.

Elementary

Elementary is another great one, it’s very performant, has a basic but pretty UI, and gets shit done. It’s also Ubuntu-based, so you have access to the same programs and stuff works in a similar way. I spent an year and a half in it, and it held up pretty well. I broke it hilariously when I tried to run a Tiling Window Manager on it (i3), which I’ll describe below.

Tiling Distros, or, How to go insane

Window Managers are programs that manage screens. Think about when you open a lot of programs, and you can quickly Alt-Tab your way through them, or you can place them on top of one another: yeah, that’s the window manager doing its job. Tiling Window Managers (TWMs) are a different paradigm for window placement: they think about using all available space for each program, and splitting the screen however necessary.

By now, I was very curious with the idea of tiling, because of how it makes you look really cool optimizes screen space. This was specially interesting at the time because my notebook (a 2013 Lenovo Ideapad 320s Yoga) had a tiny tiny screen, so I had to save up as much as I could. I broke my Elementary OS installation trying to run i3 because i3 is meant to be user-configured, and I had 0 knowledge about it, so it was terrifying.

What I did though was look for OSs that had a preconfigured TWM by default, making it for a better experience. This is what I found:

Manjaro i3

Manjaro is an Arch-Based distribution aimed at simplifying Arch, which is a very radical paradigm for most users (including myself). Arch requires you to manually choose your kernels, drivers and low-level programs and OS modules you need, which can be really overkill. Manjaro is basically Arch preconfigured, which makes it a lot less cumbersome to use.

One thing I’ll always miss is the Arch User Repositories (AUR) tool and a package manager called yay. Ubuntu requires you to manually add PPAs for external repositories, which is sometimes an obstacle to automate things - many programs I use daily do not have PPA builds. AUR on the other hand has pretty much everything, because any user can make one, and they work fantastically. This is the biggest selling point for me.

I had a main grip with it, though: Everything is hard. Bluetooth? hard. Graphics drivers? hella hard. Emoji? Don’t even bother. Mounting all hard-drives automatically? Nope. Did something break? Try using a tty.

devs: I dare you to use Expo (react-native) on it.

This is why I gave that advice early on: don’t push yourself too hard. Maybe what you want is something with better UI and support for basic functionality. Don’t go full hipster. In that spirit, I decided to try yet another tiling distro:

Regolith

My current distro, as I’m writing this post. Frankly, it’s awesome. It’s a great balance between a TWM and a full-featured Desktop environment. It tiles (which I like) and has Ubuntu’s system dialogs, which are pretty comprehensive. The experience doesn’t even compare.

My troubles with it are basically what I already knew by now: not all programs have a PPA that I can install automatically, and I still don’t know what nvidia drivers I’m running (mesa or proprietary). I’ll find out once I install steam.

It’s not for the faint of heart, because it still uses a TWM, but it’s pretty, has been working fine, and made me realize many aspects of Ubuntu that I really liked in the first place.

Softwares I suggest

This is a list of stuff to make your life better on Linux:

If you intend to spend a lot of time on your command line, you might as well have these:

If I remember anything else I’ll add it here.

How (not) to make Music

Last but not least, for those of you who want to make music on linux, you’re kind of in trouble. Not all DAWs are available, and forget about all your VSTs: it’s incredibly hard to use the few ones available in linux. If even then you’re convinced it’s a good idea, I suggest installing Jack (mandatory) and the KXStudio tools (Cadence, Catia, etc.). Just do it, it’ll make your life easier. You’re basically stuck with whatever is available. I’ve been trying Reaper, but I’m very interested in Bitwig as well. For sheet notation I use MuseScore, and for my livecoding set I use SuperCollider + TidalCycles, a stack I’ll explain better in a future post.

Anyway, I hope this helps some of you, and feel free to reach me through any channel listed below. Thank you!