LXC Source Build Problem on RedHat 7.4

Source build of LXC on RedHat 7.4 fails with error shown on screenshot. Anybody seen this before and know of a fix? Same build code on Oracle Linux and CentOS does not give this error. Thanks!

Do you have the configure output from this build? It looks like the distribution wasn’t set properly and so lead to /etc/sysconfig being missing somehow.

-bash-4.2$ ./configure
checking for pkg-config… /bin/pkg-config
checking pkg-config is at least version 0.9.0… yes
checking for a BSD-compatible install… /bin/install -c
checking whether build environment is sane… yes
checking for a thread-safe mkdir -p… /bin/mkdir -p
checking for gawk… gawk
checking whether make sets $(MAKE)… yes
checking whether make supports nested variables… yes
checking build system type… x86_64-pc-linux-gnu
checking host system type… x86_64-pc-linux-gnu
checking for style of include used by make… GNU
checking for gcc… gcc
checking whether the C compiler works… yes
checking for C compiler default output file name… a.out
checking for suffix of executables…
checking whether we are cross compiling… no
checking for suffix of object files… o
checking whether we are using the GNU C compiler… yes
checking whether gcc accepts -g… yes
checking for gcc option to accept ISO C89… none needed
checking whether gcc understands -c and -o together… yes
checking dependency style of gcc… gcc3
checking how to run the C preprocessor… gcc -E
checking for grep that handles long lines and -e… /bin/grep
checking for egrep… /bin/grep -E
checking for ANSI C header files… yes
checking for sys/types.h… yes
checking for sys/stat.h… yes
checking for stdlib.h… yes
checking for string.h… yes
checking for memory.h… yes
checking for strings.h… yes
checking for inttypes.h… yes
checking for stdint.h… yes
checking for unistd.h… yes
checking minix/config.h usability… no
checking minix/config.h presence… no
checking for minix/config.h… no
checking whether it is safe to define EXTENSIONS… yes
checking how to print strings… printf
checking for a sed that does not truncate output… /bin/sed
checking for fgrep… /bin/grep -F
checking for ld used by gcc… /bin/ld
checking if the linker (/bin/ld) is GNU ld… yes
checking for BSD- or MS-compatible name lister (nm)… /bin/nm -B
checking the name lister (/bin/nm -B) interface… BSD nm
checking whether ln -s works… yes
checking the maximum length of command line arguments… 1572864
checking how to convert x86_64-pc-linux-gnu file names to x86_64-pc-linux-gnu format… func_convert_file_noop
checking how to convert x86_64-pc-linux-gnu file names to toolchain format… func_convert_file_noop
checking for /bin/ld option to reload object files… -r
checking for objdump… objdump
checking how to recognize dependent libraries… pass_all
checking for dlltool… no
checking how to associate runtime and link libraries… printf %s\n
checking for ar… ar
checking for archiver @FILE support… @
checking for strip… strip
checking for ranlib… ranlib
checking command to parse /bin/nm -B output from gcc object… ok
checking for sysroot… no
checking for a working dd… /bin/dd
checking how to truncate binary pipes… /bin/dd bs=4096 count=1
checking for mt… no
checking if : is a manifest tool… no
checking for dlfcn.h… yes
checking for objdir… .libs
checking if gcc supports -fno-rtti -fno-exceptions… no
checking for gcc option to produce PIC… -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works… yes
checking if gcc static flag -static works… no
checking if gcc supports -c -o file.o… yes
checking if gcc supports -c -o file.o… (cached) yes
checking whether the gcc linker (/bin/ld -m elf_x86_64) supports shared libraries… yes
checking whether -lc should be explicitly linked in… no
checking dynamic linker characteristics… GNU/Linux ld.so
checking how to hardcode library paths into programs… immediate
checking whether stripping libraries is possible… yes
checking if libtool supports shared libraries… yes
checking whether to build shared libraries… yes
checking whether to build static libraries… yes
checking host distribution… redhatenterpriseserver
checking for init system type… Linux distribution init system unknown.
checking for docbook2x-man… db2x_docbook2man
checking for doxygen… no
checking for aa_change_profile in -lapparmor… no
checking for gnutls_hash_fast in -lgnutls… no
checking for setexeccon_raw in -lselinux… yes
checking selinux/selinux.h usability… yes
checking selinux/selinux.h presence… yes
checking for selinux/selinux.h… yes
checking for setexeccon_raw in -lselinux… (cached) yes
checking for seccomp_init in -lseccomp… no
checking for cgmanager_create in -lcgmanager… no
checking for get_pid_cgroup_abs_sync… checking for library containing cgmanager_get_pid_cgroup_abs_sync… no
no
checking for cgmanager_list_controllers… checking for library containing cgmanager_list_controllers_sync… no
no
checking for cap_init in -lcap… no
checking for cap_set_proc in -lcap… yes
checking sys/capability.h usability… yes
checking sys/capability.h presence… yes
checking for sys/capability.h… yes
checking for cap_set_proc in -lcap… (cached) yes
checking for cap_get_file in -lcap… yes
checking for scmp_filter_ctx… no
checking whether seccomp_syscall_resolve_name_arch is declared… no
checking for PYTHONDEV… no
checking for LUA… no
checking for LUA… no
checking for LUA… no
checking bash completion directory… /usr/share/bash-completion/completions
checking Whether to place logfiles in container config path… no
checking for linux/unistd.h… yes
checking for linux/netlink.h… yes
checking for linux/genetlink.h… yes
checking for bionic libc… no
checking whether PR_CAPBSET_DROP is declared… yes
checking whether PR_SET_NO_NEW_PRIVS is declared… yes
checking whether PR_GET_NO_NEW_PRIVS is declared… yes
checking sys/signalfd.h usability… yes
checking sys/signalfd.h presence… yes
checking for sys/signalfd.h… yes
checking pty.h usability… yes
checking pty.h presence… yes
checking for pty.h… yes
checking ifaddrs.h usability… yes
checking ifaddrs.h presence… yes
checking for ifaddrs.h… yes
checking sys/memfd.h usability… no
checking sys/memfd.h presence… no
checking for sys/memfd.h… no
checking sys/personality.h usability… yes
checking sys/personality.h presence… yes
checking for sys/personality.h… yes
checking utmpx.h usability… yes
checking utmpx.h presence… yes
checking for utmpx.h… yes
checking sys/timerfd.h usability… yes
checking sys/timerfd.h presence… yes
checking for sys/timerfd.h… yes
checking sys/resource.h usability… yes
checking sys/resource.h presence… yes
checking for sys/resource.h… yes
checking whether sys/types.h defines makedev… yes
checking for setns… yes
checking for pivot_root… yes
checking for sethostname… yes
checking for unshare… yes
checking for rand_r… yes
checking for confstr… yes
checking for faccessat… yes
checking for gettid… no
checking for memfd_create… no
checking for main in -lpthread… yes
checking for pthread_atfork… yes
checking for statvfs… yes
checking for openpty in -lutil… yes
checking for openpty… yes
checking for hasmntopt… yes
checking for setmntent… yes
checking for endmntent… yes
checking for utmpxname… yes
checking for getline… yes
checking for getsubopt… yes
checking for fgetln… no
checking for prlimit… yes
checking for library containing sem_open… none required
checking for library containing clock_gettime… none required
checking whether gcc needs -traditional… no
checking for a sed that does not truncate output… (cached) /bin/sed
checking for TLS… yes
checking that generated files are newer than configure… done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating lxc.pc
config.status: creating lxc.spec
config.status: creating config/Makefile
config.status: creating config/apparmor/Makefile
config.status: creating config/selinux/Makefile
config.status: creating config/bash/Makefile
config.status: creating config/bash/lxc
config.status: creating config/init/Makefile
config.status: creating config/init/common/Makefile
config.status: creating config/init/common/lxc-containers
config.status: creating config/init/common/lxc-net
config.status: creating config/init/systemd/Makefile
config.status: creating config/init/systemd/lxc.service
config.status: creating config/init/systemd/lxc@.service
config.status: creating config/init/systemd/lxc-net.service
config.status: creating config/init/sysvinit/Makefile
config.status: creating config/init/sysvinit/lxc-containers
config.status: creating config/init/sysvinit/lxc-net
config.status: creating config/init/upstart/lxc.conf
config.status: creating config/init/upstart/lxc-net.conf
config.status: creating config/init/upstart/Makefile
config.status: creating config/etc/Makefile
config.status: creating config/templates/Makefile
config.status: creating config/templates/alpine.common.conf
config.status: creating config/templates/alpine.userns.conf
config.status: creating config/templates/archlinux.common.conf
config.status: creating config/templates/archlinux.userns.conf
config.status: creating config/templates/centos.common.conf
config.status: creating config/templates/centos.userns.conf
config.status: creating config/templates/common.conf
config.status: creating config/templates/common.conf.d/Makefile
config.status: creating config/templates/debian.common.conf
config.status: creating config/templates/debian.userns.conf
config.status: creating config/templates/fedora.common.conf
config.status: creating config/templates/fedora.userns.conf
config.status: creating config/templates/gentoo.common.conf
config.status: creating config/templates/gentoo.moresecure.conf
config.status: creating config/templates/gentoo.userns.conf
config.status: creating config/templates/nesting.conf
config.status: creating config/templates/opensuse.common.conf
config.status: creating config/templates/opensuse.userns.conf
config.status: creating config/templates/oracle.common.conf
config.status: creating config/templates/oracle.userns.conf
config.status: creating config/templates/plamo.common.conf
config.status: creating config/templates/plamo.userns.conf
config.status: creating config/templates/slackware.common.conf
config.status: creating config/templates/slackware.userns.conf
config.status: creating config/templates/ubuntu-cloud.common.conf
config.status: creating config/templates/ubuntu-cloud.lucid.conf
config.status: creating config/templates/ubuntu-cloud.userns.conf
config.status: creating config/templates/ubuntu.common.conf
config.status: creating config/templates/ubuntu.lucid.conf
config.status: creating config/templates/ubuntu.userns.conf
config.status: creating config/templates/openwrt.common.conf
config.status: creating config/templates/sparclinux.common.conf
config.status: creating config/templates/sparclinux.userns.conf
config.status: creating config/templates/voidlinux.common.conf
config.status: creating config/templates/voidlinux.userns.conf
config.status: creating config/templates/sabayon.common.conf
config.status: creating config/templates/sabayon.userns.conf
config.status: creating config/templates/userns.conf
config.status: creating config/yum/Makefile
config.status: creating config/sysconfig/Makefile
config.status: creating config/sysconfig/lxc
config.status: creating doc/Makefile
config.status: creating doc/api/Makefile
config.status: creating doc/lxc-attach.sgml
config.status: creating doc/lxc-autostart.sgml
config.status: creating doc/lxc-cgroup.sgml
config.status: creating doc/lxc-checkconfig.sgml
config.status: creating doc/lxc-checkpoint.sgml
config.status: creating doc/lxc-clone.sgml
config.status: creating doc/lxc-config.sgml
config.status: creating doc/lxc-console.sgml
config.status: creating doc/lxc-copy.sgml
config.status: creating doc/lxc-create.sgml
config.status: creating doc/lxc-destroy.sgml
config.status: creating doc/lxc-device.sgml
config.status: creating doc/lxc-execute.sgml
config.status: creating doc/lxc-freeze.sgml
config.status: creating doc/lxc-info.sgml
config.status: creating doc/lxc-ls.sgml
config.status: creating doc/lxc-monitor.sgml
config.status: creating doc/lxc-snapshot.sgml
config.status: creating doc/lxc-start-ephemeral.sgml
config.status: creating doc/lxc-start.sgml
config.status: creating doc/lxc-stop.sgml
config.status: creating doc/lxc-top.sgml
config.status: creating doc/lxc-unfreeze.sgml
config.status: creating doc/lxc-unshare.sgml
config.status: creating doc/lxc-update-config.sgml
config.status: creating doc/lxc-user-nic.sgml
config.status: creating doc/lxc-usernsexec.sgml
config.status: creating doc/lxc-wait.sgml
config.status: creating doc/lxc.conf.sgml
config.status: creating doc/lxc.container.conf.sgml
config.status: creating doc/lxc.system.conf.sgml
config.status: creating doc/lxc-usernet.sgml
config.status: creating doc/lxc.sgml
config.status: creating doc/common_options.sgml
config.status: creating doc/see_also.sgml
config.status: creating doc/rootfs/Makefile
config.status: creating doc/examples/Makefile
config.status: creating doc/examples/lxc-macvlan.conf
config.status: creating doc/examples/lxc-vlan.conf
config.status: creating doc/examples/lxc-no-netns.conf
config.status: creating doc/examples/lxc-empty-netns.conf
config.status: creating doc/examples/lxc-phys.conf
config.status: creating doc/examples/lxc-veth.conf
config.status: creating doc/examples/lxc-complex.conf
config.status: creating doc/ja/Makefile
config.status: creating doc/ja/lxc-attach.sgml
config.status: creating doc/ja/lxc-autostart.sgml
config.status: creating doc/ja/lxc-cgroup.sgml
config.status: creating doc/ja/lxc-checkconfig.sgml
config.status: creating doc/ja/lxc-checkpoint.sgml
config.status: creating doc/ja/lxc-clone.sgml
config.status: creating doc/ja/lxc-config.sgml
config.status: creating doc/ja/lxc-console.sgml
config.status: creating doc/ja/lxc-copy.sgml
config.status: creating doc/ja/lxc-create.sgml
config.status: creating doc/ja/lxc-destroy.sgml
config.status: creating doc/ja/lxc-device.sgml
config.status: creating doc/ja/lxc-execute.sgml
config.status: creating doc/ja/lxc-freeze.sgml
config.status: creating doc/ja/lxc-info.sgml
config.status: creating doc/ja/lxc-ls.sgml
config.status: creating doc/ja/lxc-monitor.sgml
config.status: creating doc/ja/lxc-snapshot.sgml
config.status: creating doc/ja/lxc-start-ephemeral.sgml
config.status: creating doc/ja/lxc-start.sgml
config.status: creating doc/ja/lxc-stop.sgml
config.status: creating doc/ja/lxc-top.sgml
config.status: creating doc/ja/lxc-unfreeze.sgml
config.status: creating doc/ja/lxc-unshare.sgml
config.status: creating doc/ja/lxc-update-config.sgml
config.status: creating doc/ja/lxc-user-nic.sgml
config.status: creating doc/ja/lxc-usernsexec.sgml
config.status: creating doc/ja/lxc-wait.sgml
config.status: creating doc/ja/lxc.conf.sgml
config.status: creating doc/ja/lxc.container.conf.sgml
config.status: creating doc/ja/lxc.system.conf.sgml
config.status: creating doc/ja/lxc-usernet.sgml
config.status: creating doc/ja/lxc.sgml
config.status: creating doc/ja/common_options.sgml
config.status: creating doc/ja/see_also.sgml
config.status: creating doc/ko/Makefile
config.status: creating doc/ko/lxc-attach.sgml
config.status: creating doc/ko/lxc-autostart.sgml
config.status: creating doc/ko/lxc-cgroup.sgml
config.status: creating doc/ko/lxc-checkconfig.sgml
config.status: creating doc/ko/lxc-checkpoint.sgml
config.status: creating doc/ko/lxc-clone.sgml
config.status: creating doc/ko/lxc-config.sgml
config.status: creating doc/ko/lxc-console.sgml
config.status: creating doc/ko/lxc-copy.sgml
config.status: creating doc/ko/lxc-create.sgml
config.status: creating doc/ko/lxc-destroy.sgml
config.status: creating doc/ko/lxc-device.sgml
config.status: creating doc/ko/lxc-execute.sgml
config.status: creating doc/ko/lxc-freeze.sgml
config.status: creating doc/ko/lxc-info.sgml
config.status: creating doc/ko/lxc-ls.sgml
config.status: creating doc/ko/lxc-monitor.sgml
config.status: creating doc/ko/lxc-snapshot.sgml
config.status: creating doc/ko/lxc-start-ephemeral.sgml
config.status: creating doc/ko/lxc-start.sgml
config.status: creating doc/ko/lxc-stop.sgml
config.status: creating doc/ko/lxc-top.sgml
config.status: creating doc/ko/lxc-unfreeze.sgml
config.status: creating doc/ko/lxc-unshare.sgml
config.status: creating doc/ko/lxc-user-nic.sgml
config.status: creating doc/ko/lxc-usernsexec.sgml
config.status: creating doc/ko/lxc-wait.sgml
config.status: creating doc/ko/lxc.conf.sgml
config.status: creating doc/ko/lxc.container.conf.sgml
config.status: creating doc/ko/lxc.system.conf.sgml
config.status: creating doc/ko/lxc-usernet.sgml
config.status: creating doc/ko/lxc.sgml
config.status: creating doc/ko/common_options.sgml
config.status: creating doc/ko/see_also.sgml
config.status: creating hooks/Makefile
config.status: creating templates/Makefile
config.status: creating templates/lxc-alpine
config.status: creating templates/lxc-altlinux
config.status: creating templates/lxc-archlinux
config.status: creating templates/lxc-busybox
config.status: creating templates/lxc-centos
config.status: creating templates/lxc-cirros
config.status: creating templates/lxc-debian
config.status: creating templates/lxc-download
config.status: creating templates/lxc-fedora
config.status: creating templates/lxc-fedora-legacy
config.status: creating templates/lxc-gentoo
config.status: creating templates/lxc-openmandriva
config.status: creating templates/lxc-opensuse
config.status: creating templates/lxc-oracle
config.status: creating templates/lxc-plamo
config.status: creating templates/lxc-pld
config.status: creating templates/lxc-slackware
config.status: creating templates/lxc-sshd
config.status: creating templates/lxc-ubuntu
config.status: creating templates/lxc-ubuntu-cloud
config.status: creating templates/lxc-sparclinux
config.status: creating templates/lxc-voidlinux
config.status: creating templates/lxc-sabayon
config.status: creating src/Makefile
config.status: creating src/lxc/Makefile
config.status: creating src/lxc/lxc.functions
config.status: creating src/lxc/tools/lxc-checkconfig
config.status: creating src/lxc/tools/lxc-start-ephemeral
config.status: creating src/lxc/tools/lxc-update-config
config.status: creating src/lxc/version.h
config.status: creating src/python-lxc/Makefile
config.status: creating src/lua-lxc/Makefile
config.status: creating src/tests/Makefile
config.status: creating src/tests/lxc-test-usernic
config.status: creating src/config.h
config.status: linking config/etc/default.conf.unknown to config/etc/default.conf
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default commands


