Safely Remove a Package Entry from the Transitional SGML Catalogue
You will remove one package's entry from the transitional SGML catalogue, check what changed, and keep a recovery path if the result is wrong. The installed command is install-sgmlcatalog from Debian package sgml-base version 1.31. Allow about ten minutes, plus time to identify the exact package entry. This is an administrative operation: it rewrites /etc/sgml/transitional.cat and needs elevated privileges.
The route
Jump straight to the step you need, or tick off Done means at the end.
The command is a narrow maintenance tool. Its documented interface is --remove package; it does not install a catalogue, enable SGML support, or update arbitrary catalogue files. Do not use it as a general-purpose cleanup command.
1. Confirm the command and the target package
First confirm that the executable and package version are the ones you expect. These checks are ordinary read-only commands and normally need no sudo:
$ command -v install-sgmlcatalog
/usr/sbin/install-sgmlcatalog
$ dpkg-query -W -f='${Package} ${Version}\n' sgml-base
sgml-base 1.31
Read the installed usage text as a final guard against using the wrong tool:
$ install-sgmlcatalog
Usage:
install-sgmlcatalog --remove package
That invocation deliberately omits the required option, so it prints usage and exits non-zero. It does not modify the catalogue. The command does not provide a documented --help mode, so do not infer options from similar Debian utilities.
Checkpoint: replace PACKAGE_NAME below with the exact package token recorded in the catalogue, not a display name or a guessed file name. Check the relevant lines before changing anything:
$ sudo grep -n -C 2 -- 'PACKAGE_NAME' /etc/sgml/transitional.cat
If the file is absent, or the package name is not present, stop and investigate instead of removing a guessed entry. A missing entry may simply mean there is nothing for this command to do.
2. Make a separate safety copy
The program itself keeps one automatic backup at /etc/sgml/transitional.cat.old, but that file is replaced on each later removal. Make a dated copy before the operation so your recovery point is not dependent on what happens next:
$ backup="/etc/sgml/transitional.cat.before-install-sgmlcatalog.$(date +%Y%m%d-%H%M%S)"
$ sudo cp -p /etc/sgml/transitional.cat "$backup"
$ sudo ls -l /etc/sgml/transitional.cat "$backup"
The shell variable only exists in this shell. Keep its printed path in your change record. The cp -p command preserves the source mode and timestamps, while the new file is an additional copy. Do not skip this step if the catalogue is managed as part of a package or deployment process.
Warning: the next step changes system configuration. If this is a production host, use the maintenance and review process that normally covers package metadata changes. No service restart is specified by this command, but software that reads the catalogue may see the new contents on its next access.
3. Remove exactly one package entry
Run the only documented operation with the exact package name:
$ sudo install-sgmlcatalog --remove PACKAGE_NAME
A successful run normally produces no standard output and returns status 0. Capture the status immediately if you are checking it interactively:
$ printf '%s\n' "$?"
0
The command reads /etc/sgml/transitional.cat, removes the block marked for that package, moves the previous catalogue to /etc/sgml/transitional.cat.old, and writes a new catalogue. The package block markers are implementation details of the installed script, so treat the package argument as an exact catalogue identifier. Do not pass a shell wildcard, a regular expression, or a string copied from an unrelated package database.
If sudo reports a permission error, stop there and inspect the error. Do not work around it by making /etc/sgml writable or by changing the catalogue's ownership.
4. Verify the result
Check the command's backup and confirm that the target package no longer has a matching entry:
$ sudo test -s /etc/sgml/transitional.cat.old && echo 'automatic backup exists'
automatic backup exists
$ sudo grep -n -C 2 -- 'PACKAGE_NAME' /etc/sgml/transitional.cat || echo 'no matching entry found'
no matching entry found
Compare the new file with your separate safety copy. The exact diff depends on the catalogue, but it should be limited to the intended package block and any surrounding blank-line adjustment:
$ sudo diff -u "$backup" /etc/sgml/transitional.cat
An exit status of 0 from diff would mean no difference, which is unexpected when a matching block was removed. A non-zero status is not automatically an error here. Read the diff and confirm that it contains only the intended removal. Do not treat a successful command exit as proof that the right package was selected.
5. Recover if the entry was removed by mistake
If the diff shows an unintended change, restore the separate copy. This is another privileged, state-changing command:
$ sudo cp -p "$backup" /etc/sgml/transitional.cat
$ sudo diff -u "$backup" /etc/sgml/transitional.cat
The final diff should print nothing and return 0. Keep the automatic .old file until you have finished checking the restoration. Do not delete either backup in a blind cleanup command; catalogue recovery files are useful evidence if package maintenance later rewrites the file.
If the command failed after changing the catalogue, compare both /etc/sgml/transitional.cat and /etc/sgml/transitional.cat.old with the dated copy. Restore the dated copy when it is the known-good version, then investigate the error before retrying. Never hand-edit a damaged catalogue while guessing at its structure.
Common traps
- Using the wrong option: the installed usage is
--remove package. There is no documented install, list, or help operation in this command. - Removing by substring: inspect the marker and use the exact package token. A similar package name is still a different target.
- Assuming no output means no change: success is quiet. Verify the file and the exit status.
- Confusing this with
update-catalog: this command maintains the transitional file. It is not the command for regenerating the SGML super catalogue. - Deleting the only recovery copy: the automatic
.oldbackup is overwritten by a later removal. Keep the dated copy until verification is complete.
Done means
- The installed package and command usage were checked.
- The exact package entry was identified before the change.
- A separate copy of
/etc/sgml/transitional.catwas made. sudo install-sgmlcatalog --remove PACKAGE_NAMEreturned 0.- The target entry is absent, the diff is limited to the intended block, and a known-good backup remains available.