From b4a1893cddcad7cc406b388a2ef4d5888ffb0971 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 18 Oct 2012 11:54:07 -0400 Subject: [PATCH] systemd-vconsole-setup: Don't put the X server in non-raw mode MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ‘systemd-vconsole-setup’ by default operates on /dev/tty0, the currently active tty. Since it puts /dev/tty0 in Unicode or ASCII mode, if the X server is currently active when it runs, keys such as Alt-F4 won't reach the X server anymore. So use /dev/tty1 instead. --- modules/config/i18n.nix | 6 +++--- modules/system/boot/systemd.nix | 2 +- modules/tasks/kbd.nix | 32 +++++++++++++++++++++++++++----- 3 files changed, 31 insertions(+), 9 deletions(-) diff --git a/modules/config/i18n.nix b/modules/config/i18n.nix index dd435d481b7..e964b9bfb1d 100644 --- a/modules/config/i18n.nix +++ b/modules/config/i18n.nix @@ -47,11 +47,11 @@ let The keyboard mapping table for the virtual consoles. "; }; - + }; - + }; - + ###### implementation glibcLocales = pkgs.glibcLocales.override { diff --git a/modules/system/boot/systemd.nix b/modules/system/boot/systemd.nix index 66cc048d9c0..dc0c2ba4504 100644 --- a/modules/system/boot/systemd.nix +++ b/modules/system/boot/systemd.nix @@ -45,7 +45,7 @@ let # Login stuff. "systemd-logind.service" "autovt@.service" - "systemd-vconsole-setup.service" + #"systemd-vconsole-setup.service" "systemd-user-sessions.service" "dbus-org.freedesktop.login1.service" "user@.service" diff --git a/modules/tasks/kbd.nix b/modules/tasks/kbd.nix index aa708fb6019..7867b3c1912 100644 --- a/modules/tasks/kbd.nix +++ b/modules/tasks/kbd.nix @@ -13,6 +13,12 @@ let consoleFont = config.i18n.consoleFont; consoleKeyMap = config.i18n.consoleKeyMap; + vconsoleConf = pkgs.writeText "vconsole.conf" + '' + KEYMAP=${consoleKeyMap} + FONT=${consoleFont} + ''; + in { @@ -61,11 +67,27 @@ in # systemd-vconsole-setup.service if /etc/vconsole.conf changes. environment.etc = singleton { target = "vconsole.conf"; - source = pkgs.writeText "vconsole.conf" - '' - KEYMAP=${consoleKeyMap} - FONT=${consoleFont} - ''; + source = vconsoleConf; + }; + + # This is identical to the systemd-vconsole-setup.service unit + # shipped with systemd, except that it uses /dev/tty1 instead of + # /dev/tty0 to prevent putting the X server in non-raw mode, and + # it has a restart trigger. + boot.systemd.services."systemd-vconsole-setup" = + { description = "Setup Virtual Console"; + before = [ "sysinit.target" "shutdown.target" ]; + unitConfig = + { DefaultDependencies = "no"; + Conflicts = "shutdown.target"; + ConditionPathExists = "/dev/tty1"; + }; + serviceConfig = + { Type = "oneshot"; + RemainAfterExit = true; + ExecStart = "${config.system.build.systemd}/lib/systemd/systemd-vconsole-setup /dev/tty1"; + }; + restartTriggers = [ vconsoleConf ]; }; };