Whether to remove orphans/foreign packages before, or after, updating?

However …

… says to remove them before the update.
I’m confused. Which one to follow?? Before or After?

1 Like

I prefer to review my foreign & orphaned packages after an update, for the reasons I outlined above.

If an AUR package blocks a system update due to a dependency issue, the AUR package can be safely removed with sudo pacman -R the-AUR-package, and the update process run again to successful completion.

The AUR package, if the user still wants it on their system, can then be rebuilt against the updated system packages after the update has completed (pamac build the-AUR-package).

But removing foreign packages before an update can cause issues if they have become foreign only due to a name change or another package replacing them. It could result in a vital system package being removed, and due to its removal before the update, the system won’t automatically install the replacement package.

4 Likes

Yeah, same question owburp mentioned, the best practices page does say to remove them before to avoid breaking updates so I’m confused as well. That said, thanks for the clarification on the libkcompactdisc dependency. Installing audiocd-kio fixed the dependency issue when trying to remove foreign packages with Pamac.

2 Likes

There is no one-size-fits all.

We all do things differently

  • the referenced topic has been written with new users in mind
  • the fact that custom packages is entirely unsupported
  • the fact that they do not know how to interpret messages during update

In the end - how you choose to do it is your decision - how you choose to handle it - that is your decision - the important part is that you think - and you make a decision.

The best practise topic comes from the forgotten packages factor, that is leftovers which may conflict and interfere with an update - thus the best practise is to remove the alien packages before an update as this will ensure no conflicts with repository packages.

I can think of a dozen different examples but to keep it simple

Example
You have a custom package which provides the file /usr/lib/foo.so.

Then an existing package bar has gotten a new file /usr/lib/foo.so.

This will create an existing file error in the update process and you do not know what to do.

5 Likes

After one update is before the next one…so at the end: “in between”. Every update generate some garbage that can block the next update (or at least such useless garbage can lead to 5 hour compilation as someone posted several posts above). In my routine i clean orphans and aur right after update. In theory, you can do it before if you want.

6 Likes

The pamac list --foreign command that I’m using shows whether the package is from the AUR (at least that’s all I’ve seen so far). If a package is listed as alien but not actually foreign, how would it show in the pamac list response? In other words, is there something that would give me a clue that this is a situation such as you described and the package should not be removed until after the update?

I’ve been using Manjaro for a few years now and I STILL consider myself a new user because there’s just SO much to learn. This forum has given me a lot of help in that area. I’ve customized your procedure to fit my workflow and have been using it for the past few updates and everything has worked very nicely. This new wrinkle gives me something to think and learn about.

1 Like

I’ve split off these posts as they are better suited in their own thread. :wink:

2 Likes

If the package is in the AUR, you will see the AUR text in the pamac list -m listing. If it is not in the repos or the AUR, then there will be an empty space.

You can see that in my output. I have one package (maus) that I install from GitHub using makepkg -srci, as it is not in the AUR. All of the rest of my foreign packages are from the AUR:

pamac list -m
kf6-servicemenus-reimage 2.7.0-1                AUR  72.0 kB
maus                     1.5-1                       69.2 kB
ocs-url                  3.1.0-7                AUR  133.5 kB
python-desktop-notifier  6.1.1-1                AUR  336.1 kB
qbittorrent-enhanced     5.1.3.10-1             AUR  13.9 MB
qdiskinfo-git            0.4.r15.gc4b0ba8-1     AUR  674.9 kB
qimgv-git                1.0.2.r190.g3127a2d-1  AUR  2.3 MB
qjournalctl              0.6.4-2                AUR  221.7 kB
qman                     1:1.5.1-1              AUR  222.6 kB
solunar2-git             2.0c.r14.f30d862-1     AUR  202.5 kB
traur-bin                0.4.1-1                AUR  12.4 MB
txt2html                 2.5201-2               AUR  213.4 kB
user-analysis-git        r3.72045ce-1           AUR  6.2 kB
videomerge               2.0.0-3                AUR  534.2 kB

Note though (and this is especially important for those on Stable branch due to it being a fair bit behind Arch) that a package may be moved from the Arch repos to the AUR, but that package may still be in the repos for Stable branch (and possibly Testing branch). In that case, the package may appear in Pamac as both a repo package and an AUR package.

If you are not sure about a package, before removing it run the pamac info thepackagename command to see its description, and what packages are dependent on it.

If you are still not sure, best leave it on your system. You can always ask this forum if it is safe to remove.

2 Likes

Thanks @Scotty65 for that example. I’ll keep an eye out for any empty spaces in the list for further investigation of the package and, if nothing else, hold off removing it.

2 Likes

How about Before AND After?

Before - you can avoid un-necessary bandwidth installing your updates, but then the system is changed and there may be more to remove After.

2 Likes

pamac info webkit2gtk | grep -E “Required By|Optional For”
Required By : –
Optional For : –

