** Description changed:

+ [ Impact ]                                                                    
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ A release upgrade does not migrate one-line APT sources that use the          
                                                                                
                                                                        
+ signed-by option. python-apt's legacy parser implements only arch and         
                                                                                
                                                                        
+ trusted, so it marks every other documented option invalid, and               
                                                                                
                                                                        
+ migrateToDeb822Sources() then abandons the entry. Since 1:26.04.5 the         
                                                                                
                                                                        
+ file is preserved as <name>.list.disabled, but it is never converted, so      
                                                                                
                                                                        
+ the repository stays off after the upgrade.                                   
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ signed-by is the documented way to attach a keyring to a third-party          
                                                                                
                                                                        
+ repository, so this hits most of them. On the reporting machine it            
                                                                                
                                                                        
+ included a browser, Signal and OpenVPN3.                                      
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ What is lost is the source definition itself, not just its enabled            
                                                                                
                                                                        
+ state. The upgrader already disables third-party repositories it does         
                                                                                
                                                                        
+ not recognise, writing Enabled: no into their .sources file, and that is      
                                                                                
                                                                        
+ expected and recoverable: the file is in the standard location, tools         
                                                                                
                                                                        
+ show it, and one field turns it back on. An unmigrated entry instead          
                                                                                
                                                                        
+ leaves no .sources file at all, only a .list.disabled that no tool reads      
                                                                                
                                                                        
+ and nothing reports, so there is nothing left to re-enable.                   
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ The failure is silent. The packages stay installed and keep running,          
                                                                                
                                                                        
+ while apt, update-notifier and unattended-upgrades all report the system      
                                                                                
                                                                        
+ as current. There is no warning at any point that those packages no           
                                                                                
                                                                        
+ longer have an update source, so it is found by accident, if at all.          
                                                                                
                                                                        
+ On this machine it went unnoticed for weeks. A browser left unpatched         
                                                                                
                                                                        
+ with no indication makes this a security concern, not only an                 
                                                                                
                                                                        
+ inconvenience.                                                                
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ Affected upgrade paths, all of them live:                                     
                                                                                
                                                                        
+   24.04 -> 26.04 (26.04 upgrader), 26.04 -> 26.10 (26.10 upgrader),           
                                                                                
                                                                        
+   26.10 -> 27.04 (tenacious upgrader).                                        
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ [ Test Plan ]                                                                 
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ Automated: the proposed change adds                                           
                                                                                
                                                                        
+ 
tests/test_sources_list.py::TestDeb822SourcesMigration::test_signed_by_sources_migration
                                                                                
                                                              
+ which fails without it and passes with it. From the source tree:              
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+     python3 -m pytest tests/test_sources_list.py                              
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ Manual, on a machine or container running the older release:                  
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ 1. Add a one-line third-party source that uses signed-by:                     
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+        printf 'deb 
[signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] 
https://pkgs.tailscale.com/stable/ubuntu noble main\n' \                        
                                                                     
