Brave Browser Beta - uninstall (documenting issue / my process)

Description of the issue: Can’t uninstall brave-browser-beta debian package. dpkg reports errors from both brave-browser-beta and brave-browser, when trying to uninstall just brave-browser-beta.
How can this issue be reproduced?

  1. (have a messed up system? brave-browser-beta installed to previous, pkcon update , apt manipulation?
  2. attempt to uninstall [sudo] pkcon remove brave-browser-beta and sudo apt remove brave-browser-beta, error with logs from dpkg reporting errors, attached below,
  • xdg-icon-resource: 12: Syntax error: end of file unexpected (expecting ";;")
    • I don’t see any hanging bash case statements, nor unquoted arguments to xdg-icon-resource, or nearby.

Expected result: Uninstalls package

Brave Version( check About Brave): observed with:

  • 1.63.141 of brave-browser-beta, on attempt to uninstall,
  • between 1.61.116 and 1.62.156 of brave-browser, debian linux similar issue, affecting package updates, . Hopefully, no major file system changes in linux packages.

Additional Information:

$ sudo apt purge brave-browser-beta
$ sudo apt purge brave-browser-beta
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following packages will be REMOVED:
  brave-browser-beta*
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
2 not fully installed or removed.
After this operation, 362 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 468248 files and directories currently installed.)
Removing brave-browser-beta (1.63.146) ...
/usr/bin/xdg-icon-resource: 12: Syntax error: end of file unexpected (expecting ";;")
dpkg: error processing package brave-browser-beta (--remove):
 installed brave-browser-beta package pre-removal script subprocess returned error exit status 2
dpkg: too many errors, stopping
/usr/bin/xdg-icon-resource: 12: Syntax error: end of file unexpected (expecting ";;")
dpkg: error while cleaning up:
 installed brave-browser-beta package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 brave-browser-beta
Processing was halted because there were too many errors.
E: Sub-process /usr/bin/dpkg returned an error code (1)

Oddly, when I try to uninstall brave-browser-beta, an error on brave-browser prevents the dpkg operation from succeeding. Odd.

$ sudo apt remove brave-browser-beta
$ sudo apt remove brave-browser-beta
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Starting pkgProblemResolver with broken count: 0
Starting 2 pkgProblemResolver with broken count: 0
Done
The following packages will be REMOVED:
  brave-browser-beta
0 upgraded, 0 newly installed, 1 to remove and 6 not upgraded.
1 not fully installed or removed.
After this operation, 362 MB disk space will be freed.
Do you want to continue? [Y/n]
dpkg: warning: files list file for package 'brave-browser-beta' missing; assuming package has no files currently installed
(Reading database ... 468038 files and directories currently installed.)
Removing brave-browser-beta (1.63.146) ...
Setting up brave-browser (1.62.156) ...
/usr/bin/xdg-icon-resource: 12: Syntax error: end of file unexpected (expecting ";;")
dpkg: error processing package brave-browser (--configure):
 installed brave-browser package post-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 brave-browser
E: Sub-process /usr/bin/dpkg returned an error code (1)

Tried some other suggestions to fix package issues.

Digging into package issues directly

Reported error, seems to be in postinst script. dpkg -l reports brave-browser to be iF - installed, and halF-configured. So it attempts to re-run this as a cleanup task on every state-changing apt invocation.

/var/lib/dpkg/info/brave-browser.postinst:18-22:

for icon in product_logo_128.png product_logo_16.png product_logo_48.png product_logo_24.png product_logo_64.png product_logo_32.png product_logo_256.png ; do
  size="$(echo ${icon} | sed 's/[^0-9]//g')"
  "$XDG_ICON_RESOURCE" install --size "${size}" "/opt/brave.com/brave/${icon}" \
    "brave-browser"
done
$ sudo bash -x /var/lib/dpkg/info/brave-browser.postinst |& less
$ sudo bash -x /var/lib/dpkg/info/brave-browser.postinst |& less

