Skip to content

manpages of host OS are not visible for me #432

Description

@akavel

I cannot seem to be able to access the manpages of my host Ubuntu 16.04 LTS distribution with HM installed, when using the seemingly HM-provided man:

$ man bash
/home/akavel/.nix-profile/bin/man: can't set the locale; make sure $LC_* and $LANG are correct
No manual entry for bash
$ ls -l `which man`
lrwxrwxrwx 1 akavel akavel 69 sty  1  1970 /home/akavel/.nix-profile/bin/man -> /nix/store/1xq6j8hdcpd25zvhmsazfypxy37y8l87-home-manager-path/bin/man
$ /usr/bin/man bash | head -n4
BASH(1)                     General Commands Manual                    BASH(1)

NAME
       bash - GNU Bourne-Again SHell

Actually, there seem to be 3 problems with man; to me they kinda seem to faintly hint at some possible issue with environment variables maybe not being accessible to man (??? or no default values for them? or maybe actually being "set to empty" instead of being "unset"; IIRC, bash differentiates those two states...), but I'm not sure about it. The problems are:

  1. the host manpages are not visible (as shown in the snippet above);
  2. man displays this weird message about locale: can't set the locale; make sure $LC_* and $LANG are correct;
  3. also, if it displays a known page (for a Nix-installed command), it doesn't filter it through less — it just dumps it in entirety, scrolling past to the end; like if it had some problems getting a default value for $PAGER (I have it empty, but the OS man correctly defaults to less; if I do PAGER= /usr/bin/man bash, the host man also dumps everything at once; if I do PAGER=less man home-configuration.nix, the Nix man correctly uses less as pager).

I tried to reduce the home.nix to the smallest example, and it seems to happen to me with the most basic HM config already, as shown below:

$ cat ~/.config/nixpkgs/home.nix
{
  programs.home-manager.enable = true;
  programs.home-manager.path = https://github.com/rycee/home-manager/archive/master.tar.gz;
}

Any hints what could I try to do to improve the situation? Some wrapProgram trickery maybe? Currently, I'm coping with calling /usr/bin/man when I need, and man home-configuration.nix |& less when I need that one, but I'd love to have them integrated in a transparent way :)

Maybe it's a problem in nixpkgs, rather than in HM?

edit: I got a suspicion that it might be Nix's patchelf replacing some default paths in the man binary; it appears to me that this may be a correct suspicion:

$ cat `which man`
#! /nix/store/r47p5pzx52m3n34vdgqpk5rvqgm0m24m-bash-4.4-p23/bin/bash -e
export PATH='/nix/store/snv6vdf3y24wkmjbw7ngb6g9gh5v9m90-groff-1.22.3/bin'${PATH:+':'}$PATH
exec -a "$0" "/nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/bin/.man-wrapped"  "${extraFlagsArray[@]}" "$@"
$ strings /nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/bin/.man-wrapped | grep man-db
/nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/lib/man-db:/nix/store/sh2smlv0b1xg8rggkzz1z14bgwi8dxag-libpipeline-1.5.0/lib:/nix/store/lhrb8mw8c4z0vj43mmglpl9ibb1hkqcb-db-5.3.28/lib:/nix/store/g2yk54hifqlsjiha3szr4q3ccmdzyrdv-glibc-2.27/lib
/nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/bin/whatis
/nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/bin/apropos
/nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/libexec/man-db/zsoelim
/nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/libexec/man-db/manconv
/nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/etc/man_db.conf
$ strings /usr/bin/man | grep man-db
/usr/lib/man-db
/usr/lib/man-db/zsoelim
/usr/lib/man-db/manconv
$ strings /usr/bin/man | grep conf
config-file
no browser configured, so cannot show HTML output
use this user configuration file
/etc/manpath.config
From the config file %s:
is in the config file
is not in the config file
can't make sense of the manpath configuration file %s
can't open the manpath configuration file %s

edit 2: I compared the host's manpath.config vs. Nix's man_db.conf, and the latter seems to have many paths replaced with /run/current-system/sw/share/man. Do I understand correctly that this is a path that's available only in NixOS? Which would mean that nixpkgs' man seems to have some NixOS-specific tweaks hardcoded?

Click to expand the full diff

--- /etc/manpath.config	2015-11-07 00:14:35.000000000 +0100
+++ /nix/store/9vcjavzzhq739mm5g29vm1a2q4zcq2qm-man-db-2.7.5/etc/man_db.conf	1970-01-01 01:00:01.000000000 +0100
@@ -1,4 +1,4 @@
-# manpath.config
+# man_db.conf
 #
 # This file is used by the man-db package to configure the man and cat paths.
 # It is also used to provide a manpath for those without one by examining
