Public bug reported:

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
```

** Affects: mock (Ubuntu)
     Importance: Undecided
         Status: New

** Patch added: "Use mock group instead of mockbuild"
   
https://bugs.launchpad.net/bugs/1841792/+attachment/5285407/+files/add_chrootuser_and_chrootgroup_config.patch

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1841792

Title:
  groupadd -g 999 mockbuild fails

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/mock/+bug/1841792/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to