On Archlinux it is not recommended to update only one package with the package manager pacman. Let’s say I have 11 packages, and one of them is extra/firefox (true story). Updating only a pacman -S firefox could introduce problems, but installing a new single package if it wasn’t there is okay.

So my question is, could we get around this by removing and installing the same package again in one go: pacman -Rs firefox && pacman -S firefox

  • erock@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    12 hours ago

    It seems like there might be exceptions to the “no partial upgrades” which has not been discussed: you can pin your version of the kernel primarily to give time for packages like zfs to catch up to the latest kernel

  • CarrotsHaveEars@lemmy.ml
    cake
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    22 hours ago

    I haven’t used Arch in a decade, but as unstable as Arch is, I don’t think Arch doesn’t have dependencies poorly defined like that.

    Say, firefox-1 does not depend on libssl-1, but now you upgrade it to firefox-2, you won’t succeed if you successfully downloaded firefox-2, but failed to download libssl-1, because pacman shall fail, while saying the reason being failed to download all of its dependencies.

    If you start with a system with both firefox-1 and libssl-1 installed, upgrading firefox-1 to firefox-2 sure would have no problem, because its dependencies are already fulfilled.

    If your system is breaking, it’s probably due to some other issue, but it could not be pacman’s.

  • ulterno@programming.dev
    link
    fedilink
    English
    arrow-up
    0
    ·
    1 day ago

    No, pacman -S firefox will not update your firefox.

    pacman -Sy firefox will update your firefox and nothing else.

    If you have done pacman -Sy once, then your list of packages and their versions gets updated.
    From then on, using pacman -S <package> on any package, whether or not it was already installed, will now get the new version of it.

    On the other hand, if you have not updated for long, then if you run pacman -Su to update, it will update nothing, because it looks at the old package list and compares it to installed packages and all of them match.
    If you were to use pacman -Sy and then pacman -Su, then it would do the update, similar to pacman -Syu.
    If you did pacman -Sy yesterday and then do pacman -Su today, then it will update up to yesterday’s packages and will ignore any updates from that point to today.

    This can be considered analogous to apt update and apt upgrade.
    If you run apt upgrade without apt update, you only upgrade upto the packages that you got until the last apt update.

    • N0x0n@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      23 hours ago

      Isn’t pacman -Syu the recommended way to update anyway? I have always used that o. EndeavourOS and hadn’t any issues.

      Except for the recent nouveau nvidia driver :/

  • 1984@lemmy.today
    link
    fedilink
    arrow-up
    0
    ·
    1 day ago

    This thread managed to make my head spin. Why do you make it so complicated to update packages. Are you from Microsoft? :)

  • deadcade@lemmy.deadca.de
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    It is only a partial upgrade if you update your databases, without upgrading the rest of your system. If you try to pacman -S firefox, and it gives you a 404, you have to both update your pacman databases, and upgrade your packages. This will only give you a 404 if you cleaned your package cache, and your package is out of date. Usually, -S on an already installed package will reinstall it from cache. This does not cause a partial upgrade.

    If you run pacman -Sy, everything you install is now considered a partial upgrade, and will break if you don’t know exactly what you’re doing. In order to avoid a partial upgrade, you should never update databases (-Sy) without upgrading packages (-Su). This is usually combined in pacman -Syu.

  • kevincox@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    I think you are a little confused at the problem here. The issue is that partial updates are not supported. The reason for this is very simple, Arch ensures that any given package list works on its own, but not that packages from different versions of the package list work together. So if Firefox depends on libssl the new Firefox package may depend on a new libssl function. If you install that version of Firefox without updating libssl it will cause problems.

    There is no way around this limitation. If you install that new Firefox without he new libssl you will have problems. No matter how you try to rules lawyer it. Now 99% of the time this works. Typically packages don’t depend on new library functions right away. But sometimes they do, and that is why as a rule this is unsupported. You are welcome to try it, but if it breaks don’t complain to the devs, they never promised it would work. But this isn’t some policy where you can find a loophole. It is a technical limitation. If you manage to find a loophole people aren’t going to say “oh, that should work, let’s fix it” it will break and you will be on your own to fix it.

    Focusing on your commands. The thing is that pacman -S firefox is always fine on its own. If Firefox is already installed it will do nothing, if it isn’t it will install the version from the current package list. Both of those operations are supported. Also pacman -Rs firefox && pacman -S firefox is really no different than just pacman -S firefox (other than potentially causing problems if the package can’t be allowed to be removed due to dependencies). So your command isn’t accomplishing anything even if it did somehow magically work around the rules.

    What is really the problem is pacman -Sy. This command updates the package list without actually updating any packages. This will enter you system into a precarious state where any new package installed or updated (example our pacman -S firefox command form earlier) will be a version that is mismatched with the rest of your system. This is unsupported and will occasionally cause problems. Generally speaking you shouldn’t run pacman -Sy, any time you are using -Sy you should also be passing -u. This ensures that the package list and your installed packages are updated together.

    • vort3@lemmy.ml
      link
      fedilink
      arrow-up
      0
      ·
      1 day ago

      This is an excellent answer and I wish I knew all of this when starting to use archlinux. “Arch does not support partial upgrades” is something you can read everywhere, but it’s rare to find such a good explanation of what exactly a partial upgrade is, and which commands lead to it.

      I only learned about all of this when I got into some broken state by randomly running pacman commands.

      Everyone, be like this guy. This guy explains stuff well. Newbies need stuff explained.

    • frongt@lemmy.zip
      link
      fedilink
      arrow-up
      0
      ·
      2 days ago

      I’m not familiar with arch or pacman. What prevents a package from becoming too new? Like if a new version of libssl is released that removes a necessary function but a package like Firefox has become abandoned, then even updating everything will result in a broken application. Does it not have version dependencies like debs and rpms?

      • Crestwave@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        2 days ago

        Adding on to what the other commenter mentioned, that is called a breaking change and would generally be avoided at all costs by libssl. See, e.g., the decades-long python3 transition.

      • kevincox@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        2 days ago

        I’m also not familiar. But my understanding is that the package maintainers should prevent this situation. Because otherwise even if there are package version dependencies (I don’t actually know if pacman does this) it would just block the update which results in a partial update which isn’t supported. For example if your theoretical unmaintained Firefox blocks the update of libssl but Python requires new functionality you would be stuck in dependency hell. Leaving this problem to the users just makes this problem worse. So the package maintainers need to sort something out.

        It is a huge pain when it happens but tends to be pretty rare in practice. Typically they can just wait for software to update or ship a small patch to fix it. But in the worst case you need to maintain two versions of the common dependency. In lots of distros very common dependencies tend to get different packages for different major version for this reason. For example libfoo1 and libfoo2. Then there can be a period where both are supported while packages slowly move from one to the other.

        • frongt@lemmy.zip
          link
          fedilink
          arrow-up
          0
          ·
          2 days ago

          If a package manager can block an upgrade due to version dependencies, it can also pull in those dependencies for a partial upgrade.

          • chakli@lemmy.world
            link
            fedilink
            arrow-up
            0
            ·
            2 days ago

            If a function is removed from libssl and it’s used in firefox, firefox build would fail, so it’s still not possible to have a functional setup.

            • ulterno@programming.dev
              link
              fedilink
              English
              arrow-up
              0
              ·
              1 day ago

              Yeah, that kind of a condition would require the maintainer to patch the source of the non-updated program.
              And that would be fine if there is just a little change, with an alternate function available but if the change requires changing the logic of the application, you are essentially expecting the package maintainer to do the software developer’s work.

              The deprecation process is a good way to prevent this.

    • thingsiplay@beehaw.orgOP
      link
      fedilink
      arrow-up
      0
      ·
      2 days ago

      But I’m not doing pacman -Sy package. That is not what I am talking about. I am only talking about pacman -S package, which is not updating the system partially. IF the package depends on something else to update, then the system would need to be updated. But that is not what I was asking, because I only talk about the package with -S package. I just chose firefox as an example, it could have been any other package.

      To make it clear, when I say -S firefox, then I mean really that without updating a dependency like libssl. The idea is to install only new packages without updating anything on the system. I guess as you say it depends on the dependencies of the package, if this is feasible.

      • kevincox@lemmy.ml
        link
        fedilink
        arrow-up
        0
        ·
        edit-2
        2 days ago

        But that is my point. Just running pacman -S firefox is fine as long as you didn’t run pacman -Sy at some point earlier. It won’t update anything, even dependencies. It will just install the version that matches your current package list and system including the right version of any dependencies if they aren’t already installed.

        But that means if you already have Firefox installed it will do nothing.

        • thingsiplay@beehaw.orgOP
          link
          fedilink
          arrow-up
          0
          ·
          edit-2
          2 days ago

          We can install a new package if it wasn’t installed with pacman -S firefox. That is not a partial upgrade of the system. Right? What i don’t understand is, when I uninstall with pacman -Rs firefox, delete the cached firefox package (only that file), then the system is in the same state as before I installed it. Then -S firefox should be okay, right? And it even looks up the new version. This is my question, if that would work correctly.

          IF no dependency tries to update too. Off course in that case I would stop. Without pacman -Sy, I never do that anyway, only -Syu.

          • milk@discuss.tchncs.de
            link
            fedilink
            arrow-up
            0
            ·
            1 day ago

            To add to the other comment, package managers keep a local copy of the list of available packages and the version. When you do a pacman -S xxx the package manager looks up xxx in the cache and downloads the package from whatever mirror youre using as well as any dependencies, looking them up in the same way from your cache. This works for a while even if theres a new update available because mirrors usually keep a few previous versions.

            Once you do a pacman -Sy you update your cache to the latest one. If you then update xxx, it will update xxx and pull in any dependency updates required, but any other packages that depended on the same packages dont get updated, leaving you in a partially upgraded state.

          • kevincox@lemmy.ml
            link
            fedilink
            arrow-up
            0
            ·
            2 days ago

            IF no dependency tries to update too. Off course in that case I would stop. Without pacman -Sy, I never do that anyway, only -Syu.

            That’s all you need to know. As long as you always use pacman -Syu you will be fine. pacman -Sy is the real problem. The wiki page is pretty clear about the sequences of commands that are problematic https://wiki.archlinux.org/title/System_maintenance#Partial_upgrades_are_unsupported.

            Right? What i don’t understand is, when I uninstall with pacman -Rs firefox, delete the cached firefox package (only that file), then the system is in the same state as before I installed it. Then -S firefox should be okay, right? And it even looks up the new version.

            This isn’t correct. It won’t look up the new version. Assuming that the system was in a consistent state it will download the exact same package that you deleted. The system only ever “updates” when you run pacman -Sy. Until you use -y all packages are effectively pinned at a specific version. If the version that gets installed is different than the one you removed it probably means that you were breaking the partial update rule previously.

  • Pogogunner@sopuli.xyz
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    I feel like there is an underlying issue here you’re trying work around. Why do you not want to update everything together?

  • www-gem@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    You’re correct partial upgrades are unsupported. Arch follows a rolling release model, meaning there are no fixed “versions” of the system. Instead, everything is continuously updated. Each package is built and tested against the current state of the rest of the system in the Arch repositories. That package was compiled against the latest system libraries in the repos, not necessarily the ones on your machine.

    Your proposed “workaround” may work if the package is standalone and has few/no dependencies. Again, ArchLinux strongly recommends full system upgrades (pacman -Syu) rather than only reinstalling/upgrading a single package, because library or dependency mismatches can occur if your system is out of sync.
    A safer approach may be to use “pacman -S package --needed” which will avoid removing it first and automatically handles dependencies safely.

  • A_norny_mousse@feddit.org
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    but installing a new single package if it wasn’t there is okay.

    Not true. It says clearly “Partial upgrades are not supported”. Whether the package was there or not is irrelevant. And I really don’t mean this personally, but as general advice, using Archlinux and its wiki requires a modicum of independent thinking.

    • thingsiplay@beehaw.orgOP
      link
      fedilink
      arrow-up
      0
      ·
      edit-2
      2 days ago

      But -S package is not upgrading the package. Installing with that command is supported. That is NOT a partial upgrade of the system. -Sy package is considered a partial upgrade, because that command updates the package list.

      And I really don’t mean this personally, but as general advice, using Archlinux and its wiki requires a modicum of independent thinking.

      This part was a total unnecessary attack, for someone who asks. Especially if you are not entirely correct.

      • Strit@lemmy.linuxuserspace.show
        link
        fedilink
        arrow-up
        0
        ·
        2 days ago

        But -S package is not upgrading the package. Installing with that command is supported. That is NOT a partial upgrade of the system. -Sy package is considered a partial upgrade, because that command updates the package list.

        I disagree. The -S flag stands for “sync”, which means sync the local version with the remote version. So if there is no local version it just installs the remote version. This is still a partial update, because any dependencies it might have, that you already have installed, might be the wrong version compared to the one the newly installed package expects.

        pacman -S should be discouraged because of this. The correct one is pacman -Syu for installing new packages.

        • Aatube@kbin.melroy.org
          link
          fedilink
          arrow-up
          0
          ·
          2 days ago

          If you have not ran a database update (any y after -y), pacman will fetch the version that is compatible with your current installed dependencies. This is not a partial upgrade.

          • Strit@lemmy.linuxuserspace.show
            link
            fedilink
            arrow-up
            0
            ·
            1 day ago

            The remote server only has the latest version of the package, and the latest version is always built against the dependencies on the remote server. So if you didn’t update the database, then your pacman -S command will fail, because it can’t find the package version on the remote server. So you did not install anything.

        • thingsiplay@beehaw.orgOP
          link
          fedilink
          arrow-up
          0
          ·
          2 days ago

          No, pacman -S package is safe. Because the package list is not updated this way, and therefore the system is not updated and nothing else is affected. New packages can be installed with this command, perfectly okay. That is in the spirit of Archlinux.

          I think my idea would not work because the nature of the command -S package, as no new version would be synced. This is not a partial upgrade and it does not need to be discouraged.

          • Strit@lemmy.linuxuserspace.show
            link
            fedilink
            arrow-up
            0
            ·
            1 day ago

            No, pacman -S package is safe. Because the package list is not updated this way, and therefore the system is not updated and nothing else is affected. New packages can be installed with this command, perfectly okay. That is in the spirit of Archlinux.

            If the package is not in your cache, it needs to download it from the remote server first. The version on the remote server is built against the dependencies on the remote server. So if your local dependency is older, it will be a partial update!

              • Strit@lemmy.linuxuserspace.show
                link
                fedilink
                arrow-up
                0
                ·
                1 day ago

                And where does it download the newly installed package from? It’s not in your cache, because you haven’t had it installed before and the remote server only has the newest version.

                • Markaos@discuss.tchncs.de
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  23 hours ago

                  The download will simply fail if the version pacman wants to download isn’t available on the mirror. The version is part of the download URL.

      • A_norny_mousse@feddit.org
        link
        fedilink
        arrow-up
        0
        ·
        2 days ago

        It is OK to use ‘-S’ only if all installed packages are on the same level as the cached package info. That is assuming that the cached version of the package is still available on package servers.

        I just think you’re being too literal about this, instead of thinking about the reasoning behind that rule.

  • MyNameIsRichard@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    When installing on Arch (or a derivative) you should run sudo pacman -Syu package_name so it is always up to date.

  • Cassa@lemmy.blahaj.zone
    link
    fedilink
    arrow-up
    0
    ·
    2 days ago

    it’s just unsupported. like, if something breaks by that happening then it’s not a bug, but your fault.

    installing a new package without updating is the same as updating a single package

    • thingsiplay@beehaw.orgOP
      link
      fedilink
      arrow-up
      0
      ·
      2 days ago

      That is not true. Installing a package with sudo pacman -S package without updating the package list is totally supported and works without problems. Whats not recommended is to installing package and updating package list with -Sy package. So instead we should do -Syu package and update everything on the system alongside the package.

      Maybe if the package list is old, then -S package it will only install from cache? Could it be that?

      • FishFace@lemmy.world
        link
        fedilink
        arrow-up
        0
        ·
        2 days ago

        Yes, pacman -S package will install the version of the package that is listed in the current package database, and will not do anything to update that database.