Skip to content

Instantly share code, notes, and snippets.

@cfriedt
Last active March 11, 2021 13:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cfriedt/f757b8b0e4a8c7d86c875e6985ec32bb to your computer and use it in GitHub Desktop.
Save cfriedt/f757b8b0e4a8c7d86c875e6985ec32bb to your computer and use it in GitHub Desktop.
Things to Fix In and Around Chrome OS

Things to Fix In and Around Chrome OS

Expose All USB Devices to Crostini

Crostini is the codename for the Linux virtual machine in Chrome OS. It has a number of particular functions, such as running Docker containers. Recently, it also became possible to connect USB devices to the Linux VM.

Currently, only Android devices are usable within Crostini, as indicated by this phrase within the settings screen.

Only Android devices are currently supported

But to be specific, each Chrome Device should..

Support a Blacklist

It is conceivable that the Chrome OS device itself has some USB devices that should only be used by the Chrome OS system, and not shared with the guest VM. Those devices should be blacklisted by bus and device number.

For example, the keyboard of a Chromebook might be connected over USB, and we simply do not want to share direct access to the keyboard with the VM, because then it would be impossible to use Chrome OS if the VM had control of the input. Another example is, if there were a USB fingerprint reader that unlocked the Chrome OS device - if the VM took control of the fingerprint reader, and the Chrome OS device would be bricked until power was cycled. It may be possible to throw in a hook to return control of a certain USB device on suspend, but that's getting a little risky.

Allow Changing Mode in "Shared With Linux" Folders

In Crostini, Shared with Linux folders do not allow the underlying Linux VM to change the mode of shared files. Among other things, this prevents users from being able to use git.

$ git init .
error: chmod on /mnt/chromeos/MyFiles/Downloads/repo/.git/config.lock failed: Operation not permitted
fatal: could not set 'core.filemode' to 'false'

I'm sure there are a few reasons to prohibit this one of course, because a setuid binary could take control of Linux or something like that, but there are at least a finer grain of permissions / capabilities that can be filtered.

Build Chromium OS Using Docker

Currently, the Developer's Guide uses the classic tried-and-true Gentoo method of building up a system using a chroot and sysroot. While this is good for stage builds and populating fairly basic sysroots with linked binaries and libraries, it suffers from unpredictable build failures that make it difficult to bring up a development environment in some situations.

Such as? Well, the default for emerge is to always use the most recent "stable" release of a package. A model like that where tens or even thousands of packages all have their own, uncoordinated, rolling release schedules, and is an extremely complex problem to solve. Except using a container. Using super/hyper-visor capabilities you can stop a machine quite accurately and record its entire state in seconds.

E.g. cros_sdk has failed recently because chromeos-base/verity-0.0.1 failed to build yesterday (May 18, 2019) on the release-R75-12105.B branch.

Similarly, setup_board --board=elm failed yesterday (May 18, 2019) on the release-R75-12105.B branch.

These builds should be 100% reproducible even for external developers and the fact is that using a container-based build is the simplest way to achieve that goal. It just requires containers to be used instead of logical volumes.

@ivomarsan
Copy link

Hi!

Is there something new about git error?

@benaltair
Copy link

I am getting that fatal: could not set 'core.filemode' to 'false' error when using the mounted volume with Git in Chrome OS as well.

@theflyingape
Copy link

YES!! And OEMs need to understand the issue raised here:

What's the purpose of providing an SD Card slot, when it cannot even support git (among other things) -- but the single-most important CLI utility that got us ALL here??

It's not there for Selfies and Videos nor Office documents -- those are kept in the Cloud.

Innovation through Implementation (which drive $ale$) is key -- and putting arcane restrictions on any I/O port is a Bad Idea.

Onward.

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