Friday, 30 October 2015

Fixing duplicate dnf packages

I just installed a shiny new Fedora 22 (KDE spin). I was running a dnf update when everything froze and I was forced to reboot (the cause of the freeze was the nouveau open source nvidia driver, and I hadn't got around to blacklisting and installing nvidia's driver yet). I was worried that things might be broken and went hunting for a yum-complete-transaction like thing but couldn't find one and since dnf update said "Nothing to do" I left it at that.

When I finally got around to installing the nvidia driver I noticed I had two kernels and couldn't boot from the more recent one (normally it's default). I ran a dnf reinstall for each of the newer dnf list kernel\* packages and everything was ok.

I noticed the real problem when trying to install steam and eventually found out about dnf repoquery --duplicated which listed ~500 items (same pacakage, but slightly newer versions from the update). A potential problem was half the old packages were in use and half the newer ones were. I was thinking I could either remove the new ones and run dnf update again or remove the old ones and reinstall the new ones. Anyway, I decided I couldn't be bothered accounting for both cases and deleted the older ones (because I found package-cleanup --cleandupes still works and does it for me (it calls yum, but now that's just a script which calls dnf). Be careful it doesn't try to remove more than the duplicates (by checking against the list from above)!

dnf repoquery --duplicated | sed "1 d" > dupes
cat dupes | sed 's/^\(.*\)-[0-9]\+:.*/\1/' | sort | uniq | grep -v kernel > reinstall
package-cleanup --cleandupes #uses dnf via /bin/yum (now a passthrough + warning script)


Before saying yes to removing everything, check the file count in reinstall with the number about to be removed. Also note the grep -v kernel or dnf complains about reinstalling the running kernel next.
sudo dnf reinstall $(cat reinstall)

Finally the dupes are gone, except for the kernel (dnf repoquery --duplicated) and I can get back to installing steam.

1 comment:

  1. 먹튀사이트 잡는 고릴라의 먹튀검증 통과 메이저토토사이트 안전놀이터 추천 훌륭한 먹튀검증을 통한 안전토토사이트를 추천합니다 고릴라만의 검증 시스템은 특별합니다 전세계적인 먹튀검증을 인전받은 최고의 메이저사이트 추천을 합니다 자세한 내용은 내 웹 사이트를 방문하십시오 먹튀검증.

    ReplyDelete