WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127

Posted on

Question :

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127

I’d like to construct my crawler using selenium on my server.

Thus I had installed/download required dependencies- such as chromedriver, chromium-browser etc on my Ubuntu17.10 server

However, when I run following code:

driver = webdriver.Chrome()

It returns following error:

---------------------------------------------------------------------------
WebDriverException                        Traceback (most recent call last)
<ipython-input-14-2cdab8938403> in <module>()
----> 1 driver = webdriver.Chrome()

/home/zachary/.local/lib/python3.6/site-packages/selenium/webdriver/chrome/webdriver.py in __init__(self, executable_path, port, options, service_args, desired_capabilities, service_log_path, chrome_options)
     66             service_args=service_args,
     67             log_path=service_log_path)
---> 68         self.service.start()
     69 
     70         try:

/home/zachary/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py in start(self)
     96         count = 0
     97         while True:
---> 98             self.assert_process_still_running()
     99             if self.is_connectable():
    100                 break

/home/zachary/.local/lib/python3.6/site-packages/selenium/webdriver/common/service.py in assert_process_still_running(self)
    109             raise WebDriverException(
    110                 'Service %s unexpectedly exited. Status code was: %s'
--> 111                 % (self.path, return_code)
    112             )
    113 

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127

What does it mean that it’s excited..?

I can’t get what the original intention of that error code and where to start to fix it.

It looks very rare case.

Maybe relevant:

I had install ubuntu desktop 17.10 on my desktop but failed to get GUI boot. Thus I am just using terminal only, but it well works so far.
I had installed ssh and remote controlling jupyter notebook from my mac to server desktop, and those errors comes from it.
Hope this info is relevant to solve this error, otherwise will abort it.

Asked By: delinco

||

Answer #1:

It seems chromedriver needs some extra libraries. This solved the issue for me:

apt-get install -y libglib2.0-0=2.50.3-2 
    libnss3=2:3.26.2-1.1+deb9u1 
    libgconf-2-4=3.2.6-4+b1 
    libfontconfig1=2.11.0-6.7+b1

I was working on a similar setup using a docker container instead of a server/VM without X / GUI.

To figure out which dependencies are required I tried iteratively to run it from the command line like this: /opt/chromedriver/2.33/chromedriver --version over and over again.

Then at eache time I used commands like apt-cache search <STUFF> and apt-cache madison <STUFF> to figure out the exact version of the deb package needed by chromedriver 2.33 (in my case, but I guess something similar would work for any version of chromedriver).

Answered By: TPPZ

Answer #2:

I encountered the same error when using selenium/chromedriver on my VPS. I installed chromium-browser and the problem was gone.

sudo apt-get install -y chromium-browser

Maybe it’s not the chromium-browser is needed, but the packages were installed along with it. However, that was a quick fix.

Answered By: Hieu

Answer #3:

I had a similar issue but it turned out that my problem was incorrectly set service_log_path which was pointing to a deleted folder.

webdriver.Chrome(executable_path='/path/to/chromedriver', service_log_path='/path/to/existing/folder')
Answered By: Jan Havel

Answer #4:

While working with Selenium v3.11.0, ChromeDriver v2.36 and Chrome v64.x you have to download the latest ChromeDriver from the ChromeDriver – WebDriver for Chrome and place it within your system. Next while initializing the WebDriver and the WebBrowser you have to pass the argument executable_path along with the absolute path of the ChromeDriver as follows :

from selenium import webdriver

driver = webdriver.Chrome(executable_path='/path/to/chromedriver')
driver.get("http://www.python.org")
Answered By: DebanjanB

Answer #5:

Solved by carefully removing existing chromedriver and updating it to a newer version:

  1. Delete all existing chromedriver files
  2. Download wget https://chromedriver.storage.googleapis.com/2.46/chromedriver_linux64.zip (replace 2.46 bit to the newer one if needed, see compatible versions here: http://chromedriver.chromium.org/downloads)
  3. Unzip, convert to executable by running chmod +x chromedriver
  4. Move it to mv -f chromedriver /usr/local/bin/chromedriver so it appears in PATH

This should solve an issue. I thought updating doesn’t work because when I first tried it, I didn’t remove the older version and I was still using it accidentally.

Answered By: python481516

Answer #6:

I was receiving the same selenium trace error:

WebDriverException: Message: Service chromedriver unexpectedly exited. Status code was: 127

My issue was due to using a different version of chromedriver (version 78) than browser (version 79) when trying to manually run the chromedriver I would see
Segmentation fault (core dumped)

Once I updated my chromedriver to match the browser it was able to start successfully

Starting ChromeDriver 79.0.3945.36 (3582db32b33893869b8c1339e8f4d9ed1816f143-refs/branch-heads/3945@{#614}) on port 9515

Only local connections are allowed.

Please protect ports used by ChromeDriver and related test frameworks to prevent access by malicious code.

Answered By: TCB919

Answer #7:

I had this same issue, and the problem was due to chromedriver version.

Please ensure You are using latest Chrome Browser along with latest chromedriver.

Answered By: Pratik Patel

Answer #8:

Reverting to older versions might also be a solution…

I am using Ubuntu 18.10 and installed the latest Selenium (3.141.0) and ChromeDriver (75.0.3770.8), but also had the same permission problems, and status code 127 afterwards.

I tried installing Chromium and noticed that Ubuntu was using Version 73. So I reverted from the latest version of Chromedriver (75 at this time), back to Version 73 and that worked for me.

Answered By: S7bvwqX

Leave a Reply

Your email address will not be published.