Skip to content

Instantly share code, notes, and snippets.

@nahidtislam
Last active February 1, 2023 08:49
Show Gist options
  • Save nahidtislam/f7592667342bb84cd4708adcd066c669 to your computer and use it in GitHub Desktop.
Save nahidtislam/f7592667342bb84cd4708adcd066c669 to your computer and use it in GitHub Desktop.
convert ubuntu-aarch64 to pop-os (for Parallels on Apple Silicon Macs)
#!/bin/bash
## this script is intended to allow pop os to run on arm64 machines that isn't a raspberry pi
## very useful especially on a parallels virtual machine on the M1 or M2 macs
### plz note I got commands from a random reddit link leading to a website
### which I really need to credit but can't find the source
# to get the script started you must start up an ubuntu live cd ad perform the installation
# see link to download the desktop live environment for easy install
# https://cdimage.ubuntu.com/jammy/daily-live/current/jammy-desktop-arm64.iso
## plz DO NOT RESTART after the ubuntu installation
## you must chroot to /target (make sure it's mounted)
mount | grep -e '\s/target\s' &> /dev/null &&
mount --bind /target /target &&
cd /target &&
rm /target/etc/resolv.conf &&
cp /etc/resolv.conf etc &&
mount -t proc /proc proc &&
mount --make-rslave --rbind /sys sys &&
mount --make-rslave --rbind /dev dev &&
mount --make-rslave --rbind /run run
[ "$?" == "0" ] && cp "$0" "/target/tmp/"
if mount | grep -e \\s"/cdrom"\\s &> /dev/null; then
# to prevent Pop!_OS being installed to the live environment
printf "%s\n" "error: please chroot into '/target' before performming the script"
exit 1
fi
# this is for when they are not in the live environment running directly on the ubuntu installation
if pgrep gnome-shell &> /dev/null || pgrep gdm &> /dev/null && ! ischroot; then
printf "%s\n" "error: this script cannot run when gdm or gnome is running"
printf "%s\n" " log out then press ctrl-alt-(fn)f3 and type in"
printf "%s\n" " 'sudo systemctl stop gdm'"
printf "%s\n" " then try again"
exit 1
fi
# the conversion
sudo apt purge --autoremove -y ubuntu-desktop
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 63C46DF0140D738961429F4E204DD8AEC33A7AFF
sudo add-apt-repository "deb http://apt.pop-os.org/release $(lsb_release -cs) main" -y
sudo add-apt-repository "deb http://apt.pop-os.org/staging/master $(lsb_release -cs) main" -y
sudo apt update -y && sudo apt full-upgrade -y
sudo apt install -y pop-desktop-raspi
# error occurs so we must fix on apt
sudo dpkg -i --force-overwrite /var/cache/apt/archives/pop-gnome-initial-setup_*_arm64.deb
sudo apt -f -y install
sudo apt install -y pop-desktop-raspi
sudo sed -i 's/Enabled: yes/Enabled: no/g' /etc/apt/sources.list.d/system.sources /etc/apt/sources.list.d/pop-os-apps.sources
sudo apt purge --autoremove -y linux*-raspi*
sudo apt update -y && sudo apt full-upgrade --allow-downgrades -y
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment