AutoGPT icon indicating copy to clipboard operation
AutoGPT copied to clipboard

SYSTEM: Command browse_website returned: Error: Message: Service /home/appuser/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver unexpectedly exited. Status code was: 127

Open psvensson opened this issue 3 years ago • 29 comments

Duplicates

  • [X] I have searched the existing issues

Steps to reproduce 🕹

  1. Build a dockerized version of aouto-gpt
  2. Give it any instruction that leads to it needing to browse_website

Current behavior 😯

SYSTEM: Command browse_website returned: Error: Message: Service /home/appuser/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver unexpectedly exited. Status code was: 127

Expected behavior 🤔

Should be bale to browse website properly

Your prompt 📝

# It really could be any prompt

psvensson avatar Apr 16 '23 08:04 psvensson

Hi, just my two cents: I have the same problem, but with exit code 255. What is strange, is that if we go inside the running container, in /home/appuser, there is no .wdm directory , and if we try to find / -name chrome* in the container, we don't find chromedriver. I've tried to install chromium in the dockerfile, but no luck. I'm still searching...

lab34 avatar Apr 16 '23 09:04 lab34

There was a discussion in the Discord #dev-autogpt channel and one suggestion was that it might be permission issues. The installation process might download the right thing but is not able to save it, or perhaps everything is installed fine, but the docker user is not allowed to either run it or access the files (or both)

psvensson avatar Apr 16 '23 09:04 psvensson

I have now built a new docker image of master with the USER command commented out, so the container user is root, and I get exactly the same error.

this means it is most probably not a security issue but something somewhere which is not installed or configured properly

psvensson avatar Apr 16 '23 10:04 psvensson

Same here, running on Docker on MacOS.

Command browse_website returned: Error: Message: Service /home/appuser/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver unexpectedly exited. Status code was: 255

I found that this error got no history under Issues. One possible solution may be to check recent git commits. (I guess should be limited within half a day)

doem97 avatar Apr 16 '23 10:04 doem97

WTH this repo got too many updates every single hour. Should be related to browse_website file?

doem97 avatar Apr 16 '23 10:04 doem97

Heh yes maybe. OK, I have got some progress. There was some libraries missing. It might be related to a recent name change of the chromium-driver. Hope to solve this soon..

psvensson avatar Apr 16 '23 10:04 psvensson

By adding this to the Dockerfile, I get further;

RUN apt-get install -y libglib2.0 libnss3 libgconf-2-4 libfontconfig1 chromium-driver

The error is now;

WDM] - Downloading: 100%|██████████████████████....█████████████████████████████| 6.75M/6.75M [00:00<00:00, 15.9MB/s]

