groupadd -g 999 mockbuild fails

Bug #1841792 reported by Hiroaki Nakamura
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mock (Ubuntu)
New
Undecided
Unassigned

Bug Description

Here is detailed explanation to reproduce the error.

I tried to install mock-1.3.2-2 on a fresh clean Ubuntu 18.04 LTS environment and I got the following error.

```
$ sudo apt install mock
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  pigz
The following NEW packages will be installed:
  mock
0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 99.0 kB of archives.
After this operation, 503 kB of additional disk space will be used.
Get:1 http://jp.archive.ubuntu.com/ubuntu bionic/universe amd64 mock all 1.3.2-2 [99.0 kB]
Fetched 99.0 kB in 0s (1,185 kB/s)
dpkg: unrecoverable fatal error, aborting:
 unknown group 'mock' in statoverride file
E: Sub-process /usr/bin/dpkg returned an error code (2)
```

As a workaround, I created the "mock" group before installing the mock package.

```
$ sudo groupadd --system mock
$ sudo apt install mock
```

Then I added my user to the "mock" group.

```
$ sudo usermod -a -G mock $USER
$ newgrp mock
```

When I tried to init the epel-7-x86_64 chroot, I got the following error, the same error as I reported in the previous message.

```
$ /usr/bin/mock -r epel-7-x86_64 --init
...
ERROR: Command failed. See logs for output.
 # /usr/sbin/groupadd -g 999 mockbuild
```

I uninstalled the mock package.

```
$ sudo apt purge mock
...
dpkg: warning: while removing mock, directory '/var/lib/mock' not empty so not removed
dpkg: warning: while removing mock, directory '/var/cache/mock' not empty so not removed
```

And I cleaned up the environment.

```
$ sudo rm -rf /var/lib/mock /var/cache/mock
$ sudo groupdel mock
```

And I tried again with my custom mock package which is built with the attached patch file: add_chrootuser_and_chrootgroup_config.patch

```
$ sudo groupadd --system mock
$ sudo add-apt-repository ppa:hnakamur/mock
$ sudo apt update
$ sudo apt install mock
$ sudo usermod -a -G mock $USER
$ newgrp mock
```

This time when I tried to init the epel-7-x86_64 chroot, I got the following error.

```
$ /usr/bin/mock -r epel-7-x86_64 --init
...
ERROR: Command failed. See logs for output.
 # /usr/sbin/groupadd -g 999 mock
```

The reason for the above error is that another group uses the gid 999.

```
$ grep :999: /var/lib/mock/epel-7-x86_64/root/etc/group
input:x:999:
```

As a workaround, I changed the gid of the "mock" group.

```
$ sudo groupmod -g 998 mock
```

Now I can init the epel-7-x86_64 chroot successfully.

```
$ /usr/bin/mock -r epel-7-x86_64 --init
```

Tags: patch
Revision history for this message
Hiroaki Nakamura (hnakamur) wrote :
Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "Use mock group instead of mockbuild" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.