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?
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]
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.