마운트 해제 후 디렉토리를 rmdir하는 방법은 무엇입니까?

마운트 해제 후 디렉토리를 rmdir하는 방법은 무엇입니까?

디렉터리를 가져와 mount --bind해당 디렉터리가 포함된 디렉터리로 chroot한 다음 제거하면 해당 디렉터리를 삭제할 수 없습니다.

sudo mount --bind /usr/ /home/ubuntu/Code/conversations/jail/usr
sudo chroot /home/ubuntu/Code/conversations
exit
sudo umount  /home/ubuntu/Code/conversations/jail/usr
sudo rmdir /home/ubuntu/Code/conversations/jail/usr
rmdir: failed to remove '/home/ubuntu/Code/conversations/jail/usr': Device or resource busy

이 문제를 피하기 위해 사용해야 하는 마법 umount이나 명령이 있습니까?mount

제거 후 디렉토리는 비어 있지만 디렉토리에 연결된 프로세스가 많이 있는 것 같습니다. 그 중 일부는 직접 종료하고 싶지 않습니다. 이상적으로는 이렇게 막히지 않는 방식으로 설치하고 싶습니다.

lsof  /home/ubuntu/Code/conversations/jail/usr
lsof: WARNING: can't stat() ext4 file system /home/ubuntu/Code/conversations/jail/home/ubuntu/Code/conversations/jail/opt/pynlp
      Output information may be incomplete.
