9

I find man command disappears on my RHEL7:

# man ls
bash: man: command not found...
# which man
/usr/bin/which: no man in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/usr/local/go/bin:/root/gocode/bin:/root/bin:/opt/linuxki)

But man and man-pages are all on my box:

# yum install man
Loaded plugins: auto-update-debuginfo, langpacks, product-id, search-disabled-repos, subscription-manager
Package man-db-2.6.3-9.el7.x86_64 already installed and latest version
Nothing to do
# yum install man-pages
Loaded plugins: auto-update-debuginfo, langpacks, product-id, search-disabled-repos, subscription-manager
Package man-pages-3.53-5.el7.noarch already installed and latest version
Nothing to do

Where did man go?

Update 1:

Try to reinstall man, but it prompts following errors:

......
Running transaction
  Installing : man-db-2.6.3-9.el7.x86_64                                                                                                 1/1
Error unpacking rpm package man-db-2.6.3-9.el7.x86_64
error: unpacking of archive failed on file /usr/bin/man: cpio: rename
  Verifying  : man-db-2.6.3-9.el7.x86_64                                                                                               1/1

Failed:
  man-db.x86_64 0:2.6.3-9.el7

Update 2

# ls -lt /usr/bin/man
total 4
drwxr-xr-x. 2 nan nan   81 Mar 24 22:30 man1
drwxr-xr-x. 2 nan nan 4096 Mar 24 22:30 man7
# stat /usr/bin/man
  File: ‘/usr/bin/man’
  Size: 28              Blocks: 0          IO Block: 4096   directory
Device: fd00h/64768d    Inode: 67811254    Links: 4
Access: (0755/drwxr-xr-x)  Uid: ( 1000/     nan)   Gid: ( 1000/     nan)
Context: unconfined_u:object_r:bin_t:s0
Access: 2016-04-15 17:47:56.613595324 +0800
Modify: 2016-03-24 22:30:30.000000000 +0800
Change: 2016-04-08 11:08:45.605815500 +0800
 Birth: -
  • Can you add the output from ls -l /usr/bin/man to your question above (actually, include stat /usr/bin/man as well). – EightBitTony Apr 15 '16 at 7:54
  • uninstall man ,remove /usr/bin/man and install man-pages then install man – GAD3R Apr 15 '16 at 7:58
  • @EightBitTony: Add output of ls -l /usr/bin/man and stat /usr/bin/man, thanks! – Nan Xiao Apr 15 '16 at 8:00
  • RPM uses cpio as it’s archive format, which is why we’re seeing a cpio error when trying to replace the file /usr/bin/man – GAD3R Apr 15 '16 at 8:02
  • 3
    Well, I don't know why - but your /usr/bin/man appears to be a directory, rather than a single executable. It's almost as if someone has copied the man pages directory over /usr/bin/man. – EightBitTony Apr 15 '16 at 8:02
13

I doubt we'll ever be able to tell you where it went, but you should just be able to reinstall it using yum.

yum reinstall man

yum doesn't check to see if files exist when you run yum install, it just checks a database of which packages have been installed. If someone deletes all the files outside of the package manager, it won't know (you can get it to check, but it doesn't by default). Using yum reinstall tells it to do the install even though it thinks the package is already there.

Depending on what has been deleted or removed, you may need to yum reinstall ... other things like man-pages.

Updated in light of new information:

For some reason, your /usr/bin/man is a directory, rather than a single file, and judging by the content it looks like someone has done something weird like mv /usr/share/man /usr/bin or something odd.

You're not going to be able to simply undo this - you need to investigate, see what's been broken or moved, and correct it.

You might just be able to remove /usr/bin/man and its contents and then re-install man and man-pages using yum but without more investigation it's not going to be clear.

  • I try to reinstall man, but it prompts "unpacking of archive failed on file /usr/bin/man: cpio: rename" error. Could u help to check? Thanks very much in advance! – Nan Xiao Apr 15 '16 at 7:52
  • @ Remove /usr/bin/man and reinstall man fix it, thx very much! – Nan Xiao Apr 15 '16 at 8:45
  • 2
    @NanXiao: If /usr/bin/man is a directory, who knows what else is screwed up? At this point, I'd recommend backing up your files and reinstalling the OS from scratch. And don't let your three-year-old play with a root shell next time. ;) – Ilmari Karonen Apr 15 '16 at 11:39
0

RPM uses cpio as its archive format. That is why we’re seeing a cpio error when trying to replace the file /usr/bin/man.

You need to remove and purge man then you need to install man-pages.

Open the Terminal and type the following commands:

yum check-update
yum update
yum install man-pages
yum install man
  • The original question shows that yum install man and yum install man-pages didn't make any difference because yum thinks they are already installed. – EightBitTony Apr 15 '16 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.