Does package installation trigger an update?

What do you mean with you having no updates? There were clearly updates.

pacman -Sy only updates the databases, not any package. For this, you should run pacman -Syu.

Looking at the updates, most of them were not even patch but only build releases.

And I’m not sure if you actually updated on June 4th. For example, less was updated to 1:633-1 with this stable update. Still, your command shows that it was at the version before.

A cursory spot-check suggests that these updates are consistent with going from the 2023-05-07 to the 2023-06-04 snapshot.

Thanks. Maybe my understanding of updates is wrong. I thought package updates accumulated somewhere and were released in a batch every 2 to 6 weeks, each batching constituting a post to the “Announcement” board for the Stable Branch (i.e. Stable Updates - Manjaro Linux Forum). That is, I thought that, between one post and the next (e.g. between the May 7 and the June 4 posts), there were no updates I could get even if I wanted to. Is this just wrong?

If that is wrong (i.e. there are, or can be, some updates between two adjacent posts), then there may be no mystery to solve. I just got “in between” updates.

If what I understood is right, then it seems we have to accept the conclusion that my record was faulty and that I actually never updated per June 4. Also you (and Takakage) seem to be finding other evidence for this possibility. (Though I remember being excited about my first ever update after installing this, to me, new distro.) (First, that is, apart from the update I ran immediately after installing the system.)

Usually yes. However, sometimes, there are fasttracked updates mostly for security issues (browsers) or if something is broken and needs immediate fixing with a new version.

Maybe your mirror was not synced yet?

That doesn’t sound like the massive updates I got.

Possibly. Anyway I believe I have to accept I messed up somewhere. It’s all very new. Thanks very much.

2 Likes

You can use pacman -S to just install what you want. It will not put you in a partial update state, unless certain commands are run. The most notable is -Sy which only updates the local database (another is -Syuw as it updates the local database, but only downloads the updates, it doesn’t install them).

The filename contains the version and pacman requests the filename, so if you get a 404 (file not found) error, then the package has been updated and you need to update to install it.

If you update the local database using -Sy or -Syuw and then install an updated package without updating the system then you’re in a partial update state. Which may or may not cause problems, but is unsupportable (other than by telling you to update).

If you only use -S and -Syu then you can’t get into a partial update state, unless there’s a failed update that isn’t corrected, or a packaging issue.

This only applies to the repos (and pacman), the AUR and manual installs can result in mismatched versions.

EDIT:
Corrected an omission, about failed updates.

3 Likes

Thanks. So I somehow figured out how to do exactly the wrong thing.

Is this couplet

sudo pacman -Sy
pacman -S qbittorrent

the equivalent, in Ubuntu terms, of the following?

sudo apt update
sudo apt-get install qbittorrent

If so, is the Ubuntu couplet also bad for the same reason?

I think the Ubuntu equivalent would be something more like installing Ubuntu 20.04, then switching all of your repositories to 22.04 and installing individual packages from there.

So approach it from the other direction: if you can see why that would be problematic for Ubuntu, you can see why it is problematic for Manjaro.

1 Like

Ubuntu and Debian cannot be compared that way

The above command does not update the system - only the database - so you would be missing that actual upgrade of the system or - in Manjaro terms - sync

sudo apt update && sudo apt upgrade
sudo apt-get install qbittorrent

No - no - no

Pacman is smarter than apt and apt-get - but you need to include the actual sync - in Debian terms - upgrade

sudo pacman -Syu qbittorrent

Never install using -Sy or -S always use -Syu

1 Like

In Manjaro do we say that we “sync” a new package instead of “install”?

Is that a metaphor?

The one that comes to mind is that of an ideal Manjaro existing somewhere with all packages installed. My Manjaro is out of sync with it if a particular package is missing from it.

Or am I syncing (when I install) even in a technical sense?

In pacman terms … all of those commands fall under sync:

$ man pacman
...
       -S, --sync
       Synchronize packages
...
2 Likes

Why always -Syu and never -S?

Please read the wiki on System Maintenance - Manjaro

Short answer

I use pacman and pamac only for the AUR. However I tested pamac, and it appears that pamac by default does a sync and upgrade, so the option --no-upgrade would be needed. See man pamac.

# One way to view upgrade history
grep -E -e 'upgraded manjaro-system' \
        -e 'upgraded manjaro-release'  /var/log/pacman.log

From the command line, pacman or pamac, there usually is a prompt asking you if you want to continue [y|N].

Don’t mix pacman and pamac. Use one or the other. It’ll just get confusing.

The way the two updates were listed above, I get the impression that you might think they are separate. That isn’t how it works. There isn’t a 5/7 and 6/4 update, there is one update and the current one is 6/4. You’ll get all updates when you update. One caveat though, a user should still review the 5/7 and the 6/4 Announcements for any specific instructions or issues.

There are updates that occur that have no Announcement.

In general, if the local sync metadata for the package you are installing specifies a package version that resides in your local cache already or on the Manjaro repositories, and the same goes for any requirements, your install will succeed. But if there is no match, the install will fail. It depends on the repo version and the local metadata version.

You might see something like (XX is some package name):

Error: failed retrieving file ‘XX.pkg.tar.zst’ from mnvoip.mm.fcix.net : The requested URL returned error: 404
warning: failed to retrieve some files

You could play games by downloading individual packages, but other packages already installed could be affected and a mess created. Let the package manager do its’ job. It would be cleaner and more reliable to just do a pacman -Syu. It’ll have to be done anyway, that’s just how a rolling release works. If you have problems, the first thing folks will usually recommend is to update.


