-
-
Save dotsh/d807030b020d2e4ef88d4faa974a7e9f to your computer and use it in GitHub Desktop.
# should works on any cloud-init enabled hypervisor (openstack.. ) | |
# start from a ubuntu minimal install | |
# we need to shrink down the used space to move it in a tmpfs of 700MB | |
# make sure we are on the highest kernel, so we can delete all the others ... | |
sudo apt update && sudo apt upgrade -y && reboot | |
# ... reconnect | |
sudo apt install lsof | |
sudo snap remove --purge oracle-cloud-agent && sudo snap remove --purge core18 && sudo snap remove --purge snapd && sudo sudo apt -y purge snapd && sudo rm -rf ~/snap /snap /var/cache/snapd | |
sudo apt purge $(dpkg-query -Wf '${Package}\n' | grep header) $(apt list --installed | grep -oP "^linux.*\d\d\d\d-oracle" | grep -v "$(uname -r)") linux-modules-extra-$(uname -r) lxc* lxd* vim* && sudo apt -y autoremove && sudo apt -y autoclean && sudo apt -y clean | |
sudo rm -rf /var/log/* /var/lib/apt/lists/* | |
# ok, the disk usage of / should be less than 600MB now | |
cd / | |
mount -t tmpfs -o size=700m tmpfs mnt | |
tar --one-file-system -c . | tar -C /mnt -x | |
mount --make-private -o remount,rw / | |
mount --move dev mnt/dev | |
mount --move proc mnt/proc | |
mount --move run mnt/run | |
mount --move sys mnt/sys | |
sed -i '/^[^#]/d;' mnt/etc/fstab | |
echo 'tmpfs / tmpfs defaults 0 0' >> mnt/etc/fstab | |
cd mnt | |
mkdir old_root | |
mount --make-private / | |
unshare -m | |
pivot_root . old_root | |
# now the root storage is the RAM | |
# lets restart all runnig process | |
service ssh restart | |
# now switch to a new ssh connexion to let the old sshd terminate | |
service systemd-udevd restart | |
service systemd-journald restart | |
service systemd-networkd restart | |
service systemd-timesyncd restart | |
service systemd-resolved restart | |
service systemd-logind restart | |
service networkd-dispatcher restart | |
pkill agetty | |
pkill dbus-daemon | |
pkill atd | |
pkill iscsid | |
pkill rpcbind | |
pkill unattended-upgrades | |
kill 1 | |
# check with "lsof /old_root" that there is no remaining process | |
umount -l /dev/sda1 | |
# check : | |
df -h | |
lsblk | |
# the disk should be unmount | |
# now, just copy the debian cloud image on the disk. | |
# curl https://cdimage.debian.org/cdimage/openstack/current/debian-10-openstack-amd64.raw | dd of=/dev/sda bs=1M | |
# update : | |
curl -L https://cdimage.debian.org/cdimage/openstack/testing/debian-testing-openstack-amd64.raw | dd of=/dev/sda bs=1M | |
sync | |
reboot | |
I'm using ARM Processer
I've stuck at line no 36.
chroot is running...
Need an Assitance
@Angu0083 did you manage to make it work? I also want to get Debian on ARM processors.
It worked on ARM64 ubuntu image as well! thank you @ClashTheBunny and @dotsh
Here is the gist for anyone who wants to do the same: https://gist.github.com/4abhinavjain/893ec13c651bee08088c8f4661998952
@dotsh I never thought something like this could be possible. It is just brilliant!
Well done ! 👍
Hi Guys,
I've waited for response almost five days, but no one was responded. So, I choose the alternative way.
Upload the Debian 10 qcow2 image to Oracle cloud storage, and then import as a custom image.
After I created the instance using the custom image and its perfectly working fine. But this method takes extra time and data usage.
Image: https://cdimage.debian.org/cdimage/openstack/10.11.2-20211129/debian-10.11.2-20211129-openstack-arm64.qcow2
Thanks, @Angu0083 . Glad that you could do it that way. My account doesn't support custom images and I had no other way to install Debian.
I would like to say many thanks for the author for all his effort to contribute with this tutorial ..
But I had to try a few images before getting to the right one .. so I'll leave here to those who wants to try:
Canonical-Ubuntu-18.04-Minimal-2023.05.10-0
But I reached a problem and I can't get pass it:
root@debian-amd:/# mount --move run mnt/run
mount: /mnt/run: filesystem was mounted, but failed to update userspace mount table.
It gives me this error, but it allows me to continue until...
root@debian-amd:/mnt# unshare -m
mesg: ttyname failed: No such file or directory
When I restart ssh .. it restarts just fine, but when I try to connect, it accepts my login credentials, it stucks and doesn't bring the command line ability .. it just gives me the intro message and stops...
But I can continue on my old terminal plus I opened the console from Oracle and both still works .. let's continue
but unfortunately sudo doeesn't work on the command anymore and none of the following instructions also works ..
service systemd-udevd restart
service systemd-journald restart
I've been trying for hours to install debian on Oracle .. I also don't have the image converter function anymore, it only works on the first 30 days then it's gone ... and I don't want to convert my Free account into a PAYG and I'll never be able to downgrade ..
I was thinking .. maybe instead of getting all / into ram .. why not just attach a new storage? I tried to attach and it creates a /dev/sdb .. but I have no knowledge to go further =/
I would like to say many thanks for the author for all his effort to contribute with this tutorial ..
But I had to try a few images before getting to the right one .. so I'll leave here to those who wants to try: Canonical-Ubuntu-18.04-Minimal-2023.05.10-0
But I reached a problem and I can't get pass it:
root@debian-amd:/# mount --move run mnt/run mount: /mnt/run: filesystem was mounted, but failed to update userspace mount table.
It gives me this error, but it allows me to continue until...
root@debian-amd:/mnt# unshare -m mesg: ttyname failed: No such file or directory
When I restart ssh .. it restarts just fine, but when I try to connect, it accepts my login credentials, it stucks and doesn't bring the command line ability .. it just gives me the intro message and stops...
But I can continue on my old terminal plus I opened the console from Oracle and both still works .. let's continue
but unfortunately sudo doeesn't work on the command anymore and none of the following instructions also works ..
service systemd-udevd restart service systemd-journald restart
I've been trying for hours to install debian on Oracle .. I also don't have the image converter function anymore, it only works on the first 30 days then it's gone ... and I don't want to convert my Free account into a PAYG and I'll never be able to downgrade ..
Thanks for the feedback and sorry to hear it didn't work for you. I see your image name is "debian-amd". Could you please cross-check whether you are using the right arch image (i.e. arm64 on arm64 instance and amd64 on arm64)? Also, please confirm that cloud-init is enabled on the instance before the procedure.
If you are looking for arm64, you can try out my gist which seems to work on debian 12 as well: https://gist.github.com/4abhinavjain/893ec13c651bee08088c8f4661998952
I was thinking .. maybe instead of getting all / into ram .. why not just attach a new storage? I tried to attach and it creates a /dev/sdb .. but I have no knowledge to go further =/
Another possible way (which I haven't tried yet) is to boot the instance in recovery mode, mount the partition and use dd command to overwrite the raw image onto the partition.
It's so strange, I get stuck at a UEFI prompt twice, even though I got the unmount and DD to work fine. UEFI won't even detect a filesystem...