@@ -18,25 +18,25 @@
 #MANDATORY_MANPATH 			/usr/src/pvm3/man
 #
 MANDATORY_MANPATH			/usr/man
-MANDATORY_MANPATH			/usr/share/man
-MANDATORY_MANPATH			/usr/local/share/man
+MANDATORY_MANPATH			/run/current-system/sw/share/man
+MANDATORY_MANPATH			/run/current-system/sw/share/man
 #---------------------------------------------------------
 # set up PATH to MANPATH mapping
 # ie. what man tree holds man pages for what binary directory.
 #
 #		*PATH*        ->	*MANPATH*
 #
-MANPATH_MAP	/bin			/usr/share/man
-MANPATH_MAP	/usr/bin		/usr/share/man
-MANPATH_MAP	/sbin			/usr/share/man
-MANPATH_MAP	/usr/sbin		/usr/share/man
+MANPATH_MAP	/bin			/run/current-system/sw/share/man
+MANPATH_MAP	/usr/bin		/run/current-system/sw/share/man
+MANPATH_MAP	/sbin			/run/current-system/sw/share/man
+MANPATH_MAP	/usr/sbin		/run/current-system/sw/share/man
 MANPATH_MAP	/usr/local/bin		/usr/local/man
-MANPATH_MAP	/usr/local/bin		/usr/local/share/man
+MANPATH_MAP	/usr/local/bin		/run/current-system/sw/share/man
 MANPATH_MAP	/usr/local/sbin		/usr/local/man
-MANPATH_MAP	/usr/local/sbin		/usr/local/share/man
+MANPATH_MAP	/usr/local/sbin		/run/current-system/sw/share/man
 MANPATH_MAP	/usr/X11R6/bin		/usr/X11R6/man
 MANPATH_MAP	/usr/bin/X11		/usr/X11R6/man
-MANPATH_MAP	/usr/games		/usr/share/man
+MANPATH_MAP	/usr/games		/run/current-system/sw/share/man
 MANPATH_MAP	/opt/bin		/opt/man
 MANPATH_MAP	/opt/sbin		/opt/man
 #---------------------------------------------------------
@@ -64,9 +64,9 @@
 #		*MANPATH*     ->	*CATPATH*
 #
 MANDB_MAP	/usr/man		/var/cache/man/fsstnd
-MANDB_MAP	/usr/share/man		/var/cache/man
+MANDB_MAP	/run/current-system/sw/share/man		/var/cache/man
 MANDB_MAP	/usr/local/man		/var/cache/man/oldlocal
-MANDB_MAP	/usr/local/share/man	/var/cache/man/local
+MANDB_MAP	/run/current-system/sw/share/man	/var/cache/man/local
 MANDB_MAP	/usr/X11R6/man		/var/cache/man/X11R6
 MANDB_MAP	/opt/man		/var/cache/man/opt
 #
@@ -75,7 +75,7 @@
 # of the definition is already the default.  To change: uncomment a
 # definition and modify it.
 #
-#DEFINE 	pager	pager
+#DEFINE 	pager	
 #DEFINE 	cat	cat
 #DEFINE 	tr	tr '\255\267\264\327' '\055\157\047\170'
 #DEFINE		grep	grep
@@ -84,10 +84,10 @@
 #DEFINE 	eqn 	eqn
 #DEFINE 	neqn	neqn
 #DEFINE 	tbl 	tbl
-#DEFINE 	col 	col
-#DEFINE 	vgrind 	vgrind
+#DEFINE 	col 	
+#DEFINE 	vgrind 	
 #DEFINE 	refer 	refer
-#DEFINE 	grap 	grap
+#DEFINE 	grap 	
 #DEFINE 	pic 	pic -S
 #
 #DEFINE		compressor	gzip -c7
@@ -108,7 +108,7 @@
 # particular order. Sections with extensions should usually be adjacent to
 # their main section (e.g. "1 1mh 8 ...").
 #
-SECTION		1 n l 8 3 2 3posix 3pm 3perl 5 4 9 6 7
+SECTION		1 n l 8 3 0 2 5 4 9 6 7
 #
 #---------------------------------------------------------
 # Range of terminal widths permitted when displaying cat pages. If the

Though this still doesn't explain the problems with LC_ALL and PAGER to me.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions