coreos / rpm-ostree

⚛📦 Hybrid image/package system with atomic upgrades and package layering
https://coreos.github.io/rpm-ostree
Other
874 stars 196 forks source link

rpm-ostree install should upgrade locally installed package #2127

Open jmou opened 4 years ago

jmou commented 4 years ago

When a local package is installed, using rpm-ostree install on a newer rpm fails. For example:

$ rpm-ostree install Downloads/zoom_x86_64.rpm 
Checking out tree 311528d... done
Enabled rpm-md repositories: fedora rpmfusion-nonfree-updates-testing google-chrome updates rpmfusion-free-updates-testing rpmfusion-free rpmfusion-nonfree fedora-cisco-openh264
rpm-md repo 'fedora' (cached); generated: 2020-04-22T22:22:36Z
rpm-md repo 'rpmfusion-nonfree-updates-testing' (cached); generated: 2020-06-09T11:11:20Z
rpm-md repo 'google-chrome' (cached); generated: 2020-06-11T19:51:31Z
Updating metadata for 'updates'... done
rpm-md repo 'updates'; generated: 2020-06-11T22:51:32Z
rpm-md repo 'rpmfusion-free-updates-testing' (cached); generated: 2020-06-09T10:56:29Z
rpm-md repo 'rpmfusion-free' (cached); generated: 2020-04-24T17:27:23Z
rpm-md repo 'rpmfusion-nonfree' (cached); generated: 2020-04-24T17:52:12Z
rpm-md repo 'fedora-cisco-openh264' (cached); generated: 2020-03-17T20:10:45Z
Importing rpm-md... done
Resolving dependencies... done
error: Could not depsolve transaction; 1 problem detected:
 Problem: cannot install both zoom-5.0.398100.0427-1.x86_64 and zoom-5.0.418682.0603-1.x86_64
  - conflicting requests

The workaround is easy; just rpm uninstall the local package first. But it would be friendlier if rpm-ostree could upgrade the package without this step.

1player commented 2 years ago

Considering that there's no way of doing a rpm-ostree uninstall --apply-live, the only way of upgrading an rpm requires a full reboot.

jlebon commented 2 years ago

Didn't realize a lot of people were hitting this. This isn't actually hard to do, and we do something similar for override replacements already (https://github.com/coreos/rpm-ostree/pull/2863). Might take a look at this soon since I've been working a lot in that area.

champtar commented 2 years ago

@jlebon any news ? it's not a blocker but definitely nice to have

Mershl commented 9 months ago

The workaround is easy; just rpm uninstall the local package first. But it would be friendlier if rpm-ostree could upgrade the package without this step.

FWIW you can do it in a single transaction: rpm-ostree install lact-0.5.3-0.x86_64.fedora-39.rpm --uninstall lact

Upgraded:
  lact 0.5.2-0 -> 0.5.3-0
Changes queued for next boot. Run "systemctl reboot" to start a reboot
RichardFevrier commented 6 months ago

Could you give some love for this opened issue with the most 👍 in this repo and check the proposed answer by @Mershl with multiple packages at once @jlebon. It doesn't seem to work on my side.

onedr0p commented 4 months ago

The issue with @Mershl solution is that it is not idempotent, we should simply be allowed to upgrade a package from an rpm file/link and if there is no upgrade, do nothing.

The error below should not happen and just update the app if there is an update.

sudo rpm-ostree install --idempotent --assumeyes https://downloads.1password.com/linux/rpm/stable/x86_64/1password-cli-latest.x86_64.rpm
Downloading https://downloads.1password.com/linux/rpm/stable/x86_64/1password-cli-latest.x86_64.rpm...done
Checking out tree 38df155... done
Enabled rpm-md repositories: fedora fedora-cisco-openh264 updates copr:copr.fedorainfracloud.org:atim:starship
Importing rpm-md... done
rpm-md repo 'fedora' (cached); generated: 2024-04-14T18:51:11Z solvables: 74881
rpm-md repo 'fedora-cisco-openh264' (cached); generated: 2024-03-12T11:45:42Z solvables: 3
rpm-md repo 'updates' (cached); generated: 2024-07-10T01:50:03Z solvables: 21093
rpm-md repo 'copr:copr.fedorainfracloud.org:atim:starship' (cached); generated: 2024-05-16T08:24:44Z solvables: 2
Resolving dependencies... done
error: Could not depsolve transaction; 1 problem detected:
 Problem: cannot install both 1password-cli-2.29.0-1.x86_64 from @commandline and 1password-cli-2.28.0-1.x86_64 from @commandline
  - conflicting requests
michaelst0 commented 1 month ago

Some examples with rpm-ostree version 2024.8


rpm-ostree install foo-1.0.0-1.fc40.x86_64.rpm --reboot

# fails, note new version
rpm-ostree install foo-1.0.1-1.fc40.x86_64.rpm 

# works
rpm-ostree install foo-1.0.1-1.fc40.x86_64.rpm --uninstall foo

# fails, note new release
rpm-ostree install foo-1.0.1-2.fc40.x86_64.rpm --uninstall foo

# works
rpm-ostree install foo-1.0.1-2.fc40.x86_64.rpm --uninstall foo-1.0.1-1.fc40.x86_64

# works, note new version
rpm-ostree install foo-1.1.0-1.fc40.x86_64.rpm --uninstall foo

rpm-ostree install bar-1.0.0-1.fc40.x86_64.rpm --reboot

# fails since --uninstall only takes one argument
rpm-ostree install foo-1.2.0-1.fc40.x86_64.rpm bar-1.1.0-1.fc40.x86_64.rpm \
--uninstall foo bar 
RichardFevrier commented 1 month ago

Thanks for all the testing @mchlstckl

jlebon commented 1 month ago
# fails since --uninstall only takes one argument
rpm-ostree install foo-1.2.0-1.fc40.x86_64.rpm bar-1.1.0-1.fc40.x86_64.rpm \
--uninstall foo bar 

Note you can pass --uninstall multiple times (so --uninstall foo --uninstall bar).