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?
(have a messed up system? brave-browser-beta installed to previous, pkcon update , apt manipulation?
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 ";;")
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