4

Something has gone wrong with both the man and git log commands on my Ubuntu system over the holidays. Neither produce any output, and I have no clues as to what the issue is, bar that they both should produce paginated commands. An example is below.

Some points

  • I upgraded from Ubuntu 17.04 to 17.10 last night, but this hasn't changed anything.
  • less and more work fine, as does everything else I've thought to try, including the rest of the git commands.
  • The problem persists on both bash and sh.

Any help is greatly appreciated!

>>> echo Hello world > Foo.txt

>>> git init
Initialised empty Git repository in /home/eoin/GitHub/Fake/.git/

>>> git add Foo.txt 

>>> git commit -m "Init"
[master (root-commit) 9e53556] Init
 1 file changed, 1 insertion(+)
 create mode 100644 Foo.txt

>>> git log

>>> git status
On branch master
nothing to commit, working tree clean

>>> ls
Foo.txt

>>> man
What manual page do you want?

>>> man --version
man 2.7.6.1

>>> man man

>>> man git

>>> man ls

>>> which man
/usr/bin/man

>>> which git
/usr/bin/git

>>> which less
/usr/bin/less

>>> which more
/bin/more

Updates

(With thanks to everyone who has commented)

  • Reinstalling git or man doesn't work.
  • $MANPAGER is not set in a new terminal.
    • Running MANPAGER=/usr/bin/less man man brings up the manual page as is expected. Great!
    • MANPAGER=/usr/bin/less git log doesn't do anything.
    • man man alone still doesn't do anything after running this, even though $MANPAGER has been set in this terminal. I guess I need to make MANPAGER permanent in some way, but I don't know how as of yet. Good progress though.
  • sudo update-alternatives --config pager brings up the following options

    There are 3 choices for the alternative pager (providing /usr/bin/pager).
    
      Selection    Path            Priority   Status
    ------------------------------------------------------------
    * 0            /bin/less        77        auto mode
      1            /bin/less        77        manual mode
      2            /bin/more        50        manual mode
      3            /usr/bin/w3m     25        manual mode
    

    but I've tried them all, and man man still does nothing.

  • less and more work fine normally.

  • less and pager seem sensible, as best I can tell

    >>> ls -l /usr/bin/less
    lrwxrwxrwx 1 root root 9 Jul 18  2016 /usr/bin/less -> /bin/less
    
    >>> eoin@eoin-SATELLITE-S50-B:~/GitHub/Fake$ ls -l /bin/less
    -rwxr-xr-x 1 root root 170728 Mar 24  2017 /bin/less
    
    >>> file /usr/bin/pager
    /usr/bin/pager: symbolic link to /etc/alternatives/pager
    
    >>> file /etc/alternatives/pager
    /etc/alternatives/pager: symbolic link to /bin/less
    
  • man man | cat does print the man page!

    • man man | less works as well
    • as does git log | less.
    • This is a reasonable workaround, but I'm still none the wiser as to what the problem actually is.

Much later update

I've just run into the same problem again, on my work laptop, running Ubuntu 16.04. I mostly use this computer for scientific computing in python and R, so there's likely something in this set of programs that causes this problem. The solution below still fixes it.

0

1 Answer 1

3

It seems like your alternative system is broken. You should be able to update the alternatives links with:

sudo update-alternatives --auto pager

After that, choose your favorite pager with:

sudo update-alternatives --config pager

If that doesn't do the trick you can set e.g.

export PAGER=/usr/bin/less

and both man and git log should respect and use that (while MANPAGER is used by man only, as you already discovered).

A short crash course on setting variables:

  • set a variable just for a single command, e.g.:

    PAGER=/usr/bin/less man man
    
  • set a variable for the current terminal, e.g.:

    export PAGER=/usr/bin/less
    
  • set a variable for every new terminal (though you can source the file with . ~/.bashrc in any existing terminal as well), e.g.:

    PAGER=/usr/bin/less
    
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .