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

Launching a chroot from the chromeos launcher? #369

Closed
Zilog8 opened this issue Sep 15, 2013 · 18 comments
Closed

Launching a chroot from the chromeos launcher? #369

Zilog8 opened this issue Sep 15, 2013 · 18 comments
Labels

Comments

@Zilog8
Copy link

Zilog8 commented Sep 15, 2013

Would it be possible to add an "app" extension to the ChromeOS launcher that starts the chroot, instead of having to manually open a terminal and typing "sudo startkde"? (It's not a big deal for me, but I'm setting up my SO's laptop, and she's CLI-phobic)

Since crosh and "crosh window" are implemented as a chrome extensions, shouldn't it be possible to make an extension that automagically starts crosh, runs "shell", and "sudo startkde -b"?

If you wanted to make it super-fancy, it could check if chroot is already running, and just switch to it, as if the cntrl-alt-shift-=> hotkey had been used.

@drinkcat
Copy link
Collaborator

That would be neat, but it's not that simple: crosh/nassh use the terminalPrivate permission, which is only available to them (you cannot create your own extension with that permission).

You could try the approach in #170, and start crouton on startup. But that requires disabling root verification, and possibly(?) losing auto-updates in Chrome OS (some say it still works, didn't try myself).

The simplest solution might be to see if her CLI-phobicity can be cured (or at least managed), after all the command only needs to be run once per reboot ,-)) You could make a Google Doc, with commands to be copy-pasted along with clear instructions, and pin/bookmark it in Chrome.

@dnschneid
Copy link
Owner

I've heard of people putting the commands as their wallpaper...

@robertoandrade
Copy link

I know you guys have a lot of tickets requesting the same feature here but wanted to throw an alternative approach to implementing this.

