Can't launch local build as regular user.

Hi all.

I try build local rpm package by using “build” from build.rpm package. If I launch as root user - everything is fine. When trying as regular user, then error:

    0s] initializing /var/tmp/build-root/.srcfiles.cache ...
    0s] /usr/lib/build/createzyppdeps --cachedir=/var/cache/build zypp://openSUSE-42.1-0
    2s] /usr/lib/build/createzyppdeps --cachedir=/var/cache/build zypp://repo-non-oss
    3s] /usr/lib/build/createzyppdeps --cachedir=/var/cache/build zypp://repo-source
    3s] /usr/lib/build/createzyppdeps --cachedir=/var/cache/build zypp://repo-update-non-oss
    3s] /usr/lib/build/createzyppdeps --cachedir=/var/cache/build zypp://repo-update
   11s] expanding package dependencies...
   18s] Warning: distribution not specified, assuming 'default' (see /usr/lib/build/configs).
   21s] calculating packages to download...
   36s] hostname: Name or service not known
   37s] [1/29] preinstalling filesystem...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [2/29] preinstalling glibc...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [3/29] preinstalling fillup...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [4/29] preinstalling libattr1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [5/29] preinstalling libbz2-1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [6/29] preinstalling libcap2...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [7/29] preinstalling libelf1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [8/29] preinstalling libgcc_s1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [9/29] preinstalling liblua5_1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [10/29] preinstalling liblzma5...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [11/29] preinstalling libpcre1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [12/29] preinstalling libpopt0...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [13/29] preinstalling libz1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [14/29] preinstalling attr...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [15/29] preinstalling libacl1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [16/29] preinstalling libncurses5...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [17/29] preinstalling libselinux1...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [18/29] preinstalling libreadline6...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [19/29] preinstalling bash...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [20/29] preinstalling diffutils...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [21/29] preinstalling m4...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [22/29] preinstalling sed...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [23/29] preinstalling grep...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [24/29] preinstalling tar...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [25/29] preinstalling coreutils...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [26/29] preinstalling permissions...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [27/29] preinstalling aaa_base...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [28/29] preinstalling rpm...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] [29/29] preinstalling pam...
   37s] bsdtar: Can't chroot to ".": Operation not permitted
   37s] 
   37s] running aaa_base preinstall script
   37s] chroot: cannot change root directory to /var/tmp/build-root: Operation not permitted
   37s] running aaa_base postinstall script
   37s] chroot: cannot change root directory to /var/tmp/build-root: Operation not permitted
   37s] initializing rpm db...
   37s] chroot: cannot change root directory to /var/tmp/build-root: Operation not permitted

I tried to change build root with export BUILD_ROOT, but nothing changes. Same error.

Is it possible to build rpms as non-root user?

Hi
Use the rpmbuild command instead, it should create the ‘rpmbuild’ directory in you home directory else just create the same structure as under/usr/src/packages/ and move the relevant files to the respective directories and cd in the SPECS one to run your rpmbuild command.

But from manpage:

build - build SuSE Linux RPMs in a chroot environment

rpmbuild - Build RPM Package(s)

With build I keep my system clean. I suppose that “build” is like a “mock” in Fedora. That’s what I need. And mock can be launch by non-root user.

Hi,

goto: https://en.opensuse.org/openSUSE:Build_Service_Tutorial
and read the part about changing /etc/sudoers.

Hendrik

Thanks for your advice. I edited sudoers file according to link, given by you. Then I logout and login again. But nothing changes. Also I tried to add /usr/bin/chroot to sudoers file. Nothing changes too.

Should been user in wheel group?

Hi
Just to be clear, you not using the build service tool called osc? Did you try rpmbuild (this is for the user)?

No, I don’t use it. Because I need some packets, which prohobited in OBS. And as I read, I can use their using “build” with --rpm parameter.

As I said above, I want to keep my system clean and avoid to install a lot of build-requires stuff.

Is only possible way then is VM?

Hi
So you can build locally using osc and your obs account, no need to push to OBS. All I do is create a new osc package say pkg_1;


osc meta pkg -e pkg_1
osc co username:home pkg_1
cd username:home/pkg_1
<place you spec file source etc here>
osc build <your target release> --clean

Once built, I then mv pkg_1 folder to say (pkg_name) the can checkout the pkg_1 folder again to build the next one, at this point say you want to update, then cd into pkg_nameupdate and rebuild, no need to change anything…

But osc will use only openSUSE’s repositories, as I know. How can I use my local rpm’s which requires to successfully build?

I mean to use openSUSE repositories as main and add only few packages, which prohibited for legal reasons?

                  -x PAC, --extra-pkgs=PAC
                              Add this package when installing the build-root
                  -k DIR, --keep-pkgs=DIR
                              Save built packages into this directory
                  -p DIR, --prefer-pkgs=DIR
                              Prefer packages from this directory when installing
                              the build-root

Will this parameters work with local packages?

On Fri 04 Mar 2016 11:26:01 PM CST, z1trus wrote:

Code:

-x PAC, --extra-pkgs=PAC
Add this package when installing the build-root
-k DIR, --keep-pkgs=DIR
Save built packages into this directory
-p DIR, --prefer-pkgs=DIR
Prefer packages from this directory when installing
the build-root

Will this parameters work with local packages?

Hi
I’ve never tried it, sounds like it should work… The other option is
to look at creating an account on Packman https://pmbs.links2linux.de/
which you would be able to upload those restrictive type packages
(and disable publishing)…


Cheers Malcolm °¿° LFCS, SUSE Knowledge Partner (Linux Counter #276890)
SUSE Linux Enterprise Desktop 12 SP1|GNOME 3.10.4|3.12.53-60.30-default
If you find this post helpful and are logged into the web interface,
please show your appreciation and click on the star below… Thanks!

No :frowning: It doesn’t work. I tried to add custom package directly to cachedir and specify through set -x paramater. It says “unresolvable: nothing provides”.
It’s so pity.
Nevertheless, thanks for your help.

Finally, I found proper way to build rpm locally with “build” tool (with dependencies, wich prohibited in official repos). Just create local repo (createrepo package) and add it to your repo list. “Build” tool will use it alltogether with regular openSUSE repositories.