apt {upgrade,install, source} require an update call first

Bug #1709603 reported by Robie Basak on 2017-08-09
This bug affects 6 people
Affects Status Importance Assigned to Milestone
apt (Ubuntu)

Bug Description

I think that this should be tracked in its own separate bug tracking my specific UX objection to the current status quo.

See https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1429285/comments/5, subsequent discussion and https://twitter.com/chr1sa/status/894048628284604416

We think that the updating of indexes should be an implementation detail of "apt upgrade" and "apt install", rather than something exposed to the user. If updating is judged be required (for example the index is more than X old), then it should be done automatically before the requested operation commences.

Here's one proposed implementation:

1) Fix bug 1429285 ("apt-get update --if-necessary").

2) Add an option to have "apt install" and "apt upgrade" (also "apt full-upgrade", etc?) automatically and internally call the implementation of "apt-get update --if-necessary" first.

3) Enable the option by default on Ubuntu.

This would change the behaviour of "apt", which AIUI is intended to be the user focused CLI. It wouldn't change the behaviour of "apt-get", which AIUI needs to retain behavioural backwards compatibility for existing scripts.

Then we could promote "apt install" and "apt upgrade" as much simpler commands to operate.

Note that Julian disagreed with this proposed behaviour change in https://bugs.launchpad.net/ubuntu/+source/apt/+bug/1429285/comments/7. I think that the very user-focused Ubuntu perspective should be to focus on the common use case for "apt". Hence my (compromise) suggestion that we implement this as an option upstream, and then leave it to distros to choose the default behaviour for their users.

Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in apt (Ubuntu):
status: New → Confirmed
summary: - apt {upgrade,install} require an update call first
+ apt {upgrade,install, source} require an update call first
Murukesh Mohanan (murukesh) wrote :


- a `-u`/`--update` option that unconditionally performs an apt update as an option to apt itself, since every subcommand except `update` and `edit-sources` can potentially benefit from an `update` beforehand. For `edit-sources`, have it update after instead of before, and for `update`, the option can be a NOP.

I'd love to be able to do something like:

    apt full-upgrade --autoremove --update

I can do `apt full-upgrade --autoremove` now, removing obsolete packages and upgrading in one shot. It'd be glorious to include the package lists update in that operation too.

Scott Moser (smoser) wrote :

Just a comment...
'apt' indicates that its cli is unstable and should not be relied upon by scripts.
So fixing this general problem in 'apt' (and not apt-get) means you fix it possibly for humans who are typing things, but all non-human package installations needlessly have to 'apt-get update'. :-(

Anatoli Babenia (abitrolly) wrote :

Ideally, `apt-get` could behave like a `dnf`, updating caches on `update` after some expiration period.

    apt-get upgrade --refresh-period=2h

The example session from `dnf`.

    ~ sudo dnf update
    Last metadata expiration check: 0:12:32 ago on Tue 27 Aug 2019 06:30:17 PM +03.

Julian Andres Klode (juliank) wrote :

Huge anti-feature of dnf IMO, always totally confusing me when I'm on an RPM system.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers