Last active
January 10, 2022 14:27
-
-
Save B83C/67547079a592ae6bace43f7aed247002 to your computer and use it in GitHub Desktop.
Running void linux on Oracle Cloud aarch64 free tier
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#The steps are simple | |
#You would need to get the machine to boot into a live os in ram so as to allow | |
#modifications from within the machine without having to set up using another. | |
#One way to do it is to boot an alpine img: | |
wget https://dl-cdn.alpinelinux.org/alpine/v3.14/releases/aarch64/alpine-virt-3.14.2-aarch64.iso -O alpine.iso #or whatever versions suits you best | |
dd if=alpine.iso of=/dev/sda | |
#Now you have to reboot the system. If 'sudo reboot' doesn't work, try hard | |
#reboot from the OCI Console | |
#At this point, I assume that you know how to set up a console connection to the | |
#machine. I would prefer VNC since it is less buggy. Ok, just do your job here, | |
#if you haven't already. | |
#You should be greeted with the login screen, simply login with root account, no | |
#password required. | |
#Now we need to load everything into ram and unmount the disk: | |
mkdir /media/setup | |
cp -a /media/sda/* /media/setup | |
mkdir /lib/setup | |
cp -a /.modloop/* /lib/setup | |
/etc/init.d/modloop stop | |
umount /dev/sda | |
mv /media/setup/* /media/sda/ | |
mv /lib/setup/* /.modloop/ | |
#To setup networking and install required packages: | |
setup-interfaces -a | |
rc-service networking start | |
rc-update add networking boot | |
apk update | |
apk add e2fsprogs libarchive-tools | |
#optional: | |
#apk add parted | |
#I will leave the partitioning part to you | |
#But what you will at least need is a bootable efi partition ( the size of which depends on your needs ) | |
#and a rootfs. You can set the efi partition bootable easily via parted. | |
#If you have enough memory, you may skip the creation of swap. | |
#Now set the filesystems and mount them | |
mkfs.vfat /dev/sda1 #assuming efi partition to be on sda1 | |
mkfs.ext4 /dev/sda2 #it is not mandatory to use ext4 but other types would need extra config | |
mount -t ext4 /dev/sda2 /mnt | |
mkdir -p /mnt/boot/efi/ | |
mount /dev/sda1 /mnt/boot/efi | |
#Now download the rootfs for void linux (Glibc or musl the ball is in your court) | |
#But I like musl more :) | |
wget https://alpha.de.repo.voidlinux.org/live/current/void-aarch64-musl-ROOTFS-20210218.tar.xz -O void.tar.xz | |
tar -xf void.tar.xz -C /mnt | |
#Enter chroot: | |
mount --rbind /sys /mnt/sys && mount --make-rslave /mnt/sys | |
mount --rbind /dev /mnt/dev && mount --make-rslave /mnt/dev | |
mount --rbind /proc /mnt/proc && mount --make-rslave /mnt/proc | |
#DNS setup | |
cp /etc/resolv.conf /mnt/etc/ | |
#chroot, in we goooooooooooo: | |
PS1='(chroot) # ' chroot /mnt/ /bin/bash | |
#WARNING: The following commands are executed under chroot! | |
#Install base-system | |
xbps-install -Su xbps | |
xbps-install -u | |
xbps-install base-system | |
xbps-remove base-voidstrap | |
#Of course, you may avoid all the bloat packages by installing | |
#base-minimal, but then you will need to prepare your own kernel + | |
#initramfs which I assume the majority of you do not have. | |
#And yes, a lot of the packages are not needed, including the firmware | |
#Optional: | |
#echo "Your hostname" > /etc/hostname | |
#Lastly, set your root password: | |
passwd | |
#Configure your /etc/fstab | |
#You can write your own configuration but it is not the point of | |
#this guide | |
#I assume that you do not want to | |
cp /proc/mounts /etc/fstab | |
#Now remove all the lines except the ones with the essential partitions | |
#like: | |
#/dev/sda1 /boot/efi vfat rw,relatime,[...] 0 0 | |
#/dev/sda2 / ext4 rw,relatime 0 0 | |
#You would want to set the trailing 0's to a particular value, | |
#in which / = 1 and other partitions = 2 | |
#Like so: | |
#/dev/sda1 /boot/efi vfat rw,relatime,[...] 0 2 | |
#/dev/sda2 / ext4 rw,relatime 0 1 | |
#To enable /tmp to be mounted with a tmpfs, append this line | |
#tmpfs /tmp tmpfs defaults,nosuid,nodev 0 0 | |
#Last but not least, grub installation | |
xbps-install grub-arm64-efi | |
grub-install --target=arm64-efi --efi-directory=/boot/efi -- | |
#This step is optional to those who know how to add a boot option | |
#from the EFI BOOT MENU by pressing ESC on boot from vnc console connection: | |
mkdir -p /boot/efi/EFI/boot | |
cp /boot/efi/void/grubaa64.efi /boot/efi/EFI/boot/bootx64.efi | |
#The reason for that is the UEFI Entry 'Oracle BOOT ...' looks for | |
#bootx64.efi in /EFI/BOOT/ on the EFI partition | |
#Finally: | |
xbps-reconfigure -fa | |
#Now you have successfully installed void linux on your aarch64 machine! | |
#Exit, reboot and have fun! | |
exit | |
shutdown -r now | |
#or reboot from OCI Console | |
#REFS: | |
#https://www.alextsang.net/articles/20191006-063049/index.html | |
#https://docs.voidlinux.org/installation/guides/chroot.html |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment