Brave browser fails to open because of locked profile

How to resolve an issue when Brave browser is not opening normally, it just opens a small window with Brave title but no content in it.

Checking /var/log/messages we see that trying to start Brave browser is causing a systemd-coredump like shown below.

Apr  8 12:23:24 localhost systemd-coredump[11272]: Process 11164 (brave) of user 1000 dumped core.#012#012Stack trace of thread 11164:#012#0  0x00005636c5d05f73 n/a (brave)#012#1  0x00005636c5d02a76 n/a (brave)#012#2  0x00005636c5d0297e n/a (brave)#012#3  0x00005636c4f5d451 n/a (brave)#012#4  0x00005636c4f5d08e n/a (brave)#012#5  0x00005636c3c086f9 n/a (brave)#012#6  0x00005636c381839a n/a (brave)#012#7  0x00005636c3818519 n/a (brave)#012#8  0x00005636c4f52ff7 n/a (brave)#012#9  0x00005636c4f50af4 n/a (brave)#012#10 0x00005636c4f70b56 n/a (brave)#012#11 0x00005636c41dbe8e n/a (brave)#012#12 0x00005636c4f6a52d n/a (brave)#012#13 0x00005636c4f6a3e0 n/a (brave)#012#14 0x00005636c4f6a444 n/a (brave)#012#15 0x00005636c41d5e85 n/a (brave)#012#16 0x00005636c38f85f9 n/a (brave)#012#17 0x00005636c51a9923 n/a (brave)#012#18 0x00005636c51a8b94 n/a (brave)#012#19 0x00005636c51a92f2 n/a (brave)#012#20 0x00005636c51aab71 n/a (brave)#012#21 0x00005636c51c99d8 n/a (brave)#012#22 0x00005636c76da92c n/a (brave)#012#23 0x00005636c76db453 n/a (brave)#012#24 0x00005636c773419a n/a (brave)#012#25 0x00005636c507136b n/a (brave)#012#26 0x00005636c507077a n/a (brave)#012#27 0x00005636c5071844 n/a (brave)#012#28 0x00005636c4e1b642 n/a (brave)#012#29 0x00005636c381e3b4 n/a (brave)#012#30 0x00005636c3c0116e n/a (brave)#012#31 0x00005636c381cc20 n/a (brave)#012#32 0x00005636c38201cb n/a (brave)#012#33 0x00005636c381ae00 n/a (brave)#012#34 0x00005636c4dc3127 n/a (brave)#012#35 0x00005636c4df8730 n/a (brave)#012#36 0x00005636c4dc17a1 n/a (brave)#012#37 0x00005636c2cc05b3 ChromeMain (brave)#012#38 0x00007f84431bc413 __libc_start_main (libc.so.6)#012#39 0x00005636c2a3502a _start (brave)#012#012Stack trace of thread 11194:#012#0  0x00007f84432959b7 epoll_wait (libc.so.6)#012#1  0x00005636c524d01a n/a (brave)#012#2  0x00005636c524a92f n/a (brave)#012#3  0x00005636c523f639 n/a (brave)#012#4  0x00005636c51ec418 n/a (brave)#012#5  0x00005636c51c99d8 n/a (brave)#012#6  0x00005636c52038c0 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11198:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11199:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11200:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11184:#012#0  0x00007f84448ce9f2 waitpid (libpthread.so.0)#012#1  0x00005636c5235ced n/a (brave)#012#2  0x00005636c5233993 n/a (brave)#012#3  0x00005636c523a568 n/a (brave)#012#4  0x00007f84448c458e start_thread (libpthread.so.0)#012#5  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11202:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11203:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11187:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11205:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11188:#012#0  0x00007f84448cab18 [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c5236b30 n/a (brave)#012#2  0x00005636c52370c5 n/a (brave)#012#3  0x00005636c5237291 n/a (brave)#012#4  0x00005636c51f2d6f n/a (brave)#012#5  0x00005636c51f356f n/a (brave)#012#6  0x00005636c51f3304 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11208:#012#0  0x00007f84448ca72c [email protected]@GLIBC_2.3.2 (libpthread.so.0)#012#1  0x00005636c52369f2 n/a (brave)#012#2  0x00005636c523721d n/a (brave)#012#3  0x00005636c5236f2f n/a (brave)#012#4  0x00005636c51aa898 n/a (brave)#012#5  0x00005636c51ec418 n/a (brave)#012#6  0x00005636c51c99d8 n/a (brave)#012#7  0x00005636c52038c0 n/a (brave)#012#8  0x00005636c523a568 n/a (brave)#012#9  0x00007f84448c458e start_thread (libpthread.so.0)#012#10 0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11193:#012#0  0x00007f84432959b7 epoll_wait (libc.so.6)#012#1  0x00005636c524d01a n/a (brave)#012#2  0x00005636c524a92f n/a (brave)#012#3  0x00005636c523f696 n/a (brave)#012#4  0x00005636c51ec418 n/a (brave)#012#5  0x00005636c51c99d8 n/a (brave)#012#6  0x00005636c52038c0 n/a (brave)#012#7  0x00005636c523a568 n/a (brave)#012#8  0x00007f84448c458e start_thread (libpthread.so.0)#012#9  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11196:#012#0  0x00007f844328a3f1 __poll (libc.so.6)#012#1  0x00007f84445b53a6 n/a (libglib-2.0.so.0)#012#2  0x00007f84445b54d0 g_main_context_iteration (libglib-2.0.so.0)#012#3  0x00007f842af35c7d n/a (libdconfsettings.so)#012#4  0x00007f84445de2aa n/a (libglib-2.0.so.0)#012#5  0x00007f84448c458e start_thread (libpthread.so.0)#012#6  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11179:#012#0  0x00007f844328a3f1 __poll (libc.so.6)#012#1  0x00005636c3b600d2 n/a (brave)#012#2  0x00005636c5202eaf n/a (brave)#012#3  0x00005636c523a568 n/a (brave)#012#4  0x00007f84448c458e start_thread (libpthread.so.0)#012#5  0x00007f8443295683 __clone (libc.so.6)#012#012Stack trace of thread 11207:#012#0  0x00007f84432959b7 epoll_wait (libc.so.6)#012#1  0x00005636c524d01a n/a (brave)#012#2  0x00005636c524a92f

