Chromium

Chromium is an open-source graphical web browser based on the Blink rendering engine. It is the basis for the proprietary Google Chrome browser.

See this page for an explanation of the differences between Chromium and Google Chrome. Additionally:

  • Sync is unavailable in Chromium 89+ (2021-03-02)
Note: Sync can be temporarily restored by using Chrome's OAuth2 credentials or getting your own, but pay attention to the disclaimers and do not consider this to be a long-term solution.

Consider switching to xbrowsersync for bookmarks syncing as long term solution.

See List of applications/Internet#Blink-based for other browsers based on Chromium.

Installation

There are several packages available to install Chromium with:

Google Chrome packages:

Configuration

Default applications

To set Chromium as the default browser and to change which applications Chromium launches when opening downloaded files, see default applications.

Certificates

Chromium uses Network Security Services for certificate management. Certificates can be managed in chrome://settings/certificates.

Making flags persistent

Note: The chromium-flags.conf file and the accompanying custom launcher script are specific to the Arch Linux chromium package. For google-chromeAUR and google-chrome-devAUR, use chrome-flags.conf and chrome-dev-flags.conf instead.

You can put your flags in a file under (or under if you have configured that environment variable) or for global.

No special syntax is used; flags are defined as if they were written in a terminal.

  • The arguments are split on whitespace and shell quoting rules apply, but no further parsing is performed.
  • In case of improper quoting anywhere in the file, a fatal error is raised.
  • Flags can be placed in separate lines for readability, but this is not required.
  • Lines starting with a hash symbol (#) are skipped. (This is only supported by the chromium launcher script and will not work when using with the package.)

Below is an example file that defines the flags :

Force GPU acceleration

By default Chromium on Linux does not use any GPU acceleration. To force GPU acceleration, append the following flags to persistent configuration:

~/.config/chromium-flags.conf
--ignore-gpu-blocklist
--enable-gpu-rasterization
--enable-zero-copy

Additionally the flag may need to be passed to prevent GPU workaround from being used. Flags in should state "Hardware accelerated" when configured and available.

--enable-native-gpu-memory-buffers is broken since mesa 20.1.1

Hardware video acceleration

To enable VA-API support in Chromium:

  • Install the correct VA-API driver for your video card and verify VA-API has been enabled and working correctly, see Hardware video acceleration. For proprietary NVIDIA support, installing or is required.
  • Set the option . This is enough when using ANGLE GL renderer and .
  • When using ANGLE, Chromium forces the older i965 driver and fails when is used. As a workaround, configure VA-API manually. See for details.
  • To use the system GL renderer on Xorg, use either --use-gl=egl or . On XWayland, use the --use-gl=egl flag (Currently exhibits choppiness on some systems).
  • If VA-API still does not work, try the or flag

Tips and tricks

To check if it is working play a video which is using a codec supported by your VA-API driver (vainfo tells you which codecs are supported, but Chromium will only support VP9 and h264):

  • Open the DevTools by pressing or on the Inspect button of the context (right-click) menu
  • Add the Media inspection tab: Hamburger menu > More tools > Media
  • In the newly opened Media tab, look at the hardware decoder state of the video decoder

Test on a large enough video. Starting with version 86, Chromium on desktop will only accelerate videos larger than 720p.

To reduce CPU usage while watching YouTube where VP8/VP9 hardware decoding is not available use the h264ify, enhanced-h264ify or Not yet, AV1 extension.

On some systems (especially on XWayland) you might need to #Force GPU acceleration. Only is enough for our purposes.

You might need to disable the Skia renderer, as it is currently not compatible with video decode acceleration:

KDE integration

For integration into Plasma install chromium-extension-plasma-integrationAUR and the plasma-integration addon. See KDE Plasma Browser Integration for more details.

PDF viewer plugin

Chromium and Google Chrome are bundled with the Chromium PDF Viewer plugin. If you do not want to use this plugin, check Download PDFs in .

Running on XWayland

If you are using NVIDIA's proprietary driver, running Chromium on XWayland may cause the GPU process to occasionally crash. To prevent the GPU process from crashing, add the following flags:

--use-angle=vulkan --use-cmd-decoder=passthrough
Note: This does not prevent all XWayland-related crashes.

Native Wayland support

Since version 97, native Wayland support in Chromium can be enabled with the following flags :

--ozone-platform-hint=auto

If this doesn't work, e.g. on version 106 under Weston, then use:

--ozone-platform=wayland

See #Making flags persistent for a permanent configuration. The flag is also available via browser flags menu.

This will select wayland Ozone backend when in wayland session, so you can use a single desktop entry if you switch between X11 and Wayland often.

Tips and tricks

The following tips and tricks should work for both Chromium and Chrome unless explicitly stated.

chrome:// URLs

A number of tweaks can be accessed via Chrome URLs. See chrome://chrome-urls for a complete list.

  • chrome://flags - access experimental features such as WebGL and rendering webpages with GPU, etc.
  • chrome://extensions - view, enable and disable the currently used Chromium extensions.
  • chrome://gpu - status of different GPU options.
  • chrome://sandbox - indicate sandbox status.
  • chrome://version - display version and switches used to invoke the active .

An automatically updated, complete listing of Chromium switches (command line parameters) is available here.

Chromium task manager

Shift+ESC can be used to bring up the browser task manager wherein memory, CPU, and network usage can be viewed.

Chromium overrides/overwrites Preferences file

If you enabled syncing with a Google Account, then Chromium will override any direct edits to the Preferences file found under . To work around this, start Chromium with the switch:

$ chromium --disable-sync-preferences

If Chromium is started in the background when you login in to your desktop environment, make sure the command your desktop environment uses is:

$ chromium --disable-sync-preferences --no-startup-window

Search engines

Make sites like wiki.archlinux.org and wikipedia.org easily searchable by first executing a search on those pages, then going to Settings > Search and click the Manage search engines.. button. From there, "Edit" the Wikipedia entry and change its keyword to w (or some other shortcut you prefer). Now searching Wikipedia for "Arch Linux" from the address bar is done simply by entering "w arch linux".

Cache in tmpfs

To limit Chromium from writing its cache to a physical disk, one can define an alternative location via the flag:

$ chromium --disk-cache-dir="$XDG_RUNTIME_DIR/chromium-cache"

Cache should be considered temporary and will not be saved after a reboot or hard lock. Another option is to setup the space in :

/etc/fstab
tmpfs	/home/''username''/.cache	tmpfs	noatime,nodev,nosuid,size=400M	0	0
Profile in tmpfs

Relocate the browser profile to a tmpfs filesystem, including , or /dev/shm for improvements in application response as the entire profile is now stored in RAM.

Use an active profile management tool such as for maximal reliability and ease of use. It symlinks or bind mounts and syncs the browser profile directories to RAM. For more, see Profile-sync-daemon.

Launch a new browser instance

When you launch the browser, it first checks if another instance using the same data directory is already running. If there is one, the new window is associated with the old instance. If you want to launch an independent instance of the browser, you must specify separate directory using the parameter:

$ chromium --user-data-dir=/path/to/some/directory

By default, Chromium downloads files directly and you need to click the notification from the bottom-left corner of the screen in order for the file to be opened with your default torrent client. This can be avoided with the following method:

  • Download a file.
  • Right-click the notification displayed at the bottom-left corner of the screen.
  • Check the "Always Open Files of This Type" checkbox.

See xdg-open to change the default assocation.

Touch Scrolling on touchscreen devices

You may need to specify which touch device to use. Find your touchscreen device with then launch Chromium with the parameter, where "x" is the id of your device.

Reduce memory usage

By default, Chromium uses a separate OS process for each instance of a visited web site. However, you can specify command-line switches when starting Chromium to modify this behaviour.

For example, to share one process for all instances of a website:

$ chromium --process-per-site

To use a single process model:

$ chromium --single-process

In addition, you can suspend or store inactive Tabs with extensions such as Tab Suspender and OneTab.

User Agent

The User Agent can be arbitrarily modified at the start of Chromium's base instance via its --user-agent="[string]" parameter.

DOM Distiller

Chromium has a similar reader mode to Firefox. In this case it is called DOM Distiller, which is an open source project. It is disabled by default, but can be enabled using the flag, which you can also make persistent. Not only does DOM Distiller provide a better reading experience by distilling the content of the page, it also simplifies pages for print. Even though the latter checkbox option has been removed from the print dialog, you can still print the distilled page, which basically has the same effect.

After enabling the flag, you will find a new "Enter reader mode" menu item and corresponding icon in the address bar when Chromium thinks the website you are visiting could do with some distilling.

Forcing specific GPU

In multi-GPU systems, Chromium automatically detects which GPU should be used for rendering (discrete or integrated). This works 99% of the time, except when it does not - if a unavailable GPU is picked (for example, discrete graphics on VFIO GPU passthrough-enabled systems), will complain about not being able to initialize the GPU process. On the same page below Driver Information there will be multiple GPUs shown (GPU0, GPU1, ...). There is no way to switch between them in a user-friendly way, but you can read the device/vendor IDs present there and configure Chromium to use a specific GPU with flags:

$ chromium --gpu-testing-vendor-id=0x8086 --gpu-testing-device-id=0x1912

...where and 0x1912 is replaced by the IDs of the GPU you want to use (as shown on the page).

Import bookmarks from Firefox

To ease the transition, you can import bookmarks from Firefox into Chromium.

Navigate Chromium to

If Firefox is already installed on your computer, you can directly import bookmarks as well as many other things from Firefox.

Make sure Mozilla Firefox is selected. Optionally, you can uncheck some unwanted items here. Click the Import and then Done. You are done with it.

If you import bookmarks from another PC, you have to export bookmarks from Firefox first.

in Firefox

The procedure is pretty much the same. You need to go to . However, this time, in the From drop-down menu, select Bookmarks HTML File and click the Choose File button and upload the desired bookmark file.

Enabling native notifications

Go to and select Enabled.

U2F authentication

Install library. This provides the udev rules required to enable access to the U2F key as a user. U2F keys are by default only accessible by root, and without these rules Chromium will give an error.

Dark mode

To enable dark mode (used in prefers-color-scheme in CSS, JavaScript, Settings and Dev-Tools) and enable the dark theme (normally used for incognito mode) append the following flag to persistent configuration:

Dark mode by system preference

This Chromium issue aims to bring dark mode based on GTK theme selection into Chromium.

In the future, all that will be required to properly use system preference, is setting Designs to GTK in .

Enable Side Panel

The Side Panel can be enabled through chrome://flags. You can enable or disable Side panel, and change options such as Side panel border and Side panel drag and drop.

Profile maintenance

Chromium uses SQLite databases to manage history and the like. Sqlite databases become fragmented over time and empty spaces appear all around. But, since there are no managing processes checking and optimizing the database, these factors eventually result in a performance hit. A good way to improve startup and some other bookmarks- and history-related tasks is to defragment and trim unused space from these databases.

and  in the AUR do just this.

Disable JIT

At the cost of reduced performance, you can disable just-in-time compilation of JavaScript to native code, which is responsible for roughly half of the security vulnerabilities in the JS engine, using the flag .

WebRTC

WebRTC is a communication protocol that relies on JavaScript that can leak one's actual IP address and hardware hash from behind a VPN. While some software may prevent the leaking scripts from running, it is probably a good idea to block this protocol directly as well, just to be safe. As of October 2016, there is no way to disable WebRTC on Chromium on desktop, there are extensions available to disable local IP address leak, one is this extension.

One can test WebRTC via https://browserleaks.com/webrtc.

Warning: Even though IP leak can be prevented, Chromium still sends your unique hash, and there is no way to prevent this. Read more on https://www.browserleaks.com/webrtc#webrtc-disable

SSL certificates

Chromium does not have an SSL certificate manager. It relies on the NSS Shared DB . In order to add SSL certificates to the database, users will have to use the shell.

Adding CAcert certificates for self-signed certificates

Grab the CAcerts and create an , if one does not already exist. To do this, first install the package, then complete these steps:

$ mkdir -p $HOME/.pki/nssdb
$ cd $HOME/.pki/nssdb
$ certutil -N -d sql:.
$ curl -k -o "cacert-root.crt" "http://www.cacert.org/certs/root.crt"
$ curl -k -o "cacert-class3.crt" "http://www.cacert.org/certs/class3.crt"
$ certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "CAcert.org" -i cacert-root.crt 
$ certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "CAcert.org Class 3" -i cacert-class3.crt

Now users may manually import a self-signed certificate.

Example 1: Using a shell script to isolate the certificate from TomatoUSB

Below is a simple script that will extract and add a certificate to the user's :

#!/bin/sh
#
# usage:  import-cert.sh remote.host.name [port]
#
REMHOST=$1
REMPORT=${2:-443}
exec 6>&1
exec > $REMHOST
echo | openssl s_client -connect ${REMHOST}:${REMPORT} 2>&1 |sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p'
certutil -d sql:$HOME/.pki/nssdb -A -t "P,," -n "$REMHOST" -i $REMHOST 
exec 1>&6 6>&-

Syntax is advertised in the commented lines.

References:

Example 2: Using Firefox to isolate the certificate from TomatoUSB

The browser can be used to save the certificate to a file for manual import into the database.

Using firefox:

  1. Browse to the target URL.
  2. Upon seeing the "This Connection is Untrusted" warning screen, click: I understand the Risks > Add Exception...
  3. Click: View > Details > Export and save the certificate to a temporary location (/tmp/easy.pem in this example).

Now import the certificate for use in Chromium:

$ certutil -d sql:$HOME/.pki/nssdb -A -t TC -n "easy" -i /tmp/easy.pem

Reference:

Canvas Fingerprinting

Canvas fingerprinting is a technique that allows websites to identify users by detecting differences when rendering to an HTML5 canvas. This information can be made inaccessible by using the flag.

To confirm this is working run this test and make sure "hash of canvas fingerprint" is reported as undetermined in the full results.

Privacy extensions

See Browser extensions#Privacy.

Do Not Track

To enable Do Not Track, visit chrome://settings, scroll down to Advanced and under Privacy and security, check Send a "Do Not Track" request with your browsing traffic.

Force a password store

Chromium uses a password store to store your passwords and the Chromium Safe Storage key, which is used to encrypt cookie values.

By default Chromium auto-detects which password store to use, which can lead to you apparently losing your passwords and cookies when switching to another desktop environment or window manager.

You can force Chromium to use a specific password store by launching it with the flag with one of following the values :

  • , uses Gnome Keyring
  • , uses KDE Wallet
  • , saves the passwords and the cookies' encryption key as plain text in the file
  • detect, the default auto-detect behavior

For example, to force Chromium to use Gnome Keyring in another desktop or WM use , see #Making flags persistent for making it permanent.

When using a password store of another desktop environment you probably also want to unlock it automatically. See GNOME/Keyring#Using the keyring and KDE Wallet#Unlock KDE Wallet automatically on login.

Troubleshooting

Tab font size is too large

Chromium will use the GTK settings as described in GTK#Configuration. When configured, Chromium will use the setting for tabs (which may mismatch window font size). To override these settings, use .

WebGL

There is the possibility that your graphics card has been blacklisted by Chromium. See #Force GPU acceleration.

If you are using Chromium with Bumblebee, WebGL might crash due to GPU sandboxing. In this case, you can disable GPU sandboxing with .

Visit for debugging information about WebGL support.

Chromium can save incorrect data about your GPU in your user profile (e.g. if you use switch between an Nvidia card using Optimus and Intel, it will show the Nvidia card in even when you are not using it or primusrun/optirun). Running using a different user directory, e.g, chromium --user-data-dir=$(mktemp -d) may solve this issue. For a persistent solution you can reset the GPU information by deleting .

Incorrect HiDPI rendering

Chromium will automatically scale for a HiDPI display, however, this may cause an incorrect rendered GUI.

The flag may be used to overrule the automatic scaling factor.

When native Wayland support is enabled, Chromium will automatically scale based on the configured scale of each monitor.

Password prompt on every start with GNOME Keyring

See GNOME/Keyring#Passwords are not remembered.

Chromecasts in the network are not discovered

You will need to enable the Media Router Component Extension in .

Everything is syncing except for password

If synchronization is not working for password only (you can check it on chrome://sync-internals/) delete profile login data:

$ rm ~/.config/chromium/Default/Login\ Data*

See Google Chrome Help forum for details.

Losing cookies and passwords when switching between desktop environments

If you see the message in the terminal when you start Chromium, it might try to use the wrong password storage backend. This might happen when you switch between Desktop Environments.

See #Force a password store.

Hang on startup when Google Sync enabled

Try launching Chrome with or another appropriate password store.

See #Force a password store.

Chromium asks to be set as the default browser every time it starts

If you are using KDE and have once set Firefox as the default browser (by clicking the button inside Firefox), you might find Chromium asks to be set as the default browser every time it starts, even if you click the "set as default" button.

Chromium checks for this status by running . If the output is "no", it is not considering itself to be the default browser. The script checks for the following MIME associations and expect all of them to be :

To fix it, go to System settings > Applications > Default applications > Web browser and choose Chromium. Then, set the MIME association for text/html:

$ xdg-mime default chromium.desktop text/html

Finally, update the MIME database:

$ update-mime-database ~/.local/share/mime

"This browser or app may not be secure" error logging in to Google

As of 2020.04.20 if you run chromium with flag for web development, you cannot log in to your Google account. Temporarily disable this flag to login and then you can enable it back.

Chromium stuck at 60fps when using a 144Hz + 60Hz monitor

There is a suitable workaround for this issue, append the following flags to persistent configuration:

This should make Chromium run at 144fps when used on your 144hz display, assuming your compositor is refreshing at 144fps. Keep in mind it might be a little choppy , but this is way better than it being stuck at 60fps.

Chromium slow scroll speed

Mouse whell scrolling in chromium and electron based applications may be too slow for daily usage. Here are some solutions.

Libinput#Mouse wheel scrolling speed scaling injects function in libinput and provides an interface to change scale factor. This is not a application level injection, so an addition script for application specific scale factor tuning is needed. Note that scroll on chromium's small height developer tools may be too fast when scale factor is big enough.

IMWheel increases scroll distance by replaying X wheel button event for multiple times. However, chromium assumes the real scroll and the replayed ones as two events. There is a small but noticeable delay between them, so one mouse wheel scroll leads to twice page jumps. Also, touchpad scroll needs additional care.

Linux Scroll Speed Fix and SmoothScroll are two chromium extensions with suppport for scroll distance modification. Upon wheel scroll in a web page, the closest scrollable ancestor of current focused node will be found, then a scroll method with given pixel distance will be called on it, even if it has been scrolled to bottom. So once you scroll into a text editor or any scrollable element, you can never scroll out of it, except moving mouse. Also, extension based methods can not be used outside chromium.

Videos load but do not play

This may be a PulseAudio issue. See the suggested fix in PulseAudio/Troubleshooting#Browsers load videos but do no play.

gollark: Surprisingly, no, you would have *some* room.
gollark: It would be fairly densely packed but technically survivable.
gollark: Not *a* cube, *the* cube.
gollark: https://media.discordapp.net/attachments/733347369847881838/923611039533248553/unknown.png
gollark: The meme is very clear.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.