✦ For everyone, free.

Practical knowledge for real and everyday life

Home

File Manifests and File Attributes

File manifests and attributes track system files, providing metadata essential for package management and system integrity in Linux environments.

File Manifests and File Attributes are integral components of Linux package management systems, providing detailed records about the files included in a software package and the metadata associated with those files. They ensure package integrity, proper installation, configuration, and system consistency by describing what files are part of a package and defining their expected properties.


File Manifests

File manifests are structured lists or databases contained within a package that enumerate all files the package installs on the target system. These manifests serve several critical purposes:

Contents and Structure

A file manifest typically includes:

  • File paths: The full or relative paths where the files will be placed on the system.
  • File types: Information indicating whether an entry is a regular file, directory, symbolic link, device node, or other special file types.
  • Checksums or hashes: Cryptographic checksums (e.g., SHA-256, MD5) to verify file integrity and detect corruption or tampering.
  • File sizes: The sizes of the files in bytes, used to verify completeness.
  • Ownership and permissions defaults: Sometimes the manifest also records default ownership (user and group) and permission bits to be applied upon installation.
  • Configuration file flags: Identification of files that are configuration files, so the package manager can handle them specially during upgrades (e.g., preserving user modifications).

Role in Package Management

The manifest enables the package manager to:

  • Track installed files: Knowing which files belong to which package facilitates clean uninstallation and updates.
  • Verify integrity: Matching installed files to stored checksums ensures that files are not damaged or altered maliciously.
  • Resolve conflicts: Detect file overlaps or incompatibilities between packages.
  • Implement rollback or auditing: Allow restoration of previous versions or audit of installed software.

Examples in Package Systems

  • In RPM (Red Hat Package Manager), the file manifest is part of the RPM database, storing file metadata such as size, mode, owner, and digest.
  • In Debian’s dpkg, the list files under /var/lib/dpkg/info/ hold the installed file lists.
  • Pacman (Arch Linux) maintains file lists in its package database to track ownership.

File Attributes

File attributes define the metadata and properties assigned to each file installed by a package. These attributes govern how files behave on the filesystem, their security context, and how they interact with the system.

Key Attributes

  • File permissions (mode): The read, write, and execute permissions for user, group, and others, typically represented as octal values (e.g., 0755).
  • Ownership: The user ID (UID) and group ID (GID) that own the file.
  • Timestamps: Times of last modification, access, and status change.
  • Extended attributes (xattrs): Additional metadata attached to files, such as SELinux security contexts or filesystem flags.
  • File flags: System-specific flags that enforce behaviors like immutability or append-only status.
  • Link targets: For symbolic links, the path they point to.
  • Device numbers: For special device files, the major and minor device numbers.

Importance in Package Management

Proper setting and restoration of file attributes during package installation or upgrade ensure:

  • Security: Correct ownership and permissions prevent unauthorized access or execution.
  • Functionality: Executable bits and special attributes impact how binaries and scripts run.
  • System stability: Accurate attributes avoid conflicts and preserve system policies.
  • Configuration preservation: Special handling for configuration files avoids overwriting user changes.

Examples of Attribute Usage

  • RPM packages contain file metadata including ownership, mode, and checksums, which the RPM database stores and verifies.
  • In Debian, dpkg records file permissions and ownership alongside file lists.
  • SELinux contexts are often stored as extended attributes and restored by package scripts or tools.

Interaction Between File Manifests and File Attributes

File manifests and attributes work together to provide a comprehensive description of a package’s file footprint. The manifest lists what files belong to the package and where they go, while attributes specify how those files are configured on the system. This combined information enables precise control over installation, upgrading, verification, and removal processes.


Additional Considerations

Handling Configuration Files

Packages often distinguish configuration files from regular files in manifests. The package manager uses this to:

  • Avoid overwriting user-modified configs during upgrades.
  • Prompt users about new config versions.
  • Preserve local changes while applying standardized updates.

Integrity and Security

Checksums and cryptographic hashes stored in manifests provide integrity checks to detect accidental corruption or deliberate tampering. File attributes such as ownership and permissions enforce security policies critical in multi-user environments.

Manifest Formats and Locations

Manifests may be embedded inside package archives or stored in package database directories on the installed system. Common file lists or manifest files may be plain text or binary, depending on the package format.


Summary of Core Elements

ElementDescription
File pathLocation of the file on the filesystem
File typeRegular file, directory, symlink, device, etc.
File sizeSize in bytes
Checksum/hashCryptographic digest for integrity verification
Ownership (UID/GID)User and group owning the file
Permissions (mode)Read, write, execute bits for user/group/others
Extended attributesAdditional metadata like SELinux contexts
Configuration flagMarks file as configuration to handle specially
Link targetTarget path for symbolic links
Device numbersMajor/minor device IDs for special files

Practical Example: RPM File Manifest Entry

An example entry in an RPM package manifest might look like:

-rwxr-xr-x   1 root   root     12345 Jan 01 12:00 /usr/bin/example

With additional metadata stored separately:

  • SHA-256 checksum: 3a7bd3e2360c...
  • File type: regular file
  • Configuration flag: no

By maintaining detailed file manifests and precise file attributes, Linux package management systems ensure robust software deployment, integrity, and consistent system state management.