Sunday, July 10, 2016

`fetch chromium` fails

Fix for: `Command '/usr/bin/python src/build/linux/sysroot_scripts/ --running-as-hook' returned non-zero exit status 1 in /root/chromium-src`.

As part of some R&D for a JS framework I have been thinking of for a while I needed to do some Chromium hacking, problem is I hit a wall just simply attempting to check out the source code. This was on a fresh Debian VM machine following the official checkout docs.

root@lh1:~/chromium-src# fetch --no-history chromium
Running: gclient root
Running: gclient config --spec 'solutions = [
    "url": "",
    "managed": False,
    "name": "src",
    "deps_file": ".DEPS.git",
    "custom_deps": {},
Running: gclient sync --no-history
Error: Command '/usr/bin/python src/build/linux/sysroot_scripts/ --running-as-hook' returned non-zero exit status 1 in /root/chromium-src
Traceback (most recent call last):
  File "/root/depot_tools/", line 353, in 
  File "/root/depot_tools/", line 348, in main
    return run(options, spec, root)
  File "/root/depot_tools/", line 342, in run
    return checkout.init()
  File "/root/depot_tools/", line 142, in init
  File "/root/depot_tools/", line 76, in run_gclient
    return + cmd, **kwargs)
  File "/root/depot_tools/", line 66, in run
    return subprocess.check_output(cmd, **kwargs)
  File "/usr/lib/python2.7/", line 573, in check_output
    raise CalledProcessError(retcode, cmd, output=output)
subprocess.CalledProcessError: Command '('gclient', 'sync', '--no-history')' returned non-zero exit status 2

The solution is to:

  • `export PATH=$PATH:/root/depot_tools`, this one is important or you will get an error when script is processing 'Downloading /root/chromium-src/src/third_party/binutils/Linux_x64/binutils.tar.bz2'.
  • gclient sync --nohooks --no-history chromium which will fetch the code without running hooks code; more info here.
  • Then running `aptitude install sudo` if not already installed
  • `./src/build/ --unsupported --no-syms --no-arm --no-chromeos-fonts --no-nacl`
    • But that will error out with various 'E: Unable to locate package ...' on a Debian system, copy the echoed command and remove the packages from the list manually or use Bash's for loop like so:
    • for i in apache2-bin bison cdbs curl devscripts dpkg-dev elfutils fakeroot flex fonts-indic fonts-thai-tlwg g++ git-core git-svn gperf language-pack-da language-pack-fr language-pack-he language-pack-zh-hant lib32gcc1 lib32stdc++6 libapache2-mod-php5 libasound2 libasound2-dev libatk1.0-0 libav-tools libbluetooth-dev libbrlapi0.6 libbrlapi-dev libbz2-1.0 libbz2-dev libc6 libc6-i386 libcairo2 libcairo2-dev libcap2 libcap-dev libcups2 libcups2-dev libcurl4-gnutls-dev libdrm-dev libelf-dev libexpat1 libffi6 libffi-dev libfontconfig1 libfreetype6 libgbm-dev libgconf2-dev libgl1-mesa-dev libgles2-mesa-dev libglib2.0-0 libglib2.0-dev libglu1-mesa-dev libgnome-keyring0 libgnome-keyring-dev libgtk2.0-0 libgtk2.0-dev libjpeg-dev libkrb5-dev libnspr4 libnspr4-dev libnss3 libnss3-dev libpam0g libpam0g-dev libpango1.0-0 libpci3 libpci-dev libpcre3 libpixman-1-0 libpng12-0 libpulse0 libpulse-dev libsctp-dev libspeechd2 libspeechd-dev libsqlite3-0 libsqlite3-dev libssl-dev libstdc++6 libudev1 libudev-dev libwww-perl libx11-6 libxau6 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxdmcp6 libxext6 libxfixes3 libxi6 libxinerama1 libxkbcommon-dev libxrandr2 libxrender1 libxslt1-dev libxss-dev libxt-dev libxtst6 libxtst-dev mesa-common-dev msttcorefonts openbox patch perl php5-cgi pkg-config python python-cherrypy3 python-crypto python-dev python-numpy python-opencv python-openssl python-psutil python-yaml realpath rpm ruby subversion ttf-dejavu-core ttf-kochi-gothic ttf-kochi-mincho wdiff xcompmgr zip zlib1g; do sudo apt-get install -y $i; done
  • Then finally run `gclient runhooks`.


  1. Thanks a lot! I thought I can do ../depot_tools/gclient so I added depot_tools to my PATH and a roadblock overcome.

  2. In my case it was because of the wget. Since I was compiling chromium in a docker container, there wasn't wget package installed. The error has gone after installing wget.