Trying to run Ubuntu Desktop 19.04 on the HTC One M7
Not yet working. Using the PostmarketOS boot.img for a debug-ramdisk in order to use telnet. Almost had some success, but the device doesn't seem to have a framebuffer device. If it does, then I cannot see the device. The other thing used was debootstrap to create a armhf rootfs for Ubuntu Focal.
Commands to make the rootfs and possibly install (I will leave my debootstrapped rootfs in the releases tab, but it might not work unless the fbdev works)
sudo -i # type in your root password after
apt install -y debootstrap qemu-user-static
cd /mnt && mkdir ubuntu
debootstrap --arch=armhf --foreign focal /mnt/ubuntu # wait some time for the packages to download and set up
These next steps are recommended to be done on the device within recovery, but I don't really like having to tar, move, extract, modify, then tar, move, and extract a rootfs from a device multiple times as it can be slow and since we are in recovery, it will not have internet access, so no downloading and installing necessesities. This will be done on a PC using qemu-arm-static and chroot
cp /usr/bin/qemu-arm-static /mnt/ubuntu/usr/bin/
chroot /mnt/ubuntu /usr/bin/qemu-arm-static /bin/sh -i
/debootstrap/debootstrap --second-stage # wait awhile for it to set up and install the base system
passwd # type in preferred password
passwd root # type in preferred password again
apt install -y nano
nano /etc/hostname # change name in here to something that is not your PC's name
apt install locales
dpkg-reconfigure locales # choose region, in my case, I chose en_US.UTF-8 (choose this option for both prompts)
auto lo eth0
allow-hotplug eth0
iface lo inet loopback
iface eth0 inet dhcp
nano sources.list
deb http://ports.ubuntu.com/ focal main universe
deb-src http://ports.ubuntu.com/ focal main universe
deb http://ports.ubuntu.com/ focal-security main universe
deb-src http://ports.ubuntu.com/ focal-security main universe
deb http://ports.ubuntu.com/ focal-updates main universe
deb-src http://ports.ubuntu.com/ focal-updates main universe
Install a desktop environment. XFCE4 was not working for me, so try something else. For the sake of this small guide, I will put xfce4 because that is what I was trying.
apt install xfce4 # or gdm3, xdm, etc. Whatever works for you.
I skipped some of these next steps because I am wanting to install full Ubuntu without Android installed.
apt install -y openssh-server
nano /etc/ssh/sshd_config
#PermitRootLogin prohibit-password
PermitRootLogin yes
apt clean
rm /usr/bin/qemu-arm-static
exit
Now we are done with setting up our rootfs. Let's .tar.bz2 the rootfs, then push it to the device to test if it has worked.
tar -cjpf ~/ubuntu_rootfs.tar.bz2 # Wait a moment as it is compressing everything.
This will produce a archive of around ~475MB located in the folder that appears as soon as you open File Explorer.
adb push ~/ubuntu_rootfs.tar.bz2 /data
adb shell
cd data && tar xvf ubuntu_rootfs.tar.bz2 . # Wait for some more as it is a big rootfs.
Once extracted, make sure you have pmbootstrap to get the telnet boot.img for the M7. Installing pmbootstrap is as easy as:
git clone https://gitlab.com/postmarketOS/pmbootstrap.git
cd pmbootstrap && python3 setup.py install
pmbootstrap init # choose everything as default
pmbootstrap initfs hook_add debug-shell
pmbootstrap export
cp /tmp/postmarketOS-export/boot.img-htc-m7 ~/boot.img
fastboot flash boot ~/boot.img
fastboot reboot
From here on out you essentially have Ubuntu on your phone, whether or not it works is a matter of if the display manager is compatible and if the kernel is working (I guess.) Let's telnet and mount some partitions.
telnet 172.16.42.1
mount /dev/mmcblk0p39 /root
mount -o bind /dev /root/dev # this fails for me, idk why tho.
mount -o bind /dev/pts /root/dev/pts
mount -o bind /sys /root/sys
mount -o bind /proc /root/proc
After this we can chroot and start the display manager. startx is for xfce4 as far as I know, I don't know the others, hence why I cannot try to start xdm, gdm3, or gnome on my device.
chroot /root /bin/bash -i
startx