[Bug 2107604] Re: Python error when upgrading to 25.04

Nick Rosbrook 2107604 at bugs.launchpad.net
Fri Apr 18 18:06:55 UTC 2025


This is coming from the /usr/lib/ubuntu-
advantage/upgrade_lts_contract.py post install script I believe:

2025-04-17 23:31:48,322 DEBUG Running PostInstallScript:
'/usr/lib/ubuntu-advantage/upgrade_lts_contract.py'

** Also affects: ubuntu-advantage-tools (Ubuntu)
   Importance: Undecided
       Status: New

** Changed in: ubuntu-release-upgrader (Ubuntu)
       Status: New => Incomplete

** Tags added: rls-pp-incoming

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to ubuntu-release-upgrader in
Ubuntu.
https://bugs.launchpad.net/bugs/2107604

Title:
  Python error when upgrading to 25.04

Status in ubuntu-advantage-tools package in Ubuntu:
  New
Status in ubuntu-release-upgrader package in Ubuntu:
  Incomplete

Bug description:
  Hello everyone - I got an error from Python when upgrading a VM from
  24.10 to 25.04 (Ubuntu Server, AMD64). This was a minimized install
  (using the option selected when installing the system). I had also
  uninstalled Snap using https://askubuntu.com/a/1035917/ I was able to
  reproduce this with two different VMs (same version of Ubuntu on
  both).

  The upgrade appeared to work, so I'm not sure if this is a major
  issue, but it seemed worth reporting.

  Here is the error:
  ```none
  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/uaclient/system.py", line 701, in _subp
      proc = subprocess.Popen(  # nosec B603
          bytes_args,
      ...<2 lines>...
          env=merged_env,
      )
    File "/usr/lib/python3.13/subprocess.py", line 1039, in __init__
      self._execute_child(args, executable, preexec_fn, close_fds,
      ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
                          pass_fds, cwd, env,
                          ^^^^^^^^^^^^^^^^^^^
      ...<5 lines>...
                          gid, gids, uid, umask,
                          ^^^^^^^^^^^^^^^^^^^^^^
                          start_new_session, process_group)
                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3.13/subprocess.py", line 1969, in _execute_child
      raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: b'lsof'

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/python3/dist-packages/uaclient/system.py", line 710, in _subp
      out_result = out.decode("utf-8", errors="ignore") if out else ""
                                                           ^^^
  UnboundLocalError: cannot access local variable 'out' where it is not associated with a value

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib/ubuntu-advantage/upgrade_lts_contract.py", line 17, in <module>
      upgrade_lts_contract.process_contract_delta_after_apt_lock(cfg)
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
    File "/usr/lib/python3/dist-packages/uaclient/upgrade_lts_contract.py", line 58, in process_contract_delta_after_apt_lock
      out, _err = system.subp(["lsof", "/var/lib/apt/lists/lock"], rcs=[0, 1])
                  ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/uaclient/system.py", line 775, in subp
      out, err = _subp(
                 ~~~~~^
          args,
          ^^^^^
      ...<4 lines>...
          pipe_stdouterr=pipe_stdouterr,
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      )
      ^
    File "/usr/lib/python3/dist-packages/uaclient/system.py", line 719, in _subp
      raise exceptions.ProcessExecutionError(cmd=redacted_cmd)
  uaclient.exceptions.ProcessExecutionError: Invalid command specified 'lsof /var/lib/apt/lists/lock'.
  ```

  Running apt-cache policy ubuntu-release-upgrader simply produced 'N:
  Unable to locate package do-release-upgrade'. If it helps, lsof was
  not installed on the system.

  I was expecting it to upgrade without an error. Instead, it produced
  an error. Despite said error, it did appear to successfully upgrade,
  and the log noted 'System upgrade is complete.' I also attached part
  of the upgrade log in case it's useful (from do-release-upgrade, I
  saved it using tmux).

  Thanks,
  cocomac

  ProblemType: Bug
  DistroRelease: Ubuntu 25.04
  Package: ubuntu-release-upgrader-core 1:25.04.14
  ProcVersionSignature: Ubuntu 6.11.0-24.24-generic 6.11.11
  Uname: Linux 6.11.0-24-generic x86_64
  ApportVersion: 2.32.0-0ubuntu5
  Architecture: amd64
  CasperMD5CheckResult: pass
  CrashDB: ubuntu
  CrashReports:
   644:0:0:0:2025-04-17 21:57:33.181000000 +0000:2024-12-10 23:39:46.349000000 +0000:/var/crash/kdump_lock
   640:0:0:25638:2025-04-17 23:31:51.230280620 +0000:2025-04-17 23:31:51.230280620 +0000:/var/crash/_usr_lib_ubuntu-advantage_upgrade_lts_contract.py.0.crash
  Date: Fri Apr 18 00:11:55 2025
  InstallationDate: Installed on 2024-12-10 (128 days ago)
  InstallationMedia: Ubuntu-Server 24.10 "Oracular Oriole" - Release amd64 (20241007.1)
  PackageArchitecture: all
  ProcEnviron:
   LANG=C.UTF-8
   PATH=(custom, no user)
   SHELL=/bin/bash
   TERM=tmux-256color
   XDG_RUNTIME_DIR=<set>
  RebootRequiredPkgs: Error: path contained symlinks.
  SourcePackage: ubuntu-release-upgrader
  Symptom: ubuntu-release-upgrader
  UpgradeStatus: Upgraded to plucky on 2025-04-17 (0 days ago)
  VarLogDistupgradeXorgFixuplog:
   INFO:root:/usr/bin/do-release-upgrade running
   INFO:root:No xorg.conf, exiting

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/ubuntu-advantage-tools/+bug/2107604/+subscriptions




More information about the foundations-bugs mailing list