Environment:

  • compiler: gcc
  • distribution: redhatenterpriseserver
  • init script type(s):
  • rpath: no
  • GnuTLS: no
  • Bash integration: yes

Security features:

  • Apparmor: no
  • Linux capabilities: yes
  • seccomp: no
  • SELinux: yes
  • cgmanager: no

Bindings:

  • lua: no
  • python3: no

Documentation:

  • examples: yes
  • API documentation: no
  • user documentation: yes

Debugging:

  • tests: no
  • mutex debugging: no

Paths:

  • Logs in configpath: no
    -bash-4.2$

Try passing --with-distro=redhat, that should fix that.

Thanks. I’m kind of stuck on how to implement this parameter.

My build line is:

rpmbuild --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -ba lxc.spec

when I change it to:

rpmbuild --with-distro=redhat --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -ba lxc.spec

it doesn’t work at all so I use this instead

rpmbuild --with distro=redhat --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -ba lxc.spec

but that gives different errors along with previous error as well.

I think I get that rpmbuild has to pass this distro=redhat parameter back to configure, but after reading this link http://rpm.org/user_doc/conditional_builds.html and others I’m not understanding what needs to be done to pass it back to configure.

[orabuntu@khan lxc]$ rpmbuild --with-distro=redhat --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -ba lxc.spec
rpmbuild: --with-distro=redhat: unknown option

