add-apt-repository 設定了錯誤的發行版名稱

add-apt-repository 設定了錯誤的發行版名稱

我正在使用 KDE Neon 的測試映像,它似乎基於 Ubuntu 16.04 Xenial,因為lsb_release -a肯定會傳回該映像。當我嘗試使用該add-apt-repository命令時,它會要求我安裝software-properties-common我所做的。

安裝後,每次我嘗試新增儲存庫時,都會新增該儲存庫,但xenial它不會用作發行版名稱的引用,而是設定yakkety.因此,當然apt-get無法找到任何包。解決方法是手動更改yakkety對 的參考xenial

lsb_relase -a回報

Distributor ID: neon
Description:    KDE neon Developer Edition
Release:    16.04
Codename:   xenial

請問我該如何修復它?我不明白它從哪裡提取錯誤的分發參考。我希望我可以只更改 ASCII 檔案來更改設定。

供您參考,我目前正在測試的ISO是這裡

答案1

我修好它了!我所要做的就是編輯/etc/lsb-release從:

Distributor ID: neon
Description:    KDE neon Developer Edition
Release:    16.04
Codename:   xenial

Distributor ID: Ubuntu
Description:    Ubuntu 16.04 LTS
Release:    16.04
Codename:   xenial

瞧!問題就消失了。誰曾想到?在解決此問題時,我特別關注由“lsb_釋放-a”其中明確指出“謝尼爾」所以我不明白為什麼它一直引用“yakkety”。

看起來好像「aptsources.distro.get_distro()” 整個過程中所使用的方法新增 apt 儲存庫腳本不一定從 Codename 參數讀取分發代號/etc/lsb-release但不知怎的,它透過閱讀“分發ID」。我認為這裡的關鍵是“分發ID”說“霓虹燈”。因為如果你讀到“/usr/share/distro-info/ubuntu.csv「你會看到這個:

version,codename,series,created,release,eol,eol-server
4.10,Warty Warthog,warty,2004-03-05,2004-10-20,2006-04-30
5.04,Hoary Hedgehog,hoary,2004-10-20,2005-04-08,2006-10-31
5.10,Breezy Badger,breezy,2005-04-08,2005-10-12,2007-04-13
6.06 LTS,Dapper Drake,dapper,2005-10-12,2006-06-01,2009-07-14,2011-06-01
6.10,Edgy Eft,edgy,2006-06-01,2006-10-26,2008-04-25
7.04,Feisty Fawn,feisty,2006-10-26,2007-04-19,2008-10-19
7.10,Gutsy Gibbon,gutsy,2007-04-19,2007-10-18,2009-04-18
8.04 LTS,Hardy Heron,hardy,2007-10-18,2008-04-24,2011-05-12,2013-05-09
8.10,Intrepid Ibex,intrepid,2008-04-24,2008-10-30,2010-04-30
9.04,Jaunty Jackalope,jaunty,2008-10-30,2009-04-23,2010-10-23
9.10,Karmic Koala,karmic,2009-04-23,2009-10-29,2011-04-29
10.04 LTS,Lucid Lynx,lucid,2009-10-29,2010-04-29,2013-05-09,2015-04-29
10.10,Maverick Meerkat,maverick,2010-04-29,2010-10-10,2012-04-10
11.04,Natty Narwhal,natty,2010-10-10,2011-04-28,2012-10-28
11.10,Oneiric Ocelot,oneiric,2011-04-28,2011-10-13,2013-05-09
12.04 LTS,Precise Pangolin,precise,2011-10-13,2012-04-26,2017-04-26
12.10,Quantal Quetzal,quantal,2012-04-26,2012-10-18,2014-05-16
13.04,Raring Ringtail,raring,2012-10-18,2013-04-25,2014-01-27
13.10,Saucy Salamander,saucy,2013-04-25,2013-10-17,2014-07-17
14.04 LTS,Trusty Tahr,trusty,2013-10-17,2014-04-17,2019-04-17
14.10,Utopic Unicorn,utopic,2014-04-17,2014-10-23,2015-07-23
15.04,Vivid Vervet,vivid,2014-10-23,2015-04-23,2016-01-23
15.10,Wily Werewolf,wily,2015-04-23,2015-10-22,2016-07-22
16.04 LTS,Xenial Xerus,xenial,2015-10-22,2016-04-21,2021-04-21
16.10,Yakkety Yak,yakkety,2016-04-21,2016-10-20,2017-07-20

所以我猜如果aptsources.distro.get_distro() 無法找到「已知且官方」的發行版ID,那麼它只會「預設為最後的手段」讀取此文件,以檢索最新的「已知」名稱,在本例中是「yakkety」。無論如何,它可能不一定以這種方式工作,但我所做的改變肯定解決了我遇到的問題。

相關內容