Ever wanted to create a HTPC from old computer laying around. Or just have some spare time and want to try something new. This article could be just for you. It will show you the step by step process to convert a Fedora Silverblue to a fully fledged HTPC.
What is Fedora Silverblue, Kodi and HTPC?
Fedora Silverblue is a system similar to Fedora Workstation. It offers an immutable filesystem (only /var and /etc are writable) and atomic updates using an ostree image, which offers reliable updates with ability to rollback to previous version easily. If you want to find out more about Fedora Silverblue visit https://silverblue.fedoraproject.org/ or if you want to try it by yourself you can get it here.
Kodi is one of the best multimedia player available. It provides plenty of features (like automatic downloads of metadata for movies, support for UPnP etc.) and it’s open source. It also has many addons. So if you are missing any functionality you could probably find an addon for it.
HTPC is just an acronym for Home Theater PC in simple words a PC that is mainly used as an entertainment station. You can connect it to TV or any monitor and just use it to watch your favorite movies, TV shows or listen to your favorite music.
Why choosing Silverblue to create an HTPC?
So why choosing Fedora Silverblue for HTPC? The main reasons are:
- Reliability – you don’t need to fear that after update everything stop working and if it does, I can rollback easily
- New technology – it is a good opportunity to play with a new technology.
And why to choose Kodi ? As stayted before it’s one of the best multimedia player and it’s packaged as a flatpak, which make it easy to install on Silverblue.
Conversion of Fedora Silverblue to HTPC
Let’s go step by step through this process and see how to create a fully usable HTPC from Fedora Silverblue.
1. Installation of Fedora Silverblue
First thing you need to do is to install Fedora Silverblue, this guide will not cover the installation process, but you can expect similar process as with standard Fedora Workstation installation. You can get the Fedora Silverblue ISO here
Create only the root user during the installation with some password. We will create a user for Kodi later without password.
2. Booting to terminal
This part will be a little tricky. You need to bypass GNOME and end the boot sequence in terminal. Otherwise you will end up in GNOME initial setup process, which will not allow you to create user without password.
To bypass the GNOME you need to press the ‘e’ key in GRUB menu to edit the GRUB entry. When editing the GRUB entry just look for the line starting with linux16 and add 3 to end of this line. Then continue the boot sequence with CTRL + x. Don’t worry about the changes, they are used only for this session.
You will end up in terminal where you need to login as root.
3. Creation of user for Kodi
When you are in the terminal logged as root, you need to create a user that will be used by Kodi. This can be done using the useradd command.
4. Installation of Kodi from Flathub
To install the Kodi in flatpak you first need to add a Flathub remote repository.
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
With the Flathub repository added the installation of Kodi is simple.
flatpak install flathub tv.kodi.Kodi
5. Set Kodi as autostart application
First we need to create the autostart directory for the kodi user, this is easier if you switch to kodi user directly.
mkdir -p /home/kodi/.config/autostart
Then you need to create a symlink for the Kodi desktop file.
ln -s /var/lib/flatpak/exports/share/applications/tv.kodi.Kodi.desktop /home/kodi/.config/autostart/tv.kodi.Kodi.desktop
The last thing that will prevent for autostart to work correctly is the GNOME initial setup. To disable it just create a gnome-initial-setup-done file in .config directory of kodi user.
echo "yes" > /home/kodi/.config/gnome-initial-setup-done
You can now switch back to root for the next steps.
6. Set autologin for kodi user
This step is very useful together with autostart of Kodi. Every time you restart your HTPC you will end up directly in Kodi and not in the GDM or GNOME shell. To set the auto login you need to add the following lines to /etc/gdm/custom.conf to the [daemon] section
7. Enable automatic updates
For HTPC automatic updates you will need a cron job. But because cron is not part of the standard Fedora Silverblue installation you need to install it first. In this step I also recommend to do upgrade of the Fedora Silverblue first before layering the cron package.
rpm-ostree install cronie
After this you need to reboot your computer, to apply the new updates.
To be able to setup cron in this phase you need to do the second step again and log in as root. After this you need to edit the crontab.
And add the following line to it.
0 4 * * 3 flatpak update -y; rpm-ostree upgrade; reboot
This will create a new cron job, which will update any flatpaks (Kodi in this case), update Silverblue and does a restart to apply the changes.
This job will run at 4 AM on Wednesday. It is recommended to set this to a time when nobody will use the HTPC.
Restart the computer now.
8. Disable GNOME features
There are few GNOME features that could be annoying when using Fedora Silverblue as HTPC. Most of these features could be setup directly in Kodi anyway, so if you want them later it’s easy to set them directly in Kodi.
To do this exit Kodi and open the terminal. Press Super key (this is the key between ALT and CTRL) and type terminal. Once the terminal will be open and you need to type the following commands.
# Display dim
dconf write "/org/gnome/settings-daemon/plugins/power/idle-dim" false
# Sleep over time/
dconf write "/org/gnome/settings-daemon/plugins/power/sleep-inactive-ac-type" 0
dconf write "/org/gnome/desktop/screensaver/lock-enabled" false
# Automatic updates through gnome-software
dconf write "/org/gnome/software/download-updates" false
And that’s it, you just need to do one last restart to apply the dconf changes. After the restart you will end up directly in Kodi.
Now I will recommend you to play with the Kodi settings a little bit and set it up to your liking. You can find plenty of guides on the internet.
If you want to automate the process you can use my ansible script that was written just for this occasion.