[pve-devel] [PATCH container] setup: nixos: set cmode to console by default

Fiona Ebner f.ebner at proxmox.com
Fri Jan 26 15:47:34 CET 2024


Am 21.11.23 um 10:40 schrieb Christoph Heiss:
> In the default NixOS configuration (e.g. when using prebuilt container
> images from the Hydra pipeline [0]), getty is only configured for
> /dev/console, but not any TTY ports. This results in the user just
> getting a blank, black screen when opening the console in the web UI.
> 
> With this, the mentioned tarballs [0] work out-of-the-box.
> 
> [0] https://hydra.nixos.org/job/nixos/trunk-combined/nixos.containerTarball.x86_64-linux
> 
> Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
> ---
>  src/PVE/LXC/Setup/NixOS.pm | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/PVE/LXC/Setup/NixOS.pm b/src/PVE/LXC/Setup/NixOS.pm
> index c702f3d..7f23111 100644
> --- a/src/PVE/LXC/Setup/NixOS.pm
> +++ b/src/PVE/LXC/Setup/NixOS.pm
> @@ -17,6 +17,11 @@ sub new {
> 
>      $conf->{ostype} = "nixos";
> 
> +    # Set `cmode` to `console` for NixOS containers, as getty is only configured for /dev/console by
> +    # default, but not any TTY ports. This way, users still get a login/shell instead of just a
> +    # blank screen when openinng the console in the web UI.
> +    $conf->{cmode} = 'console';
> +
>      return bless $self, $class;
>  }
> 

Won't this override any pre-existing setting (from user or backup)? Even
if checking for that, it could still be considered a breaking change,
i.e. other people might have configured their NixOS container
differently, so maybe best to wait for the next major release?

For now, we could log a warning if no explicit 'cmode' was specified for
NixOS.

I don't see any other implementation of new() overriding any defaults.
Should we even start doing that?




More information about the pve-devel mailing list