Score:1

do-release-upgrade removes official ubuntu sources (and fail)

bd flag

I've been stuck for a little while on this one. Basically, I have a server running 20.04.6, and I've been trying to upgrade it to the current LTS. The only issue is that do-release-upgrade is removing the official Ubuntu sources from the apt sources list, and then refuses to proceed with the upgrade, as it can't find its essential packages.

Here's the relevant content of my /etc/apt/sources.list file:

:~# cat /etc/apt/sources.list | grep -v ^$ | grep -v ^#
deb http://ftp.ubuntu.com/ubuntu focal main restricted
deb http://ftp.ubuntu.com/ubuntu focal-updates main restricted
deb http://ftp.ubuntu.com/ubuntu focal universe
deb http://ftp.ubuntu.com/ubuntu focal-updates universe
deb http://ftp.ubuntu.com/ubuntu focal multiverse
deb http://ftp.ubuntu.com/ubuntu focal-updates multiverse
deb http://ftp.ubuntu.com/ubuntu focal-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu focal-security main restricted
deb http://security.ubuntu.com/ubuntu focal-security universe
deb http://security.ubuntu.com/ubuntu focal-security multiverse

And when I run an apt update, I properly get this:

:~# apt update
Hit:1 http://ppa.launchpad.net/ondrej/apache2/ubuntu focal InRelease
Hit:2 http://ftp.ubuntu.com/ubuntu focal InRelease                                                                                 
Get:3 http://ftp.ubuntu.com/ubuntu focal-updates InRelease [114 kB]                                                                
Get:4 http://ftp.ubuntu.com/ubuntu focal-backports InRelease [108 kB]                                                              
Get:5 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                       
Hit:6 https://esm.ubuntu.com/apps/ubuntu focal-apps-security InRelease               
Hit:7 https://esm.ubuntu.com/apps/ubuntu focal-apps-updates InRelease
Hit:8 https://esm.ubuntu.com/infra/ubuntu focal-infra-security InRelease
Hit:9 https://esm.ubuntu.com/infra/ubuntu focal-infra-updates InRelease
Fetched 336 kB in 3s (104 kB/s)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
All packages are up to date.

I have a few extra files in the /etc/apt/sources.list.d folder, notably for the esm repository.

Now, if I run do-release-upgrade, I will see the following:

Checking package manager
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Hit http://ftp.ubuntu.com/ubuntu focal InRelease                                                                                                                                                                  
Hit http://ftp.ubuntu.com/ubuntu focal-updates InRelease                                                                                                                                                          
Get:1 http://ftp.ubuntu.com/ubuntu focal-backports InRelease [108 kB]                                                                                                                                             
Hit http://ppa.launchpad.net/ondrej/apache2/ubuntu focal InRelease                                                                                                                                                
Get:2 http://security.ubuntu.com/ubuntu focal-security InRelease [114 kB]                                                                                                                                         
Hit https://esm.ubuntu.com/apps/ubuntu focal-apps-security InRelease                                                                                                                                              
Hit https://esm.ubuntu.com/apps/ubuntu focal-apps-updates InRelease                                                                                                                                               
Hit https://esm.ubuntu.com/infra/ubuntu focal-infra-security InRelease                                                                                                                                            
Hit https://esm.ubuntu.com/infra/ubuntu focal-infra-updates InRelease                                                                                                                                             
Fetched 222 kB in 0s (0 B/s)                                                                                                                                                                                      
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Updating repository information

Third party sources disabled 

Some third party entries in your sources.list were disabled. You can 
re-enable them after the upgrade with the 'software-properties' tool 
or your package manager. 

To continue please press [ENTER]

And if I press [ENTER]:

