-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg i
uses pacman -Sy
, which is fundamentally unsafe
#137
Comments
The problem description and step through are clear and accurate in my opinion I'd just like to add a little bit of additional context to a couple points.
The consistency of pacman's package database is placed on the remote repository side. The core issue is that by using This is more than likely not an unrecoverable issue and should most of the time be able to be resolved by performing a full system upgrade using
I take issue with the implication that
As you mentioned "Option 1", which is the status quo, isn't probable to be unrecoverable, "Option 3" would avoid the problem by always doing a full system upgrade ( "Option 2" preserves parity with the I think "Option 4" presents a good compromise between preserving operational parity with and
|
It follows behavior used for Yes, this is not safe for rolling release distributions and we sometimes get bug reports. Here is the most recent one: termux/termux-app#4179 May suggest changing install methods to
Removal of index update discards the primary purpose of |
As outlined in "Option 3", this will impact data transfer amounts which may be undesirable to users. |
@TomJo2000 The possible choices are:
If our choice (not one of 1 or 2 above) is to reduce |
I don't think he have to be that fatalistic about it. |
I propose the following solution: start checking in |
what's the problem
pkg i PACKAGE
, in apacman
install, callspacman -Sy PACKAGE
. It is a basic gotcha of Arch that you should never callpacman
this way - they call this a "partial system upgrade" and the relevant Arch wiki page urges you to never do this, with big bold text and everything. I think the reasons we havepkg
include saving keystrokes and providing a lower friction interface to package management for particularly new-to-linux users, both of which also point strongly away from unsafe defaults.why's it a problem
IIUC, the reason Arch unambiguously says not to do this is that
pacman
simply does not check reverse dependencies when installing individual packages. Example:browser
version 0, which depends onlibtls
version 0, providinglibtls.so.0
-Syu
, repos pick uplibtls
version 1, a breaking change that only provideslibtls.so.1
pacman -Sy libtls
pacman
will update the repo (-y
), see the upgrade forlibtls
, depsolve its forward dependencies (maybe it needs an update tolibcoolneoninstructions
)pacman
will not consider whether your current installation ofbrowser
version 0 will still have its dependencies met after installinglibtls
version 1, and will happily do the upgrade and leavebrowser
brokenimagemagick
comes to mind.)I think the idea here is that the consistency enforcement is in the repo metadata.
pacman
repos are supposed to always provide a set of packages whose dependencies are satisfiable within that set.-S libtls
would have been safe, because all packages from the same sync are consistent;-Syu
is always safe, because that actually considers every package and the repo-level consistency guarantees a single install "transaction"[0] where all dependencies are satisfied before and after it happens.I am fairly certain that theapt
stack does do reverse depsolving on every action and that no comparable problem exists - absent a bug or unrecovered interrupt,apt update && apt install PACKAGE
always leaves a consistent system[1]. The operation of "update metadata and install one package" is safely expressible inapt
and simply isn't inpacman
, by design. I might be wrong there - if so, we should change both.edit: Talked offline -
apt
has disappointed me here. termux/termux-app#4179 is this, for theapt
stack.[0]
pacman
upgrades don't appear to try for ACID. Maybe CID.[1]
Tiny soapbox: I suspect the absence of safety checks here is the dominant reason forI guess it's just betterpacman
's famous speed.okay what do we do?
I see four credible options:
Nothing. Despite the unconditional urging against this from
pacman
's authors, triggering this problem requires a combination of a specific flavor of upgraded package and a specific flavor of user install op, without doing a system upgrade in the middle. It's also potentially recoverable with a system upgrade.Change
pkg i
to usepacman -S
. This preserves intent, but the version this selects may no longer be in the repos, and it produces a painful split from a support perspective: if you tell someone topkg i
something today and they report success, you can safely assume it's pretty recent. You'd need to ask if they're onapt
orpacman
to be able to do that, or you'd need to skip it and only tell people topacman -Syu THINGISAIDTOINSTALL
instead of usingpkg
at all, which undermines the value ofpkg
.Change
pkg i
to usepacman -Syu
. This potentially adds a lot of additional work to what would otherwise be a small download and install, which may surprise some users and be an actual problem for others, but gets full marks for doing what the user asked and for doing it safely.Do both, with a safe default, a noisy preservation of the unsafe behavior for existing installs, and an opt-out:
TERMUX_PKG_PACMAN_UNSAFE
-Sy
-Syu
-Sy
with no warningTERMUX_PKG_PACMAN_UNSAFE=false
in profile.d or something, and maybe explain that this choice was made and how to reverse itOpening this issue for opinions. If we decide to take anything like one of those options, I'll send the PR. My vote is for option 4.
The text was updated successfully, but these errors were encountered: