[SRU] Safeeyes crashes in Ubuntu 24.04 with error ModuleNotFoundError: No module named 'imp'

Bug #2056233 reported by Archisman Panigrahi
18
This bug affects 3 people
Affects Status Importance Assigned to Milestone
safeeyes (Debian)
Fix Released
Unknown
safeeyes (Ubuntu)
Fix Released
Undecided
Unassigned
Noble
Fix Committed
Undecided
Unassigned

Bug Description

[ Impact ]

safeeyes is completely unusable. It will fail immediately when the user tries to start the application and will crash with the error:

$ safeeyes
Traceback (most recent call last):
  File "/usr/bin/safeeyes", line 33, in <module>
    sys.exit(load_entry_point('safeeyes==2.1.5', 'console_scripts', 'safeeyes')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/safeeyes", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/safeeyes/__main__.py", line 32, in <module>
    from safeeyes import utility
  File "/usr/lib/python3/dist-packages/safeeyes/utility.py", line 24, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'

[ Test Plan ]

install safeeyes

1) quick test:
open a terminal and use the command "safeeyes --help"

If the package is not fixed it will crash with the above error.

2) Detailed test:
start safeeyes from the launcher menu.
click on the safeeyes icon in the status bar to open the menu and then click on setting in the menu.

Change the time limits for intervals. ( I used 1 minute for interval between short breaks and interval between long breaks)
Select the "Plugins" tab and disable "Smart Pause".
close the settings.

After the time interval is over "safeeyes" will lock the screen with a message.

[ Where problems could occur ]

This upstream patch is just changing the way it checks python3-croniter module is installed or not at startup. As a worst case scenario if the changed code does not work then safeeyes will not start. But considering the fact the safeeyes is unusable now, the user should not see any new regression than what already exists.

[ Other Info ]

This has been fixed in Debian when v2.1.9 was added and so Oracular is also fixed.

[ Original Bug Description ]

Safeeyes uses the imp module, which is incompatible with python 3.12.

```
$ safeeyes
Traceback (most recent call last):
  File "/usr/bin/safeeyes", line 33, in <module>
    sys.exit(load_entry_point('safeeyes==2.1.5', 'console_scripts', 'safeeyes')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/bin/safeeyes", line 25, in importlib_load_entry_point
    return next(matches).load()
           ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/metadata/__init__.py", line 205, in load
    module = import_module(match.group('module'))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/lib/python3/dist-packages/safeeyes/__main__.py", line 32, in <module>
    from safeeyes import utility
  File "/usr/lib/python3/dist-packages/safeeyes/utility.py", line 24, in <module>
    import imp
ModuleNotFoundError: No module named 'imp'
```

The bug has been fixed upstream (it is just two lines https://github.com/slgobinath/SafeEyes/pull/544), however, there has not been any release since then.

I suggest that we cherrypick the fix in Ubuntu 24.04

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: safeeyes 2.1.5-0.1
ProcVersionSignature: Ubuntu 6.8.0-11.11-generic 6.8.0-rc4
Uname: Linux 6.8.0-11-generic x86_64
NonfreeKernelModules: wl
ApportVersion: 2.28.0-0ubuntu1
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: KDE
Date: Tue Mar 5 18:52:34 2024
InstallationDate: Installed on 2022-12-02 (460 days ago)
InstallationMedia: Kubuntu 22.04.1 LTS "Jammy Jellyfish" - Release amd64 (20220809.1)
PackageArchitecture: all
SourcePackage: safeeyes
UpgradeStatus: Upgraded to noble on 2024-02-07 (27 days ago)

Revision history for this message
Archisman Panigrahi (apandada1) wrote :
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in safeeyes (Ubuntu):
status: New → Confirmed
Revision history for this message
Archisman Panigrahi (apandada1) wrote (last edit ):

The bug has been fixed in the latest version 2.1.9. I suggest this is backported to 24.04 (It would not break any other packages).

The fixed version is hosted in this PPA https://launchpad.net/%7Esafeeyes-team/+archive/ubuntu/safeeyes.

Revision history for this message
Archisman Panigrahi (apandada1) wrote :

Oracular already has the new version of safe eyes where this bug is fixed. Can we backport it to noble? Otherwise safeeyes in the official repositories does not run at all.

summary: - Safeeyes crashes with error ModuleNotFoundError: No module named 'imp'
+ Safeeyes crashes in Ubuntu 24.04 with error ModuleNotFoundError: No
+ module named 'imp'
Changed in safeeyes (Debian):
status: Unknown → New
Revision history for this message
Archisman Panigrahi (apandada1) wrote : Re: Safeeyes crashes in Ubuntu 24.04 with error ModuleNotFoundError: No module named 'imp'

As a workaround, use the official Safe Eyes PPA.

sudo add-apt-repository ppa:safeeyes-team/safeeyes
sudo apt update
sudo apt install safeeyes

summary: - Safeeyes crashes in Ubuntu 24.04 with error ModuleNotFoundError: No
- module named 'imp'
+ [SRU] Safeeyes crashes in Ubuntu 24.04 with error ModuleNotFoundError:
+ No module named 'imp'
Changed in safeeyes (Ubuntu Noble):
assignee: nobody → Sudip Mukherjee (sudipmuk)
status: New → In Progress
Changed in safeeyes (Ubuntu):
status: Confirmed → Fix Released
description: updated
Changed in safeeyes (Ubuntu Noble):
assignee: Sudip Mukherjee (sudipmuk) → nobody
Changed in safeeyes (Debian):
status: New → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote : Please test proposed package

Hello Archisman, or anyone else affected,

Accepted safeeyes into noble-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/safeeyes/2.1.5-0.1ubuntu0.1 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-noble to verification-done-noble. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-noble. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in safeeyes (Ubuntu Noble):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-noble
Revision history for this message
Archisman Panigrahi (apandada1) wrote (last edit ):

I verified that the patched version works without any issue in Kubuntu 24.04. The error message is gone, and safeeyes functions as expected.

tags: added: verification-done-noble
removed: verification-needed-noble
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Thanks, but please be specific about what the "patched version" is. We need to be sure you tested the actual package that is sitting in noble-proposed. An "apt-cache policy safeeyes" command is enough to demonstrate what you have installed, and from where.

Revision history for this message
Archisman Panigrahi (apandada1) wrote (last edit ):

I used version `2.1.5-0.1ubuntu0.1`. I downloaded the safeeyes_2.1.5-0.1ubuntu0.1_all.deb file from https://launchpad.net/ubuntu/+source/safeeyes/2.1.5-0.1ubuntu0.1/+build/28890171, and installed it manually.

Revision history for this message
Sudip Mukherjee (sudipmuk) wrote :

I can confirm that safeeyes from noble-proposed has fixed the bug for me.

Test done:

install safeeyes and try to execute "safeeyes --help" and confirmed that it still fails.

Added noble-proposed to apt sources.
install safeeyes from noble-proposed.

Followed the testplan and quickly tried "safeeyes --help" which worked.
Then went for the detailed test with setting the time limits and waiting to confirm that safeeyes locks the screen.

Package tested:

$ apt-cache policy safeeyes
safeeyes:
  Installed: 2.1.5-0.1ubuntu0.1
  Candidate: 2.1.5-0.1ubuntu0.1
  Version table:
 *** 2.1.5-0.1ubuntu0.1 100
        100 http://gb.archive.ubuntu.com/ubuntu noble-proposed/universe amd64 Packages
        100 /var/lib/dpkg/status
     2.1.5-0.1 500
        500 http://gb.archive.ubuntu.com/ubuntu noble/universe amd64 Packages

tags: added: verification-done
removed: verification-needed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.