Puppeteer Cluster Launch Failure: 'Cannot initiate browser, error: kill EACCES' on Ubuntu 24.04

I’m encountering an issue while attempting to start a Puppeteer Cluster on Ubuntu 24.04. The error displayed is as follows:

Error creating puppeteer cluster: Cannot initiate browser, error: kill EACCES

Here’s what I’ve tried to resolve this problem:

  1. Reinstalled chromium multiple times and confirmed the installation path.
  2. Installed necessary dependencies:
    libaacs0 libass9 libavcodec60 libavformat60 libavutil58 libbdplus0 libblas3 libbluray2 libbs2b0 libchromaprint1 libcjson1 libcodec2-1.2 libgfortran5 libgme0 libgsm1 liblapack3 liblilv-0-0 libmbedcrypto7t64 libmysofa1 libnorm1t64 libopenmpt0t64 liboss4-salsa2 libpgm-5.3-0t64 libplacebo338 libpocketsphinx3 libpostproc57 librabbitmq4 librist4 librubberband2 libserd-0-0 libshine3 libsnappy1v5 libsord-0-0 libsoxr0 libsphinxbase3t64 libsratom-0-0 libsrt1.5-gnutls libssh-gcrypt-4 libswresample4 libswscale7 libudfread0 libunibreak5 libvdpau1 libvidstab1.1 libvpl2 libx265-199 libxvidcore4 libzimg2 libzix-0-0 libzmq5 libzvbi-common libzvbi0t64 mesa-vdpau-drivers pocketsphinx-en-us vdpau-driver-all
    
  3. Specified the executablePath: I’ve set it to /snap/bin/chromium within my Puppeteer configurations.
  4. Made the Chromium binary executable:
    chmod +x /snap/bin/chromium
    
  5. Removed package-lock.json and reinstalled all packages.

Here is an example of my Puppeteer setup code:

const initializePuppeteer = async () => {
  try {
    const options = {
      headless: true,
      args: [
        '--no-sandbox',
        '--disable-gpu',
        '--disable-dev-shm-usage',
        '--disable-setuid-sandbox',
      ],
      executablePath: process.env.BROWSER_PATH || '/snap/bin/chromium',
    };

    const browser = await Cluster.launch({
      concurrency: Cluster.CONCURRENCY_CONTEXT,
      maxConcurrency: 10,
      puppeteerOptions: options,
      timeout: 10000000,
    });
    return browser;
  } catch (error) {
    console.error('Error setting up the puppeteer cluster', error.message);
  }
};

Despite following these steps, I am still encountering the kill EACCES error. What additional solutions can I explore to eliminate this issue?

OS Information:

  • Ubuntu 24.04

Puppeteer Versions:

  • Puppeteer: ^21.8.0,
  • Puppeteer Cluster: ^0.23.0,
  • Puppeteer Core: ^13.0.1

Node.js Version: 18
Chromium Installed via Snap: /snap/bin/chromium

What could I be missing, or do you have alternative suggestions to troubleshoot this problem?

Hi HappyDancer99,

It sounds like you've already covered a lot of ground. The EACCES error typically relates to permission issues. Here's a few more actions you can take to resolve it:

  1. Verify Chromium Permissions: Ensure that the Chromium binary has the right permissions:
    sudo chmod 755 /snap/bin/chromium
    
  2. Check AppArmor: Ubuntu's AppArmor might be blocking Chromium's execution. Try checking if there's a relevant policy applied by running:
    sudo aa-status | grep chromium
    
    If an AppArmor profile is restricting it, consider configuring or disabling it temporarily while testing.
  3. Run as Non-root: Make sure that your script isn't trying to run as the root user, as this can cause sandboxing issues with Chromium.
  4. Use the Official Chromium Package: Instead of using the Snap version, try installing the official Chromium package via:
    sudo apt install chromium-browser
    
    Adjust your executablePath accordingly.
  5. Alternative Puppeteer Setup: If possible, try installing a standalone version of Chromium compatible with Puppeteer:
    const browserFetcher = puppeteer.createBrowserFetcher();
    await browserFetcher.download('some-revision');
    
    Then point executablePath to this version.

Hopefully, one of these suggestions helps to resolve your issue. Let me know if you need further assistance!