nix-community / nixos-generators

Collection of image builders [maintainer=@Lassulus]
MIT License
1.85k stars 146 forks source link

openstack qcow2 image deployed system is not accessible after boot (NixOS 21.05) #141

Open AleXoundOS opened 2 years ago

AleXoundOS commented 2 years ago

image

I suspect the reason for this is that the default configuration is BIOS-bootable, not UEFI. But not sure.

Lassulus commented 2 years ago

hmm, not sure if bios is at fault here, 'Booting the kernel' sounds like it found a kernel and failed later in the boot process?

Lassulus commented 2 years ago

on what machine do you try to boot the image?

cyber-goka commented 2 years ago

@Lassulus hey I generated for openstack qocw2 image and this happened, I tried with nixos-genearte

AleXoundOS commented 2 years ago

on what machine do you try to boot the image?

@Lassulus, which specs exactly do you need?

Lassulus commented 2 years ago

uhm, what kind of virtualization it is using? do you have a qemu command ready to test it for me? is it on x86_64? etc

cyber-goka commented 2 years ago

@Lassulus it's x86_64, no we don't have access directly to qemu, it is openstack

Lassulus commented 2 years ago

have you tried the openstack format instead of the cloudstack one?

AleXoundOS commented 2 years ago

@Lassulus, first of all, sorry for the misleading issue title (it erroneously featured cloudstack). The actual target cloud is openstack. I'm an experienced Nix/OS user/dev, but a newbie in cloud tech and I confused these when my colleague ran into the issue and reported it.


We currently tested NixOS 21.05, so some or all of the information may be irrelevant for the newer versions at the moment. Also the described issues originate not from nixos-generators but from nixpkgs, so may be a subject to be moved.


Ok, the image actually boots: bootloader, kernel and services, except openstack-init service. So it is not halted as we originally thought. It just prints nothing to the cloud virtual console because of boot.kernelParams = [ "console=ttyS0" ]; in openstack-config.nix (imported from nixpkgs). Overriding (lib.mkForce) this option in our configuration.nix solves this part. Do other openstack deployments nowadays benefit from "console=ttyS0"?

The openstack image is really only BIOS-bootable, but this is what our openstack cloud actually expects. "Wrong EFI loader signature" is not an issue really, just a warning. It doesn't stop the system.

However, after all the systemd services booting stuff was printed, the system is not accessible:

  1. No login prompt in the virtual console. Perhaps, serial-getty / getty / autovt systemd services are disabled or need adjustments.
  2. Cannot connect/login via ssh: ssh authorized keys are not passed from the openstack cloud configuration to the system. Maybe caused by the next issue. We had to mount the disk in another virtual machine to add authorized_keys file manually.
  3. openstack-init systemd service fails at some wget calls with 404 HTTP code. Perhaps, this is fixed in upstream: https://github.com/NixOS/nixpkgs/commit/413afdae6e29ff8f90f6576cf7317455013e8ebd.
Lassulus commented 2 years ago

ah, alright, well nixos-generators is just a thin wrapper around nixpkgs. so the problems are probably upstream. as you can see in https://github.com/nix-community/nixos-generators/blob/master/formats/openstack.nix we just import this file: https://github.com/NixOS/nixpkgs/blob/master/nixos/maintainers/scripts/openstack/openstack-image.nix and do nothing else

starcraft66 commented 2 years ago

I think this is working as expected, I see the same output as you on the graphical console of my nixos images running on openstack, however if I check the serial console I have the full linux console there. I think you're supposed to use the serial console and not the graphical one. Ideally, just enable ssh and don't use the console at all!