Linux Mint Update Manager

repository·master·Indexed 19 days ago

https://github.com/linuxmint/mintupdate

A graphical and command-line tool for managing software updates via apt, kernel management, and point release upgrades in Linux Mint. Includes the mintupdate GUI, mintupdate-cli for terminal-based updates, mintupdate-automation for automated tasks, and utilities like mint-refresh-cache and mint-release-upgrade.

Tokens
9.2K
Snippets
28
Records
59
Agent score
64%

What's inside mintupdate

  1. Use the mintupdate GUI for software updates

    master

    The mintupdate (Update Manager) is the graphical tool for managing software updates via the apt package management system. It is designed to run at session startup and provides a visual interface for:

    • Managing software updates.
    • Configuring update check schedules and automated maintenance via the Preferences menu.
    • Applying advanced filtering options for updates.
    • Managing Linux kernels via the View > Linux kernels menu (installing or removing kernels).
    • Installing Linux Mint point releases.

    Note: For command-line operations, use mintupdate-cli(8) instead.

  2. How Mintupdate refreshes updates

    master

    Mintupdate performs asynchronous refreshes of multiple update sources. The refresh(refresh_cache) method initiates the process, which includes:

    1. APT Cache: Refreshed via refresh_apt_cache().
    2. Cinnamon Spices: Refreshed via refresh_cinnamon_cache() (if Cinnamon support is enabled).
    3. Flatpak: Refreshed via refresh_flatpak_cache() (if Flatpak support is enabled).

    The refresh_updates() method ensures all spawned refresh threads complete (with a 300s timeout) before proceeding to check for updates. If the APT configuration is found to be corrupt (via check_policy()), the refresh is aborted with an error message.

    Note: refresh() must be called on the main thread. For calls from worker threads, use queue_refresh().

  3. Detecting corrupt APT configuration

    master

    Mintupdate uses check_policy() to verify the integrity of the APT configuration. It executes apt-cache policy and looks for the presence of the Linux Mint layer.

    A valid configuration must contain a line in the apt-cache policy output that:

    • Starts with 700
    • Ends with Packages
    • Contains /upstream

    If this pattern is not found, Mintupdate treats the APT configuration as corrupt, displays an error, and prevents updates to avoid breaking the system.

  4. Handling reboot requirements

    master

    Mintupdate identifies when a system restart is necessary during the installation phase. It triggers a reboot_required state if:

    • A kernel update is being installed that matches the current kernel version.
    • A security update involving nvidia packages is being installed.
    • A Cinnamon spice update requires a Cinnamon restart.

    When a reboot is required, an infobar is shown. The _on_infobar_reboot method handles the actual restart command based on the detected Desktop Environment:

    • Cinnamon/X-Cinnamon: /usr/bin/cinnamon-session-quit --reboot
    • MATE: dbus-send to org.gnome.SessionManager
    • XFCE: /usr/bin/xfce4-session-logout --reboot
    • Other: systemctl reboot
  5. Access related system tools from mintupdate

    master

    The mintupdate GUI provides direct access to several other system management tools through its Edit menu:

    • System snapshots: Opens timeshift-gtk(8).
    • Software sources: Opens mint-sources(8).
    • Upgrade to {point release}: Opens mint-release-upgrade(8).

    Additionally, mintupdate provides database updates used by mintinstall(8).

  6. Monitor APT package cache changes

    master

    The APTCacheMonitor class monitors the system's package cache (/var/cache/apt/pkgcache.bin) and dpkg status (/var/lib/dpkg/status) for modifications. When changes are detected and the application is not hidden and dpkg is not locked, it triggers a refresh of the update list. This ensures the Update Manager stays synchronized with the system's actual package state.

    # The monitor is typically initialized within the MintUpdate application
    self.cache_monitor = APTCacheMonitor(self)
  7. Retrieve and view changelogs

    master

    When an update is selected, the Update Manager can fetch and display its changelog. The retrieval logic depends on the update's origin:

    • Linux Mint: Fetches .changes files from packages.linuxmint.com.
    • Ubuntu: Fetches changelogs from changelogs.ubuntu.com (handling kernel HWE suffixes and component paths like main, universe, etc.).
    • Debian: Fetches from metadata.ftp-master.debian.org.
    • PPA (Launchpad): Attempts to fetch a .dsc file to extract the Debian changelog from the source tarball, or falls back to the .changes file on Launchpad.

    Changelogs are displayed in a dedicated tab within the update details view.

  8. Ignore or blacklist updates

    master

    You can prevent specific updates from being processed using two methods:

    1. Command Line: Use the -i or --ignore flag followed by a comma-separated list of source package names. To ignore a specific version, use the format package=version.
    2. Configuration File: Add source packages to /etc/mintupdate.blacklist, specifying one source package per line.
    # Ignore specific packages via CLI
    mintupdate-cli --ignore package1,package2=1.2.3 list
    
    # Blacklist via config file
    echo "package-to-ignore" >> /etc/mintupdate.blacklist
  9. How the installation process works

    master

    The installation process follows these steps:

    1. Pre-check: Verifies if dpkg is locked. If locked, it shows a warning and aborts.
    2. Collection: Iterates through the UI model to collect selected updates into three categories: packages (APT), spices (Cinnamon), and flatpaks (Flatpak).
    3. Kernel/Security Detection:
      • If a kernel update is detected, it compares the version to the current running kernel to set reboot_required.
      • If a security update contains nvidia packages, it sets reboot_required.
    4. Execution:
      • Calls _do_install() to trigger apt_updater.install_packages(self.packages).
      • If successful, it proceeds to update Flatpaks via flatpak_updater.perform_updates().
      • It then updates Cinnamon Spices via cinnamon_updater.upgrade(update).
    5. Cleanup: Runs _post_install_cleanup() to resume the cache monitor and uninhibited system states.
  10. Mirror health and synchronization checks

    master

    The mirror_check() method monitors the health and freshness of the configured APT mirrors. It performs the following:

    1. Mirror Identification: Reads /etc/apt/sources.list.d/official-package-repositories.list to find the main upstream import URL.
    2. Default Repo Check: If the user is using http://packages.linuxmint.com, it prompts to switch to a local mirror if the user hasn't already.
    3. Freshness Check: Compares the Last-Modified timestamp of the mirror's db/version file against the official Linux Mint db/version file.
    4. Alerting: If the mirror is unreachable or significantly out of date (more than 2 days behind the official repository), an infobar is displayed warning the user to switch mirrors.
  11. Release Upgrade Requirements and Configuration

    master

    The release upgrade process relies on specific system files and directory structures to identify the current Linux Mint edition and available upgrades:

    1. System Information: The file /etc/linuxmint/info must exist. It provides the EDITION (e.g., cinnamon, mate) and CODENAME of the current installation.
    2. Upgrade Metadata: Upgrade information is stored in /usr/share/mint-upgrade-info/{current_codename}/.
    3. Upgrade Configuration: Within the upgrade directory, a file named info (parsed via configparser) must contain the following keys under the [general] section:
      • target_name: The name of the new release.
      • target_codename: The codename of the new release.
      • editions: A list of editions compatible with this upgrade.

    If /etc/linuxmint/info is missing, the upgrade will fail with a message indicating missing critical components (specifically the mint-info virtual package).

  12. View update history

    master

    The History screen provides a searchable log of past updates. It aggregates data from multiple sources:

    • APT/Debian packages: Parsed from /var/log/dpkg.log.
    • Cinnamon Spices: Parsed from the Cinnamon harvester log.
    • Flatpaks: Parsed from the Flatpak updater log.

    The history view includes columns for Date, Type (e.g., package, kernel, flatpak-app, flatpak-runtime), Update (package name), Old Version, and New Version. You can search the history by package name.