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

change lightsail boot device to /dev/nvme0n1 #186

Closed iosmanthus closed 5 months ago

iosmanthus commented 8 months ago

This pull request closes #183. I have already tested this change in AWS Lightsail with Ubuntu 22.04.

The boot device has been changed to:

NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
...
nvme0n1      259:0    0    40G  0 disk
├─nvme0n1p1  259:1    0  39.9G  0 part /
├─nvme0n1p14 259:2    0     4M  0 part
└─nvme0n1p15 259:3    0   106M  0 part /boot/efi

After rebooting the instance, the NixOS has been installed successfully.

Linux ip-<redact>.ap-southeast-1.compute.internal 5.15.119 #1-NixOS SMP Wed Jun 28 08:29:53 UTC 2023 x86_64 GNU/Linux
xinyangli commented 8 months ago

Should we consider also upstreaming this into nixpkgs, perhaps?

iosmanthus commented 8 months ago

Should we consider also upstreaming this into nixpkgs, perhaps?

It seems this change only applied to Lightsail, the ec2 instance is still booting from xvda.

Here is the disk status I fetch from an ec2 instance (t2.micro).

ubuntu@ip-172-31-22-251:~$ lsblk
NAME     MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0      7:0    0  24.6M  1 loop /snap/amazon-ssm-agent/7528
loop1      7:1    0  55.7M  1 loop /snap/core18/2790
loop2      7:2    0  63.5M  1 loop /snap/core20/2015
loop3      7:3    0 111.9M  1 loop /snap/lxd/24322
loop4      7:4    0  40.8M  1 loop /snap/snapd/20092
xvda     202:0    0     8G  0 disk 
├─xvda1  202:1    0   7.9G  0 part /
├─xvda14 202:14   0     4M  0 part 
└─xvda15 202:15   0   106M  0 part /boot/efi
xinyangli commented 8 months ago

It seems this change only applied to Lightsail, the ec2 instance is still booting from xvda.

Okay :+1: , then lib.mkForce here seems to be the best choice

iosmanthus commented 5 months ago

@elitak PTAL