Terminal Ubuntu có thể báo lỗi Failed to fork trên Windows 10. Terminal này cài qua tính năng Windows Subsystem for Linux (WSL). Nguyên nhân do thiếu bộ nhớ, thường xảy ra khi cập nhật terminal. Lỗi:
# apt-get update
FATAL -> Failed to fork.

Lỗi Failed to Fork với Ubuntu trên Windows 10
Gợi ý khắc phục:
- Tạo file Swap mới.
- Tắt Antivirus.
1] Tạo file Swap mới
Mở Terminal WSL, chạy lệnh tạo file swap cấp 4GB:
sudo fallocate -l 4G /swapfile
Bảo mật file:
sudo chmod 600 /swapfile
Thiết lập swap space:
sudo mkswap /swapfile
Kích hoạt swap:
sudo swapon /swapfile
Khởi động lại máy sau khi đóng terminal. Lỗi nên khắc phục.
2] Tắt Antivirus
Antivirus có thể can thiệp hoạt động WSL Terminal. Tạm tắt Antivirus hoặc Windows Defender, kiểm tra. Bật lại sau khi thành công.
Hy vọng các bước dễ làm theo và bạn khắc phục thành công.
Liên quan: Windows Subsystem for Linux không có bản phân phối đã cài đặt.