The pieces in play, to hopefully aid understanding

Manjaro Repository

To view the status:

On repo.manjaro.org, if you follow one of the links you would see the file structure (simplified for this example below):

  stable
    core
      x86_64
         acl-2.3.1-3-x86_64.pkg.tar.zst               14-Feb-2023 14:45              139470
         acl-2.3.1-3-x86_64.pkg.tar.zst.sig           14-Feb-2023 14:45                 119
         ....
    extra
  testing
  unstable

The repos only contain the latest version of packages. The package versions should correspond to the latest Announcment on this forum. pacman -Sy downloads only the repo metadata to the local sync databases on your machine. The .db files are just the metadata, gzip’ed and tar’ed (compressed and archived). The metadata is the data that a user sees when they execute pacman -Si PKG. It is the data that is going to be used when you install or update.

To view if there are any updates:

  • checkupdates, or
  • pamac checkupdates

It is highly recommended that pacman -Syu be run to update your local machine. y updates the metadata. u uses the metadata to download, verify, and install a package. imho, there are more reasons to keep your sync databases and your local database at the same package versions - so the package version in the sync database matches the version installed. The only way this is achieved is by always doing a pacman -Syu and 99.9% of the time never use Sy.

Local mirrorlist

One of the first steps to take after installing Manjaro is to update your mirrorlist so an update can be done.
Always do a pacman-mirrors -f before an install. Some folks rebuild their customer mirrorlist before every install, some do neither. I do at least the first because it also shows the status.

  • runtime mirror list: /etc/pacman.d/mirrorlist
  • custom mirror: /var/lib/pacman-mirrors/custom-mirrors.json
  • default pool: /var/lib/pacman-mirrors/status.json
# Create custom mirrorlist
pacman-mirrors --country  # or --geoip; see man: pacman-mirrors

# Status
pacman-mirrors --status  # default; same as repo.manjaro.org

# Review status and order mirrors
pacman-mirrors --fasttrack # short form: -f 

Local /var/lib/pacman/sync/*.db

Sync database - Package metadata for each repository (i.e., core, extra).

# Does package exist in sync database 
pacman -Ss firefox

Local /var/lib/pacman/local/*

Installed packages database.

# Info about installed package.
pacman -Qi firefox

Local /var/cache/pacman/pkg/*.zst, *.sig

Packages are downloaded to this cache location.

The directory contains multiple versions (default: 3) of packages. The default is defined in /etc/pamac.conf (KeepNumPackages = 3).

There is a systemd timer, pamac-cleancache that maintains KeepNumPages.

  # List timers
  systemctl list-timers --no-pager

  # View content of service
  systemctl cat pamac-cleancache.service

  # View config file value; Can also us pamac GUI
  grep -i keepnumpackages /etc/pamac.conf

Additional Links

3 Likes

:+1:

Summary
 sequenceDiagram
    box Green PC Manjaro<br>local database
    participant L as Local<br>(installed package)<br>/var/lib/pacman/local/
    participant S as Sync<br>(local copy of remote DB)<br>/var/lib/pacman/sync/
    end
    actor P as Pacman
    participant M as Mirror

    Note over S,M: update -Syu decomposed
    
    rect rgba(0, 77, 255, .6)

    P-)M: -Sy
    M-->>S: Is Mirror more up-to-date than the local version ?
    S-->S: Yes
    S-->>M: Download
    M->>S: Update the database
    end
    rect rgba(0, 128, 255, .6)
      P-)S: -Su
      S-->>L: Are there version differences ?
      L-->>P: list new packages
      P-->P: non-empty list
      P-->>M: Download files
      M-->>P: Download in cache <br>/var/cache/pacman/pkg/
      par package by package
        P-->>P: install package on disk
        P->>L: update<br>local database
      end
    end

Please, someone mark @dmt’s post as a solution and close this or else you’ll go on for whole summer. :joy:

1 Like

I would change that to “GREAT answer”. :stuck_out_tongue_closed_eyes:

100% correct statement.

I just have one question to further the knowledge from your awesome response.

If a user decides to never use pacman but rather always use pamac (assuming the user does not use AUR in this case for simplicity), pamac upgrade would take care of it all correct?

I think you also forgot to mention to run pacman with sudo but NEVER use sudo for pamac, but it could have been mentioned in earlier responses though.

Otherwise, great response!

If by ‘all’ you mean sync/upgrade then yes.

A good general rule is to only use sudo when required.
systemctl or pamac ? You will be prompted.
pacman? Will fail without and say why - use sudo.

(unless of course you are already root - such as by su)

Not really, I mean everything (for a very simple user, witch I think quite a few manjaro user are), witch in this case would be 4 things:

Updating.
pamac upgrade

Searching:
pamac search APPLICATION

Installing.
pamac install APPLICATION

Removing. (add -o if dependencies are to be removed as well)
pamac remove APPLICATION

I’m asking because this seems to me to be the absolute simplest way to manage your system without the need to complicate it with -Syu and such.
Ie, for a “noob” the pamac way is WAY more explanatory of what you want to do.
(this also means everything can be done in the gui of pamac, because as I understand it, that is exactly what it will do if you use it to update/install/remove)

So because the Manjaro team wants us to update every time we install something? :grin:

Feedback on the documentation in the link

It fails to mention -Syuw

This is not required to prevent partial updates, it’s misleading:

Always ensure your system is fully up-to-date before installing software.

This is more accurate:

Don’t update the local package database without also updating the system.

https://wiki.archlinux.org/title/pacman#Installing_specific_packages
https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported