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

Fix invoked_as_root initialization #2730

Merged
merged 2 commits into from
May 29, 2024
Merged

Conversation

DaanDeMeyer
Copy link
Contributor

No description provided.

mkosi/qemu.py Fixed Show fixed Hide fixed
Let's make sure the systemd-journal-remote process we start can always
read the configuration, even if it's running as a less privileged user.
mkosi/qemu.py Dismissed Show dismissed Hide dismissed
@DaanDeMeyer DaanDeMeyer merged commit 8770a4e into systemd:main May 29, 2024
24 of 32 checks passed
@DaanDeMeyer DaanDeMeyer deleted the fix branch May 29, 2024 12:10
@marc-hb
Copy link

marc-hb commented Dec 20, 2024

Reverting commit 17010a2 "Fix invoked_as_root initialization" on top of v24.3 fixes the following error for me. Any clue?

in directory: kernel/qbuild
running: sudo -E mkosi -i -f --autologin build
‣ kernel/qbuild/mkosi.cache/fedora~40~x86-64.cache does not exist, not reusing cached images
‣ Syncing package manager metadata for default image
No matches found for the following enable plugin patterns: versionlock
[Errno 13] Permission denied: '/var/cache/dnf/metadata_lock.pid'
‣ "dnf --assumeyes --best --releasever=40 --installroot=/buildroot --setopt=keepcache=1 --setopt=logdir=/var/log --setopt=cachedir=/var/cache/dnf --setopt=persistdir=/var/lib/dnf --setopt=install_weak_deps=0 --setopt=check_config_file_age=0 '--disableplugin=*' --enableplugin builddep --enableplugin versionlock --config=/etc/dnf/dnf.conf --setopt=reposdir=/etc/yum.repos.d --setopt=varsdir=/etc/dnf/vars --setopt=proxy=http://proxy-dmz.intel.com:912 --setopt=proxy_sslcacert=/proxy.cacert makecache" returned non-zero exit code 1.

After the revert everything works fine: the image boots in QEMU etc.

I found this commit with git bisect (and building from scratch every time)

Something must have changed in my DNF configuration recently because that failure is recent...!? v24.3 (and many others) used to work.

Verbose --debug logs:

‣ + rpm --eval '%{__plugindir}'
‣ kernel/qbuild/mkosi.cache/fedora~40~x86-64.cache does not exist, not reusing cached images
‣ Syncing package manager metadata for default image
‣ Acquiring lock on /var/cache/mkosi/fedora~40~x86-64/cache/dnf
‣ Acquired lock on /var/cache/mkosi/fedora~40~x86-64/cache/dnf
‣ Acquiring lock on /var/cache/mkosi/fedora~40~x86-64/lib/dnf
‣ Acquired lock on /var/cache/mkosi/fedora~40~x86-64/lib/dnf
‣ + dnf --assumeyes --best --releasever=40 --installroot=/buildroot --setopt=keepcache=1 --setopt=logdir=/var/log --setopt=cachedir=/var/cache/dnf --setopt=persistdir=/var/lib/dnf --setopt=install_weak_deps=0 --setopt=check_config_file_age=0 '--disableplugin=*' --enableplugin builddep --enableplugin versionlock --setopt=debuglevel=10 --config=/etc/dnf/dnf.conf --setopt=reposdir=/etc/yum.repos.d --setopt=varsdir=/etc/dnf/vars --setopt=proxy=http://proxy-dmz.intel.com:912 --setopt=proxy_sslcacert=/proxy.cacert makecache
timer: config: 0 ms
No matches found for the following enable plugin patterns: versionlock
Loaded plugins: builddep
DNF version: 4.22.0
Command: dnf --assumeyes --best --releasever=40 --installroot=/buildroot --setopt=keepcache=1 --setopt=logdir=/var/log --setopt=cachedir=/var/cache/dnf --setopt=persistdir=/var/lib/dnf --setopt=install_weak_deps=0 --setopt=check_config_file_age=0 --disableplugin=* --enableplugin builddep --enableplugin versionlock --setopt=debuglevel=10 --config=/etc/dnf/dnf.conf --setopt=reposdir=/etc/yum.repos.d --setopt=varsdir=/etc/dnf/vars --setopt=proxy=http://proxy-dmz.intel.com:912 --setopt=proxy_sslcacert=/proxy.cacert makecache
Installroot: /buildroot
Releasever: 40
cachedir: /buildroot/var/cache/dnf
Base command: makecache
Extra commands: ['--assumeyes', '--best', '--releasever=40', '--installroot=/buildroot', '--setopt=keepcache=1', '--setopt=logdir=/var/log', '--setopt=cachedir=/var/cache/dnf', '--setopt=persistdir=/var/lib/dnf', '--setopt=install_weak_deps=0', '--setopt=check_config_file_age=0', '--disableplugin=*', '--enableplugin', 'builddep', '--enableplugin', 'versionlock', '--setopt=debuglevel=10', '--config=/etc/dnf/dnf.conf', '--setopt=reposdir=/etc/yum.repos.d', '--setopt=varsdir=/etc/dnf/vars', '--setopt=proxy=http://proxy-dmz.intel.com:912', '--setopt=proxy_sslcacert=/proxy.cacert', 'makecache']
Making cache files for all metadata files.
fedora: has expired and will be refreshed.
updates: has expired and will be refreshed.

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/dnf/cli/main.py", line 122, in cli_run
    cli.run()
  File "/usr/lib/python3.12/site-packages/dnf/cli/cli.py", line 1067, in run
    return self.command.run()
           ^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/cli/commands/makecache.py", line 50, in run
    return self.base.update_cache(timer)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/base.py", line 378, in update_cache
    self.fill_sack(load_system_repo=False, load_available_repos=True)  # performs the md sync
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/base.py", line 389, in fill_sack
    with lock:
         ^^^^
  File "/usr/lib/python3.12/site-packages/dnf/lock.py", line 131, in __enter__
    pid = self._try_lock(my_pid)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/dnf/lock.py", line 81, in _try_lock
    fd = os.open(self.target, os.O_CREAT | os.O_RDWR, 0o644)
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
PermissionError: [Errno 13] Permission denied: '/var/cache/dnf/metadata_lock.pid'
[Errno 13] Permission denied: '/var/cache/dnf/metadata_lock.pid'

