Bug 2560148 - dnf automatic creates warning "No network connection detected'
Summary: dnf automatic creates warning "No network connection detected'
Keywords:
Status: POST
Alias: None
Product: Fedora
Classification: Fedora
Component: dnf5
Version: 44
Hardware: Unspecified
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Marek Blaha
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2026-10-23 18:00 UTC by Villy Kruse
Modified: 2026-10-26 14:42 UTC (History)
6 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed:
Type: ---
Embargoed:
fedora-admin-xmlrpc: mirror+


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Github rpm-software-management dnf5 pull 3006 0 None Merged automatic: support IPv6 network availability checks 2026-10-26 14:42:03 UTC

Description Villy Kruse 2026-10-23 18:00:21 UTC
The problem code is

static bool server_available(std::string_view host, std::string_view service) {
    // Resolve host name/service to IP address/port
    struct addrinfo * server_info;
    if (getaddrinfo(host.data(), service.data(), nullptr, &server_info) != 0) {
        return false;
    }
    
    // Create a socket
    int sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd < 0) {
        freeaddrinfo(server_info);
        return false;
    }
    
    // Attempt to connect to the server
    bool retval = true;
    struct timeval timeout;
    timeout.tv_sec = 1;
    timeout.tv_usec = 0;
    setsockopt(sockfd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout));
    if (connect(sockfd, server_info->ai_addr, server_info->ai_addrlen) < 0) {
        retval = false;
    }

    close(sockfd);
    freeaddrinfo(server_info);
    return retval;
}

The problem is that when you test an IPv6 address you also need to create an IPv6 socket.  On systems where IPv6 is preferred, you almost always get an IPv6 address to test.

The AutomaticCommand::wait_for_network() seems pointless as you wouldn't get any addresses to test with if the network is down.  At least not when you get the addresses from DNS over the network.

Reproducible: Always

Comment 2 Dominic 2026-10-24 11:25:26 UTC
I should add that I'm not sure the bug I reported in my forum post is the same as being reported here. I get a dnf5 automatic timeout even when the network is functioning correctly so I believe it always uses cached package lists as a result.

I'll open a new bug if required.

Comment 3 Marek Blaha 2026-10-26 08:21:42 UTC
@lzqhwo the discussion very likely represents the same root cause, thanks!

Comment 4 Marek Blaha 2026-10-26 08:52:14 UTC
I created https://github.com/rpm-software-management/dnf5/pull/3006 PR with a fix for IPv6 environments.


Note You need to log in before you can comment on or make changes to this bug.