VMware Workstation 跑 Windows 11 慢到一個不可思議,VM host 的處理器顯視為滿載,但 VM guest 卻一直卡住不會動。追了很久,才發現是 Slimbook Battery 調整過顯卡的參數,導致 VMware 無法正常模擬顯卡。
解法有二個,最直接的方法就是關閉 Slimbook Battery 的省電功能;另一個是暫時將 VM host 的 3D accelerator 功能關閉。
軟體開發、伺服器和生活瑣事
VMware Workstation 跑 Windows 11 慢到一個不可思議,VM host 的處理器顯視為滿載,但 VM guest 卻一直卡住不會動。追了很久,才發現是 Slimbook Battery 調整過顯卡的參數,導致 VMware 無法正常模擬顯卡。
解法有二個,最直接的方法就是關閉 Slimbook Battery 的省電功能;另一個是暫時將 VM host 的 3D accelerator 功能關閉。
以下方法僅適用於 UbuntuMate 22.04,其他版本可能無法使用相同的方法修改。
開啟系統設定檔 /usr/share/glib-2.0/schemas/30_ubuntu-mate.gschema.override
,應該可以在檔案前半段找到系統預設使用的背景圖片檔 Jammy-Jellyfish_WP_4096x2304_Green.png
。
把這個設定改為自己要使用的檔案即可:
background=/home/zeroplex/圖片/login.png
修改完成以後,打開終端機,輸入以下指令:
sudo glib-compile-schemas /usr/share/glib-2.0/schemas/
重新開機以後,登入畫面應該就會更新。
參考資料:How to change login screen background in Ubuntu Mate 21.04?
透過 bash 中的 $?
來讀取前一個指令的狀態 (exit code)。一般來說,正常執行的 exit code 會是 0
,若有發生錯誤或其他狀況,exit code 則會是 1
– 255
之間。
正常結束的 exit code:
ls /var echo $? 0
若發生錯誤,則有其他 exit code:
ls /not-exsit echo $? 2
在 shell script 中用 if 判斷程式是否要繼續執行:
curl -s https://test.com/install.sh -o install.sh if [ @? -ne 0 ]; then echo "download failed" exit fi # run install
若要刪除 target/
目錄,Linux 下的指令就是:
rm -r target/
其中要注意幾件事:
-v
:stdout 很花時間,不使用 -v
速度會快很多target/*
則 shell 會將萬用字完展開成 target/file-1
、target/file-2
… 等等,速度就會變慢使用 find 來刪除目錄:
find /path/to/target -delete
另一個是使用 rsync 同步一個空的目錄,這比前面幾個方法快很多:
mkdir empty/ rsync -a --delete empty/ target/
參考資料:A faster way to delete millions of files in a directory
sudo umount -a -t cifs -l
-l
, --lazy
:unmount. Detach the filesystem from the file hierarchy now, and clean up all references to this filesystem as soon as it is not busy anymore.reference:Force Unmount a CIFS Share in Linux