</details>

@marc-hb
Copy link

marc-hb commented Dec 20, 2024

The problem goes way after giant, v25 commit b3a3e7e ("Introduce mkosi-sandbox and stop using subuids for image builds") which rewrites everything. I don't think v25 is released yet.

This means v23.1 and v24.x are failing. v23 was before 17010a2 and works fine.

@DaanDeMeyer
Copy link
Contributor Author

Yeah we'll release v25 soon which drastically changes all of this. Apologies for the churn, I've been figuring most of this out on the go to find out what works and what doesn't. We try to keep breaking changes to a minimum but don't always succeed

@marc-hb
Copy link

marc-hb commented Dec 20, 2024

Should I copy this report to a new, "wontfix; upgrade to future v25" bug for better visibility? This is fatal failure of the latest released version.

Something must have changed in my DNF configuration recently because that failure is recent...!? v24.3 (and many others) used to work.

I found this on my system. The timestamps look a bit strange; the two files seem to have a different understanding of the word "upgraded"!


/var/log/dnf.rpm.log:2024-09-19T15:41:25-0700 SUBDEBUG Upgraded: dnf-4.21.0-1.fc40.noarch
/var/log/dnf.rpm.log:2024-09-19T15:41:26-0700 SUBDEBUG Upgraded: python3-dnf-4.21.0-1.fc40.noarch

/var/log/dnf.log.3:2024-09-19T15:43:03-0700 DEBUG Upgraded: dnf-4.21.1-1.fc40.noarch
/var/log/dnf.log.3:2024-09-19T15:43:03-0700 DEBUG Upgraded: python3-dnf-4.21.1-1.fc40.noarch

/var/log/dnf.rpm.log:2024-12-16T16:37:37-0800 SUBDEBUG Upgraded: dnf-4.21.1-1.fc40.noarch
/var/log/dnf.rpm.log:2024-12-16T16:37:37-0800 SUBDEBUG Upgraded: python3-dnf-4.21.1-1.fc40.noarch

/var/log/dnf.log:2024-12-16T16:38:24-0800 DEBUG Upgraded: dnf-4.22.0-1.fc40.noarch
/var/log/dnf.log:2024-12-16T16:38:24-0800 DEBUG Upgraded: python3-dnf-4.22.0-1.fc40.noarch

Also:

/var/log/dnf.rpm.log:2024-12-16T16:37:38-0800 SUBDEBUG Upgraded: python3-libdnf-0.73.3-1.fc40.x86_64
/var/log/dnf.rpm.log:2024-12-16T16:37:38-0800 SUBDEBUG Upgraded: libdnf-0.73.3-1.fc40.x86_64

/var/log/dnf.log:2024-12-16T16:35:30-0800 DEBUG ---> Package libdnf.x86_64 0.73.3-1.fc40 will be upgraded
/var/log/dnf.log:2024-12-16T16:35:30-0800 DEBUG ---> Package python3-libdnf.x86_64 0.73.3-1.fc40 will be upgraded
/var/log/dnf.log:2024-12-16T16:38:24-0800 DEBUG Upgraded: libdnf-0.73.4-1.fc40.x86_64
/var/log/dnf.log:2024-12-16T16:38:24-0800 DEBUG Upgraded: python3-libdnf-0.73.4-1.fc40.x86_64

I tried to downgrade to dnf 4.19.0 and libdnf 0.73.0 which are still available in dnf (the others are not) but mkosi still fails the same.

@marc-hb
Copy link

marc-hb commented Dec 21, 2024

Should I copy this report to a new, "wontfix; upgrade to future v25" bug for better visibility? This is fatal failure of the latest released version.

Done:

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

Successfully merging this pull request may close these issues.

4 participants