https://fedoramagazine.org/how-to-install-and-update-fedora-linux-on-android-using-termux/

How to Install and Update Fedora Linux on Android using Termux
by Phani Adabala on July 19, 2023

Photo by Marek Levák on Unsplash (edited)
If you’re interested in running Linux on your Android device, you’re in luck! It’s possible to install Fedora Linux on Android using Termux. Termux is a terminal emulator for Android that allows you to run Linux commands and utilities on your phone or tablet. It does not replace Android. In this article, we’ll walk you through the process of installing Fedora Linux on Android using Termux and show you how to keep it up to date with the latest versions.
Step by step process
Step 1: Install Termux
To get started, you need to install Termux from the Google Play Store. Once you have Termux installed, open it up and type the following command to update the package list:
pkg update
Note: Termux requires Android >= 7 to run. Support for Android 5 and 6 was dropped at v0.83 on 2020-01-01, but you can find old builds on archive.org ( https://archive.org/details/termux-repositories-legacy/ ) if needed.
Step 2: Install Proot-Distro
Next, you’ll need to install Proot-Distro. Proot-Distro is a tool that allows you to install and run Linux distributions in a chroot environment. To install Proot-Distro, run the following command:
pkg install proot-distro
Step 3: Install Fedora
With Proot-Distro installed, you can now use it to install Fedora. To install Fedora, run the following command:
proot-distro install fedora
This will download and install the latest version of Fedora.
Step 4: Configure dnf
Now that you have Fedora installed, you’ll need to configure dnf, Fedora’s package manager. By default, dnf may try to install SELinux packages, which won’t work properly in a chroot environment. To prevent this, exclude SELinux packages installation by editing the dnf configuration file. Run the following command to open the dnf configuration file for editing :
cd ../usr/var/lib/proot-distro/installed-rootfs/fedora/etc/dnf vi dnf.conf
You may substitute the nano editor for vi, if it is more to your liking. Once you’re in the file, find the line that says excludepkgs= and add *selinux* to the end of the line, like so:
excludepkgs=*selinux*
It may be necessary to add the excludepkgs line. Save these changes and exit the editor.
Step 5: Install a Desktop Environment (Optional)
Fedora comes with a number of desktop environments to choose from. If you’d like to install a desktop environment, you can do so with the following commands:
proot-distro login fedora dnf groupinstall "Fedora Workstation" --skip-broken
This will switch from termux into the chroot Fedora installation and install the GNOME desktop environment, along with a number of other packages. If you prefer a different desktop environment, you can replace Fedora Workstation with the name of the group for your preferred environment.
Step 6: Install VNC Server (Optional)
If you plan on using your Fedora installation with a graphical interface, you’ll need to install a VNC server. This will allow you to connect to the Fedora desktop from another computer or device. To install the TigerVNC server, run the following command:
dnf install tigervnc-server.aarch64 -y
This will install the VNC server, along with any necessary dependencies.
Step 7: Upgrading Fedora
Now that you have Fedora installed, you’ll want to keep it up to date with the latest versions. To upgrade Fedora, run the following commands:
sudo dnf upgrade --refresh sudo dnf install dnf-plugin-system-upgrade sudo dnf system-upgrade download –releasever=37 export DNF_SYSTEM_UPGRADE_NO_REBOOT=1 sudo -E dnf system-upgrade reboot sudo -E dnf system-upgrade upgrade sudo dnf upgrade --refresh
First command sudo dnf upgrade –refresh refreshes the package cache and updates any installed packages.
The second command sudo dnf install dnf-plugin-system-upgrade installs the dnf-plugin-system-upgrade package, needed for the upgrade process.
The third command sudo dnf system-upgrade download –releasever=37 downloads the necessary packages for the upgrade to version 37 of Fedora. Replace 37 with the desired release version.
The fourth command export DNF_SYSTEM_UPGRADE_NO_REBOOT=1 sets an environment variable to prevent the system from rebooting after the upgrade.
The fifth command sudo -E dnf system-upgrade reboot reboots the system to start the upgrade process. Make sure to save any important work before running this command.
The sixth command sudo -E dnf system-upgrade upgrade performs the upgrade process.
Finally, the seventh command sudo dnf upgrade –refresh updates any remaining packages and ensures that your system is fully up to date.
Errors Encountered
During the installation and upgrade process, you may encounter errors. Two common errors are described below, along with their solutions.
Error 1: sudo: /etc/sudo.conf is owned by uid 1001, should be 0
Solution: This error occurs when the ownership of the sudo.conf file is incorrect. To fix this, run the following command:
chmod +s /usr/bin/sudo
This sets the setuid bit on the sudo command, which allows it to run with root privileges.
Error 2: filesystem package didn’t get upgraded post OS upgrade
Solution: This error occurs when the filesystem package is not upgraded during the upgrade process. To fix this, run the following commands:
sudo rpm -e --nodeps filesystem dnf download filesystem
The first command removes the filesystem package, and the second command downloads the latest version of the package. If you encounter any errors during the upgrade process, you can use rpmrebuild to rebuild the package with any necessary modifications.
Conclusion
In this article, we’ve shown you how to install Fedora Linux on Android using Termux and how to keep it up to date with the latest versions. While there may be some errors to overcome during the installation and upgrade process, following the steps outlined in this article should help you get Fedora up and running on your Android device in no time.
Like this:
Loading…
Fedora Project community Five Things in Fedora This Week For System Administrators review
Phani Adabala
#!/Linux-enthusiast/RaspberryPi-hobbyist/Gardner From a C/UNIX programmer to Linux Administrator. Linux turned into a passion, Have been using Fedora since its inception. Now a ardent fan of Raspberry Pi. Working for a MNC that provides IT services, Responsible for end to end program delivery including digital, technology, consulting, and operations services. Like long drives along scenic routes, Enjoy nature and gardening!
29 Comments
Comments are Closed

Fedora Linux 42 is available now. Read the release announcement for all the details.
Subscribe to Fedora Magazine via Email
Email Address
Subscribe
Join 10.3K other subscribers
Contribute to the Magazine
Fedora Magazine is looking for contributors!
The opinions expressed on this website are those of each author, not of the author’s employer or of Red Hat. Fedora Magazine aspires to publish all content under a Creative Commons license but may not be able to do so in all cases. You are responsible for ensuring that you have the necessary permission to reuse any work on this site. The Fedora logo is a trademark of Red Hat, Inc. Terms and Conditions

Right now, the custom Android ROM community (in most phones) relies on reverse engineered device trees, which are unstable at best, missing hardware functions (Cameras, 5g, fingerprint readers) most of the time.July 19, 2023
– Vi/Vim does not come in the default v0.118.0 termux image on GitHub. Install it withpkg install vimto edit dnf.conf.
– The “excludepkgs=” line is not in dnf.conf. It should be added.
– There’s a missing command between steps 4 and 5. You must run “proot-distro login fedora” to switch from termux into the chroot Fedora installation.July 19, 2023
Given its running in a chroot environment it would be interesting to see what devices it has access to on the phone.July 20, 2023
I would like to install KDE, what should i write?July 21, 2023
Thanks for the article.Now, I guess it would be possible to gradually use our Android phones connected to external large displays as workstations, given the growing power of Android devices, am I right?Any advice or planned article on external Android displays used with underlying Linux?July 21, 2023
– Step 5: Install a Desktop Environment : Does this mean we can access from the Android device’s screen the installed Desktop Environment ?With a full fledged Fedora now installed, could it access the Android device’s Wifi with either CLI or with Gnome’s NetworkManager ?
What about Camera access from Fedora for let’s say videoconferencing through Firefox ?August 1, 2023