Are you guys familiar with ARC (Android Runtime for Chrome) or its "open-source" copycat ARChon Runtime for Chrome (https://archon-runtime.github.io/)?

It's basically an Android chroot environment that embeds a port of the Android Runtime (ART/dalvik) and enables running Android apps inside Chrome (OS or regular Chrome in other platforms such as Windows, OSX, Linux).

The internals of it all are probably way too different from crouton to find any commonalities but the point I wanted to bring up is how ARC/hon is deployed as an extension (just like crouton) and enables other extensions (ie: apps) to depend on it and specify which "apk" to launch when running the original extension as a result of launching this depending extension.

This basically allows for individual app shortcuts (with icons/names) as well as launching the depending extension (ARC in this case but could be crouton) with specific parameters (passed in through the regular Chrome Extension manifest.json in a special section).

Following a similar principle if crouton was modified to enable other Chrome extensions to be built on top of it (ARChon source is available in Bitbucket: https://bitbucket.org/vladikoff/archon) as well as have a simple way to generate depending Apps/shortcuts like ARChon's https://github.com/vladikoff/chromeos-apk which basically creates a blank Chrome Extension that points to ARChon and enables specifying custom icon, title and APK (in crouton case it'd be the command we'd like to start: startunity, startxiwi app-name).

We could even have separate extensions published to the Chrome Web Store that worked in conjunction with the main crouton one for the standard crosh scripts it currently exposes.

Or is the whole limitation that you have to start the extension via sudo on crosh and there's no way to do what it does without it?

@robertoandrade
Copy link

If it's not as simple as that perhaps ARC/hon can be used as an inspiration for a future major revision rearchitecture of crouton to be able to create the chroot just like it does its Android one without requiring root access to do what it does today (ie: mounting/unmonting partitions, etc?)

@DennisLfromGA
Copy link
Collaborator

Running 'crouton' or something like it in a container has been discussed somewhat here: LXC containers? #364.
It is indeed a very interesting concept and one I believe could be done but it would probably take a lot of time and effort.

@robertoandrade
Copy link

I haven't dug into the code of ARChon but if LXC is not supported by the kernel I don't think that's what they are doing there?

@DennisLfromGA
Copy link
Collaborator

ARC++ has been recently implemented on Chrome OS, see 'Chrome OS Systems Supporting Android Apps'. It does unfortunately require a kernel version that supports containers however. See 'The Play Store comes to Chrome OS, but not the way we were expecting', especially the part entitled: 'Goodbye ARC; Hello containers'.

@robertoandrade
Copy link

That's a fascinating read @DennisLfromGA thanks for sharing it. I was under the impression they were still moving forward with ARC. So from a containers perspective (LXC, Docker or Rocket based), as per discussion on #364, with the latest kernels is it possible to run a container inside Chrome OS natively without the need for a chroot like with crouton?

Also, if that's possible I wonder if there is any work going on or a version/branch of crouton that leverages that for things like xiwi?

@DennisLfromGA
Copy link
Collaborator

@robertoandrade,

I believe it is very possible and probably would work on all of the Chrome OS devices listed that will eventually get Android apps since their kernel versions will support it. I'm afraid I don't know of anyone doing any work on this front though. Maybe we'll be pleasantly surprised one day with Ubuntu or something like it in a container for Chrome OS. I'm keeping my fingers crossed.

-DennisL

@robertoandrade
Copy link

On another front, looks like Google is already using Chromium OS in their GCP environment to run containers instead of its former Debian based OS.

Would be nice to see this make its way to official Chrome OS. Have you guys tried the latest dev channel? I'm on the beta one and got kernel 3.14 which enables all the Android containerization. Wondering if even on the latest dev Chrome OS you still can't run docker natively.

@Venryx
Copy link

Venryx commented Dec 6, 2017

That would be neat, but it's not that simple: crosh/nassh use the terminalPrivate permission, which is only available to them (you cannot create your own extension with that permission).

@drinkcat This is incorrect -- or at least, misleading if you're fine with using locally installed extensions.

I copied the source code for the "Secure Shell" extension, modified the code, and loaded it using the Chrome extensions page "Load Unpacked Extension" button. (my custom repo of it is here, however I haven't pushed my changes to it yet: https://github.com/Venryx/chrome-secure-shell)

The modified version is now installed, which runs my custom code -- automatically running some shell code when the "Crosh Window" (or just the Secure Shell app/tab) is opened. Instead of auto-running, it would be trivial to also add a button to choose which chroot to launch, and then have some code run to do so on click.

Which is exactly what the OP requested, is it not?

The only drawback is that you probably can't distribute the modified extension on the Chrome webstore. But manually installing an extension once is better than manually typing a command each boot, for someone CLI-phobic.


By the way: The source code in that repo I forked it from works, but does appear to be outdated. So it has some issues with scrolling, as well as not working correctly when you press "ctrl + shift + n" to open a new Crosh Window. So if someone knows where I can get the latest source code, please let me know.

EDIT: Nevermind, found that you can get the latest source code by just navigating to "~/Extensions/pnhechapfaindjhompbnflcldabbghjo/" in a Crosh shell. (and then copying it to the Downloads folder or what-not)

@robertoandrade
Copy link

That’s awesome progress @Venryx lmk when you push your changes to repo, I’ll give it a try.

@DennisLfromGA
Copy link
Collaborator

@Venryx,

Sounds very interesting, let us know when you have it working and have pushed your changes.

-DennisL

@Venryx
Copy link

Venryx commented Dec 10, 2017

I have gotten a basic "crouton launcher" toolbar added, and pushed the changes to the repo: https://github.com/Venryx/chrome-secure-shell

You can see a video of it here: https://www.useloom.com/share/21a4ecc860604600a6d92165831714a1

Note that the chroot's desktop environment was successfully launched -- the screen recorder just continued to record the ChromeOS screen instead.

@robertoandrade
Copy link

Just had a chance to test this @Venryx and indeed it works. I just changed to to provide a button to startunity and another one to enter-chroot. This is a great starting point.

I wonder if we fork Crosh Window in a similar fashion, we could provide a similar architecture as the ARC(hon) projects where every "app/shortcut" is basically an extension that hooks into the main one, launching it and running specific commands in that window (ie: startxiwi app-name). I'll let you know if I find the time to throw something like that together, and thanks again for sharing this.

@robertoandrade
Copy link

That's a pretty interesting route indeed @beliefless-dogmasless I'm wondering if crouton were to install this simple web server and allow for configuration of a wildcard route so that once you access http://localhost:port/app-name, in the background it would execute startxiwi app-name and also provide for a way to figure out which icon to return as a favicon on that page so Chrome OS dock would allow to bookmark different routes within the server with the respective icon.

Would this be a viable feature and configuration option within the crouton extension?

@ppibburr
Copy link

ppibburr commented Feb 9, 2018

If one wants to get a bit hacky

https://github.com/ppibburr/xiwi-shell/

Automatically start chroot upon Ctrl+Alt+T. If desired you can set chrome to open the developer terminal upon start up. (abstract away the steps, as this will launch a xiwi launcher service in the chroot that can be accessed by chrome)

This includes a dash like launcher for the linux apps, and you can add linux apps to the shelf.

@DennisLfromGA
Copy link
Collaborator

@ppibburr,

That looks very interesting but I'm too scared to try it. ;-)

-DennisLfromGA

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

No branches or pull requests

7 participants