我有一个執行以下命令的啟動指令碼:
sudo cryptsetup open /dev/sda3 dm_crypt && sudo mount -t btrfs /dev/mapper/dm_crypt /mnt && cd /mnt && ls -la && sudo -s
這基本上会打開我的LUKS設備並掛載BTRFS根分區,並啟動根外壳程式以进行进一步的工作。
一切都很好,但是当我尝試這樣做時:
umount -f /mnt
在root shell中,我得到:
umount: /mnt: target is busy.
有人可以告诉我為什麼会這樣吗?
我是對的,
if all the commands in my startup script are executed as mutual processes ?
那是什麼让
/mnt
忙吗?
這是
lsof | grep /mnt
的輸出
:
bash 1890 liveuser cwd DIR 0,45 42 256 /mnt
sudo 2168 root cwd DIR 0,45 42 256 /mnt
是因為根外壳是指令碼的子程序或其他东西吗?
這對我来說毫無意義。
Constraints
:我会打電话给
cryptsetup close
从子根外壳中获取。
最新回復
- 5月前1 #
相似問題
- bash:查詢唯一名稱的频率bashshellscripttextprocessingawksed2021-01-06 13:54
- bash:警告並提供將受rsync命令影响的檔案數bashshellscriptrsync2021-01-03 21:25
- bash:命令完成後的持續時間,開始時間和結束時間bashshellscriptzsh2021-01-03 19:26
/mnt
由两个程序保持忙碌:執行指令碼的shell和sudo
本身.您無法从root shell更改其工作目錄。您可以更改指令碼,這樣就不会
cd
进入安裝點,或者您可以使用umount -l
在退出根shell之前.後者会懒惰地卸下,並且当您退出外壳時,sudo
並且父外壳也会退出,从而釋放安裝點。如果您也想關闭LUKS卷,最好的方法是將其添加到指令碼中: