Bug 1740545

Summary: Group mock is not created in container
Product: [Fedora] Fedora Reporter: Lukas Slebodnik <lslebodn>
Component: mock-core-configsAssignee: Miroslav Suchý <msuchy>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: msuchy, ngompa13, petersen, philip.wyett, w, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: mock-core-configs-31.2-1.fc29 mock-core-configs-31.2-1.fc30 mock-core-configs-31.2-1.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-08-19 09:11:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Lukas Slebodnik 2019-08-13 08:57:26 UTC
Description of problem:
The recent update of mock-core-configs switch to systemd-sysusers for creating users. However it does not work in container without systemd (which is huge majority especially at built time.


Version-Release number of selected component (if applicable):
sh$ rpm -q mock-core-configs
mock-core-configs-30.5-1.fc31.noarch

How reproducible:
Deterministic

Steps to Reproduce:
1. docker run -ti --rm docker.io/fedora:rawhide
# run rest of commands in container.
2. dnf install --setopt=install_weak_deps=False -y mock
3. getent group mock

Actual results:

[root@b47d695a1c20 /]# dnf install --setopt=install_weak_deps=False -y mock-core                                                                                                           
Fedora - Modular Rawhide - Developmental packages for the next Fedora release                                                                                                              
Fedora - Rawhide - Developmental packages for the next Fedora release                                                                                                                      
Dependencies resolved.                                                                                                                                                                     
================================================================================                                                                                                           
 Package                     Architecture Version           Repository     Size                                                                                                            
================================================================================                                                                                                           
Installing:                                                                                                                                                                                
 mock-core-configs           noarch       30.5-1.fc31       rawhide        41 k                                                                                                            
Installing dependencies:                                                                                                                                                                   
 distribution-gpg-keys       noarch       1.32-2.fc31       rawhide       197 k                                                                                                            
                                                                                                                                                                                           
Transaction Summary                                                                                                                                                                        
================================================================================                                                                                                           
Install  2 Packages                                                                                                                                                                        
                                                                                                                                                                                           
Total download size: 237 k                                                                                                                                                                 
Installed size: 547 k                                                                                                                                                                      
Downloading Packages:                                                                                                                                                                      
(1/2): mock-core-configs-30.5-1.fc31.noarch.rpm 1.0 MB/s |  41 kB     00:00                                                                                                                
(2/2): distribution-gpg-keys-1.32-2.fc31.noarch 4.5 MB/s | 197 kB     00:00                                                                                                                
--------------------------------------------------------------------------------                                                                                                           
Total                                           284 kB/s | 237 kB     00:00                                                                                                                
Running transaction check                                                                                                                                                                  
Transaction check succeeded.                                                                                                                                                               
Running transaction test                                                                                                                                                                   
Transaction test succeeded.                                                                                                                                                                
Running transaction                                                                                                                                                                        
  Preparing        :                                                        1/1                                                                                                            
  Installing       : distribution-gpg-keys-1.32-2.fc31.noarch               1/2                                                                                                            
  Running scriptlet: mock-core-configs-30.5-1.fc31.noarch                   2/2                                                                                                            
  Installing       : mock-core-configs-30.5-1.fc31.noarch                   2/2                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root                                                                                                                                            
warning: group mock does not exist - using root

//snip

warning: group mock does not exist - using root
warning: group mock does not exist - using root
warning: group mock does not exist - using root

  Running scriptlet: mock-core-configs-30.5-1.fc31.noarch                   2/2 
  Verifying        : distribution-gpg-keys-1.32-2.fc31.noarch               1/2 
  Verifying        : mock-core-configs-30.5-1.fc31.noarch                   2/2 

Installed:
  mock-core-configs-30.5-1.fc31.noarch distribution-gpg-keys-1.32-2.fc31.noarch

Complete!
[root@b47d695a1c20 /]# getent group mock
[root@b47d695a1c20 /]# echo $?
2
Expected results:
[root@b47d695a1c20 /]# dnf install --setopt=install_weak_deps=False -y mock-core                                                                                                           
Fedora - Modular Rawhide - Developmental packages for the next Fedora release                                                                                                              
Fedora - Rawhide - Developmental packages for the next Fedora release                                                                                                                      
Dependencies resolved.                                                                                                                                                                     
================================================================================                                                                                                           
 Package                     Architecture Version           Repository     Size                                                                                                            
================================================================================                                                                                                           
Installing:                                                                                                                                                                                
 mock-core-configs           noarch       30.5-1.fc31       rawhide        41 k                                                                                                            
Installing dependencies:                                                                                                                                                                   
 distribution-gpg-keys       noarch       1.32-2.fc31       rawhide       197 k                                                                                                            
                                                                                                                                                                                           
Transaction Summary                                                                                                                                                                        
================================================================================                                                                                                           
Install  2 Packages                                                                                                                                                                        
                                                                                                                                                                                           
Total download size: 237 k                                                                                                                                                                 
Installed size: 547 k                                                                                                                                                                      
Downloading Packages:                                                                                                                                                                      
(1/2): mock-core-configs-30.5-1.fc31.noarch.rpm 1.0 MB/s |  41 kB     00:00                                                                                                                
(2/2): distribution-gpg-keys-1.32-2.fc31.noarch 4.5 MB/s | 197 kB     00:00                                                                                                                
--------------------------------------------------------------------------------                                                                                                           
Total                                           284 kB/s | 237 kB     00:00                                                                                                                
Running transaction check                                                                                                                                                                  
Transaction check succeeded.                                                                                                                                                               
Running transaction test                                                                                                                                                                   
Transaction test succeeded.                                                                                                                                                                
Running transaction                                                                                                                                                                        
  Preparing        :                                                        1/1                                                                                                            
  Installing       : distribution-gpg-keys-1.32-2.fc31.noarch               1/2                                                                                                            
  Running scriptlet: mock-core-configs-30.5-1.fc31.noarch                   2/2                                                                                                            
  Installing       : mock-core-configs-30.5-1.fc31.noarch                   2/2                                                                                                            
  Running scriptlet: mock-core-configs-30.5-1.fc31.noarch                   2/2 
  Verifying        : distribution-gpg-keys-1.32-2.fc31.noarch               1/2 
  Verifying        : mock-core-configs-30.5-1.fc31.noarch                   2/2 

Installed:
  mock-core-configs-30.5-1.fc31.noarch distribution-gpg-keys-1.32-2.fc31.noarch

Complete!
[root@b47d695a1c20 /]# getent group mock
mock:x:135:
[root@b47d695a1c20 /]# echo $?
0

Additional info:

Comment 1 Lukas Slebodnik 2019-08-13 09:12:07 UTC
The macro  %sysusers_create_package expect two parameters
https://src.fedoraproject.org/rpms/mock-core-configs/blob/master/f/mock-core-configs.spec#_85

Definition:
-13: sysusers_create_package    
%{expand:%%{?!__systemd_twoargs_%#:%%{error:This macro requires two arguments}}} 
systemd-sysusers --replace=%_sysusersdir/%1.conf - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : 
%(cat %2) 
SYSTEMD_INLINE_EOF 
%{nil}

Result in scriptlet:
systemd-sysusers --replace=/usr/lib/sysusers.d/mock.conf - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : 
 
SYSTEMD_INLINE_EOF

It is obvious that "%(cat %2)" did not work. And I am not sure whether replacing mock.conf with %{_sysusersdir}/mock.conf
would help because it is "%pre" scriptlet and file has not been installed yet. But I did not try

[root@b47d695a1c20 /]# rpm --eval "%sysusers_create_package mock mock.conf"
cat: mock.conf: No such file or directory

 
systemd-sysusers --replace=/usr/lib/sysusers.d/mock.conf - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : 
 
SYSTEMD_INLINE_EOF 



vs.


[root@b47d695a1c20 /]# rpm --eval "%sysusers_create_package mock %{_sysusersdir}/mock.conf"

 
systemd-sysusers --replace=/usr/lib/sysusers.d/mock.conf - <<SYSTEMD_INLINE_EOF >/dev/null 2>&1 || : 
#Type Name     ID             GECOS                 Home directory Shell
g     mock     135            - 
SYSTEMD_INLINE_EOF 

[root@b47d695a1c20 /]#

Comment 2 Zbigniew Jędrzejewski-Szmek 2019-08-16 15:24:00 UTC
In the macros.systemd file there is the following example:
# Example:
#   Source1: %{name}-sysusers.conf
#   ...
#   %install
#   install -D %SOURCE1 %{buildroot}%{_sysusersdir}/%{name}.conf
#   %pre
#   %sysusers_create_package %{name} %SOURCE1
#   %files
#   %{_sysusersdir}/%{name}.conf

That works for the case where the sysusers file is in dist-git. If it part of the
tarball, this doesn't work because the file is not available when the spec file is
evaluated. I don't have a nice solution for this atm. Maybe simply copy the file to
dist-git so that it's available early enough?

Comment 3 Miroslav Suchý 2019-08-16 20:22:12 UTC
Hmm, while it is technically possible, I do not think it is feasible. Especially if we want to replace all those groupadd and useradd pre scriptlets.
Normal
  getent group mock > /dev/null || groupadd -f -g %mockgid -r mock
sounds better to me.
If the file really have to be in dist-git, then I would highly recommend some common name. E.g., sysusers.conf so the tooling working with dist-git can work with that.

Comment 4 Zbigniew Jędrzejewski-Szmek 2019-08-17 13:23:21 UTC
Yes, I don't think sysusers provides a lot of benefit right now except for no dependency on shadow-utils. But
that only matters in specific circumstances. Sorry, we have the sysusers story nailed down yet.

Comment 5 Miroslav Suchý 2019-08-19 09:11:03 UTC
OK. I reverted the usage of sysuser back to groupadd.

Commit
* 8cc7ad8 (HEAD -> devel) revert sysusers setting [RHBZ#1740545]

Comment 6 Neal Gompa 2019-08-25 01:52:35 UTC
@Mirek, can you please backport this *now* to Fedora? This bug broke the CI for KIWI[1], and every attempt I've made to fix it seems to be failing...

[1]: https://github.com/OSInside/kiwi

Comment 7 Miroslav Suchý 2019-08-26 12:33:29 UTC
*** Bug 1745506 has been marked as a duplicate of this bug. ***

Comment 8 Miroslav Suchý 2019-08-26 12:54:48 UTC
@Neal it is coming...

Comment 9 Fedora Update System 2019-08-26 12:56:24 UTC
FEDORA-EPEL-2019-8d0e9a723b has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-8d0e9a723b

Comment 10 Fedora Update System 2019-08-26 12:56:27 UTC
FEDORA-EPEL-2019-55d57a78af has been submitted as an update to Fedora EPEL 7. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-55d57a78af

Comment 11 Fedora Update System 2019-08-26 12:56:28 UTC
FEDORA-2019-86ede7b802 has been submitted as an update to Fedora 30. https://bodhi.fedoraproject.org/updates/FEDORA-2019-86ede7b802

Comment 12 Fedora Update System 2019-08-27 00:48:12 UTC
mock-core-configs-31.2-1.el7 has been pushed to the Fedora EPEL 7 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-55d57a78af

Comment 13 Jens Petersen 2019-08-27 07:51:52 UTC
For the record, mock-core-configs-31.1-1.fc30 also broke Silverblue 30 rpm-ostree updates with layered mock:

$ rpm-ostree uninstall fedpkg
:
Processing packages... done
Running pre scripts... done
Running post scripts... done
error: While applying overrides for pkg mock-core-configs: Could not find group 'mock' in group file

Comment 14 Jens Petersen 2019-08-27 07:56:54 UTC
Well that was the wrong output I posted above: s/uninstall fedpkg/update/ .
But same story:

$ rpm-ostree update
:
Updating metadata for 'updates'... done
rpm-md repo 'updates'; generated: 2019-08-26T00:39:22Z
Importing rpm-md... done
Resolving dependencies... done
Applying 1 override and 242 overlays
Processing packages... done
Running pre scripts... done
Running post scripts... done
error: While applying overrides for pkg mock-core-configs: Could not find group 'mock' in group file

Comment 15 Fedora Update System 2019-08-27 18:21:52 UTC
mock-core-configs-31.2-1.fc30 has been pushed to the Fedora 30 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-86ede7b802

Comment 16 Fedora Update System 2019-08-27 18:27:35 UTC
mock-core-configs-31.2-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-f93ae1fa92

Comment 17 Fedora Update System 2019-08-27 19:32:31 UTC
mock-core-configs-31.2-1.el8 has been pushed to the Fedora EPEL 8 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-8d0e9a723b

Comment 18 Fedora Update System 2019-09-04 04:06:06 UTC
mock-core-configs-31.2-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 19 Fedora Update System 2019-09-04 13:58:09 UTC
mock-core-configs-31.2-1.fc30 has been pushed to the Fedora 30 stable repository. If problems still persist, please make note of it in this bug report.

Comment 20 Fedora Update System 2019-09-11 02:13:08 UTC
mock-core-configs-31.2-1.el7 has been pushed to the Fedora EPEL 7 stable repository. If problems still persist, please make note of it in this bug report.

Comment 21 Fedora Update System 2019-09-14 11:07:02 UTC
FEDORA-EPEL-2019-373a10878c has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-373a10878c

Comment 22 Fedora Update System 2019-09-15 02:55:35 UTC
mock-core-configs-31.3-1.el8 has been pushed to the Fedora EPEL 8 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-373a10878c

Comment 23 Fedora Update System 2019-09-24 16:25:53 UTC
FEDORA-EPEL-2019-5a872caba8 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-5a872caba8

Comment 24 Fedora Update System 2019-09-25 03:46:00 UTC
mock-core-configs-31.4-1.el8 has been pushed to the Fedora EPEL 8 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-5a872caba8

Comment 25 Fedora Update System 2019-09-26 12:12:13 UTC
FEDORA-EPEL-2019-eab983bd46 has been submitted as an update to Fedora EPEL 8. https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-eab983bd46

Comment 26 Fedora Update System 2019-09-27 02:36:51 UTC
distribution-gpg-keys-1.35-1.el8, mock-core-configs-31.5-1.el8 has been pushed to the Fedora EPEL 8 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-EPEL-2019-eab983bd46

Comment 27 Fedora Update System 2019-10-12 01:50:09 UTC
distribution-gpg-keys-1.35-1.el8, mock-core-configs-31.5-1.el8 has been pushed to the Fedora EPEL 8 stable repository. If problems still persist, please make note of it in this bug report.