+          | sudo tee /etc/apt/sources.list.d/tailscale.list                    
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ 2. Install a package from it, then run do-release-upgrade.                    
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ 3. Without the fix: /etc/apt/sources.list.d/tailscale.list.disabled           
                                                                                
                                                                        
+    exists and no tailscale.sources was created, so                            
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+        apt list --installed 2>/dev/null | grep 'installed,local]'             
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+    lists the package and nothing points at where it came from.                
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ 4. With the fix: tailscale.sources exists and carries                         
                                                                                
                                                                        
+    Signed-By: /usr/share/keyrings/tailscale-archive-keyring.gpg, with no      
                                                                                
                                                                        
+    tailscale.list.disabled left behind. It will carry Enabled: no, which      
                                                                                
                                                                        
+    is the upgrader's normal handling of an unrecognised third-party           
                                                                                
                                                                        
+    mirror and is the same end state as a repository that was already in       
                                                                                
                                                                        
+    deb822 form before the upgrade. Setting Enabled: yes and running           
                                                                                
                                                                        
+    apt update then fetches the repository.                                    
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ [ Where problems could occur ]                                                
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ The change re-parses an entry after moving the options it can translate       
                                                                                
                                                                        
+ into deb822 fields, so a mistake there would land in third-party source       
                                                                                
                                                                        
+ files written during the upgrade. Three specific risks:                       
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ * Keyring mix-up. Suites that would share one stanza but are verified by      
                                                                                
                                                                        
+   different keyrings must not be consolidated, or one ends up verified by     
                                                                                
                                                                        
+   the other's key. The change refuses to consolidate in that case; a          
                                                                                
                                                                        
+   failure here would show as apt rejecting a repository's signature.          
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ * Architecture widening. An entry using [arch=... signed-by=...] must         
                                                                                
                                                                        
+   keep its architecture restriction, otherwise the repository is fetched      
                                                                                
                                                                        
+   for every dpkg-configured architecture. The change emits                    
                                                                                
                                                                        
+   Architectures: explicitly for this reason.                                  
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ * Malformed stanza. Flat repositories (Suites: ./) newly reach the            
                                                                                
                                                                        
+   stanza writer and have no components. apt accepts an absent Components      
                                                                                
                                                                        
+   for a flat repository but hard-fails for a non-flat suite with              
                                                                                
                                                                        
+   "E: Malformed entry" followed by "E: The list of sources could not be       
                                                                                
                                                                        
+   read", which would break apt until the file is edited by hand. The          
                                                                                
                                                                        
+   field is therefore omitted only when it is empty.                           
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ Entries using an option that cannot be translated keep today's                
                                                                                
                                                                        
+ behaviour and are still disabled, so the change only affects sources          
                                                                                
                                                                        
+ that are currently left broken anyway.                                        
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ [ Other Info ]                                                                
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ python-apt bug #2070432 asked for the legacy parser to learn these            
                                                                                
                                                                        
+ options and was closed Won't Fix, on the grounds that the regression          
                                                                                
                                                                        
+ risk was high and that the switch to deb822 sources would resolve it.         
                                                                                
                                                                        
+ This bug is the gap that leaves: the migration that was expected to           
                                                                                
                                                                        
+ handle these entries does not convert them. Fixing it in the upgrader         
                                                                                
                                                                        
+ keeps the change away from the parser.                                        
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ Note that an unrecognised third-party mirror is disabled by                   
                                                                                
                                                                        
+ rewriteSourcesList regardless of this change, and the user is only told       
                                                                                
                                                                        
+ about it when the Ubuntu archive components are also missing. So this         
                                                                                
                                                                        
+ change does not make those repositories live again by itself; it makes        
                                                                                
                                                                        
+ them survive the upgrade as readable, re-enableable source definitions        
                                                                                
                                                                        
+ instead of disappearing. The missing warning is bug #2167656.                 
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ Note also that the migration runs with the *source* release's python-apt.     
                                                                                
                                                                        
+ A 24.04 -> 26.04 upgrade was done here with the 1:26.04.22 upgrader and       
                                                                                
                                                                        
+ noble's python3-apt 2.7.7ubuntu5.2, and python3-apt 3.1.0ubuntu1.1 still      
                                                                                
                                                                        
+ marks these entries invalid, so a python-apt change alone could not           
                                                                                
                                                                        
+ repair this path.                                                             
                                                                                
                                                                        
+                                                                               
                                                                                
                                                                        
+ Related: bug #2130273 (preserving the files, Fix Released 1:26.04.5),         
                                                                                
                                                                        
+ bug #2086506, bug #2171068 (aborting an upgrade deletes the same files),      
                                                                                
                                                                        
+ bug #2167656 (nothing warns that packages lost their update source).          
                                                                                
                                                                        
+ 
+ 
+ [ Original report ]
+ 
  Related: #2130273 (Fix Released 26.04.5), #2086506, python-apt #2070432
  (Won't Fix)
  
  Impact
  After 24.04 -> 26.04, every repository added with the documented "deb
  [signed-by=...]" syntax ends up with no .sources file and no enabled source. 
On
- this machine, that included a browser, Signal and OpenVPN3. They received no  
                                         
- updates since release upgrade while apt, update-notifier and                  
                    
- unattended-upgrades all reported the system as current. A browser going   
- unpatched with no warning is a security issue.                           
-               
+ this machine, that included a browser, Signal and OpenVPN3. They received no
+ updates since release upgrade while apt, update-notifier and
+ unattended-upgrades all reported the system as current. A browser going
+ unpatched with no warning is a security issue.
  
  Cause
  #2130273 fixed the upgrader *deleting* these files; they are now kept as
  *.list.disabled. But they are still never migrated: python-apt's legacy parser
  rejects signed-by= (#2070432, closed Won't Fix because "deb822 migration will
  handle it") and the migration gives up on anything python-apt marks invalid.
  The two decisions together leave the syntax every vendor documents 
unsupported.
  
  Reproduce
  1. On 24.04: deb 
[signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] 
https://pkgs.tailscale.com/stable/ubuntu noble main
  2. do-release-upgrade to 26.04.
  Expected: tailscale.sources with Signed-By: (Enabled: no is fine, it is 
visible).
  Actual:   tailscale.list.disabled, no .sources file, apt-cache policy shows 
no candidate.
  
  /var/log/dist-upgrade/main.log:
-   DEBUG Could not migrate deb 
[signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] 
https://pkgs.tailscale.com/stable/ubuntu noble main from 
/etc/apt/sources.list.d/tailscale.list, disabling instead.
+   DEBUG Could not migrate deb 
[signed-by=/usr/share/keyrings/tailscale-archive-keyring.gpg] 
https://pkgs.tailscale.com/stable/ubuntu noble main from 
/etc/apt/sources.list.d/tailscale.list, disabling instead.
  
  Suggested fix
  In migrateToDeb822Sources, before giving up on an invalid entry, extract the
  [options] with a regex; signed-by= maps directly to Signed-By:, which the 
deb822
  writer already emits. python-apt's legacy parser stays untouched.
  
  ubuntu-release-upgrader 26.04.22 (upgrade run), python3-apt
  3.1.0ubuntu1.1

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2167655

Title:
  Third-party repos using [signed-by=] are left as .list.disabled after
  upgrade; packages silently stop receiving security updates

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-release-upgrader/+bug/2167655/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to