Tutorial to install Lineage OS 16.0 on a Samsung Galaxy S4 mini from a Ubuntu 20.04 machine
First install adb, fastboot and heimdall from a terminal:
sudo apt install android-tools-adb
sudo apt install android-tools-fastboot
sudo apt install heimdall-flash
Then go to your S4 mini
Settings > About phone > Software information > Build number
and tap several times until developer mode is activated. Go back to settings and go into the developer mode and activate USB debugging.
Connect your phone to via usb cable and accept in the phone that the computer is trustworthy. Type in a terminal
adb devices
you should see something like

you can try to open a shell by typing
adb shell
you should see
serranoltexx:/ $
If so you are on the good way. Exit the phone shell but do not disconnect the cable and then go to download mode by typing
adb reboot bootloader
after the phone is download mode type in yout terminal
heimdall print-pit
You should see lots of text and if you see no error message and the device reboots that indicates that Heimdall is installed and working properly. If it does not, please refollow these instructions to verify steps weren’t missed, try a different USB cable, and a different USB port.
Install TWRP. Now we have to flash the recovery partition. To do so download the file twrp-3.4.0-0-serranoltexx.img. Then set your phone in to recovery mode:
adb reboot bootloader
then use heimdall to flash
heimdall flash --RECOVERY twrp-3.4.0.0-serranoltex.img
After this you can reboot normally and again with adb go to recovery mode
adb reboot recovery
the you should see TWRP app. Follow the instructions formatting your S4 mini properly. Backup your data before starting this step!
1. After TWRP booted click on “Wipe”

2. Click on “Format Data”

Warning! Format Data will format your internal Storage! Make sure you have made a backup of important data! This can’t be undone!
Note: This step is needed to use encryption on your internal storage, “Format Data” will keep some space for the “footer” which is needed by encryption!
3. Type “yes” and confirm format action

4. Once format data is done click on the “Back” button.

5. Now click on “Advanced Wipe”

6. Check
- Dalvic / ART Cache
- System
- Cache

7. Swipe to confirm wipe action
After that go to your console and after downloading push Lineage OS 16.0 for serranoltexx and Open GAPPS (ARM v9.0) (optional with Google Apps and services ) with following command:
adb push lineage-16.0-20180823-UNOFFICIAL-serranoltexx.zip /sdcard
open_gapps-arm-9.0-aroma-20200930.zip /sdcard
After this tap Install and find and select Lineage OS zipfile, after installation do not reboot if you want to install Open GAPPS, go to install and select the Open GAPPS zipfile. After this reboot and Lineage OS should welcome you ;).
If you want to be Google free and you did not install GAPPS I recommend to install Aurora to be able to access Google Play Store with fake identity.
adb install AuroraStore_3.2.3.apk
If you really want Google free apps then install F-Droid with
adb install f-droid.apk
If you still want to use apps which use Google services, like Uber. You will need to install microG which emulates this Google services with faked identity. You can download microG from F-Droid store.
You are now all set to with a mobile phone which is not per default being data mined