New lightsail instance use /dev/nvme0n1 instead of /dev/xvda as boot device
xinyangli opened this issue · 1 comments
xinyangli commented
I created two Lightsail instances and encountered the following error when running nixos-infect on them. It appears that AWS Lightsail uses /dev/nvme0n1 instead of /dev/xvda as the boot drive. Currently, amazon-linux.nix in nixpkgs defaults to /dev/xvda, and I had to force the rewrite of the device to make nixos-infect work. I'm unsure if this is also the case for EC2 instances.
Happy to file a pull request if anyone can confirm this.
+ isEFI
+ '[' -d /sys/firmware/efi ']'
+ /nix/var/nix/profiles/system/bin/switch-to-configuration boot
updating GRUB 2 menu...
installing the GRUB 2 boot loader on /dev/xvda...
Installing for i386-pc platform.
/nix/store/qp220kp2wp6yz59snjd5j5072dv29zjg-grub-2.12-rc1/sbin/grub-install: error: cannot find a GRUB drive for /dev/xvda. Check your device.map.
/nix/store/6d5z9niwr0s5rn3mhqnzp6www61hxm2v-install-grub.pl: installation of GRUB on /dev/xvda failed: No such file or directory
fdisk result
Disk /dev/nvme0n1: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk model: Amazon Elastic Block Store
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disklabel type: gpt
Disk identifier: F50D69C7-5B2E-44C2-8C60-213E9CEDE48F
Device Start End Sectors Size Type
/dev/nvme0n1p1 227328 41943006 41715679 19.9G Linux filesystem
/dev/nvme0n1p14 2048 10239 8192 4M BIOS boot
/dev/nvme0n1p15 10240 227327 217088 106M EFI System
Partition table entries are not in disk order.
configuration.nix I used to make it work
{ config, pkgs, modulesPath, lib, ... }:
{
imports = [ "${modulesPath}/virtualisation/amazon-image.nix" ];
boot.loader.grub.device = lib.mkForce "/dev/nvme0n1";
}
abeluck commented
I can confirm this. New lightsail instances need /dev/nvme0n1
as the grub device.