I have created a root jail containing rpm and yum (centos 7.5) to install some software on the original system.
Workflow
- Mount sys, proc, dev to the root jail
- Mount root of the original system "/" to the jail. This is important since I use the root jail to actually install software on the base system
- Mount sys, proc, dev of the original system inside the root of the original system in the rootJail e.g. mount /proc /rootJail/originalRoot/proc which is needed for some software being installed
- enter root jail, install software, exit root jail
- unmount sys, proc, dev from the root jail
- umount sys, proc, dev from the original system inside the root jail
- unmount the original systems root from the root jail (this is where it fails)
umount: /rootJail/originalRoot: target is busy. (In some cases useful info about processes that use the device is found by lsof(8) or fuser(1))
So I can basically unmount everything except the root of the original system itself. I need to to that in order to remove the root jail which is mandatory.
The Problem is, that lots of processes being started after installation of the software inside the root jail. That's why it tells me that the target is busy. Killing all these is processes is not possible since this also kills the system. It seems like these processes are bound to the rootJail instead of the real System even when the installation path is correct. Also, after a reboot everything is working perfectly (Worst case: remove the folder here)
I already tried to do a lazy unmount which basically works. I can remove the rootJail and it does not seem to harm the original system which was mounted inside
My question is: is this safe to do? or are there any other solutions of how to unmount that folder?