When trying to start brave-browser or brave-browser-stable from command line we see the message saying that there is some other Brave process keeping the profile in use and that profile is locked.
Message will look something like this:
“The profile appears to be in use by another Brave process ($pid) on another computer ($hostname). Brave has locked the profile so that it doesn’t get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Brave.”

(brave-browser:9312): Gtk-WARNING **: 12:18:14.282: Failed to parse /home/user/.config/gtk-3.0/settings.ini: Key file does not have group ?Settings?
[9312:9312:0408/121814.419144:ERROR:process_singleton_posix.cc(323)] The profile appears to be in use by another Brave process (11497) on another computer (localhost.localdomain). Brave has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Brave.
[9355:9355:0408/121814.421480:ERROR:sandbox_linux.cc(364)] InitializeSandbox() called with multiple threads in process gpu-process.
[9312:9312:0408/121814.435206:ERROR:desktop_window_tree_host_x11.cc(1120)] Not implemented reached in virtual void views::DesktopWindowTreeHostX11::InitModalType(ui::ModalType)
Segmentation fault (core dumped)

If the process exists we can try to kill that process.

~]$ kill -9 11497
bash: kill: (11497) - No such process

Even if the process is killed and doesn’t exists Brave browser can still keep the profile locked to process number.
Profile lock is maintained by a symlink on path /home/user/.config/BraveSoftware/Brave-Browser/SingletonLock which points to a file with hostname-pid naming format. If you delete the symlink the lock on the Brave browser profile is released.

