LinuxCommandLibrary

tlmgr-recreate-tlpdb

Rebuild TeX Live package database

TLDR

Recreate the texlive.tlpdb database file and dump it to stdout

$ sudo tlmgr recreate-tlpdb
copy

SYNOPSIS

tlmgr-recreate-tlpdb

PARAMETERS

None
    This command does not accept specific parameters of its own. It operates by scanning the existing TeX Live installation.

DESCRIPTION

The tlmgr-recreate-tlpdb command is a crucial utility within the TeX Live distribution, designed to rebuild or refresh its internal package database, known as the TeX Live Package Database (tlpdb). This database is essential for tlmgr (TeX Live Manager) to keep track of all installed packages, their versions, and their corresponding files.

When the tlpdb becomes corrupted, inconsistent, or out of sync with the actual files on the system due to manual file manipulations, incomplete updates, or system issues, tlmgr operations can fail or report incorrect information. Running tlmgr-recreate-tlpdb forces a rescan of the entire TeX Live installation tree. It identifies all installed packages and their components, then reconstructs a pristine tlpdb file based on this fresh scan. This process ensures that tlmgr regains an accurate and reliable understanding of the TeX Live environment, allowing subsequent package installations, removals, or updates to proceed correctly.

CAVEATS

Administrative Privileges: Rebuilding the TeX Live database typically requires administrative or root privileges (e.g., using sudo) to access and modify the TeX Live installation directory.

Time-Consuming: For large TeX Live installations, the database recreation process can take a significant amount of time as it involves scanning numerous files and directories.

Troubleshooting Tool: While effective for database inconsistencies, it does not resolve underlying file system corruption or package conflicts not related to the tlpdb itself. It's a tool to fix the database view of your installation.

Not for Regular Use: This command should only be used when tlmgr operations are failing due to suspected database corruption or inconsistencies, not as a routine maintenance task.

WHAT IT DOES

The command works by traversing the entire TeX Live installation, typically located under /usr/local/texlive/YYYY or a similar path. It identifies all installed packages, their files, and their metadata by examining the actual contents on disk, rather than relying on the potentially corrupt existing tlpdb. It then compiles this information into a new, consistent tlpdb file, which is usually stored in the texmf-dist/tlpkg directory within your TeX Live installation. This new database replaces the old one, providing tlmgr with an accurate map of your installed TeX Live components.

WHEN TO USE IT

You should consider using tlmgr-recreate-tlpdb in the following scenarios:
- When tlmgr reports errors indicating database corruption (e.g., 'tlpdb parse error', 'unknown package').
- After manually moving, deleting, or altering files within your TeX Live installation without using tlmgr, which can lead to inconsistencies.
- If the list of installed packages displayed by tlmgr info --list or similar commands appears incorrect or incomplete.
- Following a system crash or power failure during a tlmgr operation that might have left the database in an inconsistent state.
- As a last resort for inexplicable tlmgr issues before resorting to a full reinstallation of TeX Live.

HISTORY

tlmgr-recreate-tlpdb is an integral part of the TeX Live utility suite, which was introduced to standardize and modernize package management for TeX Live distributions. As tlmgr became the primary tool for managing TeX Live installations, the need for a mechanism to repair or regenerate its central database (tlpdb) became apparent. This command (or its equivalent as a tlmgr subcommand) was developed to ensure the robustness and maintainability of TeX Live installations against various forms of database corruption or inconsistencies that can arise over time.

SEE ALSO

tlmgr(1), tex(1), kpsewhich(1)

Copied to clipboard