1

I recently installed TeX-Live and attempted to add its man to the manpath. It didn't work and couldn't find entries, and I didn't care too much. However, (I suppose) after a system restart, the man command isn't working altogether.

:~$ man man
bash: /mnt/HDD/texlive/2021/bin/x86_64-linux/man: cannot execute binary file: Exec format error

I don't know why it is looking for the TeX Live's version.

:~$ whereis man
man: /usr/bin/man /usr/local/man /usr/share/man /mnt/HDD/texlive/2021/bin/x86_64-linux/man /usr/share/man/man7/man.7.gz /usr/share/man/man1/man.1.gz

I had modified both ~/.bashrc and /etc/manpath.config based on this accepted answer, both of which I restored back. I tried sourceing the new bashrc file, logging out and in, or restarting the system, but I cannot seem to get the man working again.

What is the problem here, how can I restore the man, and what can I be overlooking? To be clear, I don't care about successfully adding TeX Live to the man page, I just want to get my man command functional again.


EDIT: Additional informations

Here is the path variables: (I broke the output int multiple lines and erased colons to have it easier to read here.)

:~$ echo $PATH
/mnt/HDD/texlive/2021/bin/x86_64-linux
/home/<username>/.local/bin
/usr/local/sbin
/usr/local/bin
/usr/sbin:/usr/bin
/sbin
/bin
/usr/games
/usr/local/games
/snap/bin

The topmost one should be the one I need to build latex projects, so I suppose it shouldn't cause the problem.

Also, echo $MANPATH doesn't print anything.

When it comes to what I did, I didn't do anything but modifying these two files.

I added the following lines to $HOME/.bashrc

PATH=/mnt/HDD/texlive/2021/bin/x86_64-linux:$PATH; export PATH
MANPATH=/mnt/HDD/texlive/2021/texmf-dist/doc/man:$MANPATH; export MANPATH
INFOPATH=/mnt/HDD/texlive/2021/texmf-dist/doc/info:$INFOPATH; export INFOPATH

And then I added the following line at the end of the section # set up PATH to MANPATH mapping in the /etc/manpath.config

MANPATH_MAP /mnt/HDD/texlive/2021/bin/x86_64-linux    /mnt/HDD/texlive/2021/texmf-dist/doc/man

I then run source ~/.bashrc, and tried to access man pages of some random TeX stuff, and encoutered with a message stating that the related entry was not found. Hence, even though it wasn't working with TeX, the man command was functional still.

I believe I left it here, and noticed that the problem I described few days later. As I said, I undid everything I mentioned above.

Because some time has passed, and I didn't necessarily know what I was doing especially with the manpath.config file, I might have done something else, but I don't recall doing anything else. If you have suggestions of potential actions that can cause a problem like this, or a way of solving this regardless, (which doesn't involve reinstalling the linux or anything, of course) I will appreciate.

8
  • 1
    type man (or type -a man) will likely be more diagnostic as to what your bash shell is seeing than whereis man Feb 26, 2022 at 14:47
  • @steeldriver It lists the first three results of whereis man in reverse order. I don't know what to do with that though.
    – aulven
    Feb 26, 2022 at 15:00
  • 1
    Please add echo "$PATH" and its result to your question. Also explain how you "attempted to add its man to the manpath" (I see you've linked to a question, but please state here which commands you ran.) If you undo the changes you made you'll find it all works once more.
    – roaima
    Feb 26, 2022 at 17:21
  • @roaima I edited the post, hopefully I provided necessary information, beyond that, even if I did something, which I probably didn't, I don't recall doing it. I feel like there should be an easy way of fixing this.
    – aulven
    Feb 26, 2022 at 22:16
  • 1
    When you do echo $PATH, do you really get newlines between most of the directories, or have you edited the output? I would expect a list of :-delimited directory paths, not lines of directory paths.
    – Kusalananda
    Feb 26, 2022 at 23:15

2 Answers 2

1

"MANPATH" controls where the man command looks for man pages, if you want something unusual. Leave it unset to use the default locations. See man man when you get this fixed.

"$PATH" is a colon-separated list of directories where your shell looks for executable programs (if what you typed isn't an alias, function, or builtin).
By placing the /mnt/HDD/texlive/2021/bin/x86_64-linux first in your PATH, you're letting texlive provide the (non-working) man command. See man bash when fixed.
Put texlive at the end of PATH. Change the .bashrc line to:

PATH=$PATH:/mnt/HDD/texlive/2021/bin/x86_64-linux

And logout/login to start fresh.

For more detail on using the "colon-separated" list as a bash datatype, I use Stephen Collyer's bash_path_funcs, described in Linux Journal way back in 2000:

https://www.linuxjournal.com/article/3645 https://www.linuxjournal.com/article/3768 https://www.linuxjournal.com/article/3935

The addpath function adds an entry to a path only if it is not there in the first place. delpath -n deletes all non-existent directories from a path.

You can get the pathfunc.tgz file from https://web.archive.org/web/20061210054813/http://www.netspinner.co.uk:80/Downloads/pathfunc.tgz

3
  • If the tex man command has the wrong architecture / is missing libraries / plain isn't working, then it's likely that none of the commands will work. So just remove the directory from $PATH completely
    – roaima
    Feb 26, 2022 at 22:47
  • @roaima Actually latexmk was working before I started messing with the manpath and I was able to build tex files. Although now after changing the bashrc content as shown above, it decided not to. Frankly I have no idea how I ended up here.
    – aulven
    Feb 27, 2022 at 6:04
  • Well, I suspect I slightly corrupted my hard drive as I did a disk level restoration from a Windows machine shortly after installing texlive for irrelevant reasons, I think this is why I get binary errors. Not that it matters at this point nor is it related the question, still wanted to state that in case you are wondering how I managed this.
    – aulven
    Feb 27, 2022 at 7:53
0

Remove this line to restore your executables:

PATH=/mnt/HDD/texlive/2021/bin/x86_64-linux:$PATH; export PATH

Remove the other two lines to restore the documentation search paths for man and info respectively.

You must log in to answer this question.

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