Ubuntu 24.04下软件打开异常

理论上所有Electron的都有问题,比如vscode,甚至chrome

一次性:

sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0

永久

echo 'kernel.apparmor_restrict_unprivileged_userns = 0' | 
  sudo tee /etc/sysctl.d/20-apparmor-etcher.conf

2024.05.08更新:发现wayland也有问题,上面的改动无效,vscode出现很多奇怪行为,禁用能解不少问题

sudo vim /etc/gdm3/custom.conf
WaylandEnable=false

2024.05.14更新:也可以保持默认wayland,这么解vscode的问题

# /usr/share/applications/code.desktop

[Desktop Entry]
...
#Exec=/usr/share/code/code %F
Exec=/usr/share/code/code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto %F
...

[Desktop Action new-empty-window]
...
#Exec=/usr/share/code/code --new-window %F
Exec=/usr/share/code/code --enable-features=UseOzonePlatform,WaylandWindowDecorations --ozone-platform-hint=auto --new-window %F
...

 

Leave a Reply

Your email address will not be published. Required fields are marked *