If you build from git, I’ve pushed a fix to it to handle redhatenterpriseserver as a valid distro name.

When I use this syntax:

pmbuild --with distro=redhat --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -ba lxc.spec

I get:

Processing files: lxc-2.1.1-1.el7.x86_64
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.10.6-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*

RPM build errors:
Macro %_with_distro needs whitespace before body
Macro %_with_distro needs whitespace before body
Macro %_with_distro needs whitespace before body
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.10.6-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*
[orabuntu@khan lxc]$ rpmbuild --with distro=redhat --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -ba lxc.spec

Thank you for the fix. The thing is, Orabuntu_LXC builds whatever version of LXC the user specifies and uses this for source:

wget --timeout=5 --tries=10 https://linuxcontainers.org/downloads/lxc/lxc-"$LxcVersion".tar.gz

so if I use the github source I’ll have to build some additional coding as a one-off for redhat to use only the git repo.

I’ve also found that I can get the build to succeed by doing this:

sudo sed -i ‘/sysconfig/d’ /opt/olxc/"$DistDir"/uekulele/lxc/lxc.spec

which is equivalent to commenting out this line:

%config(noreplace) %{_sysconfdir}/sysconfig/*

Yeah but then the sysconfig bits will be missing which doesn’t seem like a good idea.

–with-distro is a configure argument so you should probably mangle the spec file to pass that when calling configure.

Well there is some real weirdness going on with this. Check this out - from Oracle Linux 7.4 - using the -bl switch on rpmbuild:

[orabuntu@ol-74-m lxc]$ rpmbuild --define ‘_with_distro --with-distro=oracle’ --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -bl lxc.spec
Processing files: lxc-2.1.1-1.el7.x86_64
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/bin/*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/man1/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/man5/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/man7/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ja/man1/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ja/man5/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ja/man7/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ko/man1/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ko/man5/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ko/man7/lxc*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/doc/*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/lxc/*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/lxc/*
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*
error: File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/lib/systemd/system/lxc-net.service
error: File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/lib/systemd/system/lxc.service
error: File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/lib/systemd/system/lxc@.service

RPM build errors:
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/bin/*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/man1/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/man5/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/man7/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ja/man1/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ja/man5/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ja/man7/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ko/man1/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ko/man5/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/man/ko/man7/lxc*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/doc/*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/share/lxc/*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/lxc/*
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*
File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/lib/systemd/system/lxc-net.service
File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/lib/systemd/system/lxc.service
File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.03-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/usr/lib/systemd/system/lxc@.service
[orabuntu@ol-74-m lxc]$ cat /etc/rpm/macros

Notice how many files are not found by the -bl check - and yet this build succeeds because “%_unpackaged_files_terminate_build 0” is set in /etc/rpm/macros file.

On the other hand, on RedHat, it seems to ignore the setting in /etc/rpm/macros entirely, but actually far fewer files fail on the rpmbuild -bl check:

[orabuntu@khan lxc]$ rpmbuild --define ‘_with_distro --with-distro=oracle’ --define “_sysconfidir /etc” --define “_unpackaged_files_terminate_build 0” --define “_topdir /opt/olxc/”$DistDir"/uekulele/lxc/rpmbuild" -bl lxc.spec
Processing files: lxc-2.1.1-1.el7.x86_64
error: File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.10.6-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/bash_completion.d
error: File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.10.6-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*

RPM build errors:
File not found: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.10.6-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/bash_completion.d
File not found by glob: /opt/olxc/home/orabuntu/Downloads/orabuntu-lxc-6.10.6-beta/uekulele/lxc/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*

So after many hours working on this, it seems the conclusion so far is something is definitely different over here on RedHat as compared to Oracle Linux.

Also, I’ve tried using the git repo as you suggested, and that was a no-go also:

Processing files: lxc-2.1.1-1.el7.x86_64
error: File not found: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/bash_completion.d
error: File not found by glob: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*

RPM build errors:
File not found: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/bash_completion.d
File not found by glob: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.1.1-1.el7.x86_64/etc/sysconfig/*
make: *** [rpm] Error 1
[orabuntu@khan lxc]$ history | tail -7
23 ./configure --with-distro=redhat
24 ls -lrt
25 ./autogen.sh
26 ls -lrt
27 ./configure --with-distro=redhat
28 make rpm
29 history | tail -7
[orabuntu@khan lxc]$

Oracle have done quite a lot to make Oracle Linux LXC friendly and I think there must be some bits somewhere that RedHat does not have as RedHat are pretty chilly to LXC. I’ve talked to some people I know at RedHat and none of them have any idea what this issue is with the LXC build on RedHat 7.

Searches reveal that the last version of LXC that builds reliably is the 1.0.11 from epel which goes in fine on RHEL 7 but is too old a version to be of practical use.

The only thing that works at this point is to comment out these two lines in the lxc.spec file:

%{_sysconfdir}/bash_completion.d
%config(noreplace) %{_sysconfdir}/sysconfig/*

Then the RPM build is successful. The lxc-checkconfig output looks clean:

[orabuntu@khan lxc]$ lxc-checkconfig
Kernel configuration not found at /proc/config.gz; searching…
Kernel configuration found at /boot/config-3.10.0-693.21.1.el7.x86_64
— Namespaces —
Namespaces: enabled
Utsname namespace: enabled
Ipc namespace: enabled
Pid namespace: enabled
User namespace: enabled
newuidmap is not installed
newgidmap is not installed
Network namespace: enabled
Multiple /dev/pts instances: enabled
— Control groups —
Cgroups: enabled

Cgroup v1 mount points:
/sys/fs/cgroup/systemd
/sys/fs/cgroup/hugetlb
/sys/fs/cgroup/cpuset
/sys/fs/cgroup/pids
/sys/fs/cgroup/cpu,cpuacct
/sys/fs/cgroup/perf_event
/sys/fs/cgroup/devices
/sys/fs/cgroup/blkio
/sys/fs/cgroup/freezer
/sys/fs/cgroup/net_cls,net_prio
/sys/fs/cgroup/memory

Cgroup v2 mount points:

Cgroup v1 clone_children flag: enabled
Cgroup device: enabled
Cgroup sched: enabled
Cgroup cpu account: enabled
Cgroup memory controller: enabled
Cgroup cpuset: enabled

— Misc —
Veth pair device: enabled, not loaded
Macvlan: enabled, not loaded
Vlan: enabled, not loaded
Bridges: enabled, loaded
Advanced netfilter: enabled, not loaded
CONFIG_NF_NAT_IPV4: enabled, loaded
CONFIG_NF_NAT_IPV6: enabled, loaded
CONFIG_IP_NF_TARGET_MASQUERADE: enabled, loaded
CONFIG_IP6_NF_TARGET_MASQUERADE: enabled, not loaded
CONFIG_NETFILTER_XT_TARGET_CHECKSUM: enabled, loadedCONFIG_NETFILTER_XT_MATCH_COMMENT: enabled, not loaded
FUSE (for use with lxcfs): enabled, loaded

— Checkpoint/Restore —
checkpoint restore: enabled
CONFIG_FHANDLE: enabled
CONFIG_EVENTFD: enabled
CONFIG_EPOLL: enabled
CONFIG_UNIX_DIAG: enabled
CONFIG_INET_DIAG: enabled
CONFIG_PACKET_DIAG: enabled
CONFIG_NETLINK_DIAG: enabled
File capabilities: enabled

Note : Before booting a new kernel, you can check its configuration
usage : CONFIG=/path/to/config /usr/bin/lxc-checkconfig

[orabuntu@khan lxc]$

Using the git repo as you suggested, LXC 2.0.5 (to avoid the issues around bash_completion.d):

ON REDHAT 7.4 (fails)

/usr/lib/rpm/sepdebugcrcfix: Updated 28 CRC32s, 0 CRC32s did match.
symlinked /usr/lib/debug/usr/lib64/liblxc.so.1.2.0.debug to /usr/lib/debug/usr/lib64/liblxc.so.1.debug
symlinked /usr/lib/debug/usr/lib64/liblxc.so.1.2.0.debug to /usr/lib/debug/usr/lib64/liblxc.so.debug
2428 blocks

  • /usr/lib/rpm/check-buildroot
  • /usr/lib/rpm/redhat/brp-compress
  • /usr/lib/rpm/redhat/brp-strip-static-archive /usr/bin/strip
  • /usr/lib/rpm/brp-python-bytecompile /usr/bin/python 1
  • /usr/lib/rpm/redhat/brp-python-hardlink
  • /usr/lib/rpm/redhat/brp-java-repack-jars
    Processing files: lxc-2.0.5-1.el7.x86_64
    error: File not found by glob: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.0.5-1.el7.x86_64/etc/sysconfig/*
    error: File not found by glob: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.0.5-1.el7.x86_64/etc/sysconfig/*

RPM build errors:
File not found by glob: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.0.5-1.el7.x86_64/etc/sysconfig/*
File not found by glob: /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.0.5-1.el7.x86_64/etc/sysconfig/*
make: *** [rpm] Error 1
[orabuntu@khan lxc]$ history | tail -13
328 cat lxc.spec
329 lxc-checkconfig
330 cd
331 cd Downloads
332 ls -lrt
333 rm -rf lxc
334 git clone https://github.com/lxc/lxc.git
335 cd lxc
336 git checkout lxc-2.0.5 -b b_2_0_5
337 ./autogen.sh
338 ./configure --with-distro=redhat
339 make rpm
340 history | tail -13
[orabuntu@khan lxc]$

ON ORACLE LINUX 7.4 (succeds):

warning: Installed (but unpackaged) file(s) found:
/usr/lib/systemd/system/lxc@.service
Wrote: /home/orabuntu/rpmbuild/SRPMS/lxc-2.0.5-1.el7.src.rpm
Wrote: /home/orabuntu/rpmbuild/RPMS/x86_64/lxc-2.0.5-1.el7.x86_64.rpm
Wrote: /home/orabuntu/rpmbuild/RPMS/x86_64/lxc-libs-2.0.5-1.el7.x86_64.rpm
Wrote: /home/orabuntu/rpmbuild/RPMS/x86_64/lxc-devel-2.0.5-1.el7.x86_64.rpm
Wrote: /home/orabuntu/rpmbuild/RPMS/x86_64/lxc-debuginfo-2.0.5-1.el7.x86_64.rpm
Executing(%clean): /bin/sh -e /var/tmp/rpm-tmp.b6la1a

  • umask 022
  • cd /home/orabuntu/rpmbuild/BUILD
  • cd lxc-2.0.5
  • rm -rf /home/orabuntu/rpmbuild/BUILDROOT/lxc-2.0.5-1.el7.x86_64
  • exit 0
    Executing(–clean): /bin/sh -e /var/tmp/rpm-tmp.W1XPFm
  • umask 022
  • cd /home/orabuntu/rpmbuild/BUILD
  • rm -rf lxc-2.0.5
  • exit 0
    [orabuntu@ol-74-m lxc]$ history | tail -13
    74 git clone https://github.com/lxc/lxc.git
    75 git checkout lxc-2.0.5 -b b_2_0_5
    76 ./autogen.sh
    77 cd lxc
    78 git checkout lxc-2.0.5 -b b_2_0_5
    79 ./autogen.sh
    80 ./configure --with-distro=oracle
    81 make rpm
    [orabuntu@ol-74-m lxc]$

Can also get a successful build by adding these lines under %install (instead of commenting out the lines as mentioned above) in the lxc.spec file:

install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/somefile
install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d

So after a good deal more research on this, the best fix I have come up with so far is the following:

sed -i '/find %{buildroot} -type f -name/a install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig' lxc.spec
sed -i '/find %{buildroot} -type f -name/a install -m 755 -d $RPM_BUILD_ROOT%{_sysconfdir}/bash_completion.d' lxc.spec
sudo sed -i '/sysconfig/s/\*//'     lxc.spec

I don’t think the glob * at the end of:

%config(noreplace) %{_sysconfdir}/sysconfig/*

is needed in the %files section of lxc.spec based on this reference: http://ftp.rpm.org/max-rpm/s1-rpm-inside-files-list.html

where it says in part that

“…if the %files list contains a path to a directory, RPM will automatically package every file in that directory, as well as every file in each subdirectory.”

and because sysconfig has to be created with the “install” directive above in the %install section because it’s nonexistent/empty then it’s better not to use the glob * for the sysconfig part imho.