4

I tried to use update-alternatives to set Chromium as default web browser by the following command. Although I successfully added '/snap/bin/chromium' into --config, it didn't work.

levi@Lab-XPS:~$ sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /snap/bin/chromium 200

levi@Lab-XPS:~$ sudo update-alternatives --config x-www-browser 
There are 2 choices for the alternative x-www-browser (providing /usr/bin/x-www-browser).

  Selection    Path                Priority   Status
------------------------------------------------------------
  0            /snap/bin/chromium   200       auto mode
  1            /snap/bin/chromium   200       manual mode
* 2            /usr/bin/firefox     40        manual mode

Press <enter> to keep the current choice[*], or type selection number: 0
update-alternatives: using /snap/bin/chromium to provide /usr/bin/x-www-browser (x-www-browser) in auto mode

levi@Lab-XPS:~$ x-www-browser google.com
error: unknown command "google.com", see 'snap help'

Then I found that /snap/bin/chromium is only a symbolic link to a LSB shared object:

levi@Lab-XPS:~$ file /snap/bin/chromium
/snap/bin/chromium: symbolic link to /usr/bin/snap
levi@Lab-XPS:~$ file /usr/bin/snap
/usr/bin/snap: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=ebc3e3ce9d2976e049f84e909f9822e878a39884, stripped

So, is there any solution to deal with the shared object and continue the setting? Or I have to give up using update-alternatives? Thanks.

Levi Wu
  • 66
  • 4

1 Answers1

0

You can create a wrapper script so that snap will detect that it is being run as chromium and launch the browser.

  1. Create /opt/scripts/chromium.wrapper with contents:
#!/usr/bin/env sh
/snap/bin/chromium
  1. Make the script executable.
sudo chmod +x /opt/scripts/chromium.wrapper
  1. Install with update-alternatives
sudo update-alternatives --install /usr/bin/x-www-browser x-www-browser /opt/scripts/chromium.wrapper 200
  1. Repeat for other snap-based applications.
xiota
  • 105
  • 4