~]$ ls -l /home/user/.config/BraveSoftware/Brave-Browser/SingletonLock 
lrwxrwxrwx. 1 user user 27 Apr 5 10:28 /home/user/.config/BraveSoftware/Brave-Browser/SingletonLock -> localhost.localdomain-11497

After the symlink is removed Brave browser should open normally.
This issue was on Fedora 29, it is possible path to lock file is different on other Linux distros.

Helpful link:

https://github.com/brave/browser-laptop/issues/11829

PackageKit can’t find file in /var/cache/PackageKit/

After installing RPM Fusion repos on Fedora 28 you might be getting an error shown by update manager every few minutes in GUI.
Error will say something like this: “Error when getting information for file “/var/cache/PackageKit/28/metadata/rpmfusion-nonfree-nvidia-driver/repodata/appstream.xml.gz”: No such file or directory

Error is described here https://bugzilla.redhat.com/show_bug.cgi?id=1580162 and seem to be caused by a repo that claims to support appdata but doesn’t actually provide it.

Error can be resolved by changing enabled_metadata=1 to enabled_metadata=0 in repo description file.
In case of above error change was made in /etc/yum.repos.d/rpmfusion-nonfree.repo and it now looks like this:

[rpmfusion-nonfree]
name=RPM Fusion for Fedora $releasever - Nonfree
#baseurl=http://download1.rpmfusion.org/nonfree/fedora/releases/$releasever/Everything/$basearch/os/
metalink=https://mirrors.rpmfusion.org/metalink?repo=nonfree-fedora-$releasever&arch=$basearch
enabled=1
enabled_metadata=0 #changed from 1 to 0
metadata_expire=14d
type=rpm-md
gpgcheck=1
repo_gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever

[rpmfusion-nonfree-debuginfo]
name=RPM Fusion for Fedora $releasever - Nonfree - Debug
#baseurl=http://download1.rpmfusion.org/nonfree/fedora/releases/$releasever/Everything/$basearch/debug/
metalink=https://mirrors.rpmfusion.org/metalink?repo=nonfree-fedora-debug-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
type=rpm-md
gpgcheck=1
repo_gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever

[rpmfusion-nonfree-source]
name=RPM Fusion for Fedora $releasever - Nonfree - Source
#baseurl=http://download1.rpmfusion.org/nonfree/fedora/releases/$releasever/Everything/source/SRPMS/
metalink=https://mirrors.rpmfusion.org/metalink?repo=nonfree-fedora-source-$releasever&arch=$basearch
enabled=0
metadata_expire=7d
type=rpm-md
gpgcheck=1
repo_gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-rpmfusion-nonfree-fedora-$releasever

After the change is made run pkcon repair and then pkcon update to check for any errors.

[[email protected] ~]# pkcon repair
                              [=========================]         
Finished                      [=========================]         
                              [=========================]         
Finished                      [=========================]         
[[email protected] ~]# pkcon update
Getting updates               [=========================]         
Finished                      [=========================]         
No packages require updating to newer versions.
[[email protected] ~]# 

How to enable h264 codec on Fedora 28

If you are running Fedora 28 you might have some issues with playing some type of videos in Firefox, Chromium and Vivaldi browsers.

You might be presented with a following type of error when trying to open video stream:
H.264 (High Profile) decoder is required to play the file, but is not installed

Also when visiting https://www.youtube.com/html5 you will see that browser does not support H.264 and MSE & H.264.

Here is how to enable H.264 for specific browsers.

Firefox

First you need to install and enable rpmfusion-free and rpmfusion-nonfree repositories.
Following command will install both RPM Fusion repositories.

sudo dnf install https://download1.rpmfusion.org/{free/fedora/rpmfusion-free,nonfree/fedora/rpmfusion-nonfree}-release-$(rpm -E %fedora).noarch.rpm

After that install compat-ffmpeg28 and ffmpeg-libs packages

sudo dnf install compat-ffmpeg28 ffmpeg-libs
Chromium

