Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chrome-remote-desktop: init at 120.0.6099.24 #283285

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

thiagokokada
Copy link
Contributor

@thiagokokada thiagokokada commented Jan 23, 2024

Description of changes

Fixes: #34084.

Previous attempt: #157962

Based on this gist from @sepiabrown.

There are some differences between this approach and the previous attempt from @sepiabrown. This one will not use our own infrastructure to create a systemd service, instead relying on the files shipped upstream. So you can use systemctl start chrome-remote-desktop@<user>.service to start it for user.

Not working yet, the following issues needs to be fixed:

# Trying to start directly or by the service
$ sudo systemctl start chrome-remote-desktop@thiagoko.service 
# Fails with the following error
Failed to load config: [Errno 2] No such file or directory: '/home/thiagoko/.config/chrome-remote-desktop/host#fa3e834c51b16b6f8dedf23cba86f50d.json'

# Trying to go to https://remotedesktop.google.com/headless to generate the <code> and manually register the host
$ DISPLAY= ./result/opt/google/chrome-remote-desktop/chrome-remote-desktop-host --code="<code>" --redirect-url="https://remotedesktop.google.com/_/oauthredirect" --name=sankyuu-nixos
[0123/190246.589371:ERROR:usage_stats_consent_linux.cc(37)] No host config file found.
[0123/190246.591763:INFO:remoting_me2me_host.cc(1999)] Starting host process: version 118.0.5993.9
[0123/190246.687651:ERROR:shared_x_display.cc(39)] Unable to open display
[0123/190246.687722:ERROR:remoting_me2me_host.cc(625)] Can't find host config at /home/thiagoko/.config/chrome-remote-desktop/host.json

The whole issue seems to be the ~/.config/chrome-remote-desktop/host#<hash>.json configuration file, that I have zero ideas on how to generate. Would like some help here.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@thiagokokada thiagokokada changed the title chrome-remote-desktop: init at 118.0.5993.9 chrome-remote-desktop: init at 120.0.6099.24 Jan 23, 2024
@thiagokokada
Copy link
Contributor Author

Hey @sepiabrown, would like some help here if you still are interested in this package getting in nixpkgs.

@sepiabrown
Copy link
Contributor

Hey @sepiabrown, would like some help here if you still are interested in this package getting in nixpkgs.

I can't remember seeing the file $HOME/.config/chrome-remote-desktop/host#.json. Have you tried using other working linux machine to retrieve the JSON file and putting it under the above path in the NixOS machine?

@naminx
Copy link

naminx commented Feb 17, 2024

I'd like to share my result. My machine can boot Windows or NixOS. Both OS share the same static IP (I don't know whether this is relevant) and "hostname" (Important, when each OS was given its own hostname, the following copying method did not work). I copied "host.json" and "host_unprivileged.json" from "C:\ProgramData\Google\Chrome Remote Desktop" in Windows, to "host#xxx.json" and "host#xxx.settings.json" in NixOS respectively. CRD on NixOS now stops complaining about "host#xxx.json".

For those who doesn't have Windows. I didn't try this but I would like to suggest running Ubuntu in VM/Docker on NixOS, with the same "hostname" as NixOS. Setup CRD on the VM, then copy its "host#xxx.json" to NixOS.

However, CRD complains that it cannot open display ":1", both on Wayland & X11.

Result on Plasma Wayland:

