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

Handle permissions better #76

Open
supakeen opened this issue Jan 19, 2025 · 0 comments
Open

Handle permissions better #76

supakeen opened this issue Jan 19, 2025 · 0 comments
Labels
🪄 enhancement New feature or request

Comments

@supakeen
Copy link
Member

Image Builder requires root permissions for many tasks (but not all). This is due to needing root permissions to do any disk mounting.

However, image-builder-cli always needs root permissions due to trying to create a directory in /var/cache.

If we're going down that route then perhaps we should add a geteuid() check and exit earlier. Right now it takes (on my system) 10-15 seconds before we get to the point of error:

user@muja ~ € image-builder build iot-commit
No distro name specified, selecting "fedora-41" based on host, use --distro to overrideWARN[0000] Failed to load consumer certs: no consumer key found 
Traceback (most recent call last):
  File "/usr/bin/osbuild", line 33, in <module>
    sys.exit(load_entry_point('osbuild==138', 'console_scripts', 'osbuild')())
             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/osbuild/main_cli.py", line 171, in osbuild_cli
    with ObjectStore(args.store) as object_store:
         ~~~~~~~~~~~^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/osbuild/objectstore.py", line 325, in __init__
    os.makedirs(self.store, exist_ok=True)
    ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen os>", line 217, in makedirs
  File "<frozen os>", line 227, in makedirs
PermissionError: [Errno 13] Permission denied: '/var/cache/image-builder'
error: running osbuild failed: exit status 1

Alternatively, we might want to tag the various image types with if they require root permissions and handle the cache differently.

@supakeen supakeen added the 🪄 enhancement New feature or request label Jan 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🪄 enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant