Closed krono closed 3 years ago
Manually doing
setcap cap_sys_admin,cap_mknod+pe "$(command -v enroot-aufs2ovlfs)"
setcap cap_sys_admin+pe "$(command -v enroot-mksquashovlfs)"
helps tho
Weird, did it work at any point after you installed things for the first time?
Also, does it work if you reinstall the +caps
package?
Yes, it worked with the 3.2.0 RPMs I produced from the specfile before merging ppc64.
I filed the issue right after reinstalling the +caps
package.
I see that effect on two machines...
Note that I dnf update
d the packages… maybe a weird interplay of %preun
and %post
scripts?
Might be yeah, nothing changed with 3.3.
I will try to see if I can repro with dnf
, I usually test with yum
I just got into a similar situation on Ubuntu, and for me the issue was that I previously did a make install
of enroot from sources, so enroot+caps
applied the setcap
commands to those binaries (in /usr/local/bin
) instead of the binaries installed through the enroot
package.
Perhaps this is what happened to you too.
I don't think so. I have 2 machines where that happened and one of them never saw the source code just the RPMs…
Any update on this one? I wasn't able to reproduce (even with dnf
)
Lets close then. I'll report when it happens again…
Something is fishy in the kingdom of Denmark.
it is definitively running the scriplet, but to no avail.
(But seeing that rpm
has a setcaps
option, maybe there's a part of rpm or spec that is used for this kind of things…)
Can you try the following patch, see if it does the trick (including removing the caps on uninstall):
diff --git a/pkg/rpm/SPECS/enroot.spec b/pkg/rpm/SPECS/enroot.spec
index c9d5693..b518f63 100644
--- a/pkg/rpm/SPECS/enroot.spec
+++ b/pkg/rpm/SPECS/enroot.spec
@@ -43,13 +43,9 @@ unprivileged sandboxes.
This dependency package grants extra capabilities to unprivileged users which
allows them to import and convert container images directly.
-%post -n %{name}+caps
-setcap cap_sys_admin+pe "$(command -v enroot-mksquashovlfs)"
-setcap cap_sys_admin,cap_mknod+pe "$(command -v enroot-aufs2ovlfs)"
-%preun -n %{name}+caps
-setcap cap_sys_admin-pe "$(command -v enroot-mksquashovlfs)"
-setcap cap_sys_admin,cap_mknod-pe "$(command -v enroot-aufs2ovlfs)"
%files -n %{name}+caps
+%caps(= cap_sys_admin+ep) %{_bindir}/enroot-mksquashovlfs
+%caps(= cap_sys_admin+ep cap_mknod+ep) %{_bindir}/enroot-aufs2ovlfs
%build
%make_build prefix=%{_prefix} exec_prefix=%{_exec_prefix} libdir=%{_libdir} datarootdir=%{_datarootdir}
This did not work:
# dnf install --rpmverbosity=debug dist/ppc64le/enroot*-3.3.1-1.el8.ppc64le.rpm
dio: 16 reads, 135608 total bytes in 0.002284 secs
Installing : enroot+caps-3.3.1-1.el8.ppc64le 2/3
D: adding "enroot" to Name index.
D: adding 39 entries to Basenames index.
D: adding "Unspecified" to Group index.
D: adding 23 entries to Requirename index.
D: adding 3 entries to Providename index.
D: adding 14 entries to Dirnames index.
D: adding 1 entries to Installtid index.
D: adding 1 entries to Sigmd5 index.
D: adding "d5bd4fe50e62c2673ccf5d597a0ede50647eb551" to Sha1header index.
D: ========== +++ enroot+caps-3.3.1-1.el8 ppc64le-linux 0x0
D: enroot+caps-3.3.1-1.el8.ppc64le: Header SHA256 digest: OK
D: enroot+caps-3.3.1-1.el8.ppc64le: Header SHA1 digest: OK
D: install: enroot+caps-3.3.1-1.el8.ppc64le has 2 files
D: Plugin: calling hook psm_pre in selinux plugin
D: skip 100755 1 ( 0, 0) 67600 /usr/bin/enroot-aufs2ovlfs;614c2664
D: skip 100755 1 ( 0, 0) 67600 /usr/bin/enroot-mksquashovlfs;614c2664
# getcap /bin/enroot-*
# "empty"
however, afterwards doing rpm --setcaps
interestingly does work:
# rpm --setcaps enroot+caps
# getcap /bin/enroot-*
/bin/enroot-aufs2ovlfs = cap_sys_admin,cap_mknod+ep
/bin/enroot-mksquashovlfs = cap_sys_admin+ep
weird
Not sure what we're missing, it does work on my Centos 7 system with yum
Maybe you have nocaps
set in dnf.conf
?
Hey.
Maybe you have nocaps set in dnf.conf? not to my knowledge :/
# cat /etc/dnf/dnf.conf
[main]
gpgcheck=1
installonly_limit=6
clean_requirements_on_remove=True
best=True
skip_if_unavailable=False
I tried yum on RHEL8 and no change.
The debugoutput suggests there is nothing being done, in the first place…
D: ========== +++ enroot+caps-3.3.1-1.el8 ppc64le-linux 0x0
D: enroot+caps-3.3.1-1.el8.ppc64le: Header SHA256 digest: OK
D: enroot+caps-3.3.1-1.el8.ppc64le: Header SHA1 digest: OK
D: install: enroot+caps-3.3.1-1.el8.ppc64le has 2 files
D: Plugin: calling hook psm_pre in selinux plugin
D: skip 100755 1 ( 0, 0) 67600 /usr/bin/enroot-aufs2ovlfs;614c2b8b
D: skip 100755 1 ( 0, 0) 67600 /usr/bin/enroot-mksquashovlfs;614c2b8b
Ok, this one worked for me:
diff --git a/pkg/rpm/SPECS/enroot.spec b/pkg/rpm/SPECS/enroot.spec
index c9d5693..8c79ed2 100644
--- a/pkg/rpm/SPECS/enroot.spec
+++ b/pkg/rpm/SPECS/enroot.spec
@@ -43,13 +43,21 @@ unprivileged sandboxes.
This dependency package grants extra capabilities to unprivileged users which
allows them to import and convert container images directly.
+%files -n %{name}+caps
+%caps(= cap_sys_admin+ep) %{_bindir}/enroot-mksquashovlfs
+%caps(= cap_sys_admin+ep cap_mknod+ep) %{_bindir}/enroot-aufs2ovlfs
%post -n %{name}+caps
-setcap cap_sys_admin+pe "$(command -v enroot-mksquashovlfs)"
-setcap cap_sys_admin,cap_mknod+pe "$(command -v enroot-aufs2ovlfs)"
+if [ -x /usr/sbin/setcap ]; then
+ /bin/chmod 0755 %{_bindir}/enroot-mksquashovlfs
+ /bin/chmod 0755 %{_bindir}/enroot-aufs2ovlfs
+ /usr/sbin/setcap cap_sys_admin+ep %{_bindir}/enroot-mksquashovlfs
+ /usr/sbin/setcap cap_sys_admin,cap_mknod+pe %{_bindir}/enroot-aufs2ovlfs
+fi
%preun -n %{name}+caps
-setcap cap_sys_admin-pe "$(command -v enroot-mksquashovlfs)"
-setcap cap_sys_admin,cap_mknod-pe "$(command -v enroot-aufs2ovlfs)"
-%files -n %{name}+caps
+if [ -x /usr/sbin/setcap ]; then
+ /usr/sbin/setcap cap_sys_admin-ep %{_bindir}/enroot-mksquashovlfs
+ /usr/sbin/setcap cap_sys_admin,cap_mknod-pe %{_bindir}/enroot-aufs2ovlfs
+fi
%build
%make_build prefix=%{_prefix} exec_prefix=%{_exec_prefix} libdir=%{_libdir} datarootdir=%{_datarootdir}
What about just doing
-setcap cap_sys_admin+pe "$(command -v enroot-mksquashovlfs)"
-setcap cap_sys_admin,cap_mknod+pe "$(command -v enroot-aufs2ovlfs)"
+/usr/sbin/setcap cap_sys_admin+ep %{_bindir}/enroot-mksquashovlfs
+/usr/sbin/setcap cap_sys_admin,cap_mknod+pe %{_bindir}/enroot-aufs2ovlfs
Is it enough to make it work?
You can also try to add %attr(0755,root,root)
in front of each %caps
instead, maybe it won't skip it after that
I'll try. In fact, I just copy-pasted from https://github.com/schweikert/fping/blob/develop/contrib/fping.spec#L55 to see if it works. I don't think the chmod is necessary in the first place… But I try first
Yes, this seems to be enough.
Personally, I'd probably also include the %caps
for good measure, but the variant with only /usr/sbin/setcap
works.
And we re open :(
I am at loss here
Workaround that seems to stick: re-install instead of update.
I presume that running the post-scriplet of uninstall of OLD after the install-scriplet of NEW is the culprit
Running scriptlet: enroot+caps-3.4.0-1.el7.ppc64le 2/4
Running scriptlet: enroot+caps-3.3.0-1.el7.ppc64le 3/4
Cleanup : enroot+caps-3.3.0-1.el7.ppc64le 3/4
Cleanup : enroot-3.3.0-1.el7.ppc64le 4/4
Running scriptlet: enroot-3.3.0-1.el7.ppc64le 4/4
I have a hunch that %posttrans
instead of %post
would help the ordering…
Yeah, most likely. I will release new packages once it's fixed
I'm running into caps issues with 3.3.0 on ppc64
excerpt: