Nixpkgs: Terminal broken under NixOS-17.09.2826.5141f28405e

Created on 28 Jan 2018  路  20Comments  路  Source: NixOS/nixpkgs

Issue description

On the graphical image as well as a system installed from it terminfo is broken. This manifests in the form of clear and reset not work and nano only displaying available commands at the bottom with no file content or way to edit anything. I would classify this as a blocker since I only have nano as an editor on the installation and cat/echo are no real alternatives.

The problem seems to be that ncurses-6.0-20170902 installs a broken terminfo database to /run/current-system/sw/share/terminfo/. There any lowercase entry that has corresponding uppercase entries is followed by ~nix~case~hack~1. Both the entry for l(with linux in it) and x(xterm*) have these.

Creating a copy of this directory where the postfixes are removed and setting the TERMINFO_DIRS environment variable to point to that directory fixes the problems. This isn't an acceptable fix though.

Steps to reproduce

  1. run the iso
  2. login
  3. enter clear
    actual: 'linux': unknown terminal type.
    excpected: a cleared terminal.

Technical details

 - system: `x86_64-linux`
 - host os: `Linux 4.9.77, NixOS, 17.09.2826.5141f28405e (Hummingbird)`
 - multi-user?: `no`
 - sandbox: `yes`
 - version: `nix-env (Nix) 1.11.16`
 - nixpkgs: `/nix/var/nix/profiles/per-user/root/channels/nixos/nixpkgs`
regression blocker

Most helpful comment

Ran into the same issue while installing a linux nixos 17.09 from start. sudo nix-store --repair-path /nix/store/609zdpfi5kpz2c7mbjcqjmpb4sd2y3j4-ncurses-6.0-20170902 followed by sudo nixos-rebuild switch fixed it for me (there might need to be a change for rebuild to be effectful). It forces a redownload of ncurses from one of the cache servers.

Like @chisui suggested ~nix~case~hack~ appears in archive.cc which handles nar files, archives from binary cache servers. The above "fix" suggests there is something going on with some of the binary cache servers. It looks like a version targeting OS X is retrieved by a linux NixOS (~nix~case~hack~ is flagged to the apple platform in archive.cc).

All 20 comments

Can't reproduce with 17.09.2875.c2b668ee726

I've run into this with the current head of channels/17.09, ie. c2b668ee726, in a Vagrant box. I've done a bisect and it seems like the issue was introduced in 0186286433cccbf6faf288c22df03e63e46dd94d. Here's some Bash output while running on 0186286433cccbf6faf288c22df03e63e46dd94d:

[vagrant@nixbox:~]$ clear
'xterm-256color': unknown terminal type.
[vagrant@nixbox:~]$ ls /etc/terminfo
1  6  a~nix~case~hack~1  e~nix~case~hack~1  j                  m~nix~case~hack~1  p~nix~case~hack~1  t  x~nix~case~hack~1
2  7  b                  f                  k                  N                  Q                  u  z
3  8  c                  g                  L                  n~nix~case~hack~1  q~nix~case~hack~1  v
4  9  d                  h                  l~nix~case~hack~1  o                  r                  w
5  A  E                  i                  M                  P                  s                  X
[vagrant@nixbox:~]$ export TERM=vt100
[vagrant@nixbox:~]$ clear
# works now

@chisui I'm a bit confused as to why I ran into this but you didn't. I am using the Vagrant box nixos/nixos-17.09-x86_64, but I'd be surprised if there were different results between using a fresh image and upgrading from an older version of 17.09.

I first encountered this problem with in nixos-graphical-17.09.2826.5141f28405e-x86_64-linux.iso. Some time later I tried nixos-graphical-17.09.2875.c2b668ee726-x86_64-linux.iso and terminfo was ok.

I keep seeing this more and more. I am running nixos-minimal-17.09.2875.c2b668ee726-x86_64-linux.iso on VirtualBox v5.2.6.

Doesn't it make sense to keep the issue open?

Yeah, I thought it was fixed but seems as if its still there.

The weird thing is that ~nix~case~hack~ is only used in archive.cc and only if you are on a mac. So how does this get into anything linux related at all?

Is there any way to override ~nix~case~hack~ somehow? File system is read-only...

My fix was to:

  1. create a copy of the directory.
  2. Fix the filenames.
  3. Let TERMINFO_DIRS point to the copy.

Does upgrading to 18.x help?

And upgrading to nixos-unstable also fixed the issue. Quite annoying.

Ran into the same issue while installing a linux nixos 17.09 from start. sudo nix-store --repair-path /nix/store/609zdpfi5kpz2c7mbjcqjmpb4sd2y3j4-ncurses-6.0-20170902 followed by sudo nixos-rebuild switch fixed it for me (there might need to be a change for rebuild to be effectful). It forces a redownload of ncurses from one of the cache servers.

Like @chisui suggested ~nix~case~hack~ appears in archive.cc which handles nar files, archives from binary cache servers. The above "fix" suggests there is something going on with some of the binary cache servers. It looks like a version targeting OS X is retrieved by a linux NixOS (~nix~case~hack~ is flagged to the apple platform in archive.cc).

FWIW, this can be seen on nixos-graphical-17.09.2905.c1d9aff56e0-x86_64-linux.iso as well.

Comment on IRC:
17:47:25 niksnut | somehow, the darwin-specific case hack got applied while nixops copied that path from one linux machine to another

Experienced this issue today on a fresh nixos-17.09 install. Neither backspace nor arrow keys would work in the Konsole. I could only mitigate the problem a little by using export TERM=vt100. I guess I'll give repairing the ncurses-path a try.

I installed NixOS for the first time on sunday, with the ISO pointed to by the download page of NixOS (17.09.2905.c1d9aff56e0).

I faced this problem: it makes the installation very painfull.

The solution proposed by @guillaumekoenig:

sudo nix-store --repair-path /nix/store/609zdpfi5kpz2c7mbjcqjmpb4sd2y3j4-ncurses-6.0-20170902
sudo nixos-rebuild switch

seems to work after a reboot.

Data point: nixos-graphical-17.09.3129.1dcd022f01b-x86_64-linux.iso doesn't have the problem.

I believe the underlying problem still exists in latest Nix: https://github.com/NixOS/nix/issues/2009

Does this issue still exist in 18.09 ? The nix issue ^^ was fixed.
Maybe this can be closed.

Yeah landed in Nix 2.1.

Was this page helpful?
0 / 5 - 0 ratings