+ set -e
+ DEFAULTS_FILE=/etc/default/brave-browser
++ command -v xdg-icon-resource
+ XDG_ICON_RESOURCE=/usr/bin/xdg-icon-resource
+ '[' '!' -x /usr/bin/xdg-icon-resource ']'
+ for icon in product_logo_128.png product_logo_16.png product_logo_48.png product_logo_24.png product_logo_64.png product_logo_32.png product_logo_256.png
++ echo product_logo_128.png
++ sed 's/[^0-9]//g'
+ size=128
+ /usr/bin/xdg-icon-resource install --size 128 /opt/brave.com/brave/product_logo_128.png brave-browser
/usr/bin/xdg-icon-resource: 12: Syntax error: end of file unexpected (expecting ";;")

Updated call: bash -x $XDG_ICON_RESOURCE ...
/var/lib/dpkg/info/brave-browser.postinst:20-21:

  bash -x "$XDG_ICON_RESOURCE" install --size "${size}" "/opt/brave.com/brave/${icon}" \
    "brave-browser"
$ sudo bash /var/lib/dpkg/info/brave-browser.postinst |& less | xsel -b # with bash -x $XDG_ICON_RESOURCE ...
+ check_common_commands install --size 128 /opt/brave.com/brave/product_logo_128.png brave-browser
+ '[' 5 -gt 0 ']'
+ parm=install
+ shift
+ case "$parm" in
+ '[' 4 -gt 0 ']'
+ parm=--size
+ shift
+ case "$parm" in
+ '[' 3 -gt 0 ']'
+ parm=128
+ shift
+ case "$parm" in
+ '[' 2 -gt 0 ']'
+ parm=/opt/brave.com/brave/product_logo_128.png
+ shift
+ case "$parm" in
+ '[' 1 -gt 0 ']'
+ parm=brave-browser
+ shift
+ case "$parm" in
+ '[' 0 -gt 0 ']'
+ '[' -z '' ']'
+ unset XDG_UTILS_DEBUG_LEVEL
+ '[' 0 -lt 1 ']'
+ xdg_redirect_output=' > /dev/null 2> /dev/null'
+ GTK_UPDATE_ICON_CACHE=
+ '[' xinstall '!=' x ']'
+ mode=
+ action=
+ update=yes
+ size=
+ theme=hicolor
+ context=apps
+ icon_file=
+ icon_name=
+ case $1 in
+ action=install
+ shift
+ vendor=true
+ '[' 4 -gt 0 ']'
+ parm=--size
+ shift
+ case $parm in
+ '[' -z 128 ']'
+ echo 128
+ grep '[^0-9]'
+ size=128
+ shift
+ '[' 2 -gt 0 ']'
+ parm=/opt/brave.com/brave/product_logo_128.png
+ shift
+ case $parm in
+ '[' -n '' ']'
+ '[' -n '' ']'
+ '[' install = install ']'
+ check_input_file /opt/brave.com/brave/product_logo_128.png
+ '[' '!' -e /opt/brave.com/brave/product_logo_128.png ']'
+ '[' '!' -r /opt/brave.com/brave/product_logo_128.png ']'
+ icon_file=/opt/brave.com/brave/product_logo_128.png
+ '[' 1 -gt 0 ']'
+ parm=brave-browser
+ shift
+ case $parm in
+ '[' -n '' ']'
+ '[' -n /opt/brave.com/brave/product_logo_128.png ']'
+ icon_name=brave-browser
+ '[' 0 -gt 0 ']'
+ '[' -z install ']'
+ '[' -z apps ']'
+ '[' -n '' ']'
+ '[' -z '' ']'
++ whoami
+ '[' root = root ']'
+ mode=system
+ xdg_dir_name=icons/hicolor
+ xdg_user_dir=
+ '[' -n '' ']'
+ xdg_user_dir=/root/.local/share
+ xdg_user_prefix=/root/.local/share/icons
+ xdg_user_dir=/root/.local/share/icons/hicolor
+ xdg_global_dir=
+ xdg_global_prefix=
+ xdg_system_dirs=
+ '[' -n '' ']'
+ xdg_system_dirs=/usr/local/share/:/usr/share/
++ echo /usr/local/share/:/usr/share/
++ sed 's/:/ /g'
+ for x in `echo "$xdg_system_dirs" | sed 's/:/ /g'`
+ '[' -w /usr/local/share//icons/hicolor ']'
+ for x in `echo "$xdg_system_dirs" | sed 's/:/ /g'`
+ '[' -w /usr/share//icons/hicolor ']'
+ xdg_global_prefix=/usr/share//icons
+ xdg_global_dir=/usr/share//icons/hicolor
+ break
+ '[' -w /usr/share//icons/hicolor ']'
+ dot_icon_dir=
+ dot_base_dir=
+ '[' xsystem = xuser ']'
+ xdg_base_dir=/usr/share//icons/hicolor
+ '[' -z /usr/share//icons/hicolor ']'
+ '[' xinstall = xforceupdate ']'
+ '[' -z /opt/brave.com/brave/product_logo_128.png ']'
+ xdg_size_name=
+ extension=
+ '[' -z 128 ']'
+ xdg_size_name=128x128
+ '[' xinstall = xinstall ']'
+ case "$icon_file" in
+ extension=png
+ '[' -n brave-browser ']'
+ case "$icon_name" in
/usr/bin/xdg-icon-resource: line 1041: unexpected EOF while looking for matching ``'
/usr/bin/xdg-icon-resource: line 1090: syntax error: unexpected end of file

