Reputation: 1419
I am trying to install Chrome (to use with Chromedriver / selenium) on an AWS EC2 instance and getting an error I've never seen before. I am able to reproduce consistently but can't find anything on Google about what to do.
Steps to reproduce:
wget https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
sudo yum install -y ./google-chrome-stable_current_*.rpm
google-chrome &
And I get the following errors:
[1122/164219.101517:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1122/164219.101672:ERROR:file_io_posix.cc(144)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
Would really appreciate any advice on this - thank you!
Upvotes: 11
Views: 8940
Reputation: 111
Running Chrome with default options require GUI available on the machine. In your local machine you likely have it, thus executing google-chrome &
will start the browser without any problems.
But EC2 instances are not shipped with GUI out of the box. So we're coming to the case when Chrome requests some GUI-related resources from the host -> these resources are not available -> Chrome crashes.
There are two ways to solve the problem depending on your needs:
See more about headless Chrome here
If that's what you need, just execute google-chrome --headless --remote-debugging-port=9222 &
in your shell. I used default port as an example, but it can be changed.
You may trick Chrome by letting it think that there is a GUI available on the host, so it can be launched in the same way as on your local machine. In order to achieve this you should:
google-chrome &
If you have Jenkins jobs that require Chrome GUI, you should follow the second approach, but please make sure:
jenkins
userUpvotes: 2
Reputation: 1980
Seems you hit this open bug https://bugs.chromium.org/p/chromium/issues/detail?id=1228625 (at the moment of writing this) try to use a old version http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_93.0.4577.82-1_amd64.deb which some users reported is working.
Upvotes: 5