20

A Chrome Kiosk application that I wrote has a problem only when running in Kiosk mode on a Chromebox. When staring the application manually after I log into the Chromebox it runs well. Also when testing the application on my development machine everything works well.

How can I attach a remote debug session, write remote logging information or in any other way get debugging information from the Kiosk application on the Chromebox to my development machine?

Bob Groeneveld
  • 903
  • 1
  • 9
  • 19

3 Answers3

19

If you run Chrome with the --remote-debugging-port=9222 option it will provide access to DevTools at http://localhost:9222/. Now, on a Chromebox running in Kiosk mode that's not all that useful (or even possible) without some extra steps:

  1. Put your device in "developer mode". Instructions vary depending on hardware model.
  2. Make the file system writable so that you can modify chrome's command line arguments.
  3. Add "--remote-debugging-port=9222" to /etc/chrome_dev.conf.
  4. killall chrome or pkill chrome so that the command line changes take effect.
  5. Use ssh to log into the Chromebox and forward the port locally: ssh -L9222:127.0.0.1:9222 chronos@<chromebox ip>
  6. Access DevTools from your local machine at http://localhost:9222/

Given all this it is easier to debug a kiosk app if you can run it unpackaged in non-kiosk mode.

mhenry1384
  • 7,538
  • 5
  • 55
  • 74
Reilly Grant
  • 5,590
  • 1
  • 13
  • 23
  • 1
    I will give this a try. Please note: the issue I run into only occurs when I run the kiosk app in auto start kiosk mode and not even if I run it when logged in on the Chromebox as a kiosk app. When testing on my development machine everything runs fine also. – Bob Groeneveld Dec 16 '14 at 22:15
  • In this case you may want to build an minimal example that demonstrates the problem and post that here with a description of the problem you are encountering. – Reilly Grant Dec 17 '14 at 23:39
  • When I get to step 5, I am asked for a password, and I tried the development password, but after 3 tries (using that password, typed carefully) it just says permission denied.. Any ideas? – Mr Pablo Feb 25 '16 at 17:25
  • 1
    @MrPablo I've found that ssh-ing as the chronos user can't work with a password. To get around this, run the `chromeos-setdevpasswd` command locally as root (I've found this is easiest from the VT-2 terminal, which is accessed by pressing `Ctrl + Alt + F4`). This command allows you to set a password that lets you ssh into the machine as root (`root@`). Next you can add your machine's public key to the chronos user's `.ssh/authorized_keys`, which will allow you to ssh in as the chronos user without a password (`chronos@`). – jjnebeker Mar 15 '16 at 15:33
  • In case anyone needs to do this on Windows with PuTTY. In step 5 you need to go to Connection > SSH > Tunnels and add a forwarded port, source port 9222 and destination 127.0.0.1:9222. Then under Connection > SSH > Auth select your private key file. – Scott Wilson Jun 22 '16 at 00:32
  • For those who have not yet set up the appropriate keys on their development machine to enable ssh access to their Chrome device follow the instructions from this page: https://www.chromium.org/chromium-os/testing/autotest-developer-faq/ssh-test-keys-setup to find the testing_rsa key pair needed for root access. When creating the files don't forget to chmod the testing_rsa file (containing the private key) to 600 (= wr------- or write and read for root only). – Bob Groeneveld Apr 03 '17 at 09:35
  • For anyone trying this on a Raspberry Pi, just use the pi user instead of the chronos user, and for clarification, you need to run the ssh command on the computer you want to debug with. – Adam Reis Jan 09 '18 at 08:14
  • So I'm a little stuck on this issue. I followed the steps above and filled in the games for opening ports with the guide listed below. This works, but only when I'm logged in to chrome OS as the user account when I boot an app kiosk mode the ports never get opened. I then tried the solution you gave and I it still didn't seem to work maybe I misunderstood? @BobGroeneveld can you explain your solution a bit more I fell like I just can't jump that last hurdle. http://www.de7ec7ed.com/2013/05/ssh-daemon-samsung-chromebook-exynos.html – CubanAzcuy Mar 02 '18 at 06:07
1

In the hopes of saving other a bit of time in the future, I found that you do not need to ssh in as the chronos user when attempting to debug an app that is running in kiosk mode.

In fact, I found that I was unable to ssh in as the chronos user while the device was running an app in unmanaged kiosk mode at all, however, I could while logged in to the OS.

Instead I had to ssh in as the root user. I was then able to setup the tunnel as documented by Reilly Grant and connect to the remote debugger via localhost:9222.

This means that the only change you need to make to Reilly Grant's instructions are in Step 5 change ssh -L9222:127.0.0.1:9222 chronos@<chromebox ip> to ssh -L9222:127.0.0.1:9222 root@<chromebox ip>

mdh350
  • 21
  • 1
  • 4
0

I know this should be a comment yet I sit at 49 rep.. For those trying this with the latest version of chrome you will likely end up with a non functioning remote console. To fix this you must open a local debugger and enter the following into Its console: (Reference: https://github.com/Adobe-CEP/CEP-Resources/issues/78)

isEnterKey = function(event){
  return event.key ==  'Enter' && event.keyCode == 13;
};

Object.defineProperty(KeyboardEvent.prototype, 'keyIdentifier', {
    get: function() {
        switch (this.key) {
            case "ArrowDown":
                return "Down";
            case "ArrowLeft":
                return "Left";
            case "ArrowRight":
                return "Right";
            case "ArrowUp":
                return "Up";
            case "Escape":
                return "U+001B";
            case "Tab":
                return "U+0009";
            default:
                return this.key;
        } 
    }
});
justFatLard
  • 482
  • 5
  • 9