$ zypper ps
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.
|Operating system/app||SUSE/OpenSUSE Linux|
|Root privileges required||Yes|
|Estimated completion time||2m|
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:
|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.|
Type the following zypper command as follows:
$ sudo zypper ref
$ sudo zypper up
$ sudo zypper install lsof
$ 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.
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"
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.