Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reconfigure APT after manual installation of google-chrome-stable #1959

Merged
merged 2 commits into from
Apr 27, 2024

Conversation

PanisSupraOmnia
Copy link
Contributor

After the recent changes in #1932, the Chrome Web Driver installation script fails. This PR fixes this by ensuring that apt-get is called with --fix-broken install afterwards, to ensure that the dependencies are resolved and google-chrome-stable is actually configured.

@browner12
Copy link
Contributor

Is there anything unique in your Homestead setup, because the web driver installation succeeds fine for me.

I don't fully understand what this change is doing. Can you explain a little more what the additional line is supposed to do?

@PanisSupraOmnia
Copy link
Contributor Author

While our setup is customized, I can replicate it with a basic example. Below are the steps I used.

In an empty folder:

  1. composer create-project laravel/laravel example-app
  2. cd example-app && composer require laravel/dusk --dev

On a clean copy of Homestead main (e.g. git checkout main && git checkout . && git clean -xdf):

  1. bash init.sh
  2. Edit Homestead.yaml to point to example-app from the previous steps
  3. vagrant up

The error occurs during this step:

if [[ "$ARCH" != "aarch64" ]]; then
wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb
dpkg -i /tmp/chrome.deb
rm -f /tmp/chrome.deb
fi

Click here to see the relevant part of the output.
    homestead: Selecting previously unselected package google-chrome-stable.
    homestead: (Reading database ... 85746 files and directories currently installed.)
    homestead: Preparing to unpack /tmp/chrome.deb ...
    homestead: Unpacking google-chrome-stable (122.0.6261.94-1) ...
    homestead: dpkg: dependency problems prevent configuration of google-chrome-stable:
    homestead:  google-chrome-stable depends on libasound2 (>= 1.0.17); however:
    homestead:   Package libasound2 is not installed.
    homestead:  google-chrome-stable depends on libatk-bridge2.0-0 (>= 2.5.3); however:
    homestead:   Package libatk-bridge2.0-0 is not installed.
    homestead:  google-chrome-stable depends on libatk1.0-0 (>= 2.2.0); however:
    homestead:   Package libatk1.0-0 is not installed.
    homestead:  google-chrome-stable depends on libatspi2.0-0 (>= 2.9.90); however:
    homestead:   Package libatspi2.0-0 is not installed.
    homestead:  google-chrome-stable depends on libgbm1 (>= 17.1.0~rc2); however:
    homestead:   Package libgbm1 is not installed.
    homestead:  google-chrome-stable depends on libgtk-3-0 (>= 3.9.10) | libgtk-4-1; however:
    homestead:   Package libgtk-3-0 is not installed.
    homestead:   Package libgtk-4-1 is not installed.
    homestead:  google-chrome-stable depends on libu2f-udev; however:
    homestead:   Package libu2f-udev is not installed.
    homestead:  google-chrome-stable depends on libvulkan1; however:
    homestead:   Package libvulkan1 is not installed.
    homestead:  google-chrome-stable depends on libxcomposite1 (>= 1:0.4.4-1); however:
    homestead:   Package libxcomposite1 is not installed.
    homestead:  google-chrome-stable depends on libxdamage1 (>= 1:1.1); however:
    homestead:   Package libxdamage1 is not installed.
    homestead:  google-chrome-stable depends on libxfixes3; however:
    homestead:   Package libxfixes3 is not installed.
    homestead:  google-chrome-stable depends on libxkbcommon0 (>= 0.5.0); however:
    homestead:   Package libxkbcommon0 is not installed.
    homestead:  google-chrome-stable depends on libxrandr2; however:
    homestead:   Package libxrandr2 is not installed.
    homestead:  google-chrome-stable depends on xdg-utils (>= 1.0.2); however:
    homestead:   Package xdg-utils is not installed.
    homestead: 
    homestead: dpkg: error processing package google-chrome-stable (--install):
    homestead:  dependency problems - leaving unconfigured
    homestead: Processing triggers for mailcap (3.70+nmu1ubuntu1) ...
    homestead: Processing triggers for man-db (2.10.2-1) ...
    homestead: Errors were encountered while processing:
    homestead:  google-chrome-stable
    homestead: Reading package lists...
    homestead: Building dependency tree...
    homestead: Reading state information...
    homestead: libxrender1 is already the newest version (1:0.9.10-1build4).
    homestead: libxrender1 set to manually installed.
    homestead: libnss3 is already the newest version (2:3.68.2-0ubuntu1.2).
    homestead: libnss3 set to manually installed.
    homestead: libxpm4 is already the newest version (1:3.5.12-1ubuntu0.22.04.2).
    homestead: libxpm4 set to manually installed.
    homestead: imagemagick is already the newest version (8:6.9.11.60+dfsg-1.3ubuntu0.22.04.3).
    homestead: You might want to run 'apt --fix-broken install' to correct these.
    homestead: The following packages have unmet dependencies:
    homestead:  google-chrome-stable : Depends: libasound2 (>= 1.0.17)
    homestead:                         Depends: libatk-bridge2.0-0 (>= 2.5.3) but it is not going to be installed
    homestead:                         Depends: libatk1.0-0 (>= 2.2.0) but it is not going to be installed
    homestead:                         Depends: libatspi2.0-0 (>= 2.9.90) but it is not going to be installed
    homestead:                         Depends: libgbm1 (>= 17.1.0~rc2) but it is not going to be installed
    homestead:                         Depends: libgtk-3-0 (>= 3.9.10) but it is not going to be installed or
    homestead:                                  libgtk-4-1 but it is not going to be installed
    homestead:                         Depends: libu2f-udev but it is not going to be installed
    homestead:                         Depends: libvulkan1 but it is not going to be installed
    homestead:                         Depends: libxcomposite1 (>= 1:0.4.4-1) but it is not going to be installed
    homestead:                         Depends: libxdamage1 (>= 1:1.1) but it is not going to be installed
    homestead:                         Depends: libxfixes3 but it is not going to be installed
    homestead:                         Depends: libxkbcommon0 (>= 0.5.0) but it is not going to be installed
    homestead:                         Depends: libxrandr2 but it is not going to be installed
    homestead:                         Depends: xdg-utils (>= 1.0.2) but it is not going to be installed
    homestead:  gtk2-engines-pixbuf : Depends: libgdk-pixbuf-2.0-0 (>= 2.22.1) but it is not going to be installed
    homestead:  libgconf-2-4 : Depends: gconf2-common (= 3.2.6-7ubuntu2) but it is not going to be installed
    homestead:                 Recommends: gconf-service but it is not going to be installed
    homestead:  libgtk2.0-0 : Depends: libgtk2.0-common but it is not going to be installed
    homestead:                Depends: libatk1.0-0 (>= 1.32.0) but it is not going to be installed
    homestead:                Depends: libgdk-pixbuf-2.0-0 (>= 2.22.1) but it is not going to be installed
    homestead:                Depends: libxcomposite1 (>= 1:0.4.5) but it is not going to be installed
    homestead:                Depends: libxcursor1 (> 1.1.2) but it is not going to be installed
    homestead:                Depends: libxdamage1 (>= 1:1.1) but it is not going to be installed
    homestead:                Depends: libxfixes3 but it is not going to be installed
    homestead:                Depends: libxi6 but it is not going to be installed
    homestead:                Depends: libxinerama1 (>= 2:1.1.4) but it is not going to be installed
    homestead:                Depends: libxrandr2 (>= 2:1.5.0) but it is not going to be installed
    homestead:                Depends: adwaita-icon-theme but it is not going to be installed or
    homestead:                         gnome-icon-theme but it is not going to be installed
    homestead:                Recommends: libgail-common but it is not going to be installed
    homestead:                Recommends: librsvg2-common but it is not going to be installed
    homestead:                Recommends: libgtk2.0-bin but it is not going to be installed
    homestead:  x11-apps : Depends: libxcursor1 (> 1.1.2) but it is not going to be installed
    homestead:             Depends: libxft2 (> 2.1.1) but it is not going to be installed
    homestead:             Depends: libxkbfile1 (>= 1:1.1.0) but it is not going to be installed
    homestead:             Recommends: xbitmaps but it is not going to be installed
    homestead:  xfonts-100dpi : Depends: xfonts-utils but it is not going to be installed
    homestead:  xfonts-75dpi : Depends: xfonts-utils but it is not going to be installed
    homestead:  xfonts-base : Depends: xfonts-utils (>= 1:7.5+2) but it is not going to be installed
    homestead:  xfonts-cyrillic : Depends: xfonts-utils but it is not going to be installed
    homestead:  xfonts-scalable : Depends: xfonts-utils but it is not going to be installed
    homestead:  xvfb : Depends: xserver-common (>= 2:21.1.4-2ubuntu1.7~22.04.8) but it is not going to be installed
    homestead:         Depends: libgl1 but it is not going to be installed
    homestead:         Depends: libxfont2 (>= 1:2.0.1) but it is not going to be installed
    homestead:         Depends: x11-xkb-utils but it is not going to be installed
    homestead:         Recommends: libgl1-mesa-dri but it is not going to be installed
    homestead: E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution).
