A possible solution for no sound in Firefox on Ubuntu

computer speakers

For the last couple of days I was having a weird issue with Firefox on Ubuntu, namely there was no sound.

After searching all over the Internet and trying different solutions I finally found one that worked and I wanted to share it with you in case you find yourself in the same situation.

Note: before running the following command, please make sure you have a backup of your data!

Run this command in a terminal:

rm ~/.config/pulse/*

And restart your computer.

You should now have a working sound in Firefox.

How to get environment variables from a running process in Linux

In Linux, everything is a file. Even running processes are represented as files. You will find all the running processes in /proc/, with a separate directory for each process id.

ps aux | grep [process name]  # to get the process ID
cat /proc/[process ID]/environ | tr '\0' '\n'

What the above commands do, is:

  • Get the id of a process by name
  • print the contents of the “environ” file for that process
  • print each environment variable on a new line; tr stands for “translate”

SQL Database Course

I’ve recently finished a great database course “Mastery with SQL” which I recommend to anyone interested in learning modern SQL as well as some specific PostgreSQL features.

It starts with the SQL fundamentals and builds up all the way to window functions, views and query performance optimizations.

Although it isn’t free, I’ve learned a lot from finishing this course and I consider it is well worth the money.

Book Review: Level Up! The Guide to Great Video Game Design, 2nd Edition

If you ever wanted to make a video game, it is pretty easy nowadays having game engines and game development environments such as Unity 3D and Unreal Engine being free. There are also a lot of tutorials and documentation on how to use them.

When it comes to game design, there aren’t as many resources. In my opinion, one of the best book to learn about game design is “Level Up! The Guide to Great Video Game Design, 2nd Edition” by Scott Rogers.

Continue reading →

How to investigate Ubuntu slow boot

Investigating why Ubuntu boots slowly can be difficult. There are a lot of things that can go wrong: a lingering service, a bad config file, a wrong disk uuid in fstab and others.

In my opinion the easiest way to start is by using “systemd-analyze” which is part of systemd.
Since version 15.04, Ubuntu has switched from upstart to systemd as the default system and service manager. Systemd is not something specific to Ubuntu, but rather an industry standard that other major distributions have adopted as well: Debian, Fedora and CentOS to name a few.
“systemd-analyze” gives us information about what programs are run on startup and how much time they need to start.

Continue reading →

Change swap size in Ubuntu 18.04 or newer

[Updated July 26, 2020]: Change swapfile permission; Set swapfile in /etc/fstab.

Swap is a special area on your computer, which the operating system can use as additional RAM.
Starting with Ubuntu 17.04, the swap partition was replaced by a swap file. The main advantage of the swap file is easy resizing.

Note: before running the following commands, please make sure you have a backup of your data!

In the following example, we’ll extend the swap space available in the /swapfile from 4 GB to 8 GB.

  1. Turn off all swap processes
sudo swapoff -a

2. Resize the swap

sudo dd if=/dev/zero of=/swapfile bs=1G count=8

if = input file
of = output file
bs = block size
count = multiplier of blocks

3. Change permission

sudo chmod 600 /swapfile

4. Make the file usable as swap

sudo mkswap /swapfile

5. Activate the swap file

sudo swapon /swapfile

6. Edit /etc/fstab and add the new swapfile if it isn’t already there

/swapfile none swap sw 0 0

7. Check the amount of swap available

grep SwapTotal /proc/meminfo