aptitude-create-state-bundle
Backup and restore installed package state
SYNOPSIS
aptitude-create-state-bundle [options] FILE
PARAMETERS
--current-only
Includes only the current package selections (output of dpkg --get-selections) in the bundle, excluding other package information.
--apt-only
Includes only APT configuration files (/etc/apt/sources.list and /etc/apt/preferences directories) in the bundle, without package state.
--cache-only
Includes only APT cache information (primarily the output of apt-cache policy) in the bundle.
--full-config
Includes all Aptitude configuration files, providing a more comprehensive view of Aptitude's settings.
--help
Displays a brief help message describing command usage and options, then exits.
--version
Displays the command's version information and exits.
FILE
The required argument specifying the path and filename for the output gzipped tar archive (e.g., my-system-state.tar.gz).
DESCRIPTION
The aptitude-create-state-bundle command generates a gzipped tar archive, often referred to as a 'state bundle,' that encapsulates the current state of the Aptitude package management system and relevant system information. This bundle is invaluable for reproducing a system's configuration for debugging purposes, particularly when reporting bugs related to Aptitude's behavior or complex package resolution issues. It typically includes critical files such as APT source lists (/etc/apt/sources.list and files in /etc/apt/sources.list.d/), APT preferences (/etc/apt/preferences and files in /etc/apt/preferences.d/), the output of dpkg --get-selections, Aptitude's internal state file (/var/lib/aptitude/pkgstates), a list of all installed packages, apt-cache policy output, and general system details. By providing a comprehensive snapshot, it helps developers and users understand and replicate specific package management scenarios, making bug identification and resolution significantly easier.
CAVEATS
The generated state bundle can contain sensitive system configuration details. Care should be taken to ensure its security, especially when sharing it for bug reports. The command typically requires root privileges to access all necessary system files and directories to create a complete and accurate bundle.
CONTENTS OF THE STATE BUNDLE
A typical state bundle generated by aptitude-create-state-bundle includes a variety of files and command outputs, such as:
- APT source list files (e.g., /etc/apt/sources.list and /etc/apt/sources.list.d/*)
- APT preferences files (e.g., /etc/apt/preferences and /etc/apt/preferences.d/*)
- Output of dpkg --get-selections, detailing package selections
- Aptitude's internal state file (e.g., /var/lib/aptitude/pkgstates)
- A list of all installed packages (from dpkg -l)
- Output of apt-cache policy for relevant packages
- System identification information (e.g., lsb_release, uname -a)
- Aptitude version and relevant configuration files
HISTORY
aptitude-create-state-bundle is a utility script that is part of the Aptitude package management suite, which serves as an interactive front-end to APT. Its development is intrinsically linked to the evolution of Aptitude itself, a prominent package manager on Debian-based systems since the early 2000s. This specific command was introduced to streamline the process of gathering comprehensive system state information, which is crucial for debugging complex package management issues and providing reproducible contexts for bug reports submitted by users to the Aptitude development team. It standardized the 'debug information' collection, making it easier for developers to assist users.