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

last updated in Categories , ,

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 requiredYes
DifficultyEasy (rss)
Estimated completion time2m
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:

OptionDescription
PIDID of the process
PPIDID of the parent process
UIDID of the user running the process
LoginLogin name of the user running the process
CommandCommand used to execute the process
ServiceService name, if command is associated with a system service
FilesThe list of the deleted files
-sCreate 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 formatFor 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 filenameOutput 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 2 in the 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

Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.


ADVERTISEMENTS

1 comment

Leave a Comment