VS Code on Raspberry Pi 5 - Stable Setup
VS Code v1.97+ crashes on Pi 5 with "code 5" error due to incompatibility with the 16K pagesize kernel. This is the workaround I've been using since the bug appeared. As of this revision date, Microsoft hasn't fixed it yet, but it's likely this will become unnecessary at some point.
Problem
VS Code v1.97+ crashes with "code 5" error on Pi5 due to incompatibility with 16K pagesize kernel.
Solution
Kernel Fix (permanent)
- Edit boot configuration:
sudo nano /boot/firmware/config.txt
- Add at the end:
kernel=kernel8.img
- Reboot:
sudo reboot
Install VS Code
sudo apt update
sudo apt install code -y
First Launch
code
On login: accept "Use weaker encryption" (keyring not available by default).
Performance
- Loss: ~2-5% with 4K kernel vs 16K (imperceptible in practice).
- Benefit: Stable VS Code + automatic updates.
Restore 16K Kernel (if Microsoft fixes the bug)
- Edit boot configuration:
sudo nano /boot/firmware/config.txt
- Remove this line:
kernel=kernel8.img
- Reboot:
sudo reboot
- Check if VS Code remains stable. If it crashes, revert the change.
Known Issues
- Keyring warning: Normal behavior, use "weaker encryption"
- Mouse lag:
Ctrl+Shift+P→ "Configure Runtime Arguments" → uncomment"disable-hardware-acceleration": true - VNC: Degraded performance, use SSH Remote instead
System Info
- Bug affects: VS Code v1.97.x, v1.98.x (and possibly later versions)
- Tested on: Raspberry Pi 5 (8GB), Raspberry Pi OS Bookworm 64-bit
Changelog
- Translated from Spanish to English