-
-
Save zengxinhui/01afb43b8d663a4232a42ee9858be45e to your computer and use it in GitHub Desktop.
[09/23/2023] | |
Refs: | |
1. http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz | |
2. https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/aarch64/alpine-virt-3.18.0-aarch64.iso | |
3. https://wiki.alpinelinux.org/wiki/Replacing_non-Alpine_Linux_with_Alpine_remotely | |
4. https://wiki.archlinux.org/index.php/installation_guide#Configure_the_system | |
5. https://archlinuxarm.org/platforms/armv8/generic | |
See also: | |
1. Convert to Debian https://gist.github.com/zengxinhui/ee0ad6b7c7f99e2ead6cd0d2bd6641fd | |
2. Convert to arch x64 https://gist.github.com/zengxinhui/f328fdce54f5039689ee3aa4e91fc805 | |
3. Convert to arch arm https://gist.github.com/zengxinhui/01afb43b8d663a4232a42ee9858be45e | |
Requirement: | |
Console access. | |
# Prepare alpine linux, which can be configured to run from ram only. | |
# Alpine is leveraged to do the conversion. | |
# In any linux(ubuntu/debian/arch tested) become root first: | |
sudo su - | |
cd /tmp && wget https://dl-cdn.alpinelinux.org/alpine/v3.18/releases/aarch64/alpine-virt-3.18.0-aarch64.iso | |
dd if=alpine-virt-3.18.0-aarch64.iso of=/dev/sda && sync && reboot | |
# In Alpine with console: | |
# [Bring up networking] | |
ip li set eth0 up | |
udhcpc eth0 | |
# [Setup SSH, answer RET, yes, RET] | |
setup-sshd | |
# [set temp password] | |
passwd | |
# [At this point it's easier to use SSH to copy & paste] | |
# [Per Ref #3] | |
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/ | |
# [Setup apk and bring in pacman] | |
setup-apkrepos | |
# [enable community] | |
vi /etc/apk/repositories | |
apk update | |
apk add dosfstools e2fsprogs findmnt pacman arch-install-scripts | |
# [Disk partitioning & mounting] | |
# (use gpt table, set esp partition 15 size 256M), set root partition 1 size remaining) | |
# g, n, 15, RET, +256m, t, 1, n, RET, RET, RET, p, w | |
fdisk /dev/sda | |
ls /dev/sda* | |
# if sda1 or sda15 is missing, do "/etc/init.d/devfs restart" | |
mkfs.vfat /dev/sda15 | |
mkfs.ext4 /dev/sda1 | |
mount -t ext4 /dev/sda1 /mnt | |
mkdir /mnt/boot | |
mount /dev/sda15 /mnt/boot | |
cd /mnt && wget http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz | |
bsdtar -xpf /mnt/ArchLinuxARM-aarch64-latest.tar.gz -C /mnt | |
genfstab -U /mnt >> /mnt/etc/fstab | |
cd /; arch-chroot /mnt/ | |
# This is your arch root password. Choose carefully and remember it | |
# do the same for user `alarm` if you prefer to use that account and lots of `sudo` | |
passwd | |
cat > ~/.ssh/authorized_keys << EOF | |
<your key here> | |
EOF | |
cat > /etc/resolv.conf << EOF | |
nameserver 1.1.1.1 | |
nameserver 4.2.2.2 | |
nameserver 8.8.8.8 | |
EOF | |
pacman-key --init | |
pacman-key --populate archlinuxarm | |
pacman --noconfirm -Syu grub efibootmgr vi | |
# [EFI boot] | |
grub-install --efi-directory=/boot --bootloader-id=GRUB | |
vi /etc/default/grub | |
# Better console. Comparison below: | |
# GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet" | |
# GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 console=ttyS0,115200" | |
# Or use perl/sed to replace | |
# perl -pi.bak -e "s/quiet/console=ttyS0,115200/" /etc/default/grub | |
# sed -i.bak -e "s/quiet/console=ttyS0,115200/" /etc/default/grub | |
grub-mkconfig -o /boot/grub/grub.cfg | |
exit | |
reboot |
I'm missing something as I don't see /dev/sda1
after doing fdisk partitioning steps... anyone ran into the same issue?
localhost:~# fdisk /dev/sda
Welcome to fdisk (util-linux 2.38.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
GPT PMBR size mismatch (105191 != 97677311) will be corrected by write.
The backup GPT table is not on the end of the device. This problem will be corrected by write.
The device contains 'iso9660' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Command (m for help): g
Created a new GPT disklabel (GUID: 3CC9C60C-EA66-3341-B4AF-DE608E36B04D).
The device contains 'iso9660' signature and it will be removed by a write command. See fdisk(8) man page and --wipe option for more details.
Command (m for help): p
Disk /dev/sda: 46.58 GiB, 50010783744 bytes, 97677312 sectors
Disk model: BlockVolume
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: 3CC9C60C-EA66-3341-B4AF-DE608E36B04D
Command (m for help): n
Partition number (1-128, default 1): 15
First sector (2048-97677278, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-97677278, default 97675263): +512M
Created a new partition 15 of type 'Linux filesystem' and of size 512 MiB.
Command (m for help): t
Selected partition 15
Partition type or alias (type L to list all): 1
Changed type of partition 'Linux filesystem' to 'EFI System'.
Command (m for help): n
Partition number (1-14,16-128, default 1):
First sector (1050624-97677278, default 1050624):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1050624-97677278, default 97675263):
Created a new partition 1 of type 'Linux filesystem' and of size 46.1 GiB.
Command (m for help): p
Disk /dev/sda: 46.58 GiB, 50010783744 bytes, 97677312 sectors
Disk model: BlockVolume
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 1048576 bytes
Disklabel type: gpt
Disk identifier: 3CC9C60C-EA66-3341-B4AF-DE608E36B04D
Device Start End Sectors Size Type
/dev/sda1 1050624 97675263 96624640 46.1G Linux filesystem
/dev/sda15 2048 1050623 1048576 512M EFI System
Partition table entries are not in disk order.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
localhost:~# ls /dev
block loop-control sda15 tty19 tty34 tty5 tty8 vcsa2
bsg loop0 shm tty2 tty35 tty50 tty9 vcsa3
bus loop1 stderr tty20 tty36 tty51 ttyAMA0 vcsa4
console loop2 stdin tty21 tty37 tty52 ttyS0 vcsa5
cpu_dma_latency loop3 stdout tty22 tty38 tty53 ttyS1 vcsa6
disk loop4 tty tty23 tty39 tty54 ttyS2 vcsu
dri loop5 tty0 tty24 tty4 tty55 ttyS3 vcsu1
fb0 loop6 tty1 tty25 tty40 tty56 urandom vcsu2
fd loop7 tty10 tty26 tty41 tty57 vcs vcsu3
full mem tty11 tty27 tty42 tty58 vcs1 vcsu4
hidraw0 mqueue tty12 tty28 tty43 tty59 vcs2 vcsu5
hidraw1 null tty13 tty29 tty44 tty6 vcs3 vcsu6
hidraw2 ptmx tty14 tty3 tty45 tty60 vcs4 zero
input pts tty15 tty30 tty46 tty61 vcs5
kmsg random tty16 tty31 tty47 tty62 vcs6
log rtc0 tty17 tty32 tty48 tty63 vcsa
loop sda tty18 tty33 tty49 tty7 vcsa1
localhost:~# mkfs.ext4 /dev/sda1
mke2fs 1.46.5 (30-Dec-2021)
The file /dev/sda1 does not exist and no size was specified.
localhost:~#
You manually partition the disk at this step. Until that is done there's no sda1.
The disk is partiioned according to fdisk
Device Start End Sectors Size Type
/dev/sda1 1050624 97675263 96624640 46.1G Linux filesystem
/dev/sda15 2048 1050623 1048576 512M EFI System
but /dev/sda1 does not show under /dev when doing ls /dev
only /dev/sda
and /dev/sda15
so for whatever reason, the node device for /dev/sda1 was not present.... fixed it with:
mknod /dev/sda1 b 8 1
Thanks for the instructions.
If anyone runs into the problem of not being able to ssh into the machine after changing CPU count, try going into Oracle's Cloud Console. There, you should find yourself in the EFI Shell
as grub
couldn't be booted (at least in my case).
Enter map
to get the mapping table. First entry should be FS0
, so enter FS0:
to change directory to the FS0
device. You should now be on the boot partition. You should be able to cd EFI/GRUB
, and ls
to confirm that there is the grubaa64.efi
. Enter grubaa64.efi
to boot grub/Arch.
You can now either login through that Console or ssh into your machine and run grub-install --efi-directory=/boot/efi --bootloader-id=GRUB
again. It should now reboot as usual.
Not really sure what exactly causes it, some part isn't persistent through CPU count/memory amount changes.
has anyone had luck installing fedora cloud on this?
just a doubt, I have to create an instance with Oracle Linux 8, is that it?
The only change I would make is to switch ext4 to BTRFS + ZSTD
Followed this guide and with a few tiny mods got Arch up and running. I had one or a few reboots in the process.
When I issued poweroff
- Arch powered off but the instance said Running in my Oracle account. I stopped the instance, and the next time I tried running it - it wouldn't boot up, no pings, no SSH. The console shows me Shell>
only.
Is the intention here that Alpine is running 24/7 and when it stops - your Arch OS is gone or did I just miss a step somewhere and it's an easy recover?
Played with it for a while. I can get to the UEFI shell and launch EFI/GRUB/grubaa64.efi
directly, but this is not a long-term solution. Right now I have a functioning system but whenever I need to power it up I need to create a serial connection and launch OS manually. I even created /boot/startup.nsh
but that didn't help
It would be nice to mention to switch to
root
user in original host OSit would also be nice to note down that the alpine account is
root
for login from the Console.And like e-minguez said it would be nice to mention that to mention how to gain root access in alarm.
Thanks a lot, this saved me a lot of time!
I've also saved it to my own repo with some small changes - https://gitlab.com/C0rn3j/arch/-/blob/master/OracleCloudARM.md