$ journalctl -b -u chrome-remote-desktop@namin
Feb 17 23:10:50 tokyo systemd[1]: Started Chrome Remote Desktop instance for namin.
Feb 17 23:10:50 tokyo (-desktop)[17693]: pam_unix(chrome-remote-desktop:session): session opened for user namin(uid=1000) by (uid=0)
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,793:INFO:Using host_id: xxx
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,793:WARNING:Failed to get xserver-xorg-video-dummy version: [Errno 2] No such file or directory: 'dpkg-query'
... start of loop ...
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,795:INFO:Launching pipewire
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,811:INFO:Launching X server and X session.
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,811:INFO:Setting up and launching session
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,811:INFO:Launching host process
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,811:INFO:['/nix/store/30ca3w21gyhcmjlqp7dl6xlhndr5nfaw-chrome-remote-desktop/opt/google/chrome-remote-desktop/chrome-remote-desktop-host', '--host-con>
Feb 17 23:10:50 tokyo pipewire[17969]: mod.protocol-native: server 0x563926e6b820: name crd_audio#1eM0NjT2sY/pipewire is not an absolute path and no runtime dir found. Set one of PIPEWIRE_RUNTIME_DIR, XDG_RUNTIME_DIR or US>
Feb 17 23:10:50 tokyo pipewire[17969]: pw.conf: 0x563926e56000: could not load mandatory module "libpipewire-module-protocol-native": No such file or directory
Feb 17 23:10:50 tokyo pipewire[17969]: default: failed to create context: No such file or directory
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,813:INFO:wait() returned (17969,65024)
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,813:INFO:PipeWire process terminated
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,813:INFO:Failure count for 'PipeWire' is now 1
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,813:INFO:Sending SIGTERM to pipewire-pulse proc (pid=17970)
Feb 17 23:10:50 tokyo pipewire[17970]: spa.dbus: Failed to connect to session bus: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
Feb 17 23:10:50 tokyo pipewire[17970]: mod.fallback-sink: can't connect: Host is down
Feb 17 23:10:50 tokyo pipewire[17970]: default: can't run command load-module module-always-sink: Host is down
Feb 17 23:10:50 tokyo pipewire[17970]: default: acquire_rt thread:0x7f1c465aa6c0 prio:-1 not implemented
Feb 17 23:10:50 tokyo wireplumber[17971]: acquire_rt thread:0x7f177783e6c0 prio:-1 not implemented
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,815:INFO:Sending SIGTERM to wireplumber proc (pid=17971)
Feb 17 23:10:50 tokyo chrome-remote-desktop[17971]: Failed to connect to PipeWire
Feb 17 23:10:50 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:50,818:INFO:Waiting before relaunching
Feb 17 23:10:50 tokyo chrome-remote-desktop[17972]: [0217/231050.844729:INFO:remoting_me2me_host.cc(1998)] Starting host process: version 120.0.6099.24
Feb 17 23:10:50 tokyo chrome-remote-desktop[17972]: [0217/231050.845208:ERROR:xlib_support.cc(45)] Check failed: xlib_xcb_loader->Load("libX11-xcb.so.1").
Feb 17 23:10:50 tokyo chrome-remote-desktop[17972]: Authorization required, but no authorization protocol specified
Feb 17 23:10:50 tokyo chrome-remote-d[17972]: cannot open display: :1
Feb 17 23:10:51 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:51,819:INFO:wait() returned (17972,256)
Feb 17 23:10:51 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:51,819:INFO:Host process terminated
Feb 17 23:10:51 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:51,819:INFO:Host exited with status 1.
Feb 17 23:10:51 tokyo chrome-remote-desktop[17976]: Authorization required, but no authorization protocol specified
Feb 17 23:10:51 tokyo chrome-remote-desktop[17976]: /nix/store/nin6wlvknkgb49h0cajdp7jc1gd15i7g-xdpyinfo-1.3.4/bin/xdpyinfo: unable to open display ":1".
Feb 17 23:10:51 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:51,830:INFO:Failure count for 'Display server' is now 1
Feb 17 23:10:51 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:51,830:INFO:Failure count for 'session' is now 0
Feb 17 23:10:51 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:51,830:INFO:Failure count for 'host' is now 0
Feb 17 23:10:51 tokyo chrome-remote-desktop[17693]: 2024-02-17 23:10:51,830:INFO:Waiting before relaunching
... go back start of loop ...

Result on Plasma X11.

$ /nix/store/...hash...-chrome-remote-desktop/opt/google/chrome-remote-desktop/chrome-remote-desktop --start --new-session
2024-02-17 23:37:32,851:INFO:Using host_id: xxx
2024-02-17 23:37:32,851:WARNING:Failed to get xserver-xorg-video-dummy version: [Errno 2] No such file or directory: 'dpkg-query'
2024-02-17 23:37:32,853:INFO:Launching pipewire
2024-02-17 23:37:32,869:INFO:Launching X server and X session.
2024-02-17 23:37:32,869:INFO:Setting up and launching session
2024-02-17 23:37:32,869:INFO:Launching host process
... go back start of loop ...
2024-02-17 23:37:32,869:INFO:['/nix/store/gnbbnxr66qslxzfylirfckamgflffp13-chrome-remote-desktop/opt/google/chrome-remote-desktop/chrome-remote-desktop-host', '--host-config=-', '--audio-pipe-name=/run/user/1000/crd_audio#1eM0NjT2sY/fifo_output', '--ssh-auth-sockname=/tmp/chromoting.namin.ssh_auth_sock', '--signal-parent']
M 23:37:32.873179 default ../src/pipewire/thread.c:105:impl_acquire_rt: acquire_rt thread:0x7fafef7e76c0 prio:-1 not implemented
[E][01737.006994] mod.protocol-pulse | [ dbus-name.c: 53 dbus_request_name()] D-Bus name org.pulseaudio.Server already taken.
[W][01737.007376] default | [ thread.c: 105 impl_acquire_rt()] acquire_rt thread:0x7fc9665b96c0 prio:-1 not implemented
[W][01737.008322] default | [ thread.c: 105 impl_acquire_rt()] acquire_rt thread:0x7f4923e906c0 prio:-1 not implemented
M 23:37:32.879206 pw.context ../src/pipewire/context.c:1629:pw_context_load_spa_handle: 0x13a2800: no library for api.libcamera.enum.manager: No such file or directory
M 23:37:32.879218 wp-device ../lib/wp/device.c:619:wp_spa_device_new_from_spa_factory: SPA handle 'api.libcamera.enum.manager' could not be loaded; is it installed?
M 23:37:32.879222 script/libcamera libcamera.lua:173:chunk: PipeWire's libcamera SPA missing or broken. libcamera not supported.
M 23:37:32.879612 pw.context ../src/pipewire/context.c:1629:pw_context_load_spa_handle: 0x13a2800: no library for api.alsa.enum.udev: No such file or directory
M 23:37:32.879617 wp-device ../lib/wp/device.c:619:wp_spa_device_new_from_spa_factory: SPA handle 'api.alsa.enum.udev' could not be loaded; is it installed?
M 23:37:32.879622 script/alsa alsa.lua:349:createMonitor: PipeWire's SPA ALSA udev plugin("api.alsa.enum.udev")missing or broken. Sound Cards cannot be enumerated
M 23:37:32.879808 pw.context ../src/pipewire/context.c:1629:pw_context_load_spa_handle: 0x13a2800: no library for api.v4l2.enum.udev: No such file or directory
M 23:37:32.879811 wp-device ../lib/wp/device.c:619:wp_spa_device_new_from_spa_factory: SPA handle 'api.v4l2.enum.udev' could not be loaded; is it installed?
M 23:37:32.879816 script/v4l2 v4l2.lua:164:chunk: PipeWire's V4L SPA missing or broken. Video4Linux not supported.
[W][01737.015713] pw.context | [ context.c: 1629 pw_context_load_spa_handle()] 0x5623ebc9a120: no library for api.alsa.seq.bridge: No such file or directory
M 23:37:32.882087 m-lua-scripting ../modules/module-lua-scripting/api/api.c:387:object_activate_done: WpNode:0x14cc190 Object activation aborted: PipeWire proxy destroyed
[0217/233732.884991:INFO:remoting_me2me_host.cc(1998)] Starting host process: version 120.0.6099.24
[0217/233732.885053:ERROR:xlib_support.cc(45)] Check failed: xlib_xcb_loader->Load("libX11-xcb.so.1").

(chrome-remote-desktop-host:20486): Gtk-WARNING **: 23:37:32.885: cannot open display: :1
2024-02-17 23:37:32,886:INFO:wait() returned (20486,256)
2024-02-17 23:37:32,886:INFO:Host process terminated
2024-02-17 23:37:32,886:INFO:Host exited with status 1.
/nix/store/nin6wlvknkgb49h0cajdp7jc1gd15i7g-xdpyinfo-1.3.4/bin/xdpyinfo: unable to open display ":1".
2024-02-17 23:37:32,888:INFO:Failure count for 'Display server' is now 1
2024-02-17 23:37:32,888:INFO:Sending SIGTERM to pipewire proc (pid=20483)
[E][01737.022238] mod.pipe-tunnel | [module-pipe-tunn: 682 core_error()] error id:0 seq:29 res:-32 (Broken pipe): connection error
M 23:37:32.888978 wireplumber ../src/main.c:364:on_disconnected: disconnected from pipewire
2024-02-17 23:37:32,890:INFO:Sending SIGTERM to pipewire-pulse proc (pid=20484)
2024-02-17 23:37:32,891:INFO:Sending SIGTERM to wireplumber proc (pid=20485)
2024-02-17 23:37:32,891:INFO:Failure count for 'PipeWire' is now 0
2024-02-17 23:37:32,891:INFO:Failure count for 'session' is now 0
2024-02-17 23:37:32,891:INFO:Failure count for 'host' is now 0
2024-02-17 23:37:32,891:INFO:Waiting before relaunching
... go back start of loop ...

@thiagokokada
Copy link
Contributor Author

thiagokokada commented Feb 17, 2024

@naminx can you post the contents of your host#xxx.json and host#xxx.settings.json? Of course, you may hide anything you think shouldn't be public, I just want to see the structure of the file.

Maybe I can create a script that generate this file and get it working without needing another operational system.

@naminx
Copy link

naminx commented Feb 17, 2024

Hi, here are the files. Please note that "xxx" in the file name changes when your "hostname" changes. My first attempt to copy
from Windows failed because the hostnames were different. I can't remember the error exactly but I think CRD complained that
"host#xxx.json" is invalid. When I change hostname to that of Windows, it asks for "host#yyy.json"

host#xxx.settings.json:
{"host_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","xmpp_login":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@chromoting.gserviceaccount.com"}

host#xxx.json:
{"host_id":"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx","host_name":"tokyo","host_owner":"xxx@mail.com","host_secret_hash":"...(short)...=",
"oauth_refresh_token":"...(long)...=","xmpp_login":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@chromoting.gserviceaccount.com"}

@thiagokokada
Copy link
Contributor Author

@naminx this is great, thank you. I have an idea of what the hash from the hostname is, will give it a try later.

For everything that is a hash in the file, can you show it to me if they're the same or different?

@naminx
Copy link

naminx commented Feb 18, 2024

Sorry. I misslooked one field in "host#xxx.json". There is one more field named "private_key".

{
"host_id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"host_name": "tokyo",
"host_owner": "xxx@gmail.com",
"host_secret_hash": "hmac:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx=",
"oauth_refresh_token": "1//0...(~100 chars)...",
"private_key": "...(~1600 chars)...=",
"xmpp_login": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx@chromoting.gserviceaccount.com"
}

The field "host_id" in "host#xxx.settings.json" and "host#xxx.json" are identical.
The field "xmpp_login" in "host#xxx.settings.json" and "host#xxx.json" are also identical.

I check the host.json and host_unprivileged.json from another Windows machine.
All fields except "host_onwer" are different.
Should I try renaming the hostname to "tokyo" and check again if the hash is same or not?

@naminx
Copy link

naminx commented Feb 20, 2024

Hi all,

I think I have found the way to create "host#xxx.json".

  1. Open Chromium/Chrome
  2. Log in your google account
  3. Install CRD extension from https://chromewebstore.google.com/detail/chrome-remote-desktop/inomeogfingihgjfjlpeplalcfajhgai
  4. visit https://remotedesktop.google.com/access
  5. Scroll down to the bottom of page and click "Turn on" set up remote access on this device.
  6. Name your host, set up secret pin.
  7. In my case, KDE wallet pops up and asks for password.
  8. Now you should have host#xxx.json in ~/.config/chrome-remote-desktop/

In order to make https://remotedesktop.google.com/access show that your host is "Online",
you have to create the following symlink. I don't know how to achieve this in mkDerivation.
$ sudo ln -s $out/opt/google/chrome-remote-desktop /opt/google/chrome-remote-desktop
Then refresh https://remotedesktop.google.com/access, now your host should be displayed as "Online".
From another PC, I am able to enter the secret pin and login. However, it freezes at this screen.

crd

When I examine the service log, I get:

$ journalctl -b -u chrome-remote-desktop@namin
Feb 20 21:06:38 tokyo chrome-remote-desktop[65951]: [0220/210638.601711:ERROR:fractional_input_filter.cc(39)] Event has incomplete fractional coordinates.

@naminx
Copy link

naminx commented Feb 23, 2024

Hi all,

We are in business!
My working config files here: https://github.com/naminx/chrome-remote-desktop

This is for KDE Plasma Wayland or X11. Remote session is always X11.
If your local session is Wayland, you must log out before login remotely, or else you get only a black screen.

I have to use an old version of DEB file because the feature below causes the freezing problem mentioned in my last post.
https://chromium.googlesource.com/chromium/src.git/+/e62d6034c94a1d5e0677e9405b9192eb27243d62

To make CRD work like it does on Windows, I tried to follow this guide, but could not make it work:
https://github.com/BromTeque/Google_Chrome_Remote_Desktop_Persisten
I am clueless on the error message "Xvfb: _XSERVTransSocketUNIXCreateListener: ...SocketCreateListener() failed"

Update 27 Feb:
I have ironed out all issues except Wayland and audio matters. Now it works for KDE/X11 and GNOME/X11.
When You login remotely, you have the same screen as you see on local display, like it is on Windows.
I think it is ready for review.

replacePrefix = "/opt/google/chrome-remote-desktop";
in
stdenvNoCC.mkDerivation rec {
name = "chrome-remote-desktop";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name = "chrome-remote-desktop";
pname = "chrome-remote-desktop";

or any special reason to use name here?

--replace ${replacePrefix}/remote-assistance-host $out/${replacePrefix}/remote-assistance-host

substituteInPlace $out/${replacePrefix}/chrome-remote-desktop \
--replace /usr/bin/python3 ${python3.withPackages (ps: with ps; [ psutil pyxdg packaging ])}/bin/python3 \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it could be in the let-in above, like

Suggested change
--replace /usr/bin/python3 ${python3.withPackages (ps: with ps; [ psutil pyxdg packaging ])}/bin/python3 \
--replace /usr/bin/python3 ${lib.getBin pythonEnv}/bin/python3 \

mesa
nss
pam
xorg.libX11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason to not use the packages directly?


substituteInPlace $out/${replacePrefix}/chrome-remote-desktop \
--replace /usr/bin/python3 ${python3.withPackages (ps: with ps; [ psutil pyxdg packaging ])}/bin/python3 \
--replace '"Xvfb"' '"${xorg.xorgserver}/bin/Xvfb"' \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use lib.getExe'.

It works like

  lib.getExe' pkgs.imagemagick "convert" => /nix/store/<imagemagick-id>/bin/convert

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Packaging request: chrome remote desktop
5 participants