Cannot update with DNF

I am running an Alma Linux 9 server.

When I run sudo dnf update it hangs for 30/60 odd seconds and then just returns the text “Killed”.

I tried adding the following to my /etc/dnf/dnf.conf file:

max_parallel_downloads=10
fastestmirror=true
deltarpm=true

My full DNF conf file now looks like this:

[main]
gpgcheck=1
installonly_limit=3
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False

max_parallel_downloads=10
fastestmirror=true
deltarpm=true

Anything else it could be orhow might I get update to work?

I would not add more configuration in the /etc/dnf/dnf.conf to try and solve this. The default configuration should be good enough unless you have a very “strange” setup.
Most of these problems comes then dnf is trying to use the .repo file in /etc/yum.repos.d/ and DNS/proxy or other network problems is often to blame. Try using the -v (verbose flag) or raise the debug level with -d to get some more information.

Thanks for reply.

I ran sudo dnf update -v and it produced the following:

Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync, system-upgrade
DNF version: 4.14.0
cachedir: /var/cache/dnf
User-Agent: constructed: 'libdnf (AlmaLinux 9.3; generic; Linux.x86_64)'
repo: using cache for: copr:copr.fedorainfracloud.org:group_caddy:caddy
copr:copr.fedorainfracloud.org:group_caddy:caddy: using metadata from Fri 08 Dec 2023 09:45:06 AM GMT.
repo: using cache for: appstream
appstream: using metadata from Fri 16 Feb 2024 12:02:54 PM GMT.
repo: using cache for: baseos
baseos: using metadata from Fri 16 Feb 2024 12:04:44 PM GMT.
repo: using cache for: crb
crb: using metadata from Fri 16 Feb 2024 12:05:23 PM GMT.
repo: using cache for: extras
extras: using metadata from Fri 16 Feb 2024 12:05:12 PM GMT.
repo: using cache for: epel
Killed

It gets stuck on the epel repo. So I tried to refresh the repos with sudo dnf update --refresh and it produced:

Copr repo for caddy owned by @caddy                                                                                            4.0 kB/s | 1.8 kB     00:00    
AlmaLinux 9 - AppStream                                                                                                        8.7 kB/s | 4.1 kB     00:00    
AlmaLinux 9 - BaseOS                                                                                                            12 kB/s | 3.8 kB     00:00    
AlmaLinux 9 - CRB                                                                                                               13 kB/s | 4.1 kB     00:00    
AlmaLinux 9 - Extras                                                                                                            12 kB/s | 3.8 kB     00:00    
Extra Packages for Enterprise Linux 9 - x86_64                                                                                 631 kB/s |  35 kB     00:00    
Killed

“Extra Packages for Enterprise Linux” is the epel repo. So always gets stuck on that repo.

In /etc/yum.repos.d/epel.repo it has:

[epel]
name=Extra Packages for Enterprise Linux $releasever - $basearch
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=1
gpgcheck=1
countme=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever

[epel-debuginfo]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Debug
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1

[epel-source]
name=Extra Packages for Enterprise Linux $releasever - $basearch - Source
# It is much more secure to use the metalink, but if you wish to use a local mirror
# place its address here.
#baseurl=https://download.example/pub/epel/$releasever/Everything/source/tree/
metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
gpgcheck=1

Anything wrong with epel?

On /etc/yum.repos.d.epel.repo I added the following 2 lines under the [epel] section:

metadata_expire=60
mirrorlist_expire=60

I ran sudo dnf update -v and got(the line at the end about “revived” is new):

Loaded plugins: builddep, changelog, config-manager, copr, debug, debuginfo-install, download, generate_completion_cache, groups-manager, needs-restarting, playground, repoclosure, repodiff, repograph, repomanage, reposync, system-upgrade
DNF version: 4.14.0
cachedir: /var/cache/dnf
Unknown configuration option: mirrorlist_expire = 60 in /etc/yum.repos.d/epel.repo
User-Agent: constructed: 'libdnf (AlmaLinux 9.3; generic; Linux.x86_64)'
repo: using cache for: copr:copr.fedorainfracloud.org:group_caddy:caddy
copr:copr.fedorainfracloud.org:group_caddy:caddy: using metadata from Fri 08 Dec 2023 09:45:06 AM GMT.
repo: using cache for: appstream
appstream: using metadata from Fri 16 Feb 2024 12:02:54 PM GMT.
repo: using cache for: baseos
baseos: using metadata from Fri 16 Feb 2024 12:04:44 PM GMT.
repo: using cache for: crb
crb: using metadata from Fri 16 Feb 2024 12:05:23 PM GMT.
repo: using cache for: extras
extras: using metadata from Fri 16 Feb 2024 12:05:12 PM GMT.
countme: no event for epel: window already counted
Extra Packages for Enterprise Linux 9 - x86_64                                                                                 517 kB/s |  35 kB     00:00    
reviving: 'epel' can be revived - metalink checksums match.
Killed

But it still hung and got stuck/died on epel.

When I ran:

sudo dnf update --disablerepo=epel

It ran and completed and bunch of updates from all the other updates.

I’m on Alma 9, so I then installed microdnf with:

sudo dnf install microdnf --disablerepo=epel

and then ran update with microdnf:

sudo microdnf update

and microdnf ran and completed the left over updates.

So I got updates installed and can fallback to microdnf. But something wrong with the epel repo for me.

Until I can fix the epel repo issue, I’ll have to keep running dnf with --disablerepo=epel and microdnf for left overs.

My server only had 1G RAM, and it wasn’t enough.
Adding 4G swap file fixed the issue for me.

Here’s the link I used to create the swap: