vinifmor / bauh

Graphical user interface for managing your Linux applications. Supports AppImage, Debian and Arch packages (including AUR), Flatpak, Snap and native Web applications
zlib License
947 stars 71 forks source link

Bauh crashes on upgrading apps #164

Closed Flash1232 closed 3 years ago

Flash1232 commented 3 years ago

Before opening a new issue Install the staging branch and check if the unexpected behavior is happening there as well. If you are on ArchLinux-based distro, you can install it through AUR (bauh-staging). Otherwise, you have to clone the repository and install it with pip:

git clone https://github.com/vinifmor/bauh.git -b staging --depth=1
cd bauh
python3 -m venv venv
venv/bin/pip install pip --upgrade
venv/bin/pip install setuptools --upgrade
venv/bin/pip install -r requirements.txt
venv/bin/pip install .
venv/bin/bauh  # or venv/bin/bauh-tray

Describe the bug Bauh crashes when upgrading all checked applications. It happens only in conjunction with these packages: image

Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 425, in run
    requirements = self.manager.get_upgrade_requirements(models, root_password, self)
  File "/usr/lib/python3.9/site-packages/bauh/view/core/controller.py", line 556, in get_upgrade_requirements
    man_reqs = man.get_upgrade_requirements(pkgs, root_password, watcher)
  File "/usr/lib/python3.9/site-packages/bauh/gems/flatpak/controller.py", line 596, in get_upgrade_requirements
    sizes = flatpak.map_update_download_size([str(p.id) for p in apps_by_install[0]], apps_by_install[1], flatpak_version)
  File "/usr/lib/python3.9/site-packages/bauh/gems/flatpak/flatpak.py", line 414, in map_update_download_size
    size = p2.findall(line_split[6])[0].split('?')
IndexError: list index out of range
Fatal Python error: Aborted

Current thread 0x00007fbbcffff640 (most recent call first):
<no Python frame>

Thread 0x00007fbbeb7fe640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 804 in run

Thread 0x00007fbc0d485640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 804 in run

Thread 0x00007fbbeaffd640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/prepare.py", line 111 in run

Thread 0x00007fbc04b91640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/gems/appimage/worker.py", line 109 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007fbc0dc86640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/util/cache.py", line 95 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007fbc1b5b8740 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/app.py", line 54 in main
  File "/usr/bin/bauh", line 33 in <module>
[1]    9802 abort (core dumped)  bauh

Software Environment bauh version: 0.9.10-1 (tested up to 0.9.12.RC-4) O.S: Manjaro Linux 5.4.85-1-MANJARO Python version: 3.9.1 (GCC 10.2.0) Installation method: pacman

P.S: these instructions and the template must be respected, otherwise your issue will be closed.

vinifmor commented 3 years ago

@Flash1232 thanks for reporting the issue. I'm going to investigate the cause and publish a fix ASAP.

PrzemekSkw commented 3 years ago

Hi, I have the sam problem on EndevourOS [archlinux]. Python 3.9.1

In terminal after click upgrade in bauh:

[mariank@marian-dell ~]$ bauh
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 425, in run
    requirements = self.manager.get_upgrade_requirements(models, root_password, self)
  File "/usr/lib/python3.9/site-packages/bauh/view/core/controller.py", line 579, in get_upgrade_requirements
    man_reqs = man.get_upgrade_requirements(pkgs, root_password, watcher)
  File "/usr/lib/python3.9/site-packages/bauh/gems/flatpak/controller.py", line 604, in get_upgrade_requirements
    sizes = flatpak.map_update_download_size([str(p.id) for p in apps_by_install[0]], apps_by_install[1], flatpak_version)
  File "/usr/lib/python3.9/site-packages/bauh/gems/flatpak/flatpak.py", line 415, in map_update_download_size
    size = p2.findall(line_split[6])[0].split('?')
IndexError: list index out of range
Fatal Python error: Aborted

Current thread 0x00007f44637fe640 (most recent call first):
<no Python frame>

Thread 0x00007f4460ff9640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 804 in run

Thread 0x00007f4462ffd640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 804 in run

Thread 0x00007f443e7fc640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/prepare.py", line 138 in run

Thread 0x00007f4463fff640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/util/cache.py", line 96 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007f4499f40740 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/app.py", line 54 in main
  File "/usr/bin/bauh", line 33 in <module>
Aborted (memory dump)

Regards.

vinifmor commented 3 years ago

@Flash1232 @PrzemekSkw , I've just publish a possible fix for this issue on the staging branch. It is already available in AUR (bauh-staging). Please, give me a feedback if its working on your ends.

Flash1232 commented 3 years ago

This is indeed fixed in the latest staging release (at least for me). Thanks so much! :smiley:

PrzemekSkw commented 3 years ago

@vinifmor Hi, I have checked on my Ubuntu Laptop at home and everything is OK. I cannot check my arch laptop because it is in work. Thanks in advance. Regards Przemek.

vinifmor commented 3 years ago

Great! Thanks for the feedback, @PrzemekSkw . I'm going to hold this issue open until the final 0.9.12 release.

PrzemekSkw commented 3 years ago

@vinifmor Hi, today I noticed problem in my Ubuntu. I see there's 0.9.11 version when I run bauh but when I install I see: Successfully installed bauh-0.9.13. First I upgrade, next I purge bauh and install fresh. Regards, Przemek

vinifmor commented 3 years ago

@PrzemekSkw , I'm not sure if I understood the issue. Were you trying to upgrade bauh through the command line and it did not work properly ? (sudo pip3 install bauh --upgrade)

PrzemekSkw commented 3 years ago

@vinifmor Yes, I also try to upgrade but I still have older version.

vinifmor commented 3 years ago

@PrzemekSkw , it may be an issue with the Ubuntu's pip version. Does it work if you uninstall and reinstall it again ?

sudo pip3 uninstall bauh -y
sudo pip3 install bauh --upgrade
PrzemekSkw commented 3 years ago

@vinifmor Hi, I make a screenshots: Zrzut ekranu z 2021-01-31 22-51-26 Zrzut ekranu z 2021-01-31 22-52-24

vinifmor commented 3 years ago

That's odd. It is updating fine on my Ubuntu machine. What are the outputs of bauh --version and which bauh ?

Flash1232 commented 3 years ago

Might be unrelated to the previous issue, but I have another weird crash for the 'pdfsam' package (AUR - community) when attempting to upgrade the app:

error: package 'pdfsam' was not found
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 425, in run
    requirements = self.manager.get_upgrade_requirements(models, root_password, self)
  File "/usr/lib/python3.9/site-packages/bauh/view/core/controller.py", line 579, in get_upgrade_requirements
    man_reqs = man.get_upgrade_requirements(pkgs, root_password, watcher)
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/controller.py", line 3030, in get_upgrade_requirements
    return summarizer.summarize(pkgs, root_password, arch_config)
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/updates.py", line 400, in summarize
    context.pkgs_data.update(pacman.map_updates_data(context.repo_to_update.keys()))
TypeError: 'NoneType' object is not iterable
Fatal Python error: Aborted

Current thread 0x00007fb26effd640 (most recent call first):
<no Python frame>

Thread 0x00007fb26f7fe640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 809 in run

Thread 0x00007fb289ffb640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 809 in run

Thread 0x00007fb28b7fe640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/prepare.py", line 139 in run

Thread 0x00007fb2b1705640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/util/cache.py", line 96 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007fb2bb634740 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/app.py", line 54 in main
  File "/usr/bin/bauh", line 33 in <module>
[1]    34298 abort (core dumped)  bauh

I can launch the package from within bauh without problems, just upgrading crashes bauh. Specs as in first post except Bauh version is now 0.9.13-2

PrzemekSkw commented 3 years ago

That's odd. It is updating fine on my Ubuntu machine. What are the outputs of bauh --version and which bauh ?

~$ bauh --version
bauh 0.9.11
$ which bauh
/usr/local/bin/bauh

Edit. I make bauh --reset and delete all bauh folders from HDD. Install fresh and now I have 0.9.13 :) Regards.

vinifmor commented 3 years ago

@Flash1232 , I'm going to have a look here.

@PrzemekSkw , great that your sorted the issue out.

vinifmor commented 3 years ago

@Flash1232 , I've published a possible fix on the staging branch. It is already available in AUR (bauh-staging). Can you give me a feedback if it is working on your end ?

Flash1232 commented 3 years ago

@vinifmor Thanks for your speedy response! Unfortunately the error still persists with bauh-staging 0.9.14.RC-2:

error: package 'pdfsam' was not found
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 425, in run
    requirements = self.manager.get_upgrade_requirements(models, root_password, self)
  File "/usr/lib/python3.9/site-packages/bauh/view/core/controller.py", line 579, in get_upgrade_requirements
    man_reqs = man.get_upgrade_requirements(pkgs, root_password, watcher)
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/controller.py", line 3030, in get_upgrade_requirements
    return summarizer.summarize(pkgs, root_password, arch_config)
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/updates.py", line 438, in summarize
    res.to_upgrade = [self._map_requirement(pkg, context, installed_sizes) for pkg in sorted_pkgs]
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/updates.py", line 438, in <listcomp>
    res.to_upgrade = [self._map_requirement(pkg, context, installed_sizes) for pkg in sorted_pkgs]
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/updates.py", line 330, in _map_requirement
    data = context.pkgs_data[pkg.name]
KeyError: 'pdfsam'
Fatal Python error: Aborted

Current thread 0x00007fa628ef9640 (most recent call first):
<no Python frame>

Thread 0x00007fa6296fa640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 809 in run

Thread 0x00007fa648cdf640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 809 in run

Thread 0x00007fa649ce1640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/prepare.py", line 139 in run

Thread 0x00007fa658819640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/util/cache.py", line 96 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007fa668660740 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/app.py", line 54 in main
  File "/usr/bin/bauh", line 33 in <module>
