Can’t run Zed after installing it in AppVM

Hi there,

I installed the IDE zed in an AppVM. But when you run it you will be stuck in a blank window and it does not run at all.

Starting it with the command zed --foreground you can see the error message, which is:

image

So apparently, zed does not find the xinput mouse pointer device.

The error message stems from this part of code:

fn get_new_pointer_device_states(
    xcb_connection: &XCBConnection,
    scroll_values_to_preserve: &BTreeMap<xinput::DeviceId, PointerDeviceState>,
) -> BTreeMap<xinput::DeviceId, PointerDeviceState> {
    let devices_query_result = xcb_connection
        .xinput_xi_query_device(XINPUT_ALL_DEVICES)
        .unwrap()
        .reply()
        .unwrap();

    let mut pointer_device_states = BTreeMap::new();
    pointer_device_states.extend(
        devices_query_result
            .infos
            .iter()
            .filter(|info| is_pointer_device(info.type_))
            .filter_map(|info| {
                let scroll_data = info
                    .classes
                    .iter()
                    .filter_map(|class| class.data.as_scroll())
                    .map(|class| *class)
                    .rev()
                    .collect::<Vec<_>>();
                let old_state = scroll_values_to_preserve.get(&info.deviceid);
                let old_horizontal = old_state.map(|state| &state.horizontal);
                let old_vertical = old_state.map(|state| &state.vertical);
                let horizontal = scroll_data
                    .iter()
                    .find(|data| data.scroll_type == xinput::ScrollType::HORIZONTAL)
                    .map(|data| scroll_data_to_axis_state(data, old_horizontal));
                let vertical = scroll_data
                    .iter()
                    .find(|data| data.scroll_type == xinput::ScrollType::VERTICAL)
                    .map(|data| scroll_data_to_axis_state(data, old_vertical));
                if horizontal.is_none() && vertical.is_none() {
                    None
                } else {
                    Some((
                        info.deviceid,
                        PointerDeviceState {
                            horizontal: horizontal.unwrap_or_else(Default::default),
                            vertical: vertical.unwrap_or_else(Default::default),
                        },
                    ))
                }
            }),
    );
    if pointer_device_states.is_empty() {
        log::error!("Found no xinput mouse pointers.");
    }
    return pointer_device_states;
}

I am not that good in rust, but it looks like the virtual mouse pointer device is a problem for zed:

$ xinput
⎡ Virtual core pointer                    	id=2	[master pointer  (3)]
⎜   ↳ Virtual core XTEST pointer              	id=4	[slave  pointer  (2)]
⎜   ↳ qubesdev                                	id=6	[slave  pointer  (2)]
⎣ Virtual core keyboard                   	id=3	[master keyboard (2)]
    ↳ Virtual core XTEST keyboard             	id=5	[slave  keyboard (3)]

Is there anything one could do about that? Help would be appreciated.

Hello, before starting the debugging. Could I ask if you have gpu passthrough to the vm/vms that will run Zed?

The thing with Zed is that it heavily relies on gpu for rendering. IMO without a gpu and passthrough setup, Zed not worth it.

Here is the warning you get when launching without gpu (in qube) if interested.

Zed uses Vulkan for rendering and requires a compatible GPU.
Currently you are using a software emulated GPU (llvmpipe (LLVM 18.1.6, 256 bits)) which will result in awful performance.
For troubleshooting see: https://zed.dev/docs/linux Set ZED_ALLOW_EMULATED_GPU=1 env var to permanently override.

I don’t think I use GPU pass through, but I do not get the message that you posted either. So maybe GPU pass through is active. How would I confirm?

If you are unsure about the gpu then most likely its not been setup. Would not recommend Zed on a machine that does not use GPU.

The message should show up when you start Zed, based on your error zed has prob not been launched.

But if you really wanna get zed working, try a different template debian/fedora and also try installing via flathub (Linux - Zed). Got it working in my fedora template by following the guide on zed.dev.

Well that sounds way to much effort for having this editor. Thanks regardless for the hints.

Yeah sorry, but will say Zed is my goto editor. Just sad that it needs a GPU to run well.

Which guide exactly was that? I feel like I really want to get that working.

https://zed.dev/docs/linux

The above link. If the installscript (install.sh) does not work I would maybe recommend installing via Flathub, should be easy. Also try fedora/debain. But got mine working in fedora template so should be fine :).

That worked on Fedora. Zed is rendering. However, as you already said without GPU passthrough it is somewhat unusable. I don’t understand how to use GPU passthrough. The only real ressource on that topic is some thread about gaming. Also my notebook does not have a special GPU. It is some Intel on board graphic chip. I would love to use zed in 2 AppVMs but I think as long as I use Qubes it will not be possible.

Well if you have no GPU in your notebook, then you wanna search for eGPU (external GPU). But for this to work your notebook most likely needs thunderbolt or later gen USB-C (please search online before making decision). Then you should also consider that the GPU will only be able to attach to a single qube and not multiple.

Getting eGPU working is always nice to have, enables you to do much more graphical intensive apps in a qube. That being said, it’s does come with some complexity, wont type out a guide here but there is plenty of threads on this forum regarding passthrough.