apt-smart icon indicating copy to clipboard operation
apt-smart copied to clipboard

Apt-smart does not work on Ubuntu 24.04 LTS (Noble)

Open grossmj opened this issue 9 months ago • 0 comments

I installed and ran apt-smart like this:

sudo python3 -m pip install -U apt-smart --break-system-packages
apt-smart -a

and got this traceback:

Encountered unexpected exception! Aborting ..
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/dist-packages/apt_smart/cli.py", line 211, in main
    callback()
  File "/usr/local/lib/python3.12/dist-packages/apt_smart/__init__.py", line 589, in change_mirror
    new_mirror = self.best_mirror
                 ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/apt_smart/__init__.py", line 203, in best_mirror
    logger.debug("Selecting best %s mirror ..", self.distributor_id.capitalize())
                                                ^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/apt_smart/__init__.py", line 313, in distributor_id
    return self.release.distributor_id
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/apt_smart/__init__.py", line 447, in release
    return coerce_release(self.distribution_codename)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/property_manager3/__init__.py", line 784, in __get__
    value = super(custom_property, self).__get__(obj, type)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/dist-packages/apt_smart/__init__.py", line 298, in distribution_codename
    raise EnvironmentError("Failed to determine the distribution codename using apt's package resource list!")
OSError: Failed to determine the distribution codename using apt's package resource list!

I suspect this is because of the switch to the deb822 format for Ubuntu sources:

$ cat /etc/apt/sources.list
# Ubuntu sources have moved to the /etc/apt/sources.list.d/ubuntu.sources
# file, which uses the deb822 format. Use deb822-formatted .sources files
# to manage package sources in the /etc/apt/sources.list.d/ directory.
# See the sources.list(5) manual page for details.

grossmj avatar May 18 '24 05:05 grossmj