The SSH command responded with a non-zero exit status. Vagrant
assumes that this means the command failed. The output for this command
should be in the log above. Please read the output to determine what
went wrong.

@browner12, are you using an ARM Mac? If so that would explain why you can't reproduce the issue, since the problem command is skipped on AArch64.

@browner12
Copy link
Contributor

Thanks for the explanation. Yes, I am on an ARM Mac.

@vintagesucks
Copy link

@browner12 You can reproduce the issue on an ARM Mac using Docker:

docker run -it --rm --platform linux/amd64 ubuntu:jammy

Running the following in Docker will cause the error described above:

apt-get update \
  && apt-get install -y wget \
  && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb \
  && dpkg -i /tmp/chrome.deb

I don't use Homestead anymore and stumbled across this PR by chance, but I would suggest the following change to fix it:

-dpkg -i /tmp/chrome.deb
+apt-get install -y /tmp/chrome.deb

The following will work inside the amd64 docker image:

apt-get update \
  && apt-get install -y wget \
  && wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb -O /tmp/chrome.deb \
  && apt-get install -y /tmp/chrome.deb

@PanisSupraOmnia
Copy link
Contributor Author

@vintagesucks I think I went with doing it this way assuming there was a reason dpkg was used directly, but just using apt-get is definitely a lot cleaner than adding it in a separate step, and I don't see a reason not to.

Copy link
Contributor

@svpernova09 svpernova09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@svpernova09 svpernova09 merged commit 21bd6f2 into laravel:main Apr 27, 2024
4 checks passed
@PanisSupraOmnia PanisSupraOmnia deleted the fix/webdriver-install branch April 27, 2024 09:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants