Reputation: 11
I’m encountering an issue while trying to generate PDFs using Puppeteer on my Ubuntu server. The code seems to be executing without problems, but I keep running into a symbol lookup error
when attempting to launch the Chromium browser.
Here’s the relevant error message I’m receiving:
Error: Failed to launch the browser process!
/root/.cache/puppeteer/chrome/linux-130.0.6723.58/chrome-linux64/chrome: symbol lookup error: /root/.cache/puppeteer/chrome/linux-130.0.6723.58/chrome-linux64/chrome: undefined symbol: snd_device_name_get_hint
This is the code for browser init
browser = await puppeteer.launch({
headless: true,
args: [
'--disable-gpu',
'--disable-features=IsolateOrigins',
'--disable-site-isolation-trials',
'--autoplay-policy=user-gesture-required',
'--disable-background-networking',
'--disable-background-timer-throttling',
'--disable-backgrounding-occluded-windows',
'--disable-breakpad',
'--disable-client-side-phishing-detection',
'--disable-component-update',
'--disable-default-apps',
'--disable-dev-shm-usage',
'--disable-domain-reliability',
'--disable-features=AudioServiceOutOfProcess',
'--disable-hang-monitor',
'--disable-ipc-flooding-protection',
'--disable-notifications',
'--disable-offer-store-unmasked-wallet-cards',
'--disable-popup-blocking',
'--disable-print-preview',
'--disable-prompt-on-repost',
'--disable-renderer-backgrounding',
'--disable-setuid-sandbox',
'--disable-speech-api',
'--disable-sync',
'--hide-scrollbars',
'--ignore-gpu-blacklist',
'--metrics-recording-only',
'--mute-audio',
'--no-default-browser-check',
'--no-first-run',
'--no-pings',
'--no-sandbox',
'--no-zygote',
'--password-store=basic',
'--use-gl=swiftshader',
'--use-mock-keychain',
],
ignoreDefaultArgs: ['--disable-extensions'],
userDataDir: './tmp',
});
/root/.cache/puppeteer
).libatk1.0-0
, libasound2
, etc.).libasound2
.Despite these efforts, the issue persists. I'm looking for insights or solutions from the community. Has anyone encountered a similar problem or can you suggest any additional steps I might take to resolve this?
Thank you in advance for your help!
Upvotes: 1
Views: 287
Reputation: 1029
I had the exact same problem. This is not related to the execution of chrome or chromium-driver or sanbox etc. hence not a duplicate problem being discussed in the thread pointed in the comment above.
This is actually related to an incompatibility issue arising from the ALSA lib which is part of the official dependencies of the local chrome downloaded by pyppeteer. list of dependencies is listed here. These dependencies need to be installed manually the downloader won't do it for you.
Since the issue has been raised on ubuntu I will refer to the debian dependencies. There is a dependency libasound2 which is a virtual package which can be installed by installing any of the following packages:
liboss4-salsa-asound2 4.2-build2020-1ubuntu3
libasound2t64 1.2.11-1build2 (= 1.2.11-1build2)
The thing you need to ensure is to use libasound2t64 and not the former.
sudo apt install libasound2t64
Ofcourse you need to install the rest of the dependencies as well in as mentioned in the official docs. If you are not sure which dependencies you are missing you can run:
ldd /<your-user>/.local/share/pyppeteer/local-chromium/<id>/chrome-linux/chrome | grep "not found"
This path will be different for you installation and will be shown by the pyppeteer downloader when you run launch for the first time
With all this in place your local chrome should start getting launched. You may have to additionally pass --no-sandbox argument during launch.
await launch(args=['--no-sandbox'])
Hope this helps someone who is facing an incompatible dependency issue.
Upvotes: 0