Get:1 http://security.ubuntu.com/ubuntu jammy-security InRelease [110 kB]                                                                                                                                         
Get:2 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security InRelease [7,553 B]                                                                                                                                  
Get:3 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates InRelease [7,459 B]                                                                                                                                   
Get:4 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security InRelease [7,453 B]                                                                                                                                
Get:5 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates InRelease [7,452 B]                                                                                                                                 
Get:6 http://security.ubuntu.com/ubuntu jammy-security/main i386 Packages [277 kB]                                                                                                                                
Get:7 http://security.ubuntu.com/ubuntu jammy-security/main amd64 Packages [631 kB]                                                                                                                               
Get:8 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security/main amd64 Packages [41.5 kB]                                                                                                                        
Get:9 http://security.ubuntu.com/ubuntu jammy-security/main Translation-en [148 kB]                                                                                                                               
Get:10 http://security.ubuntu.com/ubuntu jammy-security/main amd64 c-n-f Metadata [11.0 kB]                                                                                                                       
Get:11 http://security.ubuntu.com/ubuntu jammy-security/restricted i386 Packages [29.7 kB]                                                                                                                        
Get:12 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 Packages [651 kB]                                                                                                                        
Get:13 http://security.ubuntu.com/ubuntu jammy-security/restricted Translation-en [104 kB]                                                                                                                        
Get:14 http://security.ubuntu.com/ubuntu jammy-security/restricted amd64 c-n-f Metadata [532 B]                                                                                                                   
Get:15 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 Packages [756 kB]                                                                                                                          
Get:16 https://esm.ubuntu.com/apps/ubuntu jammy-apps-security/main i386 Packages [32.7 kB]                                                                                                                        
Get:17 http://security.ubuntu.com/ubuntu jammy-security/universe i386 Packages [544 kB]                                                                                                                           
Get:18 http://security.ubuntu.com/ubuntu jammy-security/universe Translation-en [136 kB]                                                                                                                          
Get:19 https://esm.ubuntu.com/apps/ubuntu jammy-apps-updates/main amd64 Packages [479 B]                                                                                                                          
Get:20 http://security.ubuntu.com/ubuntu jammy-security/universe amd64 c-n-f Metadata [15.9 kB]                                                                                                                   
Get:21 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 Packages [36.5 kB]                                                                                                                       
Get:22 http://security.ubuntu.com/ubuntu jammy-security/multiverse i386 Packages [1,032 B]                                                                                                                        
Get:23 http://security.ubuntu.com/ubuntu jammy-security/multiverse Translation-en [7,060 B]                                                                                                                       
Get:24 http://security.ubuntu.com/ubuntu jammy-security/multiverse amd64 c-n-f Metadata [260 B]                                                                                                                   
Get:25 https://esm.ubuntu.com/infra/ubuntu jammy-infra-security/main amd64 Packages [479 B]                                                                                                                       
Get:26 https://esm.ubuntu.com/infra/ubuntu jammy-infra-updates/main amd64 Packages [479 B]                                                                                                                        
Fetched 3,567 kB in 0s (0 B/s)                                

Checking package manager
Reading package lists... Done    
Building dependency tree          
Reading state information... Done

Invalid package information 

After updating your package information, the essential package 
'ubuntu-minimal' could not be located. This may be because you have 
no official mirrors listed in your software sources, or because of 
excessive load on the mirror you are using. See /etc/apt/sources.list 
for the current list of configured software sources. 
In the case of an overloaded mirror, you may want to try the upgrade 
again later. 

So we can clearly see that do-release-upgrade just decided to nuke the list of all of the ftp.ubuntu.com/ubuntu main sources in its second step, while keeping the security.ubuntu.com ones from the same file, which of course leads to the upgrade failure, but I have no understanding of why it's removing them, nor how to prevent it from removing them.

I guess the long story short question here might be, as it says it's removing third party sources, maybe it thinks the main focal repository is third party in this case, so how is it determining that it's a third party source, maybe, if that's the cause, and how to prevent it from thinking it's a third party source?

user535733 avatar
cn flag
Quick workaround: Use a different mirror before release-upgrading. For a real fix, please file a bug report.
Nicolas Noble avatar
bd flag
Tried that workaround, didn't work. You're saying this is enough of a problem it should be a bug filed in https://bugs.launchpad.net/ubuntu ?
Score:1
bd flag

So it turns out I was right: do-release-upgrade was thinking that the main ubuntu repository was a third-party. I do not know why however. I eventually discovered that there is a flag to the tool, --allow-third-party, which will avoid ignoring third party repositories.

I was able to upgrade my servers using this flag without issues. The original problem of the tool considering this is a third party repository remains however, but it's workaroundable.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.