cancel
Showing results for 
Search instead for 
Did you mean: 
Chetan_Tiwary_
Community Manager
Community Manager
  • 932 Views

Red Hat Linux Interview Series 6

Q.) Explain the process status - what and why and can we remove this with kill ?

 

PID USER  PR NI  VIRT  RES  SHR  S  %CPU  %MEM  TIME+    COMMAND

5328 root 20  0  109m  1160 844  D  0.0   0.1   0:01.11  ls -lart /nfs

 

 

Q.) How to resolve this issue ?

 

[root@rhel9]#umount /opt umount: /opt: target is busy.

 

 

Q.) Getting this error while booting - what is it ? What will be your approach to resolve this  ?

Screenshot from 2024-09-18 23-19-42.png

Level - L2 and above.

 

I'll be posting a series of Linux-related questions covering various skill levels. Feel free to share your insights and expertise. Your contributions will benefit learners at all stages, from those in current roles to those preparing for Linux interviews.

0 Kudos
5 Replies
Trevor
Starfighter Starfighter
Starfighter
  • 853 Views

Processes - does any work get done in Linux without them!!!

Question:  "Explain the process status - what and why and can we remove this
with kill ?"

Answer:

What:  The process status is Uninterruptible Sleep

Why:  This state is necessary when a process is waiting for I/O operations to
complete - this is essential to ensure data integrity and consistency.

Can the status be removed with the "kill" command?:    NO - absolutely not!!!

 

Additional commentary:

There are two different sleeping states: Interruptible (S) and Uninterruptible (D).

The uninterruptible sleeping state (D) waits for resources to be available before it
moves into a runnable state, and doesn’t react to any signals.

In the Uninterruptible Sleep (D) state, a process is waiting for I/O operations to complete.
This state is similar to Interruptible Sleep (S), but with a key difference: the process in the
(D) state cannot be interrupted by signals.

An uninterruptible process is a process which happens to be in a system call
(kernel function) that cannot be interrupted by a signal!!!

Once the operation completes (either successfully or with an error), the process will
move out of the D state, and continue its execution, or handle any errors that occurred.


There's more that I could say, but I'll KISS, and say goodbye for now!

Trevor "Red Hat Evangelist" Chandler
Chetan_Tiwary_
Community Manager
Community Manager
  • 788 Views

@Trevor very well explained !

0 Kudos
grundblom
Flight Engineer Flight Engineer
Flight Engineer
  • 657 Views

Question regarding unmounting /opt:

The best way is to find any processes that have files open in /opt and then decide the best way to handle each file with the lsof utility:

* For example: lets say someone is reviewing a copy of documentation that is in /opt for some reason:

$ lsof +D /opt   # Note +D will look for open files recursively, +d will only look in the directory specified.

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
vim 16657 mgiggles 4u REG 253,0 16384 69140861 /opt/test/doc/zsh/.README.swp

Then you would want to get in touch with that person to let them know to close the file.

* Or it could be a service running that has several files open, like saltstack in this example:

$ lsof +D /opt
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
python3.1 798 root txt REG 253,0 3474840 100979286 /opt/saltstack/salt/bin/python3.10
python3.1 798 root mem REG 253,0 34560 101740233 /opt/saltstack/salt/lib/python3.10/lib-dynload/_csv.cpython-310-x86_64-linux-gnu.so
python3.1 798 root mem REG 253,0 28104 101831589 /opt/saltstack/salt/lib/python3.10/lib-dynload/termios.cpython-310-x86_64-linux-gnu.so
python3.1 798 root mem REG 253,0 16240 698292 /opt/saltstack/salt/lib/python3.10/site-packages/setproctitle/_setproctitle.cpython-310-x86_64-linux-gnu.so
python3.1 798 root mem REG 253,0 16240 101741348 /opt/saltstack/salt/lib/python3.10/lib-dynload/resource.cpython-310-x86_64-linux-gnu.so
python3.1 798 root mem REG 253,0 20152 69435472 /opt/saltstack/salt/lib/python3.10/site-packages/psutil/_psutil_posix.abi3.so
python3.1 798 root mem REG 253,0 29152 69435467 /opt/saltstack/salt/lib/python3.10/site-packages/psutil/_psutil_linux.abi3.so


Then stopping the service would "let go" of these files:

[root@node1 ~]# systemctl stop salt-minion
[root@node1 ~]# lsof +D /opt
[root@node1 ~]#

The not-so-great way would be using the lazy unmount option of

$ umount -l /opt
or
$ umount --lazy /opt

Usually I resort to this method if there is an emergency and the system needs to be rebooted soon.

I would always reccomend the method of looking at what is open first, and then trying to accomadate the results.

- Glen
P.S. I love mono spaced fonts
Chetan_Tiwary_
Community Manager
Community Manager
  • 602 Views

Thanks for sharing the wonderful insight @grundblom !

0 Kudos
diasdm
Cadet
Cadet
  • 587 Views

These are really well thought out answers. Thank you guys.

0 Kudos
Join the discussion
You must log in to join this conversation.