Chromium supports Vorbis, Theora, WebM and HTML5 audio and video standards, but does not include the non-free AAC, H.264, MP3 or Adobe Flash code that is found in Chrome.

To add H.264 you need to install chromium-libs-media-freeworld package from RPM Fusion.

Install RPM Fusion repositories.

sudo dnf install https://download1.rpmfusion.org/{free/fedora/rpmfusion-free,nonfree/fedora/rpmfusion-nonfree}-release-$(rpm -E %fedora).noarch.rpm

Install chromium-libs-media-freeworld package.

sudo dnf install chromium-libs-media-freeworld
Vivaldi

For Vivaldi you need to follow same steps as for Chromium, and add an extra step of copying a file to Vivaldi directory.

Install RPM Fusion repositories.

sudo dnf install https://download1.rpmfusion.org/{free/fedora/rpmfusion-free,nonfree/fedora/rpmfusion-nonfree}-release-$(rpm -E %fedora).noarch.rpm

Install chromium-libs-media-freeworld package.

sudo dnf install chromium-libs-media-freeworld

Copy /usr/lib64/chromium-browser/libffmpeg.so to /opt/vivaldi/lib/.

sudo cp -av /usr/lib64/chromium-browser/libffmpeg.so /opt/vivaldi/lib/
cp: overwrite '/opt/vivaldi/lib/libffmpeg.so'? y
removed '/opt/vivaldi/lib/libffmpeg.so'
'/usr/lib64/chromium-browser/libffmpeg.so' -> '/opt/vivaldi/lib/libffmpeg.so'

Last step will need to be repeated after every Vivaldi update.

Create key and CSR for multi-domain certificate.

If you want to secure multiple domains with one TLS/SSL certificate you will need to use multi-domain certificate with more than one Subject Alternative Name (SAN) specified in it.

Following is the procedure to create CSR for multiSAN certificate with openSSL.

First create a config file that will contain SAN information and all other parameters that need to be passed to openSSL to create CSR file.

Create multisan.conf file with following content.

[req]
distinguished_name = req_distinguished_name
req_extensions = v3_req
default_keyfile = multisan.key
prompt = no

[req_distinguished_name]
C = CountryCode (US,GB,...)
ST = State
L = City
O = OrganizatioName
OU = OrganizationUnit
CN = server.domain1.com

[v3_req]
keyUsage = keyEncipherment, dataEncipherment
extendedKeyUsage = serverAuth
subjectAltName = @alt_names

[alt_names]
DNS.1 = server.domain1.com
DNS.2 = server.domain2.com
DNS.3 = server.domain3.com

Once multisan.conf file has been created create CSR file and private key to be used with certificate with following command:

openssl req -new -nodes -out multisan.csr -config multisan.conf

This will automatically write private key to multisan.key file in the same location you executed the command.

openssl req -new -nodes -out multisan.csr -config multisan.conf 
Generating a 2048 bit RSA private key
.......+++++
.......................................................................+++++
writing new private key to 'multisan.key'

Once CSR and key files have been created you can confirm CSR content with following command:

openssl req -text -noout -in multisan.csr

Now that you have CSR file you can upload that CSR to your TLS/SSL certificate vendor to order issuing of the certificate.

Automatic backup of Ubiquiti ES-48-LITE over SSH

Ubiquiti ES-48-LITE currently doesn’t have an option to copy startup config to remote machine over scp.

This script will connect to Ubiquiti EdgeSwitch  over SSH and save startup config locally on machine running the script.

#!/usr/bin/expect -f

set user "username"
set sshpass "password for ssh access"
set enablepass "password for enable mode"
set device "device IP or hostname"
set cfgbackup "/path/to/save/config"

spawn ssh [email protected]$device

expect "assword:"
send "$sshpass\r"

expect ">"
send "enable\r$enablepass\rterminal length 0\r"

expect "#"
log_file -noappend $cfgbackup
send "show startup-config\r"
expect "#\n"
log_file

send "exit\rexit\r"

exec /bin/sed -i {1d;$d} $cfbbackup