Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error with DEB822 style APT sources using embedded keys #707

Open
rocha opened this issue Feb 10, 2025 · 4 comments
Open

Error with DEB822 style APT sources using embedded keys #707

rocha opened this issue Feb 10, 2025 · 4 comments

Comments

@rocha
Copy link

rocha commented Feb 10, 2025

I am using Ubuntu 24.04, which supports DEB822 style format APT sources. Some of my sources use the option Signed-By to embed GPG public keys, for example:

Types: some-ppa
URIs: https://some.ppa.org
Suites: stable
Components: main 
Signed-By:
 -----BEGIN PGP PUBLIC KEY BLOCK-----
 .
 mDME...
 -----END PGP PUBLIC KEY BLOCK-----

Unfortunately, this causes umake to throw an error on launch.

❯ umake                                        
Traceback (most recent call last):             
  File "/snap/ubuntu-make/1010/bin/umake", line 8, in <module>                                 
    sys.exit(main())                           
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/__init__.py", line 152, in main                                                                                               
    load_frameworks(force_loading=should_load_all_frameworks(sys.argv))                        
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/__init__.py", line 440, in load_frameworks                                                                         
    load_module(module_name, main_category, force_loading)                                     
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/__init__.py", line 365, in load_module                                                                             
    if FrameworkClass(category=current_category, force_loading=force_loading) is not None:                                                                                                     
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/android.py", line 182, in __init__                                                                                 
    super().__init__(name="Android NDK", description=_("Android NDK"),                         
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/baseinstaller.py", line 78, in __init__                                                                            
    super().__init__(*args, **kwargs)          
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/__init__.py", line 177, in __init__                                                                                
    self.need_root_access = not RequirementsHandler().is_bucket_installed(self.packages_requirements)                                                                                          
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/tools.py", line 78, in __call__                                                                                               
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)                      
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/network/requirements_handler.py", line 49, in __init__                                                                        
    self.cache = apt.Cache()                   
  File "/snap/ubuntu-make/1010/usr/lib/python3/dist-packages/apt/cache.py", line 170, in __init__                                                                                              
    self.open(progress)                        
  File "/snap/ubuntu-make/1010/usr/lib/python3/dist-packages/apt/cache.py", line 232, in open                                                                                                  
    self._cache = apt_pkg.Cache(progress)      
apt_pkg.Error: E:Invalid value set for option Signed-By regarding source https://some.ppa.org main (not a fingerprint), E:The list of sources could not be read.

The problem is fixed is the key is taken to a separate file and referenced in the Signed-By option of the corresponding APT source.

@rocha rocha changed the title Error with deb822 style APT sources using embedded keys Error with DEB822 style APT sources using embedded keys Feb 10, 2025
@LyzardKing
Copy link
Collaborator

Strange.. I can't replicate the issue on Ubuntu 14.10.

Could you tell me more about your system?
Do you get that error every time you call umake or does for example umake --help work?

@rocha
Copy link
Author

rocha commented Feb 11, 2025

Thanks for checking @LyzardKing

Here is my system information:

❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 24.04.1 LTS
Release:        24.04
Codename:       noble
 
❯ uname -a
Linux hostname 6.8.0-52-generic #53-Ubuntu SMP PREEMPT_DYNAMIC Sat Jan 11 00:06:25 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux

❯ umake --version
22.10+snap1010

The error is at the start of the command, umake --help doesn't work.

Note that it works for .sources files in /etc/apt/sources.lists.d/ in which the Signed-By option points to a key file instead of embedding the ASCII key. For example, Signed-By: /etc/apt/keyrings/ppa-key.gpg works ok.

You can try getting a .sources file with an embedded key adding the Ubuntu Git Maintainers PPA:

❯ sudo add-apt-repository ppa:git-core/ppa
❯ sudo apt update
❯ umake
Traceback (most recent call last):                                                                                                                                  
  File "/snap/ubuntu-make/1010/bin/umake", line 8, in <module>                                                                                                      
    sys.exit(main())                                                                                                                                                
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/__init__.py", line 152, in main
    load_frameworks(force_loading=should_load_all_frameworks(sys.argv))
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/__init__.py", line 440, in load_frameworks
    load_module(module_name, main_category, force_loading)
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/__init__.py", line 365, in load_module
    if FrameworkClass(category=current_category, force_loading=force_loading) is not None:
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/android.py", line 182, in __init__
    super().__init__(name="Android NDK", description=_("Android NDK"),
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/baseinstaller.py", line 78, in __init__
    super().__init__(*args, **kwargs)
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/frameworks/__init__.py", line 177, in __init__
    self.need_root_access = not RequirementsHandler().is_bucket_installed(self.packages_requirements)
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/tools.py", line 78, in __call__
    cls._instances[cls] = super(Singleton, cls).__call__(*args, **kwargs)
  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/network/requirements_handler.py", line 49, in __init__
    self.cache = apt.Cache()
  File "/snap/ubuntu-make/1010/usr/lib/python3/dist-packages/apt/cache.py", line 170, in __init__
    self.open(progress)
  File "/snap/ubuntu-make/1010/usr/lib/python3/dist-packages/apt/cache.py", line 232, in open
    self._cache = apt_pkg.Cache(progress) 
apt_pkg.Error: E:Invalid value set for option Signed-By regarding source https://ppa.launchpadcontent.net/git-core/ppa/ubuntu/ noble (not a fingerprint), E:The list of sources could not be read.

@LyzardKing
Copy link
Collaborator

@rocha Does a normal apt update work?
It seems from the log that the issue is with other repos.

ubuntu-make doesn't add anything through apt. It's just used to install dependencies

@rocha
Copy link
Author

rocha commented Feb 11, 2025

Thanks @LyzardKing

Yes, my normal apt update, install, etc. works well.

In the trace, there is a call to an apt python library (python-apt). Maybe this library is a bit old or/and doesn't know how to deal with the embedded keys? The class RequirementsHandler seems to make heavy use of the apt cache.

  File "/snap/ubuntu-make/1010/lib/python3.8/site-packages/umake/network/requirements_handler.py", line 49, in __init__
    self.cache = apt.Cache()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants