เหมือนซอฟต์แวร์ทุกตัว Windows Subsystem (WSL2) ก็มีปัญหา ในคู่มือนี้เราจะ troubleshoot Windows Subsystem for Linux Error Messages และ Codes
แก้ไข Windows Subsystem for Linux Errors, Problems & Issues
ข้อความเหล่านี้ที่เราจะ troubleshoot:
- ไม่เห็นตัวเลือก WSL 2
- Error: 0x1bc
- Error: 0x80040306 ตอนติดตั้ง
- เข้าถึง WSL files จาก Windows ไม่ได้
- เริ่ม WSL 2 distribution ไม่ได้ เห็นแค่ 'WSL 2' ใน output
- Command Not Found
- Error: 0x80370102 The virtual machine could not be started because a required feature is not installed
- Error: 0x80040154 หลัง Windows update
- WSL หยุดทำงาน Error 0x80070003
- Display language เปลี่ยนใน WSL
- ปัญหาติดตั้งหลัง Windows system restore
- ไม่มี internet ใน WSL
- Permission Denied ตอนใช้ Ping
- บูทไม่ได้หลังติดตั้ง WSL 2
- รัน Windows Commands ใน distributor ไม่ได้
- ICS disabled
- Bash หยุดทำงาน (hung)
- OpenSSH-Server connection issues
- The referenced assembly could not be found
- Correct (SSH related) permission errors
มาเจาะลึกแต่ละอย่าง
1. ไม่เห็นตัวเลือก WSL 2
ผู้ใช้ Windows หลายคนร้องว่าถึง build 1903 แล้วแต่ไม่เห็นตัวเลือก WSL 2 เกิดจากเครื่องยังไม่ได้รับ backport สำหรับ WSL 2
แก้: เช็คอัปเดต จะแก้ได้
2. Error: 0x1bc
อาจเห็น error นี้เมื่อ Display Language หรือ System Locale ไม่ใช่ English
wsl --set-default-version 2 Error: 0x1bc For information on key differences with WSL 2 please visit https://aka.ms/wsl2
แก้: เช็คว่า Kernel ติดตั้งอยู่ไหม คำสั่ง:
dir %SystemRoot%\system32\lxss\tools\kernel
ถ้าไม่มี Kernel ดาวน์โหลดจาก aka.ms ติดตั้งเป็นแอดมิน จะแก้ได้
3. Error: 0x80040306 ตอนติดตั้ง

หากเจอ Error: 0x80040306 ตอนติดตั้ง ต้องปิด Legacy Console ขั้นตอน:
- เปิด Command Prompt แบบแอดมินจาก Start Menu
- คลิกขวาไอคอน cmd เลือก Properties
- ยกเลิกติ๊ก Use legacy console คลิก Ok
เช็คดูว่าแก้ได้ไหม
4. เข้าถึง WSL files จาก Windows ไม่ได้

หากเข้าถึง Windows Subsystem for Linux ด้วย \\wsl$ บน Windows ไม่ได้ อาจหมายถึง 9P protocol file server ไม่เริ่มต้น
วิธีแก้ง่าย: อัปเดตคอมพิวเตอร์ และเปิด Receive updates for other Microsoft products when you update Windows ขั้นตอน:
- เปิด Settings ด้วย Win + I
- คลิก Update & Security > Advanced options
- ใช้ toggle เปิด Receive updates for other Microsoft products when you update Windows
จะแก้ปัญหาได้
5. เริ่ม WSL 2 distribution ไม่ได้ เห็นแค่ 'WSL 2' ใน output
Error นี้เลี่ยงไม่ได้ถ้า display language ไม่ใช่ English จะเห็น output:
C:\Users\me>wsl WSL 2
แก้: ดาวน์โหลดและติดตั้ง Kernel เอง จาก aka.ms/wsl2kernel ติดตั้ง Kernel จะแก้ได้
6. Command Not Found
Error พบบ่อยตอนรัน .exe ของ Windows ใน Linux อาจเห็น:
$ notepad.exe -bash: notepad.exe: command not found
เกิดจาก $PATH หา .exe ไม่เจอ แก้: รันคำสั่งใน Terminal:
export PATH=$PATH:/usr/sbin
ทำแล้วเช็คดู
7. Error: 0x80370102 The virtual machine could not be started because a required feature is not installed
หลายคนเจอตอนติดตั้ง Linux distributor ไม่เหมือน error ก่อนหน้า error นี้มีหลายวิธีแก้:
- Enable Hyper-V
- Enable Hardware Virtualization
- Enable Nested Virtualization
มาเจาะลึก
Enable Hyper-V

ไม่มี Hyper-V สร้าง Virtual Environment ไม่ได้ เปิดด้วยขั้นตอน:
- เปิด Control Panel จาก Start Menu
- คลิก Programs and Features > Turn Windows features on or off
- เลื่อนหา Hyper-V ติ๊ก คลิก Ok
หลังเปิด Hyper-V เช็คดูว่าแก้ได้ไหม
Enable Hardware Virtualization
Hardware Virtualization จำเป็นตอนรัน Virtual Machine ถ้าเจอ Error: 0x80370102 ลองเปิด Hardware Virtualization จาก BIOS
Enable Nested Virtualization
Nested Virtualization ให้รัน Hypervisor ใน VM ถ้ายังเจอ error ลองเปิด Nested Virtualization รัน PowerShell แบบแอดมิน รันคำสั่ง:
Set-VMProcessor -VMName <VMName> -ExposeVirtualizationExtensions $true
รอคำสั่งรัน เช็คดูว่าแก้ได้ไหม
8. Error: 0x80040154 หลัง Windows update

อาจเจอ error นี้ถ้า Windows Subsystem for Linux ถูกปิดเพราะ Windows Update แก้: เปิดตัวเลือกนี้ ขั้นตอน:
- เปิด Control จาก Start Menu
- คลิก Programs and Features > Turn Windows features on or off
- เลื่อนหา Windows Subsystem for Linux ติ๊ก คลิก Ok
รีสตาร์ทคอมพิวเตอร์ เช็คว่าปัญหายังอยู่ไหม
9. WSL หยุดทำงาน Error 0x80070003
หาก WSL หยุด error code 0x80070003 แก้กับคู่มือนี้
10. Display language เปลี่ยนใน WSL
WSL เปลี่ยน Ubuntu locale อัตโนมัติให้ตรงภาษา Windows หากไม่ชอบ ใช้คำสั่งตั้ง display language เอง (เปลี่ยนเป็น en-US):
sudo update-locale LANG=en_US.UTF8
ทำแล้วเช็ค
11. ปัญหาติดตั้งหลัง Windows system restore
หากเจอปัญหาติดตั้งหลัง system restore ลองลบโฟลเดอร์ Windows Subsystem for Linux พาธ:
%windir%\System32\Tasks\Microsoft\Windows\Windows Subsystem for Linux
รีสตาร์ท ติดตั้ง Bash ใหม่ เช็คดู
12. ไม่มี internet ใน WSL
หลายคนรายงานเข้าถึง Internet ใน WSL ไม่ได้ แต่อาจง่ายกว่าที่คิด เกิดจาก antivirus ตัวที่สาม firewall บล็อก internet แก้: ลบ anti-virus จะได้
13. Permission Denied ตอนใช้ Ping
หาก Ping ใน WSL ไม่ได้ หมายถึงไม่มีสิทธิ์แอดมิน รัน Ubuntu/Linux ด้วยสิทธิ์แอดมิน หรือ Bash.exe บน command line interpreter ด้วยสิทธิ์แอดมิน
ควรแก้ได้ง่าย
14. บูทไม่ได้หลังติดตั้ง WSL 2
เหตุผลที่บูทไม่ได้หลังติดตั้ง WSL 2 ยังไม่ชัด Microsoft กำลังทำงานอัปเดต診斷 แต่มี 2 อย่างลอง:
- ใช้ System Restore Point แก้
- อัปเดต Graphics Driver ดู
15. รัน Windows Commands ใน distributor ไม่ได้
มี distributors ใน Windows Store ไม่ optimized รัน Windows Commands ทั้งหมด อาจได้ error:
-bash: powershell.exe: command not found
powershell.exe /c start
แก้: รันคำสั่ง:
echo $PATH
เช็ค output ว่ามี /mnt/c/Windows/system32 ไหม ถ้า error ส่วนใหญ่ path จะไม่มี
เช็ค Profile settings:
cat /etc/profile
เช็คว่า Path assignment เริ่มด้วย # ไหม ถ้าใช่ comment out block นั้น เช็ค wsl.conf ว่ามี appendWindowsPath=false ไหม ถ้ามี comment out
หลังทำเสร็จ restart distribution คำสั่ง:
wsl -t <name of the distributor>
หรือ
wsl --shutdown
หวังว่าแก้ได้
16. ICS disabled
WSL ทำงานไม่ได้โดยไม่มี ICS หรือ Internet Connection Sharing Host Network Service (HNS) ใช้ ICS สร้าง virtual network พื้นฐานสำหรับ WSL 2 สร้าง NAT, DNS, DHCP, host connection sharing
แก้: เปิด ICS ขั้นตอน:
- เปิด Services จาก Start Menu
- คลิกสองครั้ง Internet Connection Sharing (ICS) คลิก Start ถ้าหยุดอยู่
- คลิก Apply > Ok
ควรแก้ policies บ้าง เปิด Group Policy Editor ไป:
Computer Configuration > Administrative Templates > Network > Network Connections
ปิด policies นี้:
- Prohibit installation and configuration of Network Bridge on your DNS domain network
- Prohibit the use of Internet Connection Firewall on your DNS domain network
- Prohibit the use of Internet Connection Sharing on your DNS domain network
- Require domain users to elevate when setting a network's location
17. Bash หยุดทำงาน (hung)
ตอน Bash hang หรือ deadlock หยุดตอบสนอง input สามารถ restart เครื่อง (จะแก้) หรือ report memory dump วิธีหลังอาจ crash ระบบ บันทึกงานก่อน report
18. OpenSSH-Server connection issues
หากเจอ OpenSSF-Server connection issue ตรวจสอบก่อนว่า OpenSSH-Server รันอยู่ไหม คำสั่ง:
sudo service ssh status
ถ้าไม่รัน เริ่ม service:
sudo service ssh start
ถ้ารันอยู่ restart service:
sudo service ssh restart
ถ้ายังไม่แก้ ลอง start SSHD debug mode ก่อนหยุด SSH service:
sudo service ssh stop
เริ่ม SSHD debug mode:
sudo /usr/sbin/sshd -d
หวังว่าแก้ได้
19. The referenced assembly could not be found
หลายคนเจอ The referenced assembly could not be found ตอนเปิด WSL additional feature ถ้าคุณหนึ่งในนั้น ลองเปิด Windows Subsystem for Linux จาก Control Panel และอัปเดตคอมพิวเตอร์ หวังว่าแก้ได้
20. Correct (SSH related) permission errors
หากเจอ error นี้ อ่านส่วนนี้:
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: UNPROTECTED PRIVATE KEY FILE! @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0777 for '/home/artur/.ssh/private-key.pem' are too open.
Microsoft แนะนำไปที่ /etc/wsl.conf เพิ่ม:
[automount] enabled = true options = metadata,uid=1000,gid=1000,umask=0022
จะแก้ได้ ก่อนทำ แน่ใจว่ามีสิทธิ์พอ
นี่คือ Windows Subsystem for Linux Error Messages และ Codes และเคล็ดลับ troubleshooting หวังว่าช่วยแก้ WSL Errors, Problems, Issues ได้