Now it can be safely removed, right? Always double-checking… for my own sanity and prev experiences wink

1 Like

Yes - you can safely remove webkit2gtk from your system.

2 Likes

List your orphans… :backhand_index_pointing_down:

pacman -Qdtq

Remove your orphans… :backhand_index_pointing_down:

sudo pacman -Rns $(pacman -Qdtq)
3 Likes

We’ll have none of that in here :zany_face:

But yes, purge it.

3 Likes

Here’s an example of why @Scotty65 prefers doing the foreign packages after the update. In just the previous update [Stable 2026-03-23], a package had been removed from the repos and replaced. Looking over my log notes from that update, I had fortunately read Scotty65’s post warning about it and delayed removing foreign packages until after the update. I’m starting to see the light …

2 Likes

It seems like it makes more sense to clean everything up, and get it all organised before initiating an update.

This could potentially backfire.

So in the event you did have a problem, it can potentially make troubleshooting much more difficult. Assuming you had a working system to start with.

Did the update break it, did I break it!?

It’s only pacman that thinks you don’t use those packages. Maybe you or something else does.

So I would update first, make sure it works. Then attempt your package management changes once you’re comfortable. (Or even vice-versa.)

2 Likes

Sorry, a little question: beside zsh requires single quotes, I don’t see the

Required By : –
Optional For : –

fields.
Pamac needs some parameter to show those fields?

$ LANG=C pamac info webkit2gtk
Name                  : webkit2gtk
Version               : 2.50.6-7
Description           : Web content engine for GTK
URL                   : https://webkitgtk.org
Licenses              : AFL-2.0 OR GPL-2.0-or-later Apache-2.0 Apache-2.0 WITH LLVM-exception BSD-2-Clause BSD-2-Clause-Views BSD-3-Clause BSD-Source-Code BSL-1.0 bzip2-1.0.6 GPL-2.0-only GPL-3.0-only WITH
                        Autoconf-exception-3.0 GPL-3.0-or-later WITH Bison-exception-2.2 ICU ISC LGPL-2.1-only LGPL-2.1-or-later MIT MPL-1.1 MPL-2.0 NCSA NCSA OR MIT OFL-1.1 SunPro Unicode-TOU
Repository            : AUR
Groups                : --
Depends On            : at-spi2-core atk bubblewrap cairo enchant expat fontconfig freetype2 gdk-pixbuf2 glib2 glibc gst-plugins-bad-libs gst-plugins-base-libs gstreamer gtk3 harfbuzz harfbuzz-icu hyphen icu lcms2
                        libatomic libavif libdrm libegl libepoxy libgcc libgcrypt libgl libgles libjpeg-turbo libjxl libmanette libpng libseccomp libsecret libsoup libstdc++ libsystemd libtasn1 libwebp libx11 libxml2
                        libxslt mesa openjpeg2 pango sqlite ttf-font wayland woff2 xdg-dbus-proxy zlib
Optional Dependencies : geoclue [Installed]
                        gst-libav [Installed]
                        gst-plugins-bad [Installed]
                        gst-plugins-good [Installed]
Make Dependencies     : clang cmake gi-docgen glib2-devel gobject-introspection gperf gst-plugins-bad lld ninja python ruby ruby-stdlib systemd unifdef wayland-protocols
Check Dependencies    : --
Provides              : libjavascriptcoregtk-4.0.so libwebkit2gtk-4.0.so
Replaces              : --
Conflicts With        : --
Maintainer            : andreas_baumann
First Submitted       : ven 10 apr 2026, 14:35:55
Last Modified         : mar 28 apr 2026, 18:18:17
Votes                 : 17
Out of Date           : --

$ LANG=C pamac info webkit2gtk | grep -E 'Required By|Optional For'

BTW please remember to the foreign language user to prefix commands with LANG=C

Mod edit: Removed zsh-generated junk characters.

This in Fish:

❯ pamac info webkit2gtk | rg "Required|Optional|Depends"
Depends On            : at-spi2-core atk bubblewrap cairo enchant expat
Optional Dependencies : geoclue [Installed]
1 Like

Thanks

But I still I don’t see “Required by” field.
The intent is to find which are the installed packages that require the webkit2gtk package.

On my system I have this:

2 extra/webkit2gtk-4.1 2.52.3-1 (35.7 MiB 132.8 MiB) (Installed)
    Web content engine for GTK
1 aur/webkit2gtk 2.50.6-7 (+18 13.74) 
    Web content engine for GTK

Not sure if it’s relevant… but it’s a more recent version… but that one is in our repo.

❯ pamac info webkit2gtk-4.1 | rg "Required|Optional|Depends"
Depends On            : at-spi2-core atk bubblewrap cairo enchant expat
Optional Dependencies : geoclue: Geolocation support [Installed]
Required By           : gufw networkmanager-openconnect yad
Optional For          : wxwidgets-gtk3