"dnf up" is empty even "Software" says there are critical updates

Hi, I regularly update my system with dnf (sudo dnf up). Today, I received a system message from “Software” (v 50.4) that there are multiple critical updates. Checking with ‘sudo dnf up’, the CLI was empty.

What is the reason? I doubt there is a plausible one.

What does sudo dnf --refresh up say?

… it does the trick. Thanks.

Remember to use the -—refresh parameter every time you want to update, so that the local cache will be refreshed from the repositories.

There is a very plausible one. Dnf is not updating every time you call it, the information in the repositories (synchronizing repos wit your local db from dnf [metadata] ). It costs time and would disturb if you just want check an info or list some packages which are installed.

I also use the notification from the Software app in Gnome, to update my system. As you, I do it also over dnf. However for the Flatpak’s I like to use Software as it gives some additional information in a quite nice overview.

I made my selves a simple helper script to use the --refresh command automatically:

#!/bin/bash
## dnf up --refresh; Force refreshing metadata before running the command.

sudo dnf  upgrade --refresh

# saving it in ~/bin/up

I personally use the ~/bin sub directory of my home drive. Reasons check the .bashrc file in your ~/.

 cat ~/.bashrc
...
# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH
...
 

If not available ( ~/bin ) you just can create it ( mkdir ~/bin ) and you are good to go.
Now I just can type up in the terminal and the metadata of dnf will be actualized all the time u want to upgrade the system, inclusive the critical Updates.
Just be aware, as bigger as your repo-list is ( dnf repolist ) , as more time it takes to actualize the metadata.

If you like more information about helper scripts, you can check out my git repo I made on codeberg. It will automate this process of creating helper script.

Just chiming in, this could also be accomplished through an alias in .bashrc or .zshrc:

alias up="sudo dnf upgrade --refresh && sudo dnf autoremove && flatpak update && flatpak remove --unused"

You could also further automate, at your own peril, with -y flags:

alias up="sudo dnf upgrade --refresh -y && sudo dnf autoremove -y && flatpak update -y && flatpak remove --unused -y"

Of course it is possible. A wise man told me once here … there are many ways to skin a cat.

Just if you like to motivate someone to use the terminal and getting in slowly, it is better to do it step wise. Flatpak is a separate tool I would make scripts about it. My approach also is, including/motivate to get into git, to learn this by doing. This way a user is quite fast able to do a proposal or change request over a git repo. So your approach would be the “advanced one” as I do focus on the one, for a more “beginner” friendly on. Win/Win in my opinion :slight_smile:

In this case I would mention the ( dnf --help ) command to se farther options. An error message also as a confirmation, helps to debug a system and should be posted, if users have a question here.
As you said with -y; “at your own peril” :bluethumb: and just then when the script is able to handle error and log entries, to get feedback to debug. I am not sure if an alias will catch this, without have to dig into the journalctl?

Good point about an alias not likely giving off much debug info and, honestly, I don’t know.

You may want to look into topgrade especially if you have things like cargo installed as it gives you an easy command to update everything on your system when you run it. Caution it will by default update all system firmware as well so its best to configure it to only update what you want to update via its config file first. You can run topgrade -n to do a dry run to ensure you have the config file set correctly for your needs. After setup running topgrade will update everything you have specified. Just thought you might find it interesting.

Sounds good thanks. Now I have something more to dig into it :slight_smile: