wez / wezterm

A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust
https://wezfurlong.org/wezterm/
Other
16.83k stars 755 forks source link

WezTerm won't launch on Chromebook #3958

Open oalders opened 1 year ago

oalders commented 1 year ago

What Operating System(s) are you seeing this problem on?

Linux X11

Which Wayland compositor or X11 Window manager(s) are you using?

I'm using a Chromebook and I just installed the latest nightly. I'm just using whatever the default window manager is. Happy to provide more info if that's helpful.

WezTerm version

20230710-171623-087e11eb

Did you try the latest nightly build to see if the issue is better (or worse!) than your current version?

Yes, and I updated the version box above to show the version of the nightly that I tried

Describe the bug

I can't get the GUI to launch. Part of the GUI flashes for a split second and then the app crashes. It's a rectangular black bar with "wezterm" on it, but that's all I see.

To Reproduce

Install on Chromebook and try to launch from the command line.

Configuration

I'm launching from the command line in a Linux VM on a Chromebook. I'm able to get Kitty to launch this way, but WezTerm hasn't worked for me yet.

Expected Behavior

I expected the app GUI to start up.

Logs

RUST_BACKTRACE=full wezterm 22:51:26.424 ERROR window::os::wayland::connection > keyboard_event: Illegal seek (os error 29) 22:51:27.029 ERROR env_bootstrap > panic at window/src/os/wayland/window.rs:426:38 - !? 0: 1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: wl_display_dispatch_queue_pending 18: 19: 20: 21: 22: 23: 24: 25: 26: __libc_start_main at ./csu/../csu/libc-start.c:308:16 27:

thread 'main' panicked at 'no keymap', window/src/os/wayland/window.rs:426:38 stack backtrace: 0: 0x558c973a304a - 1: 0x558c973d057f - 2: 0x558c9739cf45 - 3: 0x558c973a2e15 - 4: 0x558c973a4a3e - 5: 0x558c973a47e5 - 6: 0x558c95b7e793 - 7: 0x558c973a5124 - 8: 0x558c973a4e99 - 9: 0x558c973a34b6 - 10: 0x558c973a4bf2 - 11: 0x558c956b9ad3 - 12: 0x558c956b9a93 - 13: 0x558c965ae554 - 14: 0x558c965fa945 - 15: 0x558c965d5de1 - 16: 0x558c965dce29 - 17: 0x558c96655337 - 18: 0x558c96c598c3 - 19: 0x558c96c4efec - 20: 0x558c96c49996 - 21: 0x7cc77f6593f3 - 22: 0x7cc77f655922 - 23: 0x7cc77f65703c - wl_display_dispatch_queue_pending 24: 0x558c964d3de8 - 25: 0x558c965fc900 - 26: 0x558c957e39c6 - 27: 0x558c957e4b06 - 28: 0x558c95701cf3 - 29: 0x558c957393f9 - 30: 0x558c973962fe - 31: 0x558c957ed0e5 - 32: 0x7cc77f116d0a - __libc_start_main at ./csu/../csu/libc-start.c:308:16 33: 0x558c956ba16a - 34: 0x0 - [wayland-client error] A handler for wl_keyboard panicked. Aborted (core dumped)

Anything else?

image

wez commented 1 year ago

I just pushed a speculative fix. Please let me know if that works for you! That should show up in a nightly package within about an hour.

oalders commented 1 year ago

That was fast. 🚀

I've installed the latest nightly and now the behaviour is different. When I try to launch from the command line, the cursor goes to the next line. My prompt doesn't return, but no GUI is launched either that I can see. If I try Chrome's app launcher, nothing appears to happen there. This is what my log dir looks like. No output from today. I'm on EST.

ls -al $XDG_RUNTIME_DIR/wezterm/*
srwx-----T 1 olaf olaf   0 Jul 10 22:44 /run/user/1000/wezterm/gui-sock-1947
srwx-----T 1 olaf olaf   0 Jul 10 22:44 /run/user/1000/wezterm/gui-sock-2151
srwx-----T 1 olaf olaf   0 Jul 10 22:45 /run/user/1000/wezterm/gui-sock-2368
srwx-----T 1 olaf olaf   0 Jul 10 22:45 /run/user/1000/wezterm/gui-sock-2574
srwx-----T 1 olaf olaf   0 Jul 10 22:45 /run/user/1000/wezterm/gui-sock-2778
srwx-----T 1 olaf olaf   0 Jul 10 22:40 /run/user/1000/wezterm/gui-sock-29562
srwx-----T 1 olaf olaf   0 Jul 10 22:47 /run/user/1000/wezterm/gui-sock-3109
srwx-----T 1 olaf olaf   0 Jul 10 22:47 /run/user/1000/wezterm/gui-sock-3369
srwx-----T 1 olaf olaf   0 Jul 10 22:47 /run/user/1000/wezterm/gui-sock-3588
srwx-----T 1 olaf olaf   0 Jul 10 22:48 /run/user/1000/wezterm/gui-sock-3800
srwx-----T 1 olaf olaf   0 Jul 10 22:48 /run/user/1000/wezterm/gui-sock-4012
srwx-----T 1 olaf olaf   0 Jul 10 22:51 /run/user/1000/wezterm/gui-sock-4411
srwx-----T 1 olaf olaf   0 Jul 10 22:51 /run/user/1000/wezterm/gui-sock-4617
srwx-----T 1 olaf olaf   0 Jul 10 22:53 /run/user/1000/wezterm/gui-sock-4828
srwx-----T 1 olaf olaf   0 Jul 10 22:56 /run/user/1000/wezterm/gui-sock-5042
srwx-----T 1 olaf olaf   0 Jul 10 22:56 /run/user/1000/wezterm/gui-sock-5250
srwx-----T 1 olaf olaf   0 Jul 11 10:22 /run/user/1000/wezterm/gui-sock-5848
srwx-----T 1 olaf olaf   0 Jul 11 10:22 /run/user/1000/wezterm/gui-sock-6043
srwx-----T 1 olaf olaf   0 Jul 11 10:23 /run/user/1000/wezterm/gui-sock-6227
srwx-----T 1 olaf olaf   0 Jul 11 10:23 /run/user/1000/wezterm/gui-sock-6242
lrwxrwxrwx 1 olaf olaf  36 Jul 11 10:23 /run/user/1000/wezterm/wayland-wayland-0-org.wezfurlong.wezterm -> /run/user/1000/wezterm/gui-sock-6242
-rw------- 1 olaf olaf 736 Jul 10 22:44 /run/user/1000/wezterm/wezterm-gui-log-1947.txt
-rw------- 1 olaf olaf 736 Jul 10 22:44 /run/user/1000/wezterm/wezterm-gui-log-2151.txt
-rw------- 1 olaf olaf 736 Jul 10 22:45 /run/user/1000/wezterm/wezterm-gui-log-2368.txt
-rw------- 1 olaf olaf 736 Jul 10 22:45 /run/user/1000/wezterm/wezterm-gui-log-2574.txt
-rw------- 1 olaf olaf 736 Jul 10 22:45 /run/user/1000/wezterm/wezterm-gui-log-2778.txt
-rw------- 1 olaf olaf 736 Jul 10 22:40 /run/user/1000/wezterm/wezterm-gui-log-29562.txt
-rw------- 1 olaf olaf 736 Jul 10 22:47 /run/user/1000/wezterm/wezterm-gui-log-3109.txt
-rw------- 1 olaf olaf 736 Jul 10 22:47 /run/user/1000/wezterm/wezterm-gui-log-3369.txt
-rw------- 1 olaf olaf 736 Jul 10 22:47 /run/user/1000/wezterm/wezterm-gui-log-3588.txt
-rw------- 1 olaf olaf 736 Jul 10 22:48 /run/user/1000/wezterm/wezterm-gui-log-3800.txt
-rw------- 1 olaf olaf 736 Jul 10 22:48 /run/user/1000/wezterm/wezterm-gui-log-4012.txt
-rw------- 1 olaf olaf 736 Jul 10 22:51 /run/user/1000/wezterm/wezterm-gui-log-4411.txt
-rw------- 1 olaf olaf 736 Jul 10 22:51 /run/user/1000/wezterm/wezterm-gui-log-4617.txt
-rw------- 1 olaf olaf 736 Jul 10 22:53 /run/user/1000/wezterm/wezterm-gui-log-4828.txt
-rw------- 1 olaf olaf 736 Jul 10 22:56 /run/user/1000/wezterm/wezterm-gui-log-5042.txt
-rw------- 1 olaf olaf 736 Jul 10 22:56 /run/user/1000/wezterm/wezterm-gui-log-5250.txt

If I run at the cli via RUST_BACKTRACE=full I never see any output, even after ctrl-c.

wez commented 1 year ago

try running WEZTERM_LOG=trace wezterm from the cli; potentially will have way too much information, but the last 100 lines or so could be revealing.

wez commented 1 year ago

and/or: cat /run/user/1000/wezterm/wezterm-gui-log-5250.txt to show the contents of one of those existing log files

oalders commented 1 year ago
cat /run/user/1000/wezterm/wezterm-gui-log-5250.txt
22:56:24.901  ERROR  window::os::wayland::connection > keyboard_event: Illegal seek (os error 29)
22:56:25.317  ERROR  env_bootstrap                   > panic at window/src/os/wayland/window.rs:426:38 - !?
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: wl_display_dispatch_queue_pending
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: <unknown>
  22: <unknown>
  23: <unknown>
  24: <unknown>
  25: <unknown>
  26: __libc_start_main
             at ./csu/../csu/libc-start.c:308:16
  27: <unknown>
oalders commented 1 year ago

The last bits of tracing are in this gist: https://gist.github.com/oalders/0a2be66b5a47efaa56c67ba0f8a6804e

Seemed like too much to paste in here.

wez commented 1 year ago

that log makes it seem like the new gui is connecting to a hung older gui lurking in the background. Try killing all wezterm related processes and starting it again?

oalders commented 1 year ago

Thanks for being so helpful with this. I rebooted the Chromebook and restarted the Linux VM. There are no gui processes running. I get the same behaviour and there's just the one process going after running wezterm from the command line.

ps auxw | grep wez
olaf      2053  7.5  0.3 707700 50084 pts/2    Sl+  14:05   0:00 /usr/bin/wezterm-gui
olaf      2239  0.0  0.0   6240   648 pts/1    S+   14:05   0:00 grep --color=auto --exclude-dir=.git wez
wez commented 1 year ago

what does the WEZTERM_LOG=trace output say for that one now?

oalders commented 1 year ago

https://gist.github.com/oalders/58977120631e5fa157f93be4427472d1

wez commented 1 year ago

It looks like wezterm thinks everything is working, but the lack of window makes me suspect some kind of wayland issue. Consider setting enable_wayland=false in your config to avoid possible wayland related issue(s)

oalders commented 1 year ago
local wezterm = require 'wezterm';
local config = {}

if wezterm.config_builder then
  config = wezterm.config_builder()
end

config.font_size = 14.0
config.font = wezterm.font_with_fallback({
    "JetBrainsMono Nerd Font",
})
config.allow_square_glyphs_to_overflow_width = "WhenFollowedBySpace"
config.color_scheme = "nord"

config.colors = {
  cursor_bg = '#B48EAD',
  tab_bar = {
    active_tab = {
      bg_color = "#78c1d2",
      fg_color = "#404d5f",
    },
    inactive_tab = {
      bg_color = "#54748c",
      fg_color = "#ddd",
    },
    new_tab = {
      bg_color = "#54748c",
      fg_color = "#ddd",
    },
  }
}

config.enable_wayland = false
-- config.window_background_opacity = .65
-- config.macos_window_background_blur = 20
16:38:42.592  WARN   window::os::x11::connection > Unable to resolve appearance using xdg-desktop-portal: get_appearance.read_setting: Reading xdg-portal org.freedesktop.appearance color-scheme: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files
16:38:42.716  ERROR  wgpu_core::device           > surface configuration failed: incompatible window kind
16:38:42.812  ERROR  env_bootstrap               > panic at /github/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.2/src/backend/direct.rs:734:18 - !?
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: <unknown>
  16: <unknown>
  17: <unknown>
  18: <unknown>
  19: <unknown>
  20: <unknown>
  21: __libc_start_main
             at ./csu/../csu/libc-start.c:308:16
  22: <unknown>

thread 'main' panicked at 'Error in Surface::configure: Validation Error

Caused by:
    Invalid surface
', /github/home/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.16.2/src/backend/direct.rs:734:18
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
oalders commented 1 year ago

Full trace https://gist.github.com/oalders/9d8f086d273065e0d135602a191b0356

wez commented 1 year ago

try config.front_end = "OpenGL"

oalders commented 1 year ago

That launches the GUI. 🥳 It doesn't seem to find the font. The command line does emit:

16:49:01.856  WARN   window::os::x11::connection > Unable to resolve appearance using xdg-desktop-portal: get_appearance.read_setting: Reading xdg-portal org.freedesktop.appearance color-scheme: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files

image

vs kitty

image

wez commented 1 year ago

wezterm ls-fonts can help to diagnose font issues

wez commented 1 year ago

eg: wezterm ls-fonts --list-system | grep Nerd

Note that wezterm's default font is Jet Brains and there is a default Nerd Font symbol fallback, so you shouldn't technically need to specify the use of a patched nerd font.

Also also note that Nerd Fonts recently shipped breaking changes that redefined some of the code points, so what you're seeing might also be due to that. eg: if your shell setup and kitty are using the pre-3.0 NF stuff they'll work nicely together. If wezterm isn't finding your pre-3.0 NF and is using its post-3.0 NF symbols, then things may be confusing and vice versa.

oalders commented 1 year ago

Note that wezterm's default font is Jet Brains and there is a default Nerd Font symbol fallback, so you shouldn't technically need to specify the use of a patched nerd font.

I had no idea. Thanks!

Also also note that Nerd Fonts recently shipped breaking changes that redefined some of the code points, so what you're seeing might also be due to that. eg: if your shell setup and kitty are using the pre-3.0 NF stuff they'll work nicely together. If wezterm isn't finding your pre-3.0 NF and is using its post-3.0 NF symbols, then things may be confusing and vice versa.

I also wasn't aware of this. I did some reading and it would make sense that this is what's happening here. For instance, wezterm isn't displaying an hourglass and a folder icon. I can figure that stuff out.

Thanks very much for your help with this. Feel free to close this issue if you feel it's resolved. 😄

wez commented 1 year ago

I don't like that the wgpu stuff panics rather than raises an error. I'd like wezterm to be able to recover and try falling back to opengl in that case.

Let's keep this open for now; I'd like to ask you to try out possible fix for that in the future.

Actually what might be helpful is if you could run:

WEZTERM_LOG=wezterm_gui::termwindow::webgpu=trace,info wezterm -n and share what it outputs; that should show some diagnostics from webgpu in the default configuration.

Potentially also like this, which turns off wayland:

WEZTERM_LOG=wezterm_gui::termwindow::webgpu=trace,info wezterm -n --config 'enable_wayland=false'

oalders commented 1 year ago

Cool!

Here's the output from the second command: https://gist.github.com/oalders/cdffb9cb584e48c52f7ca358cec23140

With the first command the GUI isn't launched and I'm not seeing any output in the terminal even after ctrl-c.

wez commented 1 year ago

Can you run this as well; it looks like wgpu logs more context that it doesn't include in the panic and I'd like to see what it is:

WEZTERM_LOG=wgpu_hal=trace,wezterm_gui::termwindow::webgpu=trace,info wezterm -n --config 'enable_wayland=false'
oalders commented 1 year ago

https://gist.github.com/oalders/5bf7cf84e1c1b17e746d53931b9d290e

wez commented 1 year ago

Thanks!

Oh, interesting! This section:

21:12:22.984  INFO   wgpu_hal::gles::egl         > Loading Wayland library to get the current display
21:12:22.984  INFO   wgpu_hal::gles::egl         > Loading X11 library to get the current display
21:12:22.984  INFO   wgpu_hal::gles::egl         > Using Wayland platform

is wgpu choosing to use wayland without considering that we want to use x11. Then later on it panics because:

21:12:23.102  WARN   wgpu_hal::gles::egl             > Initialized platform Wayland doesn't work with window Xcb(XcbWindowHandle { window: 4194307, visual_id: 85 })

I'll file a bug with the wgpu folks about this.

wez commented 1 year ago

for the sake of completeness, can you also try:

WAYLAND_DISPLAY= WEZTERM_LOG=wezterm_gui::termwindow::webgpu=trace,info wezterm -n --config 'enable_wayland=true'

to see if that causes wgpu to skip wayland and startup ok?

oalders commented 1 year ago

This is another one which doesn't launch the GUI, but I have to ctrl-c to get the prompt back.

WAYLAND_DISPLAY= WEZTERM_LOG=wezterm_gui::termwindow::webgpu=trace,info wezterm -n --config 'enable_wayland=true'
22:20:36.073  WARN   window::os::x11::connection > Unable to resolve appearance using xdg-desktop-portal: get_appearance.read_setting: Reading xdg-portal org.freedesktop.appearance color-scheme: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.portal.Desktop was not provided by any .service files
22:20:36.168  TRACE  wezterm_gui::termwindow::webgpu > Using adapter: AdapterInfo { name: "llvmpipe (LLVM 11.0.1, 256 bits)", vendor: 65541, device: 0, device_type: Cpu, driver: "llvmpipe", driver_info: "Mesa 21.2.6 (LLVM 11.0.1)", backend: Vulkan }
22:20:36.168  TRACE  wezterm_gui::termwindow::webgpu > caps: SurfaceCapabilities { formats: [Bgra8UnormSrgb, Bgra8Unorm], present_modes: [Immediate, Mailbox, Fifo], alpha_modes: [PreMultiplied, Inherit] }
22:20:36.168  TRACE  wezterm_gui::termwindow::webgpu > downlevel_caps: DownlevelCapabilities { flags: DownlevelFlags(COMPUTE_SHADERS | FRAGMENT_WRITABLE_STORAGE | INDIRECT_EXECUTION | BASE_VERTEX | READ_ONLY_DEPTH_STENCIL | NON_POWER_OF_TWO_MIPMAPPED_TEXTURES | CUBE_ARRAY_TEXTURES | COMPARISON_SAMPLERS | INDEPENDENT_BLEND | VERTEX_STORAGE | FRAGMENT_STORAGE | MULTISAMPLED_SHADING | DEPTH_TEXTURE_AND_BUFFER_COPIES | WEBGPU_TEXTURE_FORMAT_SUPPORT | BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED | UNRESTRICTED_INDEX_BUFFER | FULL_DRAW_INDEX_UINT32 | DEPTH_BIAS_CLAMP | VIEW_FORMATS | UNRESTRICTED_EXTERNAL_TEXTURE_COPIES), limits: DownlevelLimits, shader_model: Sm5 }
WARNING: lavapipe is not a conformant vulkan implementation, testing use only.
phantomlsh commented 8 months ago

Still cannot launch wezterm on chromebook linux environment. Any updates?

oalders commented 8 months ago

@phantomlsh my config file has:

config.enable_wayland = false
config.front_end = "OpenGL"

and I can now launch on my Chromebook consistently. My entire config is at https://github.com/oalders/dot-files/blob/main/wezterm/wezterm.lua

phantomlsh commented 8 months ago

@oalders Wow this works indeed! Would you consider adding this to the doc? Thank you very much!

wez commented 2 days ago

Please try with the latest nightly build

lwbt commented 2 days ago

Please try with the latest nightly build

I'm not the OP but I just tested the latest nightly and it works.

My configuration includes these options among others, which have been working before with a non-nightly release.

config.enable_wayland = false
config.front_end = "OpenGL"

Is there anything particular to test?

wez commented 2 days ago

probably want to try enabling wayland to see if wayland is now working there

lwbt commented 2 days ago

Kind of. Moving my configuration aside (e.g. no configuration), I get the default setup. However I cannot move the window except with keyboard shortcuts (alt+[ & alt+]). Dragging with the mouse does not seem to work.


On the left side is my configuration with wayland off and on the right side is my configuration with wayland on. I'm not sure if this is just a problem with the old tabbar in my configuration, which I use in every other environment without issues, or with the ChromeOS environment.

Screenshot 2024-09-22 19 07 16

Full screen works without issues, windowed mode has problems with the window decoration, which is always the width of the entire screen when I use window:gui_window():maximize() in my configuration, even when I only use half of the screen. When I disable this option it starts with a normal window but only one quarter of the window is drawn, the rest is transparent/background.

Screenshot 2024-09-22 19 25 26

Side note: The mouse cursor, which is not in the pictures, is about twice the size when hovering over the wayland window (a common issue if I recall correctly).

Sorry about the high resolution images.

wez commented 2 days ago

Please also share the precise wezterm version that is running; copy and paste what you see from the debug overlay (CTRL-SHIFT-L)

lwbt commented 2 days ago
Debug Overlay
wezterm version: 20240922-091122-da0a7381 x86_64-unknown-linux-gnu
Window Environment: Wayland
Lua Version: Lua 5.4
OpenGL: virgl (Mesa Intel(R) UHD Graphics (CML GT2)) 4.3 (Compatibility Profile) Mesa 22.3.6
Enter lua statements or expressions and hit Enter.
Press ESC or CTRL-D to exit

I use the Appimage.