question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Bazel HEAD build fails on Ubuntu 16.04.2 LTS VirtualBox VM

See original GitHub issue

Description of the problem / feature request / question:

Compiling the latest version of Bazel from HEAD (commit https://github.com/bazelbuild/bazel/commit/97975603e5ff2247e6bb352e3afd27fea38f108d as of time of me writing this), with the command bazel build //src:bazel, fails with the following error.

jonathan@jonathan-VirtualBox:~/dev/bazel$ bazel build //src:bazel
............................
WARNING: /home/jonathan/dev/bazel/tools/build_defs/docker/docker.bzl:19:1: The docker_{build,bundle} rules bundled with Bazel are deprecated in favor of:
https://github.com/bazelbuild/rules_docker. Please change BUILD loads to reference: @io_bazel_rules_docker//docker:docker.bzl and add the following to your WORKSPACE:
git_repository(
    name = "io_bazel_rules_docker",
    remote = "https://github.com/bazelbuild/rules_docker.git",
    commit = "...",
)
load("@io_bazel_rules_docker//docker:docker.bzl", "docker_repositories")
docker_repositories().
INFO: Found 1 target...
ERROR: /home/jonathan/dev/bazel/src/main/tools/BUILD:42:1: C++ compilation of rule '//src/main/tools:linux-sandbox' failed: Process exited with status 1 [sandboxed].
src/main/tools/linux-sandbox-pid1.cc:193: "mount(/tmp, /tmp, NULL, MS_BIND, NULL)": Invalid argument
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //src:bazel failed to build
Use --verbose_failures to see the command lines of failed build steps.
INFO: Elapsed time: 10.990s, Critical Path: 0.11s

Running bazel clean --expunge && bazel shutdown beforehand or restarting the virtual machine (see Environment Info) do not seem to resolve the problem.

FWIW, bash ./compile.sh compile /usr/bin/bazel works with no problems.

If possible, provide a minimal example to reproduce the problem:

Environment info

  • Operating System: Ubuntu 16.04.2 LTS. Running as a guest in VirtualBox 5.1.20, itself running on Windows 7.

  • Bazel version (output of bazel info release): release 0.5.0

Have you found anything relevant by searching the web?

I have tried searching the GitHub issues with the search terms sandbox and build, but AFAICT there’s no pre-existing bug report that matches or seems similar enough to the problem that I’m experiencing.

Anything else, information or logs or outputs that would be helpful?

Running bazel build //src:bazel --verbose_failures generates the following output:

jonathan@jonathan-VirtualBox:~/dev/bazel$ bazel build //src:bazel --verbose_failures
WARNING: /home/jonathan/dev/bazel/tools/build_defs/docker/docker.bzl:19:1: The docker_{build,bundle} rules bundled with Bazel are deprecated in favor of:
https://github.com/bazelbuild/rules_docker. Please change BUILD loads to reference: @io_bazel_rules_docker//docker:docker.bzl and add the following to your WORKSPACE:
git_repository(
    name = "io_bazel_rules_docker",
    remote = "https://github.com/bazelbuild/rules_docker.git",
    commit = "...",
)
load("@io_bazel_rules_docker//docker:docker.bzl", "docker_repositories")
docker_repositories().
INFO: Found 1 target...
ERROR: /home/jonathan/dev/bazel/src/main/tools/BUILD:3:1: C++ compilation of rule '//src/main/tools:logging' failed: gcc failed: error executing command 
  (exec env - \
    PWD=/proc/self/cwd \
  /usr/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/usr/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer '-std=c++0x' -MD -MF bazel-out/local-fastbuild/bin/src/main/tools/_objs/logging/src/main/tools/logging.pic.d '-frandom-seed=bazel-out/local-fastbuild/bin/src/main/tools/_objs/logging/src/main/tools/logging.pic.o' -fPIC -iquote . -iquote bazel-out/local-fastbuild/genfiles -iquote external/bazel_tools -iquote bazel-out/local-fastbuild/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE__="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/tools/logging.cc -o bazel-out/local-fastbuild/bin/src/main/tools/_objs/logging/src/main/tools/logging.pic.o)

Use --sandbox_debug to see verbose messages from the sandbox.
src/main/tools/linux-sandbox-pid1.cc:193: "mount(/tmp, /tmp, NULL, MS_BIND, NULL)": Invalid argument
Use --strategy=CppCompile=standalone to disable sandboxing for the failing actions.
Target //src:bazel failed to build
INFO: Elapsed time: 0.465s, Critical Path: 0.08s

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:15 (13 by maintainers)

github_iconTop GitHub Comments

1reaction
philwocommented, Jun 5, 2017

@Helcaraxan A fix for this has been submitted by a colleague and should land in the GitHub repo later today. 😃 I tagged it with this bug so it will automatically be pinged.

Would be appreciated if you could build Bazel from HEAD then and give it a try to make sure that it really solves the issue for you.

1reaction
jbduncancommented, May 27, 2017

Upgrading to VirtualBox 5.1.22 and updating the Guest Additions within my Ubuntu VM to 5.1.22 seem to have no effect.

Furthermore, manually deleting the contents of ~/.cache/bazel/ and running bazel clean --expunge && bazel shutdown && bazel build //src:bazel also has no effect.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Installing Bazel on Ubuntu
This page describes the options for installing Bazel on Ubuntu. It also provides links to the Bazel completion scripts and the binary ...
Read more >
Reboot fails after 16.04 installation on Virtualbox VM [duplicate]
After you have fully booted into your VM open a terminal and type sudo su to become root (you will be prompted for...
Read more >
17596 (Critical Error occurs when trying to build Ubuntu 16.04.4)
It's titled "VirtualBox - Guru Meditation ". It says "A critical error has occurred while running the virtual machine and the machine execution...
Read more >
How to run an Ubuntu Desktop virtual machine using ...
For this tutorial, we will use the latest Ubuntu 22.10 release. image. Download and install VirtualBox. Duration: 5:00. You can download VirtualBox from...
Read more >
How to get and install Ubuntu 16.04 on VirtualBox - Tutorial
Ubuntu 16.04.2 LTS (Xenial Xerus) desktop ISO download (x64):http://releases. ubuntu.com/16.04/ ubuntu - 16.04.2 -desktop-amd64.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found