Managing SGML Catalogs on Linux with install-sgmlcatalog

Overview

Working with SGML documents on Linux requires a properly maintained catalog system so parsers can resolve DTDs and public identifiers without manual path overrides. In this hands-on guide, we explore install-sgmlcatalog, the standard utility for registering and unregistering package-level SGML catalogs. Follow along in your terminal as we install the required tooling, build a mock catalog file, register it with the system, verify its state, and clean up afterward.

Installing sgml-base and Inspecting the Binary

Before experimenting with install-sgmlcatalog, refresh the local package index and pull down the sgml-base package.

Updating apt and installing the sgml-base package

Next, verify where the binary resides on your system by running which install-sgmlcatalog.
As the output shows, the executable is located at /usr/sbin/install-sgmlcatalog.

Locating the install-sgmlcatalog executable path

Pull up the built-in usage summary with install-sgmlcatalog --help to review its flags.
Administrators and package maintainer scripts rely on install-sgmlcatalog to add or strip package-specific catalog entries from the system-wide SGML catalog.
⚙️ [Key Options]

--install : Registers the specified package’s SGML catalog entry into the system catalog.
--remove : Strips the specified package’s SGML catalog entry from the system catalog.
--quiet : Suppresses informational output during execution.

Viewing the help output for install-sgmlcatalog

Preparing a Sample SGML Catalog and Checking System Paths

To keep our experiments isolated, create a dedicated workspace at /tmp/sgml_lab using mkdir -p /tmp/sgml_lab.

Creating the /tmp/sgml_lab working directory

Now generate a minimal catalog file to test registration. Use echo to write PUBLIC "-//Example//DTD Sample V1.0//EN" "sample.dtd" directly into /tmp/sgml_lab/sample.cat.

Writing a sample public identifier to /tmp/sgml_lab/sample.cat

Inspect the newly created file with cat /tmp/sgml_lab/sample.cat to confirm its syntax.
The terminal output verifies that PUBLIC "-//Example//DTD Sample V1.0//EN" "sample.dtd" was written cleanly.

Verifying the contents of /tmp/sgml_lab/sample.cat

Before modifying any system state, examine the baseline layout of /etc/sgml/ by running ls -l /etc/sgml/.
Notice that /etc/sgml/catalog is actually a symbolic link pointing to the central supercatalog stored at /var/lib/sgml-base/supercatalog.

Listing the initial contents of /etc/sgml/

Registering the Catalog and Verifying Changes

With the test file ready, register /tmp/sgml_lab/sample.cat under the package identifier samplepkg by executing install-sgmlcatalog --install /tmp/sgml_lab/sample.cat samplepkg.
The command exits silently with zero errors, indicating the registration completed cleanly.

Registering sample.cat under samplepkg with install-sgmlcatalog

Re-check /etc/sgml/ using ls -l /etc/sgml/ to see whether any new files appeared in the directory.
Only the catalog symlink pointing to /var/lib/sgml-base/supercatalog is present, confirming that no extra files were dropped directly into /etc/sgml/.

Checking /etc/sgml/ after catalog registration

Run grep -n "sample.cat" /etc/sgml/transitional.cat || true to check whether sample.cat was recorded inside /etc/sgml/transitional.cat.
Nothing is printed to standard output, which indicates that /etc/sgml/transitional.cat either does not exist on this system or does not reference sample.cat.

Searching /etc/sgml/transitional.cat for sample.cat

Removing the Catalog Entry and Cleaning Up

Once testing is complete, unregister the samplepkg entry from the central catalog by running install-sgmlcatalog --remove samplepkg.
Just like installation, the removal finishes quietly without errors.

Removing the samplepkg catalog entry

Double-check that no lingering reference remains in /etc/sgml/transitional.cat with grep -n "sample.cat" /etc/sgml/transitional.cat || echo "Catalog entry removed".
Seeing Catalog entry removed printed confirms that sample.cat is absent or has been cleanly stripped.

Confirming removal of sample.cat from transitional.cat

Finally, remove the temporary lab directory and its test file by running rm -rf /tmp/sgml_lab.

Deleting the temporary /tmp/sgml_lab directory

That wraps up the essentials of managing SGML catalogs on Linux with install-sgmlcatalog. Whenever you troubleshoot DTD resolution or catalog path errors in SGML and DocBook toolchains, these inspection and registration commands give you a reliable starting point.