$ gunzip --to-stdout /usr/share/man/man1/zcat.1.gz | groff -mandoc -Thtml >zcat.html groff: can't find `DESC' file groff:fatal error: invalid device `html' (try installing the `groff' package?) $
I was able to fix the problem by installing the groff package with apt-get, but it took me a little while to figure out why there was a problem even though groff was on the system.
When you run groff it looks for a DESC file for the device specified with
the -T
option.
-T dev Set output device to dev. For this device, troff generates the intermediate output; see groff_out(5). Then groff calls a post‐ processor to convert troff's intermediate output to its final format. Real devices in groff are dvi TeX DVI format (postprocessor is grodvi). html xhtml HTML and XHTML output (preprocessors are soelim and pre-grohtml, postprocessor is post-grohtml). lbp Canon CAPSL printers (LBP-4 and LBP-8 series laser printers; postprocessor is grolbp). lj4 HP LaserJet4 compatible (or other PCL5 compatible) printers (postprocessor is grolj4). ps PostScript output (postprocessor is grops).
The DESC file it needs is usually found at
usr/share/groff/x.yz/font/dev
where x.yz
is a version number and dev is the device.
I saw that both Ubuntu systems had version 1.21 and neither listed
devhtml
.
$ ls /usr/share/groff 1.21 current site-tmac $ ls /usr/share/groff/1.21/font devascii devlatin1 devps devutf8 $
When I checked a CentOS 7 system, I saw the following:
$ ls -l /usr/share/groff/1.22 ls: cannot access /usr/share/groff/1.22: No such file or directory $ ls -l /usr/share/groff total 0 drwxr-xr-x. 4 root root 39 Oct 5 2014 1.22.2 lrwxrwxrwx. 1 root root 6 Oct 5 2014 current -> 1.22.2 $ ls -l /usr/share/groff/1.22.2 total 8 -rw-r--r--. 1 root root 620 Jun 9 2014 eign drwxr-xr-x. 7 root root 77 Oct 5 2014 font drwxr-xr-x. 3 root root 4096 Oct 5 2014 tmac $ ls -l /usr/share/groff/1.22.2/font total 4 drwxr-xr-x. 2 root root 50 Oct 5 2014 devascii drwxr-xr-x. 2 root root 95 Oct 5 2014 devhtml drwxr-xr-x. 2 root root 50 Oct 5 2014 devlatin1 drwxr-xr-x. 3 root root 4096 Oct 5 2014 devps drwxr-xr-x. 2 root root 50 Oct 5 2014 devutf8 $ ls -l /usr/share/groff/1.22.2/font/devhtml total 256 -rw-r--r--. 1 root root 25106 Jun 9 2014 B -rw-r--r--. 1 root root 25107 Jun 9 2014 BI -rw-r--r--. 1 root root 25092 Jun 9 2014 CB -rw-r--r--. 1 root root 25093 Jun 9 2014 CBI -rw-r--r--. 1 root root 25092 Jun 9 2014 CI -rw-r--r--. 1 root root 25107 Jun 9 2014 CR -rw-r--r--. 1 root root 220 Jun 9 2014 DESC -rw-r--r--. 1 root root 25106 Jun 9 2014 I -rw-r--r--. 1 root root 25091 Jun 9 2014 R -rw-r--r--. 1 root root 25091 Jun 9 2014 S $
When I checked a MacBook Pro running OS X 10.10.5 (Yosemite), I saw
the same files in the /usr/share/groff/1.19.2/font/devhtml
directory on that system as I saw in the
/usr/share/groff/1.22.2/font/devhtml
directory on the CentOS system.
Though the dates on the files were September 9, 2014 and they were different
sizes, the file names were the same on both systems.
The DESC
file is just a text file. I saw the following in
the DESC
file in the devhtml
directory on the
CentOS system:
$ cat /usr/share/groff/1.22.2/font/devhtml/DESC res 240 hor 24 vert 40 unitwidth 10 sizes 1-1000 0 fonts 9 R I B BI CR CI CB CBI S tcommand unscaled_charwidths postpro post-grohtml prepro pre-grohtml use_charnames_in_special pass_filenames unicode image_generator gs
The only difference between the DESC file on the CentOS system and the
one on the Mac OS X system was on the last line. The Mac had
image_generator missing
, instead of image_generator
gs
.
I created a devhtml
directory on one of the Ubuntu systems
and then copied the contents of the devhtml
directory from
the CentOS system into it.
$ sudo mkdir /usr/share/groff/1.21/font/devhtml $ ls -l /usr/share/groff/1.21/font total 20 drwxr-xr-x 2 root root 4096 May 12 2012 devascii drwxr-xr-x 2 root root 4096 Apr 11 21:52 devhtml drwxr-xr-x 2 root root 4096 May 12 2012 devlatin1 drwxr-xr-x 3 root root 4096 May 12 2012 devps drwxr-xr-x 2 root root 4096 May 12 2012 devutf8 $ sudo scp jdoe@192.168.0.5:/usr/share/groff/1.22.2/fontevhtml/* /usr/share/groff/1.21/font/devhtml/. jdoe@192.168.0.5's password: B 100% 25KB 24.5KB/s 00:00 BI 100% 25KB 24.5KB/s 00:00 CB 100% 25KB 24.5KB/s 00:00 CBI 100% 25KB 24.5KB/s 00:00 CI 100% 25KB 24.5KB/s 00:00 CR 100% 25KB 24.5KB/s 00:00 DESC 100% 220 0.2KB/s 00:00 I 100% 25KB 24.5KB/s 00:00 R 100% 25KB 24.5KB/s 00:00 S 100% 25KB 24.5KB/s 00:00 $
But I found that wasn't sufficient to allow me to convert a man page to an HTML file on the Ubuntu system:
$ gunzip --to-stdout /usr/share/man/man1/zcat.1.gz | groff -mandoc -Thtml >zcat.html groff: couldn't exec post-grohtml: No such file or directory groff: couldn't exec pre-grohtml: No such file or directory
Checking for the existence of the the two referenced programs, I didn't see them on the Ubuntu system.
$ which pre-grohtml $ which post-grohtml $
On the CentOS and OS X systems, I found both of the programs in
/usr/bin
.
$ which pre-grohtml /usr/bin/pre-grohtml $ which post-grohtml /usr/bin/post-grohtml
I checked on which package provided groff on the Unbuntu system and found
it was part of groff-base
.
$ which groff /usr/bin/groff $ dpkg -S /usr/bin/groff groff-base: /usr/bin/groff $
So I deleted the devhtml directory I created earlier along with the files I had copied into it.
$ sudo rm -rf /usr/share/groff/1.21/font/devhtml [sudo] password for jdoe: $ ls /usr/share/groff/1.21/font devascii devlatin1 devps devutf8 $
I then installed the groff package with apt-get
, which
created a devhtml
directory with the appropriate files, installed
pre-grohtml
, post-grohtml
and resolved the problem.
$ gunzip --to-stdout /usr/share/man/man1/import.1.gz | groff -mandoc -Thtml >import.html $ ls /usr/share/groff/1.21/font devascii devhtml devlbp devps devX100 devX75 devdvi devlatin1 devlj4 devutf8 devX100-12 devX75-12 $ which pre-grohtml /usr/bin/pre-grohtml $ which post-grohtml /usr/bin/post-grohtml $
When I checked the DESC
file in the devhtml
directory afterwards on the Ubuntu system, I found it matched the one on
the CentOS system with image_generator gs
as the last line in
the file.