title: Chrome fails to load shared libraries: libX11.so.6
body: <p>We have a Docker file that worked as late as 22 December 2020, but all of a sudden it crashes in runtime if we build the same Docker file again and the exception is:</p>
  <pre><code>PuppeteerSharp.ProcessException: Failed to launch Base! /app/.local-chromium/Linux-706915/chrome-linux/chrome: error while loading shared libraries: libX11.so.6: cannot open shared object file: No such file or directory
  </code></pre>
  <p>This is the relevant part of the docker file:</p>
  <pre><code>FROM mcr.microsoft.com/dotnet/core/aspnet:3.1-buster-slim AS base
  WORKDIR /app
  EXPOSE 80
  EXPOSE 443
  
  #Excluded since it is not relevant
  
  #####################
  #PUPPETEER RECIPE
  #####################
  RUN apt-get update &amp;&amp; apt-get install -y \
      apt-transport-https \
      ca-certificates \
      curl \
      gnupg \
      --no-install-recommends \
      &amp;&amp; curl -sSL https://dl.google.com/linux/linux_signing_key.pub | apt-key add - \
      &amp;&amp; echo &quot;deb https://dl.google.com/linux/chrome/deb/ stable main&quot; &gt; /etc/apt/sources.list.d/google-chrome.list \
      &amp;&amp; apt-get update &amp;&amp; apt-get install -y \
      google-chrome-beta \
      fontconfig \
      fonts-ipafont-gothic \
      fonts-wqy-zenhei \
      fonts-thai-tlwg \
      fonts-kacst \
      fonts-symbola \
      fonts-noto \
      fonts-freefont-ttf \
      --no-install-recommends \
      &amp;&amp; apt-get purge --auto-remove -y curl gnupg \
      &amp;&amp; rm -rf /var/lib/apt/lists/*
  
  #####################
  #END PUPPETEER RECIPE
  #####################
  
  ENV PUPPETEER_EXECUTABLE_PATH &quot;/usr/bin/google-chrome-beta&quot;
  
  WORKDIR /app
  COPY --from=publish /app/publish .
  ENTRYPOINT [&quot;dotnet&quot;, &quot;Our.File.dll&quot;]
  </code></pre>
  <p>I'm by no means experienced Docker/Linux developer, but we have this is production working well for almost a year now.</p>
  <p>When searching for the problem we have found many things to try. Among the things I have tried and all failed are these:</p>
  <ol>
  <li><a href="https://stackoverflow.com/a/64293743/6743788">https://stackoverflow.com/a/64293743/6743788</a></li>
  <li>Manually adding dependencies (tried it before and after our RUN apt-get above):</li>
  </ol>
  <pre><code>RUN apt-get update &amp;&amp; apt-get install -y \
            gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 \
            libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \
            libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 \
            libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 \
            ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
  
  </code></pre>
  <p>This suggestion was first found here: <a href="https://medium.com/@ssmak/how-to-fix-puppetteer-error-while-loading-shared-libraries-libx11-xcb-so-1-c1918b75acc3" rel="nofollow noreferrer">https://medium.com/@ssmak/how-to-fix-puppetteer-error-while-loading-shared-libraries-libx11-xcb-so-1-c1918b75acc3</a>
  When watching the build output, we noticed that most of the dependencies already existed with the latest version.</p>
  <ol start="3">
  <li>Tried to specify an older version of Chrome (we have tried with a couple of different versions):</li>
  </ol>
  <pre><code>#####################
  #PUPPETEER RECIPE
  #####################
  ARG CHROME_VERSION=&quot;81.0.4044.138-1&quot;
  RUN apt-get update &amp;&amp; apt-get -f install &amp;&amp; apt-get -y install wget gnupg2 apt-utils
  RUN wget --no-verbose -O /tmp/chrome.deb http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb \
  &amp;&amp; apt-get update \
  &amp;&amp; apt-get install -y /tmp/chrome.deb --no-install-recommends --allow-downgrades fonts-ipafont-gothic fonts-wqy-zenhei fonts-thai-tlwg fonts-kacst fonts-freefont-ttf \
  &amp;&amp; rm /tmp/chrome.deb
  
  #####################
  #END PUPPETEER RECIPE
  #####################
  </code></pre>
  <ol start="4">
  <li>Tried 3 plus 2 together</li>
  <li>Also tried to add <code>libgbm-dev</code> to the dependency list because we found that somewhere.</li>
  </ol>
  <p>I have tried to verify that the files exist in the docker file by running these commands (and their output) in the container:</p>
  <pre><code>root@5c47052da1d8:/app# dpkg-query -L libx11-6
  /.
  /usr
  /usr/lib
  /usr/lib/x86_64-linux-gnu
  /usr/lib/x86_64-linux-gnu/libX11.so.6.3.0
  /usr/share
  /usr/share/doc
  /usr/share/doc/libx11-6
  /usr/share/doc/libx11-6/NEWS.Debian.gz
  /usr/share/doc/libx11-6/NEWS.gz
  /usr/share/doc/libx11-6/changelog.Debian.gz
  /usr/share/doc/libx11-6/changelog.gz
  /usr/share/doc/libx11-6/copyright
  /usr/share/lintian
  /usr/share/lintian/overrides
  /usr/share/lintian/overrides/libx11-6
  /usr/lib/x86_64-linux-gnu/libX11.so.6
  root@5c47052da1d8:/app# ls -la /usr/lib/x86_64-linux-gnu/libX11.so.6
  lrwxrwxrwx 1 root root 15 Sep 11 16:16 /usr/lib/x86_64-linux-gnu/libX11.so.6 -&gt; libX11.so.6.3.0
  root@5c47052da1d8:/app# ldd libX11.so.6
  ldd: ./libX11.so.6: No such file or directory
  root@5c47052da1d8:/app# ldd /usr/lib/x86_64-linux-gnu/libX11.so.6
          linux-vdso.so.1 (0x00007ffc432b3000)
          libxcb.so.1 =&gt; /usr/lib/x86_64-linux-gnu/libxcb.so.1 (0x00007fe8b0ad2000)
          libdl.so.2 =&gt; /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fe8b0acd000)
          libc.so.6 =&gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007fe8b090c000)
          libXau.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXau.so.6 (0x00007fe8b0708000)
          libXdmcp.so.6 =&gt; /usr/lib/x86_64-linux-gnu/libXdmcp.so.6 (0x00007fe8b0502000)
          /lib64/ld-linux-x86-64.so.2 (0x00007fe8b0c45000)
          libbsd.so.0 =&gt; /usr/lib/x86_64-linux-gnu/libbsd.so.0 (0x00007fe8b04e8000)
          librt.so.1 =&gt; /lib/x86_64-linux-gnu/librt.so.1 (0x00007fe8b04dc000)
          libpthread.so.0 =&gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fe8b04bb000)
  </code></pre>
  <p>I have read <a href="https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md" rel="nofollow noreferrer">https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md</a></p>
  <p>Any help would be greatly appreciated, because I've got no clue how to solve this or what to try next.</p>