Void Linux Journey, Part I: Automounting

I'm not sure how I ended up using an obscure GNU/Linux distro such as Void - after finally managing to install Arch with XFCE, and realizing that all the hard work was only beginning, I deleted and kept using MX Linux for a few months more. Then winter holidays came, and thought it was finally time to stop admiring all those wonderful setups from r/unixporn and make my own!
Having already used Void before on a VM and a cheap netbook, I felt it was the right choice for my main OS - something simple to install and use on a dialy basis, with up-to-date packages, and that had a minimalistic design. After using it for several months (and breaking it dozens of times), I've come to understand its ways and quirks, and thought a handy guide to setting things up would be useful.
I'd like to begin with something I usually forget how to do:
Automounting
Sooner or later you come to realize that plugging a USB drive doesn't exactly work out of the box on such a barebones distro, and can be a little tricky - many posts I've seen about people desperately seeking for a solution, so here's one!
First we have to understand how things normally work: there's a little program called udisks that basically manages storage devices of all kind via a daemon (background process). However, on it's own, it doesn't automount anything, so there comes the need for another little program that does that for us, called udiskie.
Now all we need to do is put udiskie &
on our .xinitrc
and it should work perfectly when we boot into X, right? Not yet - this would only work with root permission! Following the documentation, it just consists of creating a new policy rule file like this:
Inside it, paste the following:
Set the right permissions:
Finally, make sure your user is in the storage
group:
And that's it! Now we should be able to plug any USB drive without hassle and call udiskie
as a user without root permissions. We'll receive notifications whenever you plug something in:

and when we unplug it with udiskie-umount /dev/sdX
:

Mounting to /media/
By default, since udiskie
is just a frontend for udisks
, it will mount things on /run/media/$USER/
. Since I'm used to mounting on /media/
, and the only user on my computer, there's a way to go back to that.
First, let's create a new rule
Inside it, paste the following:
Finally, since /media/
doesn't delete the folders it creates, we can work around that by making it a temporary file system, which will wipe out anything each time we reboot the system. Let's add the following to /etc/fstab
:
We're done! Now we have a functional and working automounting system.