Ubuntu installation guide ( New method )
Another installation guide for newer Ubuntu port.
Last updated
Another installation guide for newer Ubuntu port.
Last updated
This document is a guide for installing Ubuntu Linux on your Xiaomi Mi Pad 5 with the latest mainline kernel.
This repository is currently maintained by map220v on GitHub:
Open your browser and search GitHub, then login your account, click the link above.
Click the "Fork" button to fork this repository. Once it forked, head to the next part of this guide, we'll build a custom system image for our further installation.
Thanks to GitHub Actions, the build sections are all finished automatically, so we don't need to compile them manually. After you forked this repository, go to "Actions" tab, find the "rootfs" section in sidebar, then click "Run workflow" to build a kernel and system image. It will takes you about 23 minutes and 42 seconds to finish this build.
Once the build process is finished, click the "rootfs" in your workflow table. Scrolling down the page, you'll find the "Artifacts" section.
Here are your build files, download the xiaomi-nabu-debs_6.7-working
and rootfs package. Either rootfs_lomiri_6.7-working
or rootfs_ubuntu-desktop_6.7-working
is OK.
This procedure will not erase your Android data files, since Android will automatically fixing the userdata
partition.
To modify the partitions on the UFS, we'll need to download a 3rd-party recovery environment called "Orangefox Recovery" Link is here below:
Once you've downloaded, open a terminal and type the following commands:
This will start booting recovery image. Once the screen is on, use the terminal to continue processing. We well use adb shell
command to finish the rest of this guide. Enter this command in your terminal, it well help you to check the userdata partition's location:
In this example, the userdata
partition is located in the 31st partition of the whole disk. It has the biggest size, compared with other partitions. So this is the key for requiring new space for our Ubuntu installation.
Enter print
command to list all partitions for /dev/block/sda
:
Then you will see your current partition table with userdata
being the last partition
Below is an example of output:
Now let’s continue partitioning:
Here the size of userdata
can be decided by yourself.
Delete partition 31 and again make sure it is not deleted incorrectly.
Check the results:
Note the end of the last partition in the above list, 10.9GB, this number will be used as the start of the new userdata
partition, followed by the end of the partition. Let say that we want to make an approx 40GB userdata
partition using the following command:
Between userdata
and 10.9GB are 3 spaces, one of them replace the partition type flag, it is important to use 3 spaces at this step.
Run print again to see the results.
Exit the parted tool finally.
Now userdata
resizing is done. Restart your tablet to apply changes.
We'll use the free space for our Ubuntu installtion:
The output will look like this:
Exit the parted tool and reboot once again.
Now we need to check which slot Android is installed.
You can check this infomation via fastboot
. Command is listed below:
Force select Slot A as active slot:
Now, we are ready to flash the system image. But before we start, we need to disable Android Verified Boot (AVB) feature, otherwise it will prevent booting Ubuntu system.
Flash the vbmeta
with vbmeta_disabled.img
to disable this feature:
Then, flash rootfs
images:
To finish installing our system, we need to use chroot container to continue our setup.
Now, let's boot recovery image temporally:
Once the recovery is booted, you are ready to setup a new chroot container. Go to "Advanced" tab, tap "Terminal" to enter terminal, and you are ready to go.
The chroot target should be a directory which contains a file system hierarchy.
In Android recovery, this directory would be /mnt
. However, on Android, the /mnt
directory is occupied by other several important directories, so you'll need to create another empty folder for chrooting.
Run lsblk
and note the partition layout of your installation. It will be usually something like /dev/sd
XY
.
Mount the file system:
Then, continue on your recovery ( or Android ) session.
First, let's mount the temporary API Filesystems:
Warning: When using --rbind
, some subdirectories of dev/
and sys/
will not be unmountable. Attempting to unmount with umount -l
in this situation will break your session, requiring a reboot. If possible, use -o bind
instead.
Next, to change root into /path/to/new/root
using default sh
shell:
Then, we need to fix the permission issues to get chroot fully working under Android or Android recovery:
Simply remount root filesystem:
Finally, chroot into your system:
If you have compiled UEFI firmware, you still need to install a bootloader ( e.g. GRUB ) to load the kernel and start the system. On your chroot container, enter this command to install bootloader:
sudo apt install grub-efi grub2-common efibootmgr
Then, type exit
to exit chroot, and type reboot bootloader
to reboot your tablet.
Now, flash your UEFI firmware and reboot your tablet:
Ensure that the paths and commands are correctly adjusted to fit your system configuration. Once the bootloader installation is complete, verify that the UEFI firmware and bootloader are functioning by rebooting the device and selecting the appropriate boot option from the UEFI menu. This will confirm a successful setup and enable your tablet to boot into the new system environment.
WARNING: DO NOT download 6.8 packages as 6.8 kernel , it will show nothing on screen (even the console) after you installed them.
From now on, follow the until the "Install new system" chapter.
To resize the userdata
partition, we'll need to use the command tools to do this. Now let's open adb shell
again and start typing parted
in the terminal.
If you are using newer recovery like or PBRP Recovery, you need to download parted
and use adb
command to copy it to internal storage. Run these commands to finish this:
Follow to assign EFI partition.
Enter fastboot mode and repeat the .
NOTE: The concept of "slot" probably unfamiliar for you, since it was included in Android 10 as a feature, which called "Dynamic Partitions". Dynamic partitions are a userspace partitioning system for Android. About its further infomations, .
More information and technical details,
According to Wikipedia and Arch Wiki, a is an operation that changes the apparent root directory for the current running process and their children. A program that is run in such a modified environment cannot access files and commands outside that environmental directory tree. This modified environment is called a chroot jail.
Download Orangefox or TWRP recovery first:
If you have an and need to make changes in it (e.g. updating the or images):
Since this method require UEFI firmware to boot your system, you need to compile the UEFI firmware for your tablet. to do so.