Public bug reported:

The =px= package doesn't depend on =wtmpdb=  but the tool tries to call
=last= which then fails as the command is not found.

** Steps to reproduce

1. Make sure package =wtmpdb= is not installed
2. Install package =px=
3. Verify that =tmpdb= is not present by running: =apt list wtmpdb=
4. Choose any process id (you can list processes with =px=)
5. Run =px --no-pager 4711=

It will fail with the following output:

#+BEGIN_EXAMPLE
htop

kernel(0)                root
  init(1)                root
    systemd(6448)        nomike
      gnome-shell(6888)  nomike
        gjs(11025)       nomike
          zsh(11157)     nomike
----------> htop(42763)  nomike

1h28m ago htop was started by nomike, at 2025-05-17T16:11:26+02:00.
24.3% has been its average CPU usage since then, or 21m33s/1h28m

Other processes started close to htop(42763):
  pet(25705) was started 3m40s before htop(42763)
  zsh(25873) was started 3m40s before htop(42763)
  code-insiders(26558) was started 3m38s before htop(42763)
  code-insiders(27230) was started 3m35s before htop(42763)
  [kworker/7:3-mm_percpu_wq](41405) was started 25.0s before htop(42763)

Users logged in when htop(42763) started:

---

Problems detected, please send this text to one of:
* https://github.com/walles/px/issues/new
* [email protected]

px version: 3.6.9-1-g7c04a45

Python version: 3.12.7 (main, Feb  4 2025, 14:46:03) [GCC 14.2.0]

Platform info: Linux-6.11.0-25-generic-x86_64-with-glibc2.40