lsof: WARNING: can't stat() ext4 file system /home/ubuntu/Code/conversations/jail/home/ubuntu/Code/conversations/jail/opt/pynlp
      Output information may be incomplete.
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF    NODE NAME
systemd 26578 ubuntu  cwd    DIR  259,1     4096       2 /
systemd 26578 ubuntu  rtd    DIR  259,1     4096       2 /
systemd 26578 ubuntu  txt    REG  259,1  1595792   27443 /lib/systemd/systemd
systemd 26578 ubuntu  mem    REG  259,1  1700792    2087 /lib/x86_64-linux-gnu/libm-2.27.so
systemd 26578 ubuntu  mem    REG  259,1   121016    1764 /lib/x86_64-linux-gnu/libudev.so.1.6.9
systemd 26578 ubuntu  mem    REG  259,1    84032    2072 /lib/x86_64-linux-gnu/libgpg-error.so.0.22.0
systemd 26578 ubuntu  mem    REG  259,1    43304    2208 /lib/x86_64-linux-gnu/libjson-c.so.3.0.1
systemd 26578 ubuntu  mem    REG  259,1    34872    6176 /usr/lib/x86_64-linux-gnu/libargon2.so.0
systemd 26578 ubuntu  mem    REG  259,1   432640    2207 /lib/x86_64-linux-gnu/libdevmapper.so.1.02.1
systemd 26578 ubuntu  mem    REG  259,1    18680    2076 /lib/x86_64-linux-gnu/libattr.so.1.1.0
systemd 26578 ubuntu  mem    REG  259,1    18712    2057 /lib/x86_64-linux-gnu/libcap-ng.so.0.0.0
systemd 26578 ubuntu  mem    REG  259,1    27112    2165 /lib/x86_64-linux-gnu/libuuid.so.1.3.0
systemd 26578 ubuntu  mem    REG  259,1    14560    2086 /lib/x86_64-linux-gnu/libdl-2.27.so
systemd 26578 ubuntu  mem    REG  259,1   464824    2158 /lib/x86_64-linux-gnu/libpcre.so.3.13.3
systemd 26578 ubuntu  mem    REG  259,1   144976    2178 /lib/x86_64-linux-gnu/libpthread-2.27.so
systemd 26578 ubuntu  mem    REG  259,1   112672    4764 /usr/lib/x86_64-linux-gnu/liblz4.so.1.7.1
systemd 26578 ubuntu  mem    REG  259,1   153984    2103 /lib/x86_64-linux-gnu/liblzma.so.5.2.2
systemd 26578 ubuntu  mem    REG  259,1   206872    2221 /lib/x86_64-linux-gnu/libidn.so.11.6.16
systemd 26578 ubuntu  mem    REG  259,1    27088    6177 /usr/lib/x86_64-linux-gnu/libip4tc.so.0.1.0
systemd 26578 ubuntu  mem    REG  259,1  1155768    2164 /lib/x86_64-linux-gnu/libgcrypt.so.20.2.1
systemd 26578 ubuntu  mem    REG  259,1    22768    2205 /lib/x86_64-linux-gnu/libcap.so.2.25
systemd 26578 ubuntu  mem    REG  259,1   310040    2070 /lib/x86_64-linux-gnu/libcryptsetup.so.12.2.0
systemd 26578 ubuntu  mem    REG  259,1    31232    2074 /lib/x86_64-linux-gnu/libacl.so.1.1.0
systemd 26578 ubuntu  mem    REG  259,1    64144    2199 /lib/x86_64-linux-gnu/libapparmor.so.1.4.2
systemd 26578 ubuntu  mem    REG  259,1    92208    2225 /lib/x86_64-linux-gnu/libkmod.so.2.3.2
systemd 26578 ubuntu  mem    REG  259,1   124848    2174 /lib/x86_64-linux-gnu/libaudit.so.1.0.0
systemd 26578 ubuntu  mem    REG  259,1    55848    2058 /lib/x86_64-linux-gnu/libpam.so.0.83.1
systemd 26578 ubuntu  mem    REG  259,1   311720    2168 /lib/x86_64-linux-gnu/libblkid.so.1.1.0
systemd 26578 ubuntu  mem    REG  259,1   340232    2078 /lib/x86_64-linux-gnu/libmount.so.1.1.0
systemd 26578 ubuntu  mem    REG  259,1   154832    2161 /lib/x86_64-linux-gnu/libselinux.so.1
systemd 26578 ubuntu  mem    REG  259,1   288976    2229 /lib/x86_64-linux-gnu/libseccomp.so.2.4.1
systemd 26578 ubuntu  mem    REG  259,1    31680    2180 /lib/x86_64-linux-gnu/librt-2.27.so
systemd 26578 ubuntu  mem    REG  259,1  2363632    2434 /lib/systemd/libsystemd-shared-237.so
systemd 26578 ubuntu  mem    REG  259,1  2030544    2083 /lib/x86_64-linux-gnu/libc-2.27.so
systemd 26578 ubuntu  mem    REG  259,1   170960    2079 /lib/x86_64-linux-gnu/ld-2.27.so
bash    27117 ubuntu  cwd    DIR  259,1     4096 1287299 /home/ubuntu/Code/conversations/jail
bash    27117 ubuntu  rtd    DIR  259,1     4096       2 /
bash    27117 ubuntu  txt    REG  259,1  1113504      32 /bin/bash
bash    27117 ubuntu  mem    REG  259,1    47568    2093 /lib/x86_64-linux-gnu/libnss_files-2.27.so
bash    27117 ubuntu  mem    REG  259,1    97176    2090 /lib/x86_64-linux-gnu/libnsl-2.27.so
bash    27117 ubuntu  mem    REG  259,1    47576    2095 /lib/x86_64-linux-gnu/libnss_nis-2.27.so
bash    27117 ubuntu  mem    REG  259,1    39744    2091 /lib/x86_64-linux-gnu/libnss_compat-2.27.so
bash    27117 ubuntu  mem    REG  259,1  1516558    7807 /usr/lib/locale/C.UTF-8/LC_COLLATE
bash    27117 ubuntu  mem    REG  259,1  2030544    2083 /lib/x86_64-linux-gnu/libc-2.27.so
bash    27117 ubuntu  mem    REG  259,1    14560    2086 /lib/x86_64-linux-gnu/libdl-2.27.so
bash    27117 ubuntu  mem    REG  259,1   170784    2107 /lib/x86_64-linux-gnu/libtinfo.so.5.9
bash    27117 ubuntu  mem    REG  259,1   170960    2079 /lib/x86_64-linux-gnu/ld-2.27.so
bash    27117 ubuntu  mem    REG  259,1   199772    7808 /usr/lib/locale/C.UTF-8/LC_CTYPE
bash    27117 ubuntu  mem    REG  259,1       50    7813 /usr/lib/locale/C.UTF-8/LC_NUMERIC
bash    27117 ubuntu  mem    REG  259,1     3360    7816 /usr/lib/locale/C.UTF-8/LC_TIME
bash    27117 ubuntu  mem    REG  259,1      270    7811 /usr/lib/locale/C.UTF-8/LC_MONETARY
bash    27117 ubuntu  mem    REG  259,1       48    7805 /usr/lib/locale/C.UTF-8/LC_MESSAGES/SYS_LC_MESSAGES
bash    27117 ubuntu  mem    REG  259,1       34    7814 /usr/lib/locale/C.UTF-8/LC_PAPER
bash    27117 ubuntu  mem    REG  259,1       62    7812 /usr/lib/locale/C.UTF-8/LC_NAME
bash    27117 ubuntu  mem    REG  259,1      131    7806 /usr/lib/locale/C.UTF-8/LC_ADDRESS
bash    27117 ubuntu  mem    REG  259,1       47    7815 /usr/lib/locale/C.UTF-8/LC_TELEPHONE
bash    27117 ubuntu  mem    REG  259,1       23    7810 /usr/lib/locale/C.UTF-8/LC_MEASUREMENT
bash    27117 ubuntu  mem    REG  259,1  1683056    7802 /usr/lib/locale/locale-archive
bash    27117 ubuntu  mem    REG  259,1    26376    5016 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
bash    27117 ubuntu  mem    REG  259,1      252    7809 /usr/lib/locale/C.UTF-8/LC_IDENTIFICATION
lsof    27234 ubuntu  cwd    DIR  259,1     4096 1287299 /home/ubuntu/Code/conversations/jail
lsof    27234 ubuntu  rtd    DIR  259,1     4096       2 /
lsof    27234 ubuntu  txt    REG  259,1   163224    4561 /usr/bin/lsof
lsof    27234 ubuntu  mem    REG  259,1   144976    2178 /lib/x86_64-linux-gnu/libpthread-2.27.so
lsof    27234 ubuntu  mem    REG  259,1    14560    2086 /lib/x86_64-linux-gnu/libdl-2.27.so
lsof    27234 ubuntu  mem    REG  259,1   464824    2158 /lib/x86_64-linux-gnu/libpcre.so.3.13.3
lsof    27234 ubuntu  mem    REG  259,1  2030544    2083 /lib/x86_64-linux-gnu/libc-2.27.so
lsof    27234 ubuntu  mem    REG  259,1   154832    2161 /lib/x86_64-linux-gnu/libselinux.so.1
lsof    27234 ubuntu  mem    REG  259,1   170960    2079 /lib/x86_64-linux-gnu/ld-2.27.so
lsof    27234 ubuntu  mem    REG  259,1   199772    7808 /usr/lib/locale/C.UTF-8/LC_CTYPE
lsof    27234 ubuntu  mem    REG  259,1  1683056    7802 /usr/lib/locale/locale-archive
lsof    27234 ubuntu  mem    REG  259,1    26376    5016 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
lsof    27235 ubuntu  cwd    DIR  259,1     4096 1287299 /home/ubuntu/Code/conversations/jail
lsof    27235 ubuntu  rtd    DIR  259,1     4096       2 /
lsof    27235 ubuntu  txt    REG  259,1   163224    4561 /usr/bin/lsof
lsof    27235 ubuntu  mem    REG  259,1   144976    2178 /lib/x86_64-linux-gnu/libpthread-2.27.so
lsof    27235 ubuntu  mem    REG  259,1    14560    2086 /lib/x86_64-linux-gnu/libdl-2.27.so
lsof    27235 ubuntu  mem    REG  259,1   464824    2158 /lib/x86_64-linux-gnu/libpcre.so.3.13.3
lsof    27235 ubuntu  mem    REG  259,1  2030544    2083 /lib/x86_64-linux-gnu/libc-2.27.so
lsof    27235 ubuntu  mem    REG  259,1   154832    2161 /lib/x86_64-linux-gnu/libselinux.so.1
lsof    27235 ubuntu  mem    REG  259,1   170960    2079 /lib/x86_64-linux-gnu/ld-2.27.so
lsof    27235 ubuntu  mem    REG  259,1   199772    7808 /usr/lib/locale/C.UTF-8/LC_CTYPE
lsof    27235 ubuntu  mem    REG  259,1  1683056    7802 /usr/lib/locale/locale-archive
lsof    27235 ubuntu  mem    REG  259,1    26376    5016 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache

관련 정보