4

I was building a package from SRPM on Fedora:

$ rpmbuild --rebuild *.src.rpm

...
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
warning: user mockbuild does not exist - using root
warning: group mockbuild does not exist - using root
...

The package was built but there were many such mockbuild does not exist warnings. There doesn't seem to be such an account on my system, even though I have package mock installed. Are there any other packages I'm missing? Is this a fault on the package or my system? How to eliminate these warnings?

Cyker
  • 4,174
  • 6
  • 34
  • 45

2 Answers2

5

You don't, and they don't do anything anyways. They are an artifact of the package having been built in the Fedora buildsystem.

Ignacio Vazquez-Abrams
  • 44,857
  • 7
  • 93
  • 100
  • So where can I find the details about where these artifacts come from and why they must exist? The koji page doesn't mention user/group `mockbuild`, and I'm building on my machine not on koji. I'm not really good at remembering which warnings are harmful and which are false alarms so I prefer they get fixed somehow. – Cyker Jul 30 '18 at 16:02
  • Even SRPMs must be built. And they are being built as `mockbuild`. – Ignacio Vazquez-Abrams Jul 30 '18 at 16:02
  • My understanding is that you can build with any user/group so I don't think it should warn me with a specific one. If rpmbuild must use user/group `mockbuild` to build SRPM, then I can add this user/group. But it's better to understand what's happening before modifying the system. – Cyker Jul 30 '18 at 16:05
  • Files in a RPM are owned by a specific user and group. In a SRPM from Fedora's buildsystem they are owned by `mockbuild`. Adding a local user called `mockbuild` won't help, since normal users can't chown files regardless. – Ignacio Vazquez-Abrams Jul 30 '18 at 16:09
  • I'd like to clarify this a bit. SRPM contains source code, whose owner doesn't matter, as long as the builder can read the files. RPM contains binary files, but those files are built on MY machine, where there isn't a `mockbuild` user. Why would I expect the built binary files to be owned by a non-existent user? – Cyker Jul 30 '18 at 16:48
  • I don't understand why you would, and I don't understand what that question is doing here. If you're asking "Why do files in a SRPM have an owner?", the answer is that SRPMs are still RPMs, they just happen to contain source instead of built binaries. – Ignacio Vazquez-Abrams Jul 30 '18 at 17:06
  • No, I don't care about SRPM file owners. My question is actually very simple: I don't have user/group `mockbuild` on my machine and I don't want packages built on my machine to be bothered with those warnings. So I'd like to understand why rpmbuild would spit out those warnings. Well, the comments have grown very long so I probably wait for a while. – Cyker Jul 30 '18 at 17:34
  • 1
    It spits out those warnings *because* those are the SRPM file owners. – Ignacio Vazquez-Abrams Jul 30 '18 at 17:38
  • All right I got your point. My research shows that downloaded RPMs have file owners `root` but SRPMs have `mockbuild`. How difficult is it to fix the owner that won't be available on most users system before shipping out those SRPMs... – Cyker Jul 30 '18 at 18:05
  • Just unpack them and then repack them with the username that will eventually unpack them. – Ignacio Vazquez-Abrams Jul 30 '18 at 18:52
2

Installing mock is the way to go, if you are interested in making the same package as Fedora's (as opposed to just creating an rpm). When installing that, the package creates a mock user which happens to partially fix the problem. According to the Fedora wiki page Using Mock to test package builds, you should add yourself to the mock group:

Add your user name to the mock group

sudo usermod -a -G mock myusername

Doing that fixed the warnings which I got in a rebuild of Fedora's ncurses source-packages. Depending on the version of mock (and the packages built using it), there may be a mockbuild account referenced in the source-rpms:

commit c33ccca2d36250e9d9fb7dec85fa72c311d43adb
Author: Miroslav Suchý
Date: Thu Nov 13 14:59:00 2014 +0100
run --shell as root with --new-chroot

Until now --new-chroot run --shell as 'mockbuild' user. This is
regression from --old-chroot, where it was run as root user.

Further reading:

On 11/13/2010 18:15, Christopher Stolzenberg wrote:

yum install mock
useradd mockbuild
usermod -G mock mockbuild

Unless you want to ``su'' to a dedicated mockbuild account every time you want to build you should add your usual account to the mock group instead.

mock rebuild -r epel-6-x86_64 /home/mockbuild/kernel 2.6.32-71.7.1.el6.src.rpm

Mock typically grabs packages from CentOS, so until CentOS 6 is out you're going to have to build using RHEL 6.

The Fedora project's page says to add your user to mock. You can skip this, but to avoid errors later (when installing srpms), add a mockbuild user. The mockbuild user doesn't need a password.

sudo useradd mockbuild

Thomas Dickey
  • 75,040
  • 9
  • 171
  • 268