I’m not seeing progress on this line of inquiry.

Ok, in a process that is very likely to cause future issues, and may irreparably break future updates.

I’ve updated the dpkg status file manually,

dpkg status file

/var/lib/dpkg/status

from

Package: brave-browser
Status: install ok half-configured
...
Version: 1.62.156
Config-Version: 1.61.116
Provides: www-browser
...

with approximately s/half-configured/installed/ & /^Config-Version:/d to:

Package: brave-browser
Status: install ok installed
...
Version: 1.62.156
Provides: www-browser
...

My system has stopped reporting errors. Hope there were no major file system changes in linux packages between 1.61.116 and 1.62.156. Wish me luck.

I’ve confirmed that between 1.61.116 and 1.62.156, there were no file additions to nor deletions from the debian package. Just changes in size.

$ apt-get download brave-browser=1.61.116 brave-browser=1.62.156  ; ls
brave-browser_1.61.116_amd64.deb       brave-browser_1.62.156_amd64.deb

$ for f in *.deb; do dpkg -c $f > $f.list & done  ; ls *.list
brave-browser_1.61.116_amd64.deb.list  brave-browser_1.62.156_amd64.deb.list

diffs

example record, filter for diffs

-rw-r--r-- root/root       203 2024-01-09 23:09 ./usr/share/doc/brave-browser/changelog.gz
$ _awk6(){ awk '{print $1,$2,$3,$6}';}  # ignore date & time

Any of these suffice:

  • diff - with filtered listings
diff -dyW $COLUMNS <(<brave-browser_1.61.116_amd64.deb.list _awk6)  <(<brave-browser_1.62.156_amd64.deb.list _awk6) | wdiff -d | colordiff | less -RS
  • wdiff (word diff) with filtered listings – most focused on salient differences
wdiff <(<brave-browser_1.61.116_amd64.deb.list _awk6)  <(<brave-browser_1.62.156_amd64.deb.list _awk6) | colordiff | less -RS
  • faster, wdiff. shows sizes, but also dates (build date differences), highlighted:
 wdiff brave-browser_1.6*list | colordiff | less -RS

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.