2025-05-17 17:40:03CEST ERROR    Uncaught Exception
Traceback (most recent call last):
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px.py", 
line 100, in main
    _main(argv)
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px.py", 
line 254, in _main
    px_processinfo.print_pid_info(sys.stdout.fileno(), pid)
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 329, in print_pid_info
    print_process_info(fd, process, processes)
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 348, in print_process_info
    print_users_when_process_started(fd, process)
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 184, in print_users_when_process_started
    users = px_loginhistory.get_users_at(process.start_time)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_loginhistory.py",
 line 79, in get_users_at
    last_output = call_last()
                  ^^^^^^^^^^^
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_loginhistory.py",
 line 136, in call_last
    return px_exec_util.run(["last"])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_exec_util.py",
 line 18, in run
    with subprocess.Popen(
         ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'last'
#+END_EXAMPLE

If you run =px 4711= without the =--no-pager= option, the you won't get
an error message. However, your pager will be stuck forever, until you
manually interrupt the program with C-c.

Installing =wtmpb= solves this issue

** Expected behavior
IMHO the =px= package needs to have a dependency on =wtmpdb=. An alternative 
would be to modify =px= so that it checks for the availability of the =last= 
command and only tries to run it, if it exists. But I consider this the worse 
of those two options.

In debian [[https://packages.debian.org/bookworm/px][the package]] also
doesn't seem to have a dependency on =wtmpdb= so I believe this should
be filed upstream as well, but I'm not sure if its OK if I do that, so
I'm leaving this to the package maintainer.

ProblemType: Bug
DistroRelease: Ubuntu 24.10
Package: px 3.3.1-1
ProcVersionSignature: Ubuntu 6.11.0-25.25-generic 6.11.11
Uname: Linux 6.11.0-25-generic x86_64
ApportVersion: 2.30.0-0ubuntu4.2
Architecture: amd64
CasperMD5CheckResult: pass
CurrentDesktop: ubuntu:GNOME
Date: Sat May 17 17:34:59 2025
InstallationDate: Installed on 2023-07-14 (673 days ago)
InstallationMedia: Ubuntu 23.04 "Lunar Lobster" - Release amd64 (20230414.1)
PackageArchitecture: all
SourcePackage: px
UpgradeStatus: Upgraded to oracular on 2024-11-21 (177 days ago)

** Affects: px (Ubuntu)
     Importance: Undecided
         Status: New


** Tags: amd64 apport-bug oracular wayland-session

** Description changed:

  The =px= package doesn't depend on =wtmpdb=  but the tool tries to call
  =last= which then fails as the command is not found.
  
  ** Steps to reproduce
  
  1. Make sure package =wtmpdb= is not installed
  2. Install package =px=
  3. Verify that =tmpdb= is not present by running: =apt list wtmpdb=
  4. Choose any process id (you can list processes with =px=)
  5. Run =px --no-pager 4711=
  
  It will fail with the following output:
  
  #+BEGIN_EXAMPLE
  htop
  
  kernel(0)                root
-   init(1)                root
-     systemd(6448)        nomike
-       gnome-shell(6888)  nomike
-         gjs(11025)       nomike
-           zsh(11157)     nomike
+   init(1)                root
+     systemd(6448)        nomike
+       gnome-shell(6888)  nomike
+         gjs(11025)       nomike
+           zsh(11157)     nomike
  ----------> htop(42763)  nomike
  
  1h28m ago htop was started by nomike, at 2025-05-17T16:11:26+02:00.
  24.3% has been its average CPU usage since then, or 21m33s/1h28m
  
  Other processes started close to htop(42763):
-   pet(25705) was started 3m40s before htop(42763)
-   zsh(25873) was started 3m40s before htop(42763)
-   code-insiders(26558) was started 3m38s before htop(42763)
-   code-insiders(27230) was started 3m35s before htop(42763)
-   [kworker/7:3-mm_percpu_wq](41405) was started 25.0s before htop(42763)
+   pet(25705) was started 3m40s before htop(42763)
+   zsh(25873) was started 3m40s before htop(42763)
+   code-insiders(26558) was started 3m38s before htop(42763)
+   code-insiders(27230) was started 3m35s before htop(42763)
+   [kworker/7:3-mm_percpu_wq](41405) was started 25.0s before htop(42763)
  
  Users logged in when htop(42763) started:
  
  ---
  
  Problems detected, please send this text to one of:
  * https://github.com/walles/px/issues/new
  * [email protected]
  
  px version: 3.6.9-1-g7c04a45
  
  Python version: 3.12.7 (main, Feb  4 2025, 14:46:03) [GCC 14.2.0]
  
  Platform info: Linux-6.11.0-25-generic-x86_64-with-glibc2.40
  
  2025-05-17 17:40:03CEST ERROR    Uncaught Exception
  Traceback (most recent call last):
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px.py", 
line 100, in main
-     _main(argv)
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px.py", 
line 254, in _main
-     px_processinfo.print_pid_info(sys.stdout.fileno(), pid)
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 329, in print_pid_info
-     print_process_info(fd, process, processes)
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 348, in print_process_info
-     print_users_when_process_started(fd, process)
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 184, in print_users_when_process_started
-     users = px_loginhistory.get_users_at(process.start_time)
-             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_loginhistory.py",
 line 79, in get_users_at
-     last_output = call_last()
-                   ^^^^^^^^^^^
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_loginhistory.py",
 line 136, in call_last
-     return px_exec_util.run(["last"])
-            ^^^^^^^^^^^^^^^^^^^^^^^^^^
-   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_exec_util.py",
 line 18, in run
-     with subprocess.Popen(
-          ^^^^^^^^^^^^^^^^^
-   File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
-     self._execute_child(args, executable, preexec_fn, close_fds,
-   File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
-     raise child_exception_type(errno_num, err_msg, err_filename)
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px.py", 
line 100, in main
+     _main(argv)
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px.py", 
line 254, in _main
+     px_processinfo.print_pid_info(sys.stdout.fileno(), pid)
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 329, in print_pid_info
+     print_process_info(fd, process, processes)
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 348, in print_process_info
+     print_users_when_process_started(fd, process)
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_processinfo.py",
 line 184, in print_users_when_process_started
+     users = px_loginhistory.get_users_at(process.start_time)
+             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_loginhistory.py",
 line 79, in get_users_at
+     last_output = call_last()
+                   ^^^^^^^^^^^
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_loginhistory.py",
 line 136, in call_last
+     return px_exec_util.run(["last"])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File 
"/home/nomike/.local/pipx/venvs/pxpx/lib/python3.12/site-packages/px/px_exec_util.py",
 line 18, in run
+     with subprocess.Popen(
+          ^^^^^^^^^^^^^^^^^
+   File "/usr/lib/python3.12/subprocess.py", line 1026, in __init__
+     self._execute_child(args, executable, preexec_fn, close_fds,
+   File "/usr/lib/python3.12/subprocess.py", line 1955, in _execute_child
+     raise child_exception_type(errno_num, err_msg, err_filename)
  FileNotFoundError: [Errno 2] No such file or directory: 'last'
  #+END_EXAMPLE
  
  If you run =px 4711= without the =--no-pager= option, the you won't get
  an error message. However, your pager will be stuck forever, until you
  manually interrupt the program with C-c.
  
  Installing =wtmpb= solves this issue
  
  ** Expected behavior
  IMHO the =px= package needs to have a dependency on =wtmpdb=. An alternative 
would be to modify =px= so that it checks for the availability of the =last= 
command and only tries to run it, if it exists. But I consider this the worse 
of those two options.
  
  In debian [[https://packages.debian.org/bookworm/px][the package]] also
- doesn't seem to have a dependency on =wtmpdb= so I guess this is an
- upstream issue. I will file a bug report there as well.
- 
- Additionally I will file an Issue on the project's github page as well.
- 
- I will post the links here when I'm done.
+ doesn't seem to have a dependency on =wtmpdb= so I believe this should
+ be filed upstream as well, but I'm not sure if its OK if I do that, so
+ I'm leaving this to the package maintainer.
  
  ProblemType: Bug
  DistroRelease: Ubuntu 24.10
  Package: px 3.3.1-1
  ProcVersionSignature: Ubuntu 6.11.0-25.25-generic 6.11.11
  Uname: Linux 6.11.0-25-generic x86_64
  ApportVersion: 2.30.0-0ubuntu4.2
  Architecture: amd64
  CasperMD5CheckResult: pass
  CurrentDesktop: ubuntu:GNOME
  Date: Sat May 17 17:34:59 2025
  InstallationDate: Installed on 2023-07-14 (673 days ago)
  InstallationMedia: Ubuntu 23.04 "Lunar Lobster" - Release amd64 (20230414.1)
  PackageArchitecture: all
  SourcePackage: px
  UpgradeStatus: Upgraded to oracular on 2024-11-21 (177 days ago)

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2111171

Title:
  px is missing dependency to wtmpdb

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/px/+bug/2111171/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to