OpenSUSE install lsof package to get rid of ‘zypper ps’ errors

I run the following command but getting error:
$ zypper ps
    Check failed:
    Please install package 'lsof' first.

How do I fix this error? How can I use the ‘zypper ps‘ command on SELS/OpenSUSE 15.1/15.2 to find out if system reboot requires or not?

You need to install the lsof package. But, first, let us see why we need the ‘zypper ps‘ command.
Tutorial requirements
Operating system/appSUSE/OpenSUSE Linux
Root privileges required Yes
Difficulty Easy (rss)
Estimated completion time 2m
Table of contents

ADVERTISEMENTS

zypper ps: Check failed – Please install package ‘lsof’ first.

After each upgrade or removal of packages, there may be running processes on the OpenSUSE Linux. These processes continue to run meanwhile deleted files such as shared libs. The zypper ps command lists all processes using deleted files, together with the corresponding files, and a service name hint, in case it’s a known service. This gives a hint which services may need to be restarted after an update. Usually programs which continue to use deleted shared libraries. The list contains the following information:

Option Description
PID ID of the process
PPID ID of the parent process
UID ID of the user running the process
Login Login name of the user running the process
Command Command used to execute the process
Service Service name, if command is associated with a system service
Files The list of the deleted files
-s Create a short table not showing the deleted files. Given twice, show only processes which are associated with a system service. Given three times, list the associated system service names only.
--print format For each associated system service print format on the standard output, followed by a newline. Any %s directive in format is replaced by the system service name.
-d filename Output a file with all proc entries that make it into the final set of used open files. This can be submitted as additional information in a bug report.

Installing lsof on OpenSUSE Linux

Type the following zypper command as follows:
$ sudo zypper ref
$ sudo zypper up
$ sudo zypper install lsof

OpenSUSE Linux install lsof using zypper command

How to use the zypper ps command

Simply type:
$ sudo zypper ps

The following running processes use deleted files:
 
PID   | PPID | UID | User    | Command   | Service   | Files
------+------+-----+---------+-----------+-----------+--------------------------------------
6064  | 1    | 482 | polkitd | polkitd   | polkit    | /usr/lib64/libgobject-2.0.so.0.6200.5
      |      |     |         |           |           | /usr/lib64/libgmodule-2.0.so.0.6200.5
      |      |     |         |           |           | /usr/lib64/libgio-2.0.so.0.6200.5
      |      |     |         |           |           | /usr/lib64/libglib-2.0.so.0.6200.5
16499 | 1    | 0   | root    | python3.6 | firewalld | /usr/lib64/libgobject-2.0.so.0.6200.5
      |      |     |         |           |           | /usr/lib64/libglib-2.0.so.0.6200.5
      |      |     |         |           |           | /usr/lib64/libgio-2.0.so.0.6200.5
      |      |     |         |           |           | /usr/lib64/libgmodule-2.0.so.0.6200.5
 
You may wish to restart these processes.
See 'man zypper' for information about the meaning of values in the above table.
 
No core libraries or services have been updated.
Reboot is probably not necessary.

Let us restart the firewalld on OpenSUSE Linux and polkit too:
$ sudo systemctl restart firewalld
$ sudo systemctl restart polkit
## NOW VERIFY IT AGAIN ##
$ sudo zypper ps

No processes using deleted files found.
 
No core libraries or services have been updated.
Reboot is probably not necessary.

How to find out if my OpenSUSE or SUSE Linux server needs a reboot

Simply run the following and it will let you know if reboot necessary or not:
$ sudo zypper ps
See how to automate Linux kernel and packages updates and reboot the server using Ansible IT automation tool.

Examples

Want to display only processes associated with a system service that requires restart? Try:
$ sudo zypper ps -ss
Here is short cut for zypper ps --print "%s"; list services which might need a restart:
$ sudo zypper ps -sss
We can force the zypper command print the commands to retrieve status information for services which might need a restart, run:
$ sudo zypper ps --print "systemctl status %s"
Please note that if Linux kernel updated or core Linux system libs replaced, reboot the Linux box:
$ sudo reboot
## OR ##
$ sudo shutdown -r now "Going down for kernel updates"

Conclusion

We explained the ‘zypper ps’ command and its usage to restart services or servers. To use the ‘zypper ps’ command, you need the lsof tool. Hence, we installed it on our system. See OpenSUSE wiki for more information here.

This entry is 2 of 3 in the Linux Reboot Tutorial series. Keep reading the rest of the series:
  1. Find out if my Ubuntu/Debian Linux server needs a reboot
  2. OpenSUSE install lsof package to get rid of 'zypper ps' errors
  3. Check if CentOS / RHEL needs a full reboot

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
1 comment… add one
  • Dude Jul 18, 2020 @ 7:35

    I was wondering what to do and I searched the Internet. It solves my problems. Thank you kind stranger.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.