elitak / nixos-infect

[GPLv3+] install nixos over the existing OS in a DigitalOcean droplet (and others with minor modifications)
GNU General Public License v3.0
1.3k stars 214 forks source link

Add oraclecloud PROVIDER to fix small /boot #179

Closed xvello closed 5 months ago

xvello commented 9 months ago

This is an alternative to https://github.com/elitak/nixos-infect/pull/145, to fix infect on Oracle Cloud.

All of the provided image I tested (Ubuntu, Oracle 8, Oracle 9, Alma Linux) have a 100MB /boot/efi partition, that nixos-infect takes over as /boot. The partition is too small to hold two kernels, and subsequent NixOS upgrades fail.

Tested on both ARM64 and AMD64 with curl https://raw.githubusercontent.com/xvello/nixos-infect/oracle/nixos-infect | PROVIDER=oraclecloud NO_SWAP=1 bash -x.

An alternative approach would be to modify findESP() to keep track of the folder it autodetected, to reuse that path. The code change for that was more intrusive, and could break infect on another topology.

Partition layouts

For reference, here are the partition layouts for VMs in Oracle Cloud

Canonical Ubuntu 22.04 Minimal (aarch64 and amd64)

This is the best layout I found so far, only 100M of EFI, the rest as ext4 root. This is the one we should recommend for new users:

Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1        45G  1.1G   44G   3% /
/dev/sda15       98M  6.3M   92M   7% /boot/efi

Oracle 8 (default)

This layout is very wasteful, leaving 11G unused after infect (1G of /boot, 10G of /var/oled):

Filesystem                  Size  Used Avail Use% Mounted on
/dev/mapper/ocivolume-root   36G  8.8G   27G  25% /
/dev/sda2                   924M  319M  606M  35% /boot
/dev/mapper/ocivolume-oled   10G  108M  9.8G   2% /var/oled
/dev/sda1                   100M  6.2M   94M   7% /boot/efi
xvello commented 8 months ago

Heya @elitak, do you have a moment to review this PR?

xvello commented 5 months ago

Closing after 3 months without feedback.

0xB10C commented 3 months ago

Hey @xvello, I ran into this the second time now and use your branch to infect some oracle cloud ARM machines. I think fixing this is important. Do you mind if I pickup your branch and PR it again?