SYSTEM: Command browse_website returned: Error: Message: unknown error: Chrome failed to start: exited abnormally. (unknown error: DevToolsActivePort file doesn't exist) (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stacktrace: #0 0x5642ba4d1fe3 #1.....

Note that the download succeeds - it downloads 6.75MB data. After that, the error occur. I'm adding progress here in case another intrepid explorer does some research and can help further in case I get stuck.

psvensson avatar Apr 16 '23 11:04 psvensson

I think I found the problem. BY adding some options before starting the chrome webdriver, the problem goies away;

if CFG.selenium_web_browser == "firefox": driver = webdriver.Firefox( executable_path=GeckoDriverManager().install(), options=options ) elif CFG.selenium_web_browser == "safari": # Requires a bit more setup on the users end # See https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari driver = webdriver.Safari(options=options) else: options.add_argument('--no-sandbox') options.add_argument('--window-size=1420,1080') options.add_argument('--headless') options.add_argument('--disable-gpu') driver = webdriver.Chrome( executable_path=ChromeDriverManager().install(), options=options ) driver.get(url)

That's the lines with 'option.add'

This is the first Python code I've ever written/pasted from Google btw :) Will do a PR now..

psvensson avatar Apr 16 '23 11:04 psvensson

Solved by this PR https://github.com/Significant-Gravitas/Auto-GPT/pull/1857

psvensson avatar Apr 16 '23 11:04 psvensson

Solution:

The issue occurred due to missing libraries in the Dockerfile. The solution is to add the required libraries to the Dockerfile.

RUN apt-get install -y libglib2.0 libnss3 libgconf-2-4 libfontconfig1 chromium-driver

Additionally, adding options to the Chrome webdriver also helped to resolve the issue.

options.add_argument('--no-sandbox')
options.add_argument('--window-size=1420,1080')
options.add_argument('--headless')
options.add_argument('--disable-gpu')

These changes have been made in the PR #1857 and it has been merged. Please check if the issue is resolved by updating your code with the changes in the PR.

hemangjoshi37a avatar Apr 16 '23 11:04 hemangjoshi37a

Thank you, no luck for me, I have the same error then before but know, but it's related with the Apple Silicon architecture now, SYSTEM: Command browse_website returned: Error: Message: Service /home/appuser/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver unexpectedly exited. Status code was: 255 So, I connect to the terminal inside the container, and now I see the .wdm directory. If I'm going inside and launch the chromedriver, I have this error:

$ ./chromedriver
qemu-x86_64: Could not open '/lib64/ld-linux-x86-64.so.2': No such file or directory

it send me to this: https://github.com/browserless/chrome/issues/2004 It's true that my Macbook is an M1, so it's another specific issue. So, I've ticked "Use Rosetta..." in docker desktop, and now, when I launch chromedriver, I have rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2 Trace/breakpoint trap So I did export DOCKER_DEFAULT_PLATFORM=linux/amd64 And now I have the status code 127 back and ./chromedriver: error while loading shared libraries: libglib-2.0.so.0: cannot open shared object file: No such file or directory aaarg... :-( endless debugging...

lab34 avatar Apr 16 '23 12:04 lab34

@p-i- I also have same issue, also using docker on an apple M2 macbook...

SYSTEM:  Command browse_website returned: Error: Message: Service /home/appuser/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver unexpectedly exited. Status code was: 255

montanaflynn avatar Apr 18 '23 07:04 montanaflynn

I think I found the problem. BY adding some options before starting the chrome webdriver, the problem goies away;

if CFG.selenium_web_browser == "firefox": driver = webdriver.Firefox( executable_path=GeckoDriverManager().install(), options=options ) elif CFG.selenium_web_browser == "safari": # Requires a bit more setup on the users end # See https://developer.apple.com/documentation/webkit/testing_with_webdriver_in_safari driver = webdriver.Safari(options=options) else: options.add_argument('--no-sandbox') options.add_argument('--window-size=1420,1080') options.add_argument('--headless') options.add_argument('--disable-gpu') driver = webdriver.Chrome( executable_path=ChromeDriverManager().install(), options=options ) driver.get(url)

That's the lines with 'option.add'

This is the first Python code I've ever written/pasted from Google btw :) Will do a PR now..

may i know which .py file you made this change? also new to coding

WangPeterXF avatar Apr 19 '23 07:04 WangPeterXF

This also does not work for me with the latest code on stable.

M1 MBP running in docker.

@WangPeterXF the file he's referring to is commands/web_selenium.py

But the solution did not work for me.

templeman15 avatar Apr 21 '23 18:04 templeman15

I am having the same error on Macbook M1:

Service /home/appuser/.wdm/drivers/chromedriver/linux64/112.0.5615.49/chromedriver unexpectedly exited. Status code was: 255

The issue appeard to be that Chrome Driver is not correctly installed or configured.

martoast avatar Apr 21 '23 23:04 martoast

I too am on an M1.

I set a --platform=linux/amd64 in the Dockerfile FROM --platform=linux/amd64 python:3.10-slim just to see if it would help.

Incredibly slow build, running wasn't too terrible.

SYSTEM:  Command browse_website returned: Error: Message: unknown error: Chrome failed to start: exited abnormally. (chrome not reachable) (The process started from chrome location /usr/bin/chromium is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stacktrace: #0 0x0040006e6fe3 <unknown> #1 0x004000425d36 <unknown> #2 0x00400044eb20 <unknown> #3 0x00400044aa9b <unknown> #4 0x00400048caf7 <unknown> #5 0x00400048c11f <unknown> #6 0x004000483693 <unknown> #7 0x00400045603a <unknown> #8 0x00400045717e <unknown> #9 0x0040006a8dbd <unknown> #10 0x0040006acc6c <unknown> #11 0x0040006b64b0 <unknown> #12 0x0040006add63 <unknown> #13 0x004000680c35 <unknown> #14 0x0040006d1138 <unknown> #15 0x0040006d12c7 <unknown> #16 0x0040006df093 <unknown> #17 0x004002585ea7 start_thread

Nope

interwubs avatar Apr 22 '23 03:04 interwubs

I've had good milage using Seleniarm (Selenium for ARM64) on M1 https://github.com/seleniumhq-community/docker-seleniarm

FROM seleniarm/standalone-chromium:latest

# Install git
USER root
RUN apt-get -y update
RUN apt-get -y install git pip

# Install Xvfb and other dependencies for headless browser testing
RUN apt-get update \
    && apt-get install -y wget gnupg2 libgtk-3-0 libdbus-glib-1-2 dbus-x11 xvfb ca-certificates

# Set environment variables
ENV PIP_NO_CACHE_DIR=yes \
    PYTHONUNBUFFERED=1 \
    PYTHONDONTWRITEBYTECODE=1

# Create a non-root user and set permissions
WORKDIR /home/seluser
RUN chown seluser:seluser /home/seluser
USER seluser

# Copy the requirements.txt file and install the requirements
COPY --chown=seluser:seluser requirements.txt .
RUN sed -i '/Items below this point will not be included in the Docker Image/,$d' requirements.txt && \
	pip install --no-cache-dir --user --break-system-packages -r requirements.txt

# Copy the application files
COPY --chown=seluser:seluser autogpt/ ./autogpt

# Set the entrypoint
ENTRYPOINT ["python3", "-m", "autogpt"]

and override the chromedriver binary path in autogpt/commands/web_selenium.py

        driver = webdriver.Chrome(
            #executable_path=ChromeDriverManager().install(), options=options
            executable_path=r'/usr/bin/chromedriver', options=options
        )

MnrGreg avatar Apr 22 '23 17:04 MnrGreg

wget https://chromedriver.storage.googleapis.com/94.0.4606.41/chromedriver_linux64.zip unzip chromedriver_linux64.zip -d /path/to/directory mkdir ~/bin mv /path/to/chromedriver ~/bin export PATH=$PATH:$HOME/bin

above resolved this issue for me

ornedaj avatar Apr 24 '23 00:04 ornedaj

In the file at location autogpt/commands/web_selenium.py, change line 90 to

driver = webdriver.Chrome( executable_path="/usr/bin/chromedriver", options=options )

and re-build the Docker container. This resolved the issue for me

On Sun, Apr 23, 2023 at 8:53 PM ornedaj @.***> wrote:

wget https://chromedriver.storage.googleapis.com/94.0.4606.41/chromedriver_linux64.zip unzip chromedriver_linux64.zip -d /path/to/directory mkdir ~/bin mv /path/to/chromedriver ~/bin export PATH=$PATH:$HOME/bin

above resolved this issue for me

— Reply to this email directly, view it on GitHub https://github.com/Significant-Gravitas/Auto-GPT/issues/1821#issuecomment-1519228165, or unsubscribe https://github.com/notifications/unsubscribe-auth/AR2D4OAUOH6EVZYVFV3QHRTXCXFG5ANCNFSM6AAAAAAW77EI5A . You are receiving this because you are subscribed to this thread.Message ID: @.***>

barrettj44 avatar Apr 24 '23 21:04 barrettj44

TLDR; [SOLUTION]

  1. Add required libraries to the Dockerfile:

    RUN apt-get install -y libglib2.0 libnss3 libgconf-2-4 libfontconfig1 chromium-driver
    
  2. Add options to the Chrome webdriver in the web_selenium.py file:

    options.add_argument('--no-sandbox')
    options.add_argument('--window-size=1420,1080')
    options.add_argument('--headless')
    options.add_argument('--disable-gpu')
    

except apple M1 chip.

hemangjoshi37a avatar Apr 26 '23 12:04 hemangjoshi37a