[1]    63046 abort (core dumped)  bauh
vinifmor commented 3 years ago

@Flash1232 , no worries. Let's fix this. I've just pushed another possible fix to bauh-staging. Could you try it again ?

Flash1232 commented 3 years ago

We're getting closer, at least it crashes only after the upgrade summary dialog now. :) (0.9.14.RC-3)

error: package 'pdfsam' was not found
qt.qpa.xcb: QXcbConnection: XCB error: 3 (BadWindow), sequence: 3048, resource id: 10723348, major code: 40 (TranslateCoords), minor code: 0
Traceback (most recent call last):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 510, in run
    success = bool(self.manager.upgrade(requirements, root_password, self))
  File "/usr/lib/python3.9/site-packages/bauh/view/core/controller.py", line 288, in upgrade
    res = man.upgrade(man_reqs, root_password, handler)
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/controller.py", line 1167, in upgrade
    if not self._upgrade_repo_pkgs(to_upgrade=[p.name for p in repo_pkgs],
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/controller.py", line 994, in _upgrade_repo_pkgs
    downloaded = self._download_packages(pkgnames=to_upgrade_remaining,
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/controller.py", line 2273, in _download_packages
    return download_service.download_packages(pkgs=pkgnames,
  File "/usr/lib/python3.9/site-packages/bauh/gems/arch/download.py", line 163, in download_packages
    for pkg in pkgs_data:
TypeError: 'NoneType' object is not iterable
Fatal Python error: Aborted

Current thread 0x00007faedf7fe640 (most recent call first):
<no Python frame>

Thread 0x00007faec6ffd640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 809 in run

Thread 0x00007faf02d88640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/thread.py", line 809 in run

Thread 0x00007faf03589640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/qt/prepare.py", line 139 in run

Thread 0x00007faf110f6640 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/view/util/cache.py", line 96 in run
  File "/usr/lib/python3.9/threading.py", line 954 in _bootstrap_inner
  File "/usr/lib/python3.9/threading.py", line 912 in _bootstrap

Thread 0x00007faf20ffd740 (most recent call first):
  File "/usr/lib/python3.9/site-packages/bauh/app.py", line 54 in main
  File "/usr/bin/bauh", line 33 in <module>
[1]    12308 abort (core dumped)  bauh
vinifmor commented 3 years ago

@Flash1232 , just pushed another fix to bauh-staging. Could you print the response of the following commands here as well ?

cat ~/.cache/bauh/arch/installed/pdfsam/data.json
pacman -Qi pdfsam
Flash1232 commented 3 years ago
➜  ~ cat ~/.cache/bauh/arch/installed/pdfsam/data.json
{"maintainer": "community", "command": "pdfsam", "icon_path": "pdfsam", "repository": "community", "desktop_entry": "/usr/share/applications/pdfsam.desktop"}%                                                      
➜  ~ pacman -Qi pdfsam
Name            : pdfsam
Version         : 4.2.1-3
Description     : A free open source tool to split and merge pdf documents
Architecture    : any
URL             : https://www.pdfsam.org/
Licenses        : AGPL3
Groups          : None
Provides        : None
Depends On      : hicolor-icon-theme  java-environment>=11  sh  unzip
Optional Deps   : None
Required By     : None
Optional For    : None
Conflicts With  : None
Replaces        : None
Installed Size  : 26.11 MiB
Packager        : Unknown Packager
Build Date      : Di 19 Jan 2021 11:58:30
Install Date    : Di 19 Jan 2021 11:59:07
Install Reason  : Explicitly installed
Install Script  : No
Validated By    : None

Now bauh doesn't seem to crash anymore, and now there is a graceful exception and error dialog.

vinifmor commented 3 years ago

@Flash1232 Were you able to upgrade your packages ?

Flash1232 commented 3 years ago

I was able to upgrade the package to 4.2.2 with pamac, but not with bauh. Bauh would give me an error dialog and print error: package 'pdfsam' was not found to the console.

vinifmor commented 3 years ago

I see. Well, this is odd. I'm going to perform more testing related to package upgrading to see if I find out the reason. But the crash is fixed at least.

Flash1232 commented 3 years ago

Thanks a lot for your time and yeah it's great that the exception is now caught properly which is the main thing :) Bauh is really great! I enjoy its sheer simplicity, customizability and speed.

vinifmor commented 3 years ago

Thank you @Flash1232 . It's nice when people actually report the bugs instead of dropping the tool. bauh has to handle complex scenarios that are not always caught during testing. Thanks helping the project.

vinifmor commented 3 years ago

@Flash1232 , just a doubt: do you have AUR manually added to pacman configuration files or only use it through bauh/pamac ?

Flash1232 commented 3 years ago

I enabled AUR in both pamac and bauh, my pacman.conf has no AUR configuration.

vinifmor commented 3 years ago

It can be a cache related issue. Try removing the Arch cache (rm -rf ~/.cache/bauh/arch/installed) and launch bauh to regenerate it. If you face the same upgrade problem in the future, open a new Github issue, please.