I’ve written a small bash script to help with updating various packages/dependencies on my machine (Pop!_OS) but it doesn’t seem to be working correctly for flatpak. If I run flatpak update in the terminal it will show that I have updates, but when running the script there aren’t any updates.

The Script:

#!/bin/bash

# Update package list
sudo apt update -y

# Upgrade the packages and dependencies
sudo apt upgrade -y

# Remove unnecessary packages and dependencies
sudo apt autoremove -y

# Clean package cache
sudo apt clean -y

# Update Flatpak
sudo flatpak update -y

# Update firmware
sudo fwupdmgr update -y

echo "All updates and upgrades have completed sucessfully!"

EDIT: Running flatpak update -y without sudo fixes the issue.

  • governorkeagan@lemdro.idOP
    link
    fedilink
    English
    arrow-up
    5
    ·
    edit-2
    11 months ago

    Without.

    EDIT: Just tested sudo flatpak update and it returned the same results as the script (duh!). Thanks for the help!

    • Ace! _SL/S@ani.social
      link
      fedilink
      arrow-up
      5
      ·
      edit-2
      11 months ago

      There’s something valueable to learn here. Seems like flatpak installs packages per user, meaning when you do

      $sudo flatpak update

      it runs as the root user, which probably doesn’t have any packages installed.

      Kind of a weird concept if you used Windows for a long time before switching to linux, where running as admin still used the same user account just with elevated privileges iirc

      Edit: According to flathub running flatpak as root installs packages systemwide, otherwise they’re installed on a per user basis. You should still keep the multi user thing I mentioned in your mind if you’re used to windows