thegreatt
thegreatt

Reputation: 1419

Error installing Chrome on AWS EC2 Linux Instance: scaling_cur_freq & scaling_max_freq not found

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:

  1. Start a new EC2 Instance (Amazon Linux 2, 64-bit x86, t2.Micro)
  2. Connect to the instance and run the following commands:
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

Answers (2)

Vadym
Vadym

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:

Run Chrome in headless mode

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.

Install a virtual desktop

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:

  1. Install VNC server or similar on the EC2 instance. I've found this wonderful step-by-step guide
  2. Connect to your EC2 instance using VNC client
  3. Start terminal and run google-chrome &

Chrome GUI in Jenkins jobs

If you have Jenkins jobs that require Chrome GUI, you should follow the second approach, but please make sure:

  • VNC server or similar is setup on behalf of jenkins user
  • Chrome is not being started with super-user privileges
  • Your job uses Xvnc Jenkins plugin or similar, depending on the tool installed

Upvotes: 2

Jinxmcg
Jinxmcg

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

Related Questions