Does package installation trigger an update?

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

Excuse the confusion derived from you statement which quite specifically only states upgrade.


Those things do work … and might be all a user requires.
Though … you are missing some thing I would normally include in removal such as n for ‘no save files’. (pamac does have an equivalent)

This is not dependencies its orphans. I suppose its all orphans, after the removal, so it would include orphans created by the removal. Neither this nor the cascade option are quite like what is recommended in pacman. And one of the reasons I still avoid pamac … though it supposedly no longer uses cascade by default - gutting your system like a drunk necromancer … or so I’m told.

Disagree. Its maybe more accessible, less confusing, uses simpler language … but explanatory? I dont think so … simply compare the pacman man pages … there a whole lot more explanation.

Not really. You have to keep it to these bare examples. If, for example, an application will not start and it complains of a missing randomfile.so … with pacman I would sudo pacman -Fyx randomfile.so … I do not believe pamac has a replacement.

But … update, search, install, remove? sure.

1 Like
pamac search --files randomfile.so

:person_shrugging:

I really don’t understand Fyx, this is why there is so much confusion.

I do! :raising_hand_man:

❯ manly pacman -Fyx

pacman - package manager utility
================================

      -F, --files
           Query the files database. This operation allows you to look for
           packages owning certain files or display files owned by certain
           packages. Only packages that are part of your sync databases are
           searched. See File Options below.

      -y, --refresh
           Download a fresh copy of the master package database from the
           server(s) defined in pacman.conf(5). This should typically be used
           each time you use --sysupgrade or -u. Passing two --refresh or-y
           flags will force a refresh of all package databases, even if they
           appear to be up-to-date.

FILE OPTIONS (APPLY TO -F)
      -y, --refresh
           Download fresh package databases from the server. Use twice to
           force a refresh even if databases are up to date.

      -x, --regex
           Interpret each query as a regular expression.
2 Likes
pacman -F 'cuda'

search (exact) filename

pacman -Fx '\.ttf$'
pacman -Fx 'python2'

search in all path (not only filename) and use regex


pacman -F 'cuda' == pacman -Fx '\/cuda$' :wink:

pamac search --files ~= pacman -Fx but pamac not use regex


pamac at all update download files database
pacman download(update) files database only with -Fy

You know as well as I do and most experienced Manjaro users - as well as Arch users - there is certain commands you avoid - but you choose to take my comment out of context - it has been repeated over and over - install using -S is OK when you know your system is current.

When refreshing the package database, always do a full upgrade with pacman -Syu. Note that if pacman -Syu does not perform the upgrade because of an error, the end result is the same as running pacman -Sy. Therefore, the error must be resolved and the upgrade operation completed as soon as possible.

The reason -Syuw is not mention is because - at the time of writing - the author likely didn’t think of it - or didn’t know it.

I read your comment and I have edited the wiki page accordingly.

2 Likes

I felt it was a very clear and certain phrase and it contradicted your earlier posts. I didn’t mean to misquote you or to offend in any way, I apologise If I have.

Indeed, I forgot to include it in my post.

:sweat_smile:

Definitely more accurate, looks like a nice logical set of rules. :+1:

There’s a typo, “use” should be “using”.

You may install a single package use pacman -S <pkgname>

Some of your discussions are going over my head (at present), but it seems I should make sure to understand at least as much as the following.

  1. Recommended is updating the local database and the system and installing a package with:
sudo pacman -Syu qbittorrent

or

pamac install qbittorrent

although I might as well stick with pacman as it is common to Arch and Manjaro.

  1. I can get by with just installing without updating either the database or the system with:
sudo pacman -S qbittorrent
  1. The thing I should not do is updating the database, not updating the system, and installing:
sudo pacman -Sy qbittorrent

Am I OK there? Thanks.

1 Like

One addition: this should be done only with a fully up-to-date systen, which means after you run:

sudo pacman -Syu

See the solution of this thread (2nd post in this thread)