-
Notifications
You must be signed in to change notification settings - Fork 104
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
Add --wait option to wait for acquiring a transaction lock instead of failing immediately #2186
Comments
While DNF5 could gain this feature, I don't think it would be good default behavior: My reason is an already running RPM transaction can affect the waiting transaction. Either because the new state will conflict with the latter transaction (e.g. this first transaction installs a package which will conflict with a package from the second transaction), or worse it will result into a different package set (e.g. the first transaction installs a package which will satisfy a rich dependency from the latter transaction). I understand that the feature can be handy for batching installing large package sets where the user is confident that the batches are commutative. Thus, I think that DNF5 should not wait on a concurrent transactions by default. But there could be a command-line opton, or a configuration option to resort to waiting on the lock. Preferably parametrized with a timeout value. Examples:
I'm not sure how the waiting was implemented in DNF4. I guess it was an loop with try-an-RPM-transaction and sleep. Would a feature like that be sufficient for you? |
Would your proposal solve the akmod-kmod part? If "wait&retry" is not the default behaviour, then I guess it would not. After running
That should block the prompt from returning till kmod RPMs are built and installed (or other conclusion). Hence no more problems with following package actions. |
Why not? Add --wait option to this automatic command.
Sure, you can write a DNF plugin which will do it. But I cannot see how it would help you besides not exiting DNF until akmod finshes. The transaction lock you observe is an RPM lock. Not a DNF lock. Once the RPM transaction finishes and when the DNF plugin has been executing akmod, a concurrent DNF instance would be able to run and perform another RPM transaction in parallel. Of course you could add the locking on DNF level to your DNF plugin. Frankly the whole akmod orchestration is a piece of antipatterns. If akmod needs to do something asynchronously, then it is it's job handle the synchronization. |
Ahhhh! I am sorry for my confusion. Now I see my mistake (apply new option to gstreamer* or akmods installation, not kmod installation). Now I understand your proposal:
To answer your queston:
yes |
RFE for akmods to use to-be-implemented --wait https://bugzilla.redhat.com/show_bug.cgi?id=2358625 |
Thanks for rising the issue. (akmods maintainer speaking). Somehow I never managed to reproduce on my setups on f41+ (dnf5) for now. Using --wait is not easy as the argument doesn't exist yet. So I will have to parse the dnf exact (future) version to know if I can use this term... Also, maybe I can deal with the "new behavior" if a proper error code can help me to identify the situation. For now I would advocate to revert to the previous behavior (aka blocking for the transaction lock to be acquired), because this is less surprising. Eventually introduce --no-block (same option as systemd-run) to change the default-locking mechanism I don't know which "locks" are available in dnf5, but I think I used to be able to do dnf searches while installing packages on another process. |
"dnf install --help" output will enumerate the new option once it becomes supported.
Interesting idea. DNF4 documents an exit code 200 for that purpose. DNF5 returns 1. We should change the exist code of DNF5. However, I don't think any number > 127 is usable because coded above that limit are used for termination by a signal. If that's so, then DNF5 should not emit 200. At the same time we cannot change exit code of DNF4 for backward compatibility.
There is nothing to revert. DNF5 simply never implemented that blocking behavior.
Yes, DNF5 does not lock anything accept when updating a repository cache, it locks write access to them, and RPM locks its database when installing packages. That's why with DNF5 you can perform multiple read-only operations in parallel. |
dnf5 does not seem to wait and try multiple times to gain transaction lock. I could not find an answer or a hint at changed behaviour ("Changes between DNF and DNF5") at https://dnf5.readthedocs.io/en/latest/ hence writing this text.
Is there an option to make dnf wait&retry?
If not, could dnf5 be reprogrammed to wait&retry like dnf-3 before?
dnf
's behaviour for "try to gain transaction lock" has changed compared to dnf on F40. Since Fedora 41 dnf5 is default fordnf
. On Fedora 42 beta with:you can reproduce it easily with:
dnf remove -y libreoffice*
,dnf install -y libreoffice*
Another use-case (might be harder, because timing due to akmod->kmod compilation and installation):
top
forcc1
On F42 dnf only tries once before failing:
I noticed the "dnf5 does not wait&retry" behaviour initially with
dnf install -y gstreamer*
, which pulls in akmod-intel-ipu6 and akmod-v4l2loopback, which in turn runsakmods
, which creates kmod-*.rpm files, which might or might not get installed, when installed can prevent installation of other packages during automated script-based system installation. Other akmod packages use similar code:akmods
creates and installs: kmod-v4l2loopback-6.14.0-63.fc42.x86_64-0.14.0-1.fc42.x86_64 kmod-intel-ipu6-6.14.0-63.fc42.x86_64-0.0-20.2025011.x86_64These packages get installed automatically with
dnf -y install --nogpgcheck --disablerepo=* /tmp/akmods.JioRK8g4/results/kmod-v4l2loopback-6.14.0-63.fc42.x86_64-0.14.0-1.fc42
More information in:
$ sudo journalctl -u akmods.service
$ sudo cat /var/cache/akmods/v4l2loopback/0.14.0-1-for-6.14.0-63.fc42.x86_64.failed.log
Brainstorming: Failed kmod RPM installation can be fixed without restart with
systemctl restart akmods
. It blocks prompt until compilation and installation is done. Maybeakmods
orakmods --force
do the same.On F40 dnf waits to finish task (same for kmod package installation (not shown here)). I show only the "waiting" side:
The text was updated successfully, but these errors were encountered: