LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   man and the paths where man looks for manuals. (http://www.linuxquestions.org/questions/linux-general-1/man-and-the-paths-where-man-looks-for-manuals-813169/)

stf92 06-09-2010 01:01 PM

man and the paths where man looks for manuals.
 
GNU/linux kernel 2.6, Slackware 12.0
man 1.6c

Hi:
If I do 'man mplayer' I get 'No manual entry for mplayer'. If I do 'less /usr/local/share/man/man1/mplayer.1' or 'man /usr/local/share/man/man1/mplayer.1' then the manual is displayed in a perfectly readable form. I don't understand because, in /usr/lib/man.conf I have the line

MANPATH /usr/local/share/man/man1

Could somebody give me a clue on this mystery? Thanks.

catkin 06-09-2010 01:23 PM

What is the value of $MANPATH when you are at a command prompt? echo $MANPATH will show.

MensaWater 06-09-2010 01:31 PM

It should only be:

Code:

MANPATH /usr/local/share/man
That is to say, leave off the man1

MensaWater 06-09-2010 01:35 PM

Quote:

Originally Posted by catkin (Post 3998038)
What is the value of $MANPATH when you are at a command prompt? echo $MANPATH will show.

In Linux you don't have to explicitly set MANPATH - man will use the config file if it isn't set.

However, on CentOS it is in /etc/man.config rather than the one the OP mentioned. Not sure if the man page there says differently. On CentOS it says:

Quote:

If you donít specify an explicit path list with -M or MANPATH, man develops its own path list based on the contents of the configuration file /etc/man.config. The MANPATH statements in the configuration file identify particular directories to include in the search path.

bathory 06-09-2010 01:39 PM

In Slackware $MANPATH is set in /etc/profile and extended from the various config files in /etc/profile.d/*.
So the OP can unset $MANPATH and use /usr/lib/man.conf, or add /usr/local/share/man in the MANPATH definition in /etc/profile.

stf92 06-09-2010 01:47 PM

Quote:

Originally Posted by catkin (Post 3998038)
What is the value of $MANPATH when you are at a command prompt? echo $MANPATH will show.

It is
/usr/local/man:/usr/man:/usr/lib/java/man:/usr/share/texmf/man

Thanks for your kind post, katkin.

stf92 06-09-2010 01:55 PM

Thanks, thanks, thanks.
 
Thanks everybody who replied. If I want to test if man now sees the page should I reboot the machine or can I do it somehow else?

catkin 06-09-2010 01:59 PM

Quote:

Originally Posted by stf92 (Post 3998076)
It is
/usr/local/man:/usr/man:/usr/lib/java/man:/usr/share/texmf/man

Aha! That doesn't include the necessary /usr/local/share/man. Assuming you are using bash, have a look at /etc/profile, /etc/profile.d/*.sh, ~/bashrc, ~/.bash_profile, ~/.bash_login, and ~/.profile (only the first two are created during installation, later ones may not exist) and you will hopefully find where MANPATH is being set and can adjust accordingly.

bathory 06-09-2010 02:07 PM

Quote:

If I want to test if man now sees the page should I reboot the machine or can I do it somehow else?
You can run either
Code:

unset MANPATH
to use /usr/lib/man.conf, or
Code:

export MANPATH=/usr/local/share/man:$MANPATH
and check.

MensaWater 06-09-2010 02:09 PM

It shouldn't require a reboot.

The way it is done on CentOS it doesn't require anything after you add it to the man.config.

On UNIX (and maybe Slackware?) it require re-sourcing the file (.bashrc, .profile or /etc/profile etc...) that contains the MANPATH= line.

You source a file but typing ". filename" note - the space between the dot and the filename. If it were say .bashrc it would be ". .bashrc".

stf92 06-09-2010 02:14 PM

Quote:

Originally Posted by catkin (Post 3998090)
Aha! That doesn't include the necessary /usr/local/share/man. Assuming you are using bash, have a look at /etc/profile, /etc/profile.d/*.sh, ~/bashrc, ~/.bash_profile, ~/.bash_login, and ~/.profile (only the first two are created during installation, later ones may not exist) and you will hopefully find where MANPATH is being set and can adjust accordingly.

Well, it is in /usr/lib/man.conf and, there, I have removed MANPATH /usr/local/share/man/man1
and left only
MANPATH /usr/local/share/man
(among other MANPATH's).

But it's just the same. The problem is mplayer doesn't belong to the distro. It was compiled and installed by me from source. That is, I think this might be the problem.

To everybody else: I think I now have enough material to work with. I'll set to work and let you know. Thanks.

stf92 06-09-2010 03:04 PM

Quote:

Originally Posted by bathory (Post 3998063)
In Slackware $MANPATH is set in /etc/profile and extended from the various config files in /etc/profile.d/*.
So the OP can unset $MANPATH and use /usr/lib/man.conf, or add /usr/local/share/man in the MANPATH definition in /etc/profile.

If I unset MANPATH then I see man reads /usr/lib/man.conf (because 'man mplayer' gets the manual) and, if I insert 'MANPATH /usr/local/share/man' in /etc/profile this, works too. But I cannot understand why, in spite of the remarks heading /usr/lib/man.conf, man does not read /usr/lib/man.conf. Because obviously it does not read it unless I unset MANPATH. That is, long before I installed mplayer, /usr/lib/man.conf must have been there, from the time I installed slackware. But what is the purpose of that file if the only way for the system to use it is to unset MANPATH?
Thanks a lot, bathory.

bathory 06-09-2010 03:16 PM

man reads /usr/lib/man.conf, but the MANPATH variable is overwritten by the value of MANPATH at /etc/profile. Quote from /usr/lib/man.conf:
Quote:

# This file is read by man to configure the default manpath (also used
# when MANPATH contains an empty substring), to find out where the cat
# pages corresponding to given man pages should be stored,
# and to map each PATH element to a manpath element.

stf92 06-09-2010 03:50 PM

Quote:

Originally Posted by bathory (Post 3998167)
man reads /usr/lib/man.conf, but the MANPATH variable is overwritten by the value of MANPATH at /etc/profile. Quote from /usr/lib/man.conf:

I see: in /etc/profile I see:
export MANPATH=/usr/local/man:/usr/man
I'll reboot and carefully write down the value of MANPATH, because I see in /usr/lib/man.conf I have several MANPATH sentences. Good bye.

stf92 06-09-2010 04:30 PM

Hi again:
reading man man, I now see there are at least two solutions to the problem. One is to use
MANPATH_MAP bynary_path manual_path.

The other is to unset MANPATH in /etc/profile, perhaps simply by removing the statement MANPATH=.
Still another one would be to mkdir a subdir in the dir which contains the binary and place the manual there, but to do this I have to have AUTOPATH enabled in man.conf, which whould man waste time. And of course, like bathory said, I could enlarge the MANPATH variable in /etc/profile inserting the required path into it.

When I have decided in favor of one of these and seen that it works, I'll post it here in case some linux newbie like me finds it helpful.
Cheers.


All times are GMT -5. The time now is 09:16 PM.