Command not found proxy error with Fedora 32

Hi,

I have an issue with PackageKit-command-not-found since around the upgrade to Fedora 32 (from F31). Whenever I type an invalid command I get the following error:

Failed to search for file: cannot update repo 'updates-modular': Cannot prepare internal mirrorlist: Curl error (5): Couldn't resolve proxy name for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Unsupported proxy syntax in 'http://:8080/']; Last error: Curl error (5): Couldn't resolve proxy name for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Unsupported proxy syntax in 'http://:8080/']

I can’t seem to find out how PackageKit or libdnf gets the invalid proxy here. I don’t use any proxy and dnf works fine, I can update, search, install packages as usual, this only affects the command-not-found tool as far as I can see.

I tried disabling modular repo, but then it just errors with a different repo, actually in PackageKit logs there is an error for every repo I have saying ā€œSkipping refresh of reponame: cannot update repo ā€˜reponame’ ā€¦ā€ the rest is the same as the error above ending with the invalid proxy setting.

I tried adding proxy=_none_ to dnf.conf but it didn’t change anything.
My env does not have any proxy variables set either (normal dnf commands work fine).

Has anyone any idea on where could I look for the proxy setting that PackageKit uses?

kernel-5.6.14-300.fc32.x86_64
libdnf-0.47.0-1.fc32.x86_64
dnf-4.2.21-1.fc32.noarch
PackageKit-1.1.13-3.fc32.x86_64
PackageKit-command-not-found-1.1.13-3.fc32.x86_64

I just noticed that I can use pkcon to reproduce it. Quick look at the source code shows that it reads the http_proxy env variable.

āžœ  ~ pkcon get-updates
Getting updates               [=========================]         
Finished                      [=========================]         
Fatal error: cannot update repo 'updates-modular': Cannot prepare internal mirrorlist: Curl error (5): Couldn't resolve proxy name for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Unsupported proxy syntax in 'http://:8080/']; Last error: Curl error (5): Couldn't resolve proxy name for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Unsupported proxy syntax in 'http://:8080/']

Now when I use http_proxy the value gets used, but since I do not have a proxy it errors out as well:

āžœ  ~ http_proxy=127.0.0.1  pkcon get-updates
Getting updates               [=========================]         
Finished                      [=========================]         
Fatal error: cannot update repo 'updates-modular': Cannot prepare internal mirrorlist: Curl error (7): Couldn't connect to server for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Failed to connect to 127.0.0.1 port 1080: Connection refused]; Last error: Curl error (7): Couldn't connect to server for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Failed to connect to 127.0.0.1 port 1080: Connection refused]

And the strange thing now is that it remembers this setting and now I keep getting the new error… Even killing packagekitd does not revert to the no proxy setting. I wonder where does PackageKit store this value

āžœ  ~ pkcon get-updates                      
Getting updates               [=========================]         
Finished                      [=========================]         
Fatal error: cannot update repo 'updates-modular': Cannot prepare internal mirrorlist: Curl error (7): Couldn't connect to server for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Failed to connect to 127.0.0.1 port 1080: Connection refused]; Last error: Curl error (7): Couldn't connect to server for https://mirrors.fedoraproject.org/metalink?repo=updates-released-modular-f32&arch=x86_64 [Failed to connect to 127.0.0.1 port 1080: Connection refused]

I found my answers here PackageKit/setting-the-proxy.txt at a7533e2c9eb0554bd32723f70d64a68acb67d7b4 Ā· PackageKit/PackageKit Ā· GitHub

Basically PackageKit proxy is set by GNOME at session start based on GSettings and then stores this setting in a database.

In GNOME I have no proxy as expected:

gsettings list-recursively org.gnome.system.proxy
...
org.gnome.system.proxy.http port 8080
org.gnome.system.proxy.http host ''

For some reason it seems PackageKit still tries to use http://:8080, which might be an incorrect entry stored in the DB, so I deleted all proxy entries from the sqlite db where it was stored and the problem got resolved. I restarted to be sure it doesn’t come back and while the ā€œ:8080ā€ gets added to the DB again, pk does not complain about it anymore and just works.

For anyone encountering this issue, my fix was to clean the stored proxy entries.

> sqlite3 /var/lib/PackageKit/transactions.db
select * from proxy;
delete from proxy;
.exit

Edit: I found out that GNOME Software is sending the ā€œ:8080ā€ proxy value because I had org.gnome.system.proxy.mode set to manual. Setting this to none if the proxy is not used anyway since the host is not set, should prevent this issue.

1 Like

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.