mitchellh / nixos-config

My NixOS configurations.
https://twitter.com/mitchellh/status/1346136404682625024
MIT License
1.93k stars 191 forks source link

Missing `/dev/sda` in Nixos VM #13

Closed flou closed 2 years ago

flou commented 2 years ago

Hello,

I managed to create a nixos ISO (on a M1) and run it, but when I try to bootstrap it complains that /dev/sda doesn't exist:

❯ make vm/bootstrap0
ssh -o PubkeyAuthentication=no -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p22 root@192.168.136.130 " \
        parted /dev/sda -- mklabel gpt; \
        parted /dev/sda -- mkpart primary 512MiB -8GiB; \
        parted /dev/sda -- mkpart primary linux-swap -8GiB 100\%; \
        parted /dev/sda -- mkpart ESP fat32 1MiB 512MiB; \
        parted /dev/sda -- set 3 esp on; \
        mkfs.ext4 -L nixos /dev/sda1; \
        mkswap -L swap /dev/sda2; \
        mkfs.fat -F 32 -n boot /dev/sda3; \
        mount /dev/disk/by-label/nixos /mnt; \
        mkdir -p /mnt/boot; \
        mount /dev/disk/by-label/boot /mnt/boot; \
        nixos-generate-config --root /mnt; \
        sed --in-place '/system\.stateVersion = .*/a \
            nix.package = pkgs.nixUnstable;\n \
            nix.extraOptions = \"experimental-features = nix-command flakes\";\n \
            services.openssh.enable = true;\n \
            services.openssh.passwordAuthentication = true;\n \
            services.openssh.permitRootLogin = \"yes\";\n \
            users.users.root.initialPassword = \"root\";\n \
        ' /mnt/etc/nixos/configuration.nix; \
        nixos-install --no-root-passwd; \
        reboot; \
    "
Warning: Permanently added '192.168.136.130' (ED25519) to the list of known hosts.
(root@192.168.136.130) Password:
Error: Could not stat device /dev/sda - No such file or directory.
Error: Could not stat device /dev/sda - No such file or directory.
Error: Could not stat device /dev/sda - No such file or directory.
Error: Could not stat device /dev/sda - No such file or directory.
Error: Could not stat device /dev/sda - No such file or directory.
mke2fs 1.46.4 (18-Aug-2021)
The file /dev/sda1 does not exist and no size was specified.
mkswap: cannot open /dev/sda2: No such file or directory
mkfs.fat 4.1 (2017-01-24)
mkfs.fat: warning - lowercase labels might not work properly with DOS or Windows
mkfs.fat: unable to open /dev/sda3: No such file or directory
mount: /mnt: special device /dev/disk/by-label/nixos does not exist.
mount: /mnt/boot: special device /dev/disk/by-label/boot does not exist.
writing /mnt/etc/nixos/hardware-configuration.nix...

Is there an obvious setting in VMware that I missed?

mitchellh commented 2 years ago

Make sure your disk is SATA or SCSI. Its probably nvme, which is fine, it works fine, but the Makefile doesn't expect that.