Update Fedora Linux to Get Latest Software

| 0 Comments| | 12:56
Categories:

This is the recommended command-line upgrade method.

$ dnf check-update
$ sudo dnf upgrade

or

sudo dnf upgrade --refresh

 

about dnf upgrade

Aliases: up
Deprecated aliases: update, upgrade-to, update-to, localupdate
 

Clean-up packages

You can safely remove packages no longer in use with:

$ sudo dnf autoremove

 
You can see a list of packages with broken dependencies by typing:

$ sudo dnf repoquery --unsatisfied

The list should be empty, but if this is not the case consider removing them as they are not likely to work.
 
You can see duplicate packages (packages with multiple versions installed) with:

$ sudo dnf repoquery --duplicates

 
Some packages that are still on your system may no longer be in the repositories. To see a list of these packages do:

$ sudo dnf list extras

 
If you see a package you do not need, or use, you can remove it with:

$ sudo dnf remove $(sudo dnf repoquery --extras --exclude=kernel,kernel-\*)

 
Old kernels remain even after dnf autoremove.
 
The script below works whenever Fedora updates a kernel, and does not depend upon a system upgrade.

#!/usr/bin/env bash

old_kernels=($(dnf repoquery --installonly --latest-limit=-1 -q))
if [ "${#old_kernels[@]}" -eq 0 ]; then
    echo "No old kernels found"
    exit 0
fi

if ! dnf remove "${old_kernels[@]}"; then
    echo "Failed to remove old kernels"
    exit 1
fi
 
echo "Removed old kernels"
exit 0

Clean-up old symlinks

There may be some dangling symlinks in the filesystem after an upgrade. You can clean the dangling links by installing the symlinks utility and deleteing the old links.

$ sudo dnf install symlinks

 
Once the utility is installed you can audit for broken symlinks like shown below. -r means recursive.

$ sudo symlinks -r /usr | grep dangling

 
After you verify the list of broken symlinks you can delete them like shown below. -d means delete.

$ sudo symlinks -r -d /usr

 
 
ref:
DNF System Upgrade
DNF Command Reference
 
#fedora36

Leave a Reply

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *