mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-06-05 21:03:40 +00:00
nixos/terminfo: Fix less in systemd stage 1
Since `less` 691, we get `terminals database is inaccessible` in initrd. This is a problem because ordinary systemd commands like systemctl and journalctl often try to use the pager. Bisected to:7bf5441da5Fedora only adds these few terminfos to their initramfs, see dracut:5d2bda46f4/modules.d/95terminfo/module-setup.sh (L12)
This commit is contained in:
@@ -66,6 +66,17 @@
|
||||
source = "${config.system.path}/share/terminfo";
|
||||
};
|
||||
|
||||
boot.initrd.systemd.contents = lib.listToAttrs (
|
||||
lib.map
|
||||
(ti: lib.nameValuePair "/etc/terminfo/${ti}" { source = "${pkgs.ncurses}/share/terminfo/${ti}"; })
|
||||
[
|
||||
"l/linux"
|
||||
"v/vt100"
|
||||
"v/vt102"
|
||||
"v/vt220"
|
||||
]
|
||||
);
|
||||
|
||||
environment.profileRelativeSessionVariables = {
|
||||
TERMINFO_DIRS = [ "/share/terminfo" ];
|
||||
};
|
||||
|
||||
@@ -1560,6 +1560,7 @@ in
|
||||
};
|
||||
systemd-initrd-simple = runTest ./systemd-initrd-simple.nix;
|
||||
systemd-initrd-swraid = runTest ./systemd-initrd-swraid.nix;
|
||||
systemd-initrd-terminfo = runTest ./systemd-initrd-terminfo.nix;
|
||||
systemd-initrd-vconsole = runTest ./systemd-initrd-vconsole.nix;
|
||||
systemd-initrd-vlan = runTest ./systemd-initrd-vlan.nix;
|
||||
systemd-journal = runTest ./systemd-journal.nix;
|
||||
|
||||
22
nixos/tests/systemd-initrd-terminfo.nix
Normal file
22
nixos/tests/systemd-initrd-terminfo.nix
Normal file
@@ -0,0 +1,22 @@
|
||||
{ lib, ... }:
|
||||
{
|
||||
name = "systemd-initrd-terminfo";
|
||||
|
||||
meta.maintainers = [ lib.maintainers.elvishjerricco ];
|
||||
|
||||
nodes.machine =
|
||||
{ config, ... }:
|
||||
{
|
||||
boot.initrd.systemd = {
|
||||
enable = true;
|
||||
extraBin.script = "${config.boot.initrd.systemd.package.util-linux}/bin/script";
|
||||
};
|
||||
testing.initrdBackdoor = true;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
machine.wait_for_unit("initrd.target")
|
||||
rc, out = machine.execute("echo q | script -q -e -c 'yes | less' /dev/null")
|
||||
assert "terminals database is inaccessible" not in out
|
||||
'';
|
||||
}
|
||||
Reference in New Issue
Block a user