Google Deploys Rust VM to Shield Chrome OS From Untrusted Linux Code

Linux for Chromebooks: Secure Development (Google I/O ’19) — Chrome for Developers

Chrome for Developers

Hardware-isolated hypervisors and sandboxed system jails eliminate the need for secondary laptops by preventing containerized development exploits from accessing host personal data, networks, or physical peripherals.

AI-assisted summary of Linux for Chromebooks: Secure Development (Google I/O ’19) — original source. Check the original for full context.

Source published:

Key ideas

  • Chrome OS has scaled Linux support (Crostini) to over 50% of the active Chromebook fleet, running directly on 8th-generation Intel Core hardware without requiring dual-booting or standalone desktop shells. (2:46)
  • The platform enforces strict security boundaries by executing untrusted developer tools inside LXD containers nested within a Google-signed, read-only VM managed by crosvm—a memory-safe hypervisor written in Rust. (5:30)
  • File sharing and USB device passthrough rely on heavily jailed, Rust-implemented services and explicit user authorization, ensuring guest environments cannot inspect host files or harvest peripheral identifiers. (11:21)
  • Local web development operates over automated VSOCK tunneling between daemons, enabling zero-config localhost routing and desktop PWA testing while isolating container network namespaces from host traffic. (15:46)

Detailed notes

## Background Published by Chrome for Developers on YouTube on May 9, 2019, this presentation from Google I/O 2019 features Dylan Reid, Tom Buckley, and Sudha Broslawsky introducing Linux for Chromebooks (codenamed Crostini). The session explores the underlying architecture and user-experience design decisions that provide developers with a secure, sandboxed Linux development environment on Chrome OS.

## TL;DR The speakers present Crostini as a solution to the common developer dilemma of balancing risky development scripts with sensitive personal data on a single machine. They break down the security architecture—anchored by Rust, the custom `crosvm` hypervisor, jailed device emulators, and LXD containers—which isolates untrusted code while keeping the host Chrome OS environment protected. Through live demonstrations, the team showcases seamless file sharing, automated local web server forwarding over VSOCK, and granular USB peripheral passthrough for Android debugging. Advanced developer features are also highlighted, including direct access to the Termina VM via Crosh, btrfs copy-on-write snapshots, and multi-distribution support like Arch Linux.

## Atmosphere & style The presentation carries the polished, collaborative energy characteristic of Google I/O, seamlessly alternating between high-level product design, deep virtualization engineering, and live desktop demos. The speakers share an easy, relatable rapport, opening with empathetic humor about bad development habits like piping untrusted scripts into sudo before diving into rigorous technical breakdowns. Watching the session feels reassuring and practical, as complex sandboxing concepts and hypervisor pipelines are translated into smooth, everyday developer interactions that eliminate the anxiety of system compromise.

## Bulletin - [02:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=166s) Chrome OS has scaled Linux support (Crostini) to over 50% of the active Chromebook fleet, running directly on 8th-generation Intel Core hardware without requiring dual-booting or standalone desktop shells. - [05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) The platform enforces strict security boundaries by executing untrusted developer tools inside LXD containers nested within a Google-signed, read-only VM managed by crosvm—a memory-safe hypervisor written in Rust. - [11:21](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=681s) File sharing and USB device passthrough rely on heavily jailed, Rust-implemented services and explicit user authorization, ensuring guest environments cannot inspect host files or harvest peripheral identifiers. - [15:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=946s) Local web development operates over automated VSOCK tunneling between daemons, enabling zero-config localhost routing and desktop PWA testing while isolating container network namespaces from host traffic.

## Key takeaways - [00:00](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=0s) Developers frequently compromise their machine's security under deadline pressure, running unverified scripts that jeopardize personal data on primary work devices. - [02:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=166s) Crostini integrates standard Debian terminal utilities and graphical Linux applications seamlessly alongside native Chrome OS and Android apps. - [05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) The crosvm hypervisor is built in Rust to eliminate critical memory safety vulnerabilities such as buffer overflows and use-after-free conditions. - [05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) Virtual device emulators within crosvm, such as the display driver and RNG, operate in sandboxed, least-privilege pillars with no network access. - [09:40](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=580s) Crostini's core design philosophy prioritizes developer intuition, native desktop integration, and technical simplicity that keeps hypervisor complexity hidden. - [11:21](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=681s) Host file sharing is mediated by '9s', a custom, fuzzed 9P file server written in Rust that restricts guest visibility strictly to explicitly shared directories. - [14:10](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=850s) The Chrome OS Files app provides default access to a dedicated 'Linux Files' directory while allowing two-click sharing of local and Google Drive folders. - [15:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=946s) Development web servers run inside nested network namespaces and are bridged to Chrome OS host browsers via automated VSOCK port forwarding. - [19:10](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1150s) Localhost endpoints mapped from Crostini containers are treated as secure contexts, enabling full support for PWA desktop installation workflows. - [20:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1230s) USB peripheral access presents a major security risk for machine fingerprinting and firmware exploits, requiring emulated empty buses until users grant permission. - [24:02](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1442s) Physical Android hardware debugging is managed via granular system notification prompts that can be revoked at any time in Chrome OS Settings. - [25:54](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1554s) Advanced users can access the underlying Termina VM via the Crosh shell and manage containers directly using LXD command-line tooling. - [28:53](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1733s) Because Crostini uses the btrfs filesystem inside the VM, developers can leverage copy-on-write container snapshots for risk-free system experimentation. - [28:53](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1733s) The platform supports launching non-Debian distributions, such as Arch Linux, directly from Canonical's public image repositories inside Termina. - [32:28](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1948s) Upcoming Crostini roadmap items include native UI support for multi-container workflows and integrated backup and restore mechanisms.

## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=0s) Developer Workflows and the Two-Laptop Dilemma

At the end of day two at Google I/O 2019, Sudha Broslawsky (Designer on Crostini), Dylan Reid (Chrome OS Virtualization Lead), and Tom Buckley (Product Manager for Linux on Chromebooks) take the stage to introduce Linux for Chromebooks, codenamed Crostini. Rather than pitching new development frameworks or target platforms, Tom emphasizes that their session focuses squarely on developer peace of mind, achieved by carefully balancing simplicity and security.

Sudha conducts an informal show of hands across the packed room, noting that 100% of the audience members are developers who also rely on their primary machines for sensitive personal tasks such as filing taxes and checking personal email. When she asks how many are genuinely worried about security, virtually the entire room keeps their hands raised.

Addressing this anxiety, Dylan describes the all-too-relatable cycle of hitting an engineering roadblock on a new project under tight deadlines. When searching online for a quick fix, developers frequently stumble across suspicious instructions—such as piping an unverified script from an untrusted site directly into `sudo`. While knowing it violates every security principle, the pressure of a looming deadline often wins out: “And then it happens again and again, and eventually, I end up with a system that I don't trust as much as I should, because I don't really know what code I've run on it anymore.” To cope with this reality, Dylan explains that his personal workaround had long been carrying two distinct laptops—one dedicated solely to risky development work and another strictly reserved for personal and secure activities. Crostini, however, was designed to eliminate the need for that second laptop.

- 100% of developers surveyed in the room reported using their work machines for high-stakes personal business like taxes and email. - The habit of running unverified scripts via `curl | sudo` forces developers into an uncomfortable compromise between velocity and system trust.

---

[02:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=166s) Bringing Linux to Chrome OS: Setup and Integration

Tom Buckley explains that while Chrome OS was built from the ground up to be safe and frictionless, it originally prevented engineers from doing serious development because its locked-down environment could not execute standard developer tooling. That trade-off changed following the previous year's Google I/O announcement introducing Linux support. By mid-2019, Crostini expanded to support over 50% of the active Chromebook fleet, powering eighth-generation Intel CPU hardware such as the Lenovo Yoga Book C630 and the Acer Chromebook Spin 13.

Turning on Linux requires only a couple of clicks in settings. Beneath the surface, Chrome OS handles the complex tasks of downloading a virtual machine image, standing up container environments, and configuring all necessary bridging services. Once complete, a standard terminal icon appears directly in the Chrome OS launcher. The environment drops the user into a familiar Debian system pre-populated with standard utilities such as Git and Vim. Additional tools can be pulled in using the standard APT package manager or by installing downloaded `.deb` packages. Graphical applications integrate transparently, appearing alongside web and Android apps in the Chrome OS app launcher and managing windows directly through the native Chrome OS window manager without forcing users into a clunky secondary desktop environment.

```mermaid flowchart TD accTitle: Chrome OS Crostini User Experience Architecture accDescr: Diagram illustrating how Linux tools and applications integrate seamlessly into the native Chrome OS launcher and window manager.

subgraph ChromeOS ["Native Chrome OS Desktop"] Launcher["Chrome OS App Launcher"] WinMgr["Chrome OS Window Manager"] end

subgraph CrostiniLayer ["Linux (Crostini) Integration"] Term["Debian Terminal Environment\n(Git, Vim, APT)"] GUIApps["Graphical Linux Tools\n(IDEs, Editors,.deb packages)"] end

Term --> Launcher GUIApps --> Launcher GUIApps --> WinMgr ```

Tom underscores that convenience cannot come at the expense of safety: “You don't have to worry about malware accessing your files, snooping on your traffic, or infecting your peripherals.” Because developers need verifiable architectural guarantees rather than blind trust, the remainder of the talk dives into the exact virtualization primitives making this safety model possible.

- Linux support is available on more than half of Chromebooks, including high-end 8th-gen Intel Core devices like the Lenovo Yoga Book C630 and Acer Chromebook Spin 13. - Linux applications—both command-line tools and full graphical user interfaces—run seamlessly side-by-side with Chrome OS apps without requiring a standalone X11 or desktop shell session.

---

[05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) Crostini Architecture: Rust, crosvm, and Sandboxed Pillars

Dylan Reid returns to explain the security architecture under the hood. Chrome OS has traditionally relied on multi-layered defense-in-depth, isolating untrusted web code within sandboxed browser renderers with severely constrained system calls. However, traditional developer workflows require arbitrary Linux kernel privileges and unrestricted package installations that would compromise the host system if run natively.

To bridge this gap without endangering the host, Google introduced a hardware-isolated virtualization layer managed by `crosvm`, a custom virtual machine monitor written from scratch in Rust. Rust was selected specifically for its memory safety, eliminating entire classes of security bugs such as buffer overflows, use-after-free conditions, and integer overflows. Within this hypervisor runs a Google-signed, read-only guest VM kernel and root filesystem. Because the guest VM base image is cryptographically verified and immutable, users cannot permanently brick their boot environment.

To provide mutable developer freedom inside this read-only VM, Google partnered with Canonical's LXD team to host Debian system containers. Within these containers, developers have full root access to install any library, language, or tool. Furthermore, `crosvm` separates virtual device emulators into isolated, least-privilege sandboxes or "pillars": - The random number generator (RNG) process runs in an empty filesystem with zero network access. - The virtual display driver process handles UI rendering but is completely cut off from network access, ensuring it cannot exfiltrate host data even if compromised.

```mermaid flowchart TD accTitle: Crostini Security and Isolation Architecture accDescr: Layered Crostini architecture showing the separation between Chrome OS host, crosvm sandboxes, the guest VM, and the Debian container.

subgraph Host ["Chrome OS Host Layer"] HostOS["Chrome OS Base System\n(Browser, Personal Data, Taxes, Banking)"]

subgraph CrosvmPillars ["crosvm (Rust VMM Sandboxes)"] RNG["RNG Device Jail\n(Empty FS, No Net)"] Display["Display Driver Jail\n(No Net)"] OtherDev["Other Device Jails"] end end

subgraph GuestVM ["Read-Only Guest VM (Signed by Google)"] LinuxKernel["Guest Linux Kernel"]

subgraph LXDContainer ["Debian System Container (LXD)"] UserApps["Developer Tools & Apps\n(Unrestricted User / Root Access)"] end end

HostOS --- CrosvmPillars CrosvmPillars <-->|"Limited crosvm API"| LinuxKernel LinuxKernel --- UserApps ```

Dylan points out that securing this boundary is paramount: “So that cross-VM layer I was talking about, that's kind of the most important part of the security story here. It's the last line of defense before something gets into Chrome OS.”

---

[09:40](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=580s) Core Design Goals: Intuitive, Native, and Simple

Sudha Broslawsky returns to articulate the design philosophy that guides Crostini. Translating complex hypervisor and container machinery into everyday software required the team to establish three clear design pillars:

1. **Intuitive:** Developers have entrenched muscle memory, terminal habits, and workflow conventions built over decades. The environment must accommodate those expectations out-of-the-box so engineers feel immediately productive without learning esoteric Chrome OS workarounds. 2. **Native:** Instead of taking the easy technical route—such as booting a self-contained Linux desktop window that isolates users inside an awkward box—Google integrated Linux applications directly into the Chrome OS window manager, file picker, and application shelf. 3. **Simple:** All the complexity of virtualization, container lifecycles, and jail management is intentionally kept out of sight.

As Sudha summarizes the core philosophy: “Our guiding principle is that complexity shouldn't interfere with the user experience.” The user interface is intentionally built to mediate access gracefully, ensuring that security safeguards never degrade into friction that hinders everyday development.

[11:21](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=681s) File Sharing Architecture and the Threat Model

Tom Buckley frames the design challenge of Crostini as finding the sweet spot between developer flexibility and the established security patterns of Chrome OS. The first critical developer flow is accessing files: editors, compilers, and source control all require disk access. However, modern personal computers store far more than source code, holding tax returns, family photos, and unfinished novels. If an untrusted build tool or dependency compromises a developer's environment, standard OS setups leave all personal data vulnerable to ransomware, malicious data exfiltration, or spiteful deletion. Crostini is architected deliberately so untrusted code running inside Linux cannot reach host files unless explicitly permitted.

```mermaid flowchart TD accTitle: Crostini File Sharing Architecture accDescr: Diagram illustrating how files travel from Chrome OS to a Linux container through an isolated 9P server and VM. subgraph Host["Chrome OS (Host)"] FS["Host File System"] NineS["9s (Rust 9P Server in Jail)"] FS -->|"Explicitly Shared Folders"| NineS end

subgraph GuestVM["termina VM"] Mount9P["Kernel 9P Client Mount"] NineS -->|"9P Protocol"| Mount9P LXD["LXD Container Manager"] Mount9P --> LXD end

subgraph Container["penguin Container"] DevTools["Development Tools & Editors"] LXD -->|"Bind Mount"| DevTools end ```

Dylan Reid breaks down the layered implementation that enforces this boundary. Chrome OS shares selected directories out to the virtual machine using a custom 9P file server called `9s`. Because file sharing is a prime attack surface, the Chrome OS team authored `9s` from scratch in Rust to guarantee memory safety, thoroughly fuzzed it to ensure anomalous file inputs do not trigger exploits, and confined it in an extremely restrictive sandbox jail. The guest Linux kernel in the VM mounts the 9P export, and LXD then bind-mounts that directory into the default container where developer tools run. Even if an attacker completely subverts the Linux container, breaches the VM kernel, and exploits the server back into Chrome OS, the jailed server process itself only has file descriptors for the specific directories the user granted. As Dylan Reid emphasizes: “Because ultimately, we don't trust the code that's running inside this VM.”

- **`9s` Server:** Memory-safe 9P file server written in Rust, fuzzed against malicious input, and restricted to a sandboxed host jail. - **Layered Isolation:** Files traverse from Chrome OS host through `9s`, over the hypervisor boundary into the guest kernel's 9P client, and through LXD bind mounts to reach the container. - **Compromise Containment:** A catastrophic exploit spanning the container, VM, and file server still cannot access unshared host files, preventing ransomware or exfiltration of personal data.

---

[14:10](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=850s) User Experience: Seamless File Sharing in the Chrome OS UI

Sudha Broslawsky takes the stage to show how Crostini conceals the intricate pipeline of 9P mounts and container bind-mounts behind standard Chrome OS UI patterns. In the default configuration, users receive a dedicated folder in the Files app called "Linux Files," which maps directly to the user's home directory (`~`) inside the Linux container. Any file placed inside this folder is instantly readable and writable by Linux tools without security prompts. Everywhere else on the device—including local storage, external drives, and cloud files—remains completely invisible to Linux until the user grants explicit permission.

Granting access to external directories requires just two clicks. Broslawsky illustrates this by right-clicking a project folder named "Illustrations" in the Files app and choosing "Share with Linux." Notably, this folder resides directly in Google Drive, demonstrating that cloud-synced storage can be seamlessly forwarded into the local Linux environment; users can revoke access at any time through the Chrome OS Settings application. For quick one-off edits, Chrome OS provides implicit ephemeral sharing: double-clicking a file in the host "Downloads" folder that is associated with a Linux application, such as Visual Studio Code, launches the editor and shares that single file behind the scenes until the system restarts. Sudha Broslawsky notes the philosophy behind these choices: “This is the balance of security and simplicity we wanted to bring you.”

---

[15:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=946s) Web Development Flow: Securing Local Web Servers

Tom Buckley turns to the second core developer scenario: spinning up local web servers. Developing modern web applications requires running local HTTP and WebSocket servers, but raw low-level networking privileges present severe security vulnerabilities. A malicious process capable of listening to and binding arbitrary network traffic can potentially sniff outbound internet packets, observe the URLs a user navigates to in their primary browser, or even intercept session content. Crostini was engineered to let developers spin up development servers while completely walling them off from the host's actual network interfaces.

```mermaid flowchart LR accTitle: Crostini Web Server Port Forwarding accDescr: Flow diagram showing how HTTP traffic moves between Chrome and a containerized web server via VSOCK and background daemons. subgraph Browser["Chrome OS Host"] Chrome["Chrome Browser (localhost:PORT)"] HostDaemon["Host Forwarding Daemon"] Chrome <-->|"HTTP"| HostDaemon end

subgraph Guest["Termina VM / Container"] VMрез["VM Detection Daemon"] WebServer["Web Server (e.g.:8080)"] VMрез <-->|"Monitors Ports"| WebServer HostDaemon <-->|"VSOCK"| VMрез VMрез <-->|"HTTP"| WebServer end ```

Dylan Reid explains the underlying networking architecture. When a developer executes a command to run a web server inside a Crostini container, that server opens a port inside an isolated network namespace. That namespace is nested within the virtual machine, which is itself running inside a separate network namespace managed by the hypervisor (`crosvm`), entirely disconnected from Chrome OS host traffic. Because Chrome cannot natively route directly back into this multi-tiered namespace, Google built cooperating daemons into each layer. A daemon running inside the VM continuously monitors network namespaces to identify when a container opens a listening socket, bundles that metadata, and notifies a companion daemon on the Chrome OS host. The host daemon sets up local port forwarding, tunneling the connection over VSOCK—a dedicated socket protocol for host-to-guest VM communication. As Dylan Reid summarizes: “So the key here is that the web server gets to talk HTTP. Chrome gets to talk HTTP. Everything's normal.” Furthermore, Chrome OS marks these proxied `localhost` endpoints as trusted origins, allowing developers to test Progressive Web App (PWA) installation flows directly on their desktop.

- **Double Namespace Isolation:** Linux containers exist in a network namespace inside the VM, while the VM hypervisor network sits in a host namespace, preventing Linux code from sniffing host web traffic. - **Automated VSOCK Forwarding:** VM daemons automatically detect newly opened container listening ports and coordinate with Chrome OS daemons to bridge HTTP traffic over VSOCK without manual port mapping. - **Trusted Origin Support:** Proxied local ports are treated as secure local contexts, enabling full support for PWA desktop installs, service workers, and modern Web APIs.

---

[19:10](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1150s) Testing Web Apps and PWAs via Localhost

Sudha Broslawsky proves how invisible this networking machinery is during day-to-day development. Navigating into a `PWA Starter Kit` directory within the Linux terminal, she executes the build script to start a local server listening on port 8080. Without configuring any iptables rules, editing hosts files, or tweaking IP addresses, the developer can simply open the Chrome browser on the host, type `localhost:8080`, and interact with the application.

To showcase platform versatility, Broslawsky arranges the screen with Chrome rendering the web application on the left and a native Linux build of Mozilla Firefox running on the right, verifying that cross-browser testing functions effortlessly on a single Chromebook. Importantly, this entire flow does not trigger a single security confirmation dialog or permission prompt. Because the connection direction flows exclusively from the secure host inward to the untrusted virtual machine—rather than the VM reaching out into host services—Chrome OS can safely permit the connection automatically. Reflecting on this architecture, Sudha Broslawsky notes: “This is because the host is accessing the VM and not the other way around.”

---

[20:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1230s) Android Development and USB Device Forwarding

For the third developer flow, Tom Buckley addresses Android development. Having announced official Android Studio support for Chromebooks the prior day—complete with a dedicated one-click installer for Chrome OS—the team needed to ensure developers could deploy and debug apps on physical hardware. While wireless debugging via remote ADB over Wi-Fi is possible, developers expect the tactile convenience of plugging an Android phone directly into a USB port. However, USB is historically one of the most perilous peripheral interfaces in computing. Developers routinely connect thumb drives containing private data, fitness wearables storing sensitive health metrics, and hardware security keys guarding corporate accounts. Malicious or compromised software with direct access to a USB bus can track a user across machines via hardware serial identifiers, deploy firmware exploits, or manipulate peripheral memory.

Dylan Reid recounts that USB passthrough was one of the engineering team's most arduous undertakings. As Dylan Reid puts it: “Implementing USB was a lot of fun for us. It might have been our most painful stack.” The USB specification is notoriously massive and frequently implemented with subtle deviations across different hardware manufacturers. To defend the Chrome OS host kernel, the engineers isolated the USB virtualization driver inside a heavily sandboxed `crosvm` jail with zero access to the host file system or network interfaces. Instead of granting blanket access to the machine's physical USB controller, Crostini presents the Linux VM with an emulated, empty USB bus. Physical hardware remains completely invisible to the Linux environment until the user deliberately selects a specific peripheral to attach to the development container, ensuring that sensitive accessories like security tokens or mass storage devices remain strictly guarded by Chrome OS.

- **Official Android Studio Support:** Android Studio is packaged with a dedicated Chrome OS installer designed to streamline setup on Chromebooks. - **Physical USB Attack Surface:** Arbitrary USB bus access exposes users to machine tracking, peripheral firmware alteration, and compromise of connected security keys or storage media. - **Jailed Emulation:** The guest VM interacts exclusively with a virtualized USB bus managed within a jailed crosvm process, requiring explicit user permission before any physical USB device is passed through.

[23:00](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1380s) USB Device Passthrough: Security, Privacy, and UX

Dylan Reid outlines how USB device passthrough operates across the Crostini virtualization stack. When a physical USB accessory is initially attached to the machine, the Linux environment does not see it at all—from the container's perspective, nothing is connected. Only when the user explicitly grants permission does the host attach the device to the virtual bus, expose it to the guest VM, and forward it down into the container.

```mermaid flowchart TD accTitle: USB Passthrough Flow accDescr: Step-by-step path of a physical USB device from host Chrome OS to the container.

subgraph Host["Host (Chrome OS)"] USB["Physical USB Device"] -->|"Plugged in"| CrOS["Chrome OS Kernel"] CrOS -->|"User prompted"| Dialog{"User Authorizes?"} end

subgraph VM["Termina VM"] Jail["Jailed Bus Controller (Rust)"] GuestKernel["Guest Linux Kernel"] end

subgraph Cont["Container"] LXC["Penguin (Debian Container)"] end

Dialog -->|"Yes"| Jail Jail -->|"Attach to virtual bus"| GuestKernel GuestKernel -->|"Forward device node"| LXC ```

Reid explains that the engineering team focused heavily on two core principles while designing this feature: security and privacy. To ensure security, the device handling code runs inside a Minijail environment to reduce the host attack surface, is implemented in Rust for memory safety, and is subjected to continuous fuzz testing. Privacy was an equally critical consideration: Reid emphasizes that untrusted code running inside a container must not be allowed to inventory connected peripherals, as peripheral lists can easily be used to fingerprint and track users across sessions.

- **Rust and Minijail:** The device emulation code is written in Rust to guarantee memory safety and runs within a sandbox jail to minimize attack exposure. - **Fuzzing:** Continuous fuzz testing is applied to identify vulnerabilities in the USB emulation layers. - **Fingerprint prevention:** Shielding device lists prevents rogue container code from harvesting hardware identifiers to track users.

[24:02](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1442s) Demo: Android USB Debugging and Granular Access Control

Sudha Broslawsky takes the stage to present the final live demonstration, showing how secure USB passthrough works during real-world development. She connects an Android phone to a Linux-enabled Chromebook. As soon as the phone is plugged in, Chrome OS intercepts it and displays a notification banner asking the user whether to connect the device to Linux. At this stage, Chrome OS alone detects the hardware, while running a USB listing command inside the Linux terminal confirms that the container is entirely unaware of the device.

Once Broslawsky clicks the notification prompt to allow access, the device instantly registers inside Linux and appears in the terminal's USB device list. She switches over to Android Studio, runs an app project, selects the attached phone as the target, and watches the build deploy directly to the physical handset for testing and debugging. Users can open Chrome OS Settings at any time to inspect or revoke device permissions. Emphasizing the design philosophy behind this integration, Broslawsky highlights: “You, the user, are in full control at all times of what Linux has access to.”

- **Explicit notification prompt:** Devices remain completely hidden from the VM until the user explicitly permits the connection via a Chrome OS system notification. - **Android Studio deployment:** The user can instantly deploy, inspect, and debug mobile applications on physical Android hardware directly from the Linux container. - **Centralized Settings management:** Linux hardware permissions can be inspected, altered, or revoked at any point directly within Chrome OS Settings.

[25:54](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1554s) Under the Hood: Termina, Crosh, and LXD Commands

Returning to the podium, Dylan Reid transitions from standard consumer workflows to the low-level developer hooks built into the platform. While the standard, polished experience meets the needs of most developers, Reid explains that Chrome OS retains built-in tools for advanced tinkerers who want to experiment under the hood. He enters the Chrome OS developer shell (Crosh) using `Ctrl`+`Alt`+`T`, highlighting the `vmc` utility introduced specifically to orchestrate virtual machines and container instances.

Running `vmc list` shows the installed virtual machines, displaying the default VM named `Termina`. Reid explains that while `vmc container` drops a user straight into the default `Penguin` Debian container, developers can also use `vmc start` to enter the `Termina` VM shell directly without invoking a container. Inside `Termina`, the LXD daemon manages containers, allowing users to leverage the standard `lxc` command-line tool. A simple `lxc list` command confirms that `Penguin` is running and displays its assigned IP address.

- **Crosh shortcut:** The developer shell is invoked from anywhere within Chrome OS using the key combination `Ctrl`+`Alt`+`T`. - **`vmc` utility:** The primary Chrome OS command-line tool used to create, list, start, and manage Crostini virtual machines. - **Default naming conventions:** The base Chrome OS virtual machine is titled `Termina`, while the default Debian-based development container inside it is named `Penguin`. - **Direct VM access:** Running `vmc start termina` accesses the intermediary VM environment where the LXD service runs.

[28:53](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1733s) Container Management: Snapshots, Btrfs, and Custom Distros

Inside the `Termina` VM shell, Reid demonstrates the power and flexibility available through the LXD toolset. To safeguard work before attempting risky experiments or installing unstable packages, developers can execute `lxc snapshot <container-name> <snapshot-name>`. Because Crostini uses the btrfs filesystem inside the VM, snapshots rely on copy-on-write functionality, preserving storage space rather than duplicating entire container images. Users can run `lxc info` to view container details and snapshot history (complete with timestamps), and execute `lxc restore` to roll back changes whenever something breaks.

Reid goes on to show how to clone existing environments or run separate containers side by side for isolated toolchains—such as maintaining dedicated, segregated environments for Python 2.7, Python 3, Go, or Rust. He uses `lxc copy penguin kingfisher` to duplicate the default container into a new container named `Kingfisher`, starts it with `lxc start kingfisher`, and spawns an interactive shell inside it using `lxc exec kingfisher -- /bin/bash`. Finally, Reid demonstrates how developers can step outside Debian entirely. By tapping into Canonical's public image server, he installs and launches an Arch Linux container named `ArchTest`, verifying the distribution by running `pacman` instead of `apt`: “Look, it's actually Arch, I promise.”

| Command Example | Context | Purpose / Effect | |:--- |:--- |:--- | | `vmc list` | Crosh shell | Lists all Crostini virtual machines installed on Chrome OS (e.g., `Termina`). | | `vmc start termina` | Crosh shell | Enters the `Termina` VM directly without opening the inner container. | | `lxc snapshot penguin io1` | Inside `Termina` | Creates a lightweight, copy-on-write btrfs snapshot of the container state. | | `lxc info penguin` | Inside `Termina` | Displays container properties, IP addresses, resource usage, and snapshot list. | | `lxc restore penguin io1` | Inside `Termina` | Reverts the container back to the exact state captured in snapshot `io1`. | | `lxc copy penguin kingfisher` | Inside `Termina` | Clones the container `Penguin` into an independent instance named `Kingfisher`. | | `lxc exec kingfisher -- /bin/bash` | Inside `Termina` | Launches an interactive Bash shell within the specified container. | | `lxc launch images:archlinux archtest` | Inside `Termina` | Downloads and boots an official Arch Linux container image from Canonical's image server. |

[32:28](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1948s) Community and Roadmap: The Future of Crostini

Tom Buckley closes the session by encouraging developers to explore the Crostini community. He points audiences directly to the Crostini subreddit (`/r/Crostini`), praising community members for their enthusiasm, their welcoming attitude toward Linux newcomers, and their uncanny ability to uncover new platform capabilities: “The folks there find features as soon as we release them, sometimes even sooner, and they're also really welcoming to new users of Linux on Chromebooks.”

Buckley summarizes the progress made with Linux on Chromebooks, emphasizing that the environment already delivers robust support for both Android and web development workflows. Looking ahead, the engineering roadmap includes expanding support for wider developer ecosystems and rolling out native UI support for features like multiple containers and integrated backup and restore mechanisms. Concluding the talk to audience applause, Buckley promises: “We're going to keep applying these principles of simplicity and security to give you the best developer experience possible.”

- **Community engagement:** The team actively points developers to the `/r/Crostini` subreddit for troubleshooting, feature discovery, and advanced configuration guides. - **Upcoming native features:** Forthcoming Chrome OS updates aim to bring multi-container orchestration and automated backup/restore functionality directly into the native graphical interface.

## Notable quotes > [09:40](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=580s) Our guiding principle is that complexity shouldn't interfere with the user experience. — Sudha Broslawsky

> [24:02](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1442s) You, the user, are in full control at all times of what Linux has access to. — Sudha Broslawsky

> [02:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=166s) You don't have to worry about malware accessing your files, snooping on your traffic, or infecting your peripherals. — Tom Buckley

## Mentioned Sudha Broslawsky, Dylan Reid, Tom Buckley, Google, Chrome OS, Crostini, Linux, Debian, crosvm, Rust, Canonical, LXD, 9s, Lenovo Yoga Book C630, Acer Chromebook Spin 13, Visual Studio Code, Android Studio, Mozilla Firefox, Termina, Penguin, Kingfisher, Arch Linux, Crosh, Minijail, Reddit

## Video description Learn how Linux for Chromebooks (Crostini) gives you a secure sandbox for development. Through a variety of demos, this talk will explain the architecture underlying Linux for Chromebooks and the design decisions that keep it easy to use.

Watch more #io19 here: Web at Google I/O 2019 Playlist → https://goo.gle/io19web Google I/O 2019 All Sessions Playlist → https://goo.gle/io19allsessions Learn more on the I/O Website → https://google.com/io

Subscribe to the Chrome Developers Channel → https://goo.gle/ChromeDevs Get started at → https://www.google.com/chrome/dev/

Speaker(s): Dylan Reid, Tom Buckley, Sudha Broslawsky

TD69F6 event: Google I/O 2019; re_ty: Publish; fullname: Dylan Reid, Tom Buckley, Sudha Broslawsky;

[Source](https://www.youtube.com/watch?v=pRlh8LX4kQI)

中文简报

Google 部署 Rust 虚拟机以保护 Chrome OS 免受不可信 Linux 代码侵害 通过硬件隔离的虚拟机管理程序和沙盒系统监狱,无需辅助笔记本电脑,即可防止容器化开发漏洞访问主机个人数据、网络或物理外设。 演讲者介绍了 Crostini,将其作为解决开发者在单台设备上平衡风险开发脚本与敏感个人数据这一常见困境的方案。他们解析了其安全架构——以 Rust 语言、定制的 crosvm 虚拟机管理程序、受限设备模拟器和 LXD 容器为基础——在隔离不可信代码的同时保护宿主 Chrome OS 环境。通过现场演示,团队展示了无缝文件共享、通过 VSOCK 实现的自动化本地 Web 服务器转发,以及用于 Android 调试的细粒度 USB 外设直通。此外,还重点介绍了高级开发者功能,包括通过 Crosh 直接访问 Termina VM、btrfs 写时复制快照以及对 Arch Linux 等多个发行版的支持。 Chrome OS 已将 Linux 支持 (Crostini) 扩展至超过 50% 的活跃 Chromebook 机型,使其可直接在第八代 Intel Core 硬件上运行,且无需双启动或独立的桌面 Shell。 (2:46) 该平台通过在由 Rust 编写的内存安全虚拟机管理程序 crosvm 管理的 Google 签名只读虚拟机中嵌套运行 LXD 容器,并在其中执行不可信开发工具,从而强制执行严格的安全边界。 (5:30) 文件共享和 USB 设备直通依赖于高度受限的 Rust 实现服务及明确的用户授权,确保客户机环境无法探测主机文件或获取外设标识符。 (11:21) 本地 Web 开发通过守护进程间的自动化 VSOCK 通道运行,实现了零配置的本地主机路由和桌面 PWA 测试,同时将容器网络命名空间与主机流量隔离开来。 (15:46)

Reading summary

Google's Crostini architecture introduces full Linux development to Chrome OS by isolating untrusted developer environments inside a read-only virtual machine and LXD containers behind a Rust-based hypervisor, protecting personal host data without sacrificing native desktop integration. Multi-Layered Isolation with Rust and crosvm (5:30) Chrome OS addresses developer security concerns—such as running unverified scripts on machines simultaneously used for personal email and banking—by decoupling untrusted code from the host operating system. Chrome OS Virtualization Lead Dylan Reid explains that Google built crosvm, a custom virtual machine monitor written from scratch in Rust to eliminate memory-safety vulnerabilities like buffer overflows and use-after-free conditions. The hypervisor isolates virtual device emulators, such as the random number generator and display driver, into jailed sandboxes stripped of host network access. Inside crosvm runs Termina, a Google-signed, read-only guest virtual machine with an immutable root filesystem to prevent persistent system tampering. To grant developers mutable root access, Google partnered with Canonical to run Debian system containers inside the VM using LXD. This tiered architecture ensures developers can install arbitrary packages and run root-level commands while keeping the host Chrome OS environment strictly partitioned behind hardware-enforced virtualization boundaries. Granular File Sharing and Memory-Safe 9P (11:21) To allow source code and asset editing without exposing sensitive personal files like tax returns or family photos, file sharing is mediated through 9s, a custom 9P file server written in Rust, fuzzed against malicious input, and confined inside a sandboxed host jail. The guest Linux kernel mounts the 9P export, which LXD then bind-mounts into the container. Even if an attacker fully breaches the container and guest VM kernel, the jailed server process only possesses file descriptors for the specific host directories explicitly authorized by the user. At the interface level, Crostini provides a dedicated "Linux Files" directory mapping directly to the container's home directory. Access to host storage, external drives, or Google Drive requires explicit two-click authorization from the Files app, which can be inspected or revoked in Settings. For quick workflows, double-clicking a host file associated with a Linux application provides ephemeral access restricted to that specific file until system restart. Secure Local Web Routing and Jailed USB (15:46) For local web development, Crostini isolates servers inside nested network namespaces within the virtual machine to prevent untrusted processes from sniffing outbound host web traffic. Background daemons inside the VM detect newly bound container ports and coordinate with host daemons over VSOCK—a specialized host-guest socket protocol—to automatically forward traffic to localhost. Chrome OS treats these proxied local endpoints as secure origins, allowing developers to test Progressive Web App installations and Web APIs without manual port mapping or firewall adjustments. Handling physical peripherals for Android development required a similarly defensive architecture to counter tracking identifiers and peripheral firmware exploits. The engineering team isolated the USB virtualization driver inside a sandboxed crosvm jail with zero host filesystem or network access. The guest VM interacts with an emulated, empty USB bus until the user explicitly permits device attachment through a Chrome OS notification prompt, keeping sensitive devices such as security keys and storage drives inaccessible to Linux. Low-Level Container Orchestration and Snapshots (25:54) Beyond standard desktop usage, Chrome OS exposes advanced virtualization hooks through the developer shell (Crosh) using the vmc utility. Advanced users can bypass container abstractions to enter the Termina VM shell directly, where LXD manages containers. Operating inside Termina allows developers to leverage standard lxc commands to manage container lifecycles, clone environments, and inspect network details. Because Crostini utilizes the btrfs filesystem inside the VM, developers can create space-efficient copy-on-write snapshots using `lxc snapshot` before testing risky dependencies, restoring prior states with `lxc restore` if an experiment fails. The underlying LXD integration also enables developers to duplicate default environments into segregated containers for isolated language runtimes, or pull third-party distribution images directly from Canonical's image repositories to run alternative operating systems like Arch Linux. Product Manager Tom Buckley noted that by mid-2019, Crostini supported more than 50% of active Chromebooks, delivering verified isolation for web and Android workflows. While advanced multi-container orchestration and snapshot rollbacks initially required low-level Crosh and LXD terminal commands, the engineering roadmap focused on surfacing multiple containers and automated backup and restore mechanisms directly into the native Chrome OS interface.

精炼阅读摘要

在 Google I/O 2019 上,Google 团队介绍了代号为 Crostini 的 Chromebook Linux 支持方案,旨在通过结合硬件隔离虚拟机、容器技术与 Rust 编写的安全组件,解决开发者在单台设备上兼顾高危开发任务与敏感个人事务的安全困境。 开发者的安全困境与双笔记本痛点 (0:00) 现场非正式调查显示,100% 的与会开发者都在其主力工作设备上处理报税、查看个人邮件等敏感事务,并对系统安全性表示担忧。在紧迫的工程交付压力下,工程师常常被迫从不可信来源复制代码,甚至执行未经验证的脚本(如直接通过管道传给 sudo),这使得宿主系统逐渐失去信任。Chrome OS 虚拟化技术主管 Dylan Reid 指出,过去为了应对这一矛盾,开发者往往需要随身携带两台笔记本电脑——一台专用于高风险开发,另一台用于个人敏感事务;而 Crostini 的核心目标正是彻底消除对第二台笔记本的需求。 Rust 与分层沙箱构筑的核心虚拟化架构 (5:30) Chrome OS 原生环境出于安全锁定考量无法运行常规开发工具。为了在不削弱宿主防御的前提下提供完整的 root 权限与内核功能,团队构建了一套分层隔离架构。底层由 Google 从零开始用 Rust 语言编写的虚拟机监视器 crosvm 驱动,利用 Rust 的内存安全特性消除缓冲区溢出和释放后使用等漏洞;虚拟机内部运行着经过 Google 签名且不可变的只读客户机内核及根文件系统,防止系统被永久损坏。 在只读虚拟机之上,Google 联合 Canonical 的 LXD 团队托管 Debian 系统容器,供开发者安装任意库、语言和工具。此外,crosvm 将虚拟设备驱动拆分为最小权限的独立沙箱(柱石):例如随机数生成器(RNG)进程运行在无网络连接的空文件系统中,虚拟显示驱动进程也完全断开网络访问,确保即便驱动组件被攻陷,也无法向外渗漏宿主机的机密数据。 受控文件共享与 9s 服务隔离机制 (11:21) 开发者环境需要频繁读写磁盘,但若直接暴露文件系统,一旦构建工具或依赖项遭到篡改,宿主机上的私人照片、财务表格等个人隐私便极易遭遇勒索软件或恶意窃取。为此,Crostini 采用专门由 Rust 编写并经过模糊测试的 9P 文件服务器 9s,该服务运行在受到严格限制的沙箱环境中。 在用户交互层面,Chrome OS 默认仅将“Linux 文件”专属目录直接映射给容器使用,宿主机其余本地存储、外部磁盘及云端文件默认对 Linux 完全隐形。用户必须通过图形界面的文件管理器显式执行“与 Linux 共享”,文件才会经由 9s 服务器和客户内核挂载传递给容器。即使容器和虚拟机内核被彻底攻破,宿主沙箱内的 9s 进程也仅持有用户显式授权的目录文件描述符,无法触及其他个人数据。 双命名空间网络隔离与外设受控直通 (15:46) 现代 Web 开发需要本地启动 HTTP 或 WebSocket 服务,但未受限的网络权限可能导致恶意进程嗅探宿主流量或拦截上网会话。Crostini 将容器放置在双层嵌套的网络命名空间内,使其与宿主网络完全物理隔离。虚拟机和宿主机上的后台守护进程协同工作,自动检测容器监听端口,并通过专用的 VSOCK 协议将流量安全转发至宿主机;Chrome 浏览器能以 localhost 正常访问,并将其视为可信来源以支持 PWA 测试,同时无需任何手动 iptables 配置或确认弹窗,因为连接严格由安全的宿主发起指向虚拟机。 针对外设风险,团队指出 USB 规范复杂且容易遭到固件利用或指纹追踪。因此,Crostini 仅向虚拟机呈现一个运行在 Minijail 沙箱内的虚拟空 USB 总线。当接入物理手机或外设时,宿主会拦截并弹出授权提示;只有在用户显式确认后,设备节点才会被挂载进容器供 Android Studio 等工具直接调试部署,用户可随时在 Chrome OS 设置中撤销权限。 底层容器编排与跨发行版扩展 (25:54) 针对高级开发者的进阶需求,Chrome OS 在开发者终端(Crosh)中内置了 vmc 与 lxc 命令行工具集。系统底层虚拟机命名为 Termina,其默认托管的 Debian 容器为 Penguin。在 Termina 内部,文件系统采用了支持写时复制(CoW)的 btrfs,开发者可以通过快照命令在执行危险实验前保存容器状态,并在出现故障时迅速回滚,无需完整克隆磁盘。 此外,开发者能够自由克隆运行多个独立容器,以隔离不同版本的技术栈(例如隔离 Python 2 与 Python 3 环境),甚至可以通过 Canonical 的官方公共镜像服务器拉取并启动如 Arch Linux 等其他发行版容器,直接调用 pacman 进行管理,从而跳出默认 Debian 生态的限制。 Crostini 证明了在保持操作系统强安全模型的同时,可以为开发者提供近乎原生的桌面与命令行开发体验。产品团队规划在后续更新中进一步将多容器编排管理以及图形化备份与恢复机制引入 Chrome OS 原生设置界面,但如何在简化体验与满足更多小众定制化开发环境之间持续保持平衡,仍取决于社区与底层架构的长期演进。

Detailed notes — zh

## Background 本内容由 YouTube 官方频道 Chrome for Developers 于 2019 年 5 月 9 日发布,记录了 Google I/O 2019 大会上的技术分享。演讲由 Dylan Reid、Tom Buckley 与 Sudha Broslawsky 共同呈现,主要介绍 Chromebook 的 Linux 支持技术(Crostini)如何通过底层架构设计与直观交互,为开发者提供一个兼顾极简体验与安全隔离的开发沙盒。 ## TL;DR 演讲直击开发者在日常主力机上运行不可信脚本与工具的安全焦虑,详细拆解了 Crostini 的分层虚拟化安全模型——宿主利用 Rust 编写的 crosvm 启动只读系统内核,再通过 LXD 派生 Debian 开发容器,并依托 Minijail 实现服务级权限最小化。团队深入展示了文件受限共享(9P 协议)、网络沙箱穿透(VSOCK 端口转发)以及 USB 外设显式授权调试 Android 等真实工作流,在保证原生交互手感的同时将恶意代码封锁在沙盒内。最后,演讲还揭示了利用 crosh、vmc 与 lxc 进行容器快照备份、多环境隔离乃至运行 Arch Linux 的极客进阶玩法,展现了 Chrome OS 进军专业开发平台的底气。 ## Atmosphere & style 整场演讲氛围专业而又轻松幽默,讲者们频繁自嘲开发者在项目紧迫时“明知有毒依然 curl 管道执行 sudo bash”的侥幸心理,极易引发同行共鸣。三位讲者配合默契,从产品理念、深层 Rust 虚拟化技术再到实际 UI 交互演示层层递进,既有严密的技术推导,又有行云流水的现场实机操作。当在 Chromebook 终端中熟练敲出 Arch Linux 的 pacman 命令时,现场充满了硬核极客探索未知的乐趣与掌控感。 ## Bulletin - [02:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=166s) Chrome OS 上的 Linux 支持(代号 Crostini)已覆盖超过 50% 的 Chromebook 设备,让开发者无需背负两台设备即可兼顾日常敏感事务与不可信代码开发。 - [05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) Crostini 采用“Chrome OS 宿主 -> crosvm (Rust) -> 只读 Termina VM -> Debian LXD 容器”的多层沙箱架构,阻断恶意代码越狱到宿主机的攻击面。 - [11:36](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=696s) 文件共享、网络端口转发与 USB 设备穿透均默认采用最小特权隔离,需用户主动授权,核心通信组件均用 Rust 编写并运行在 Minijail 沙盒中。 - [20:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1230s) Google 官方正式宣布在 Chromebook 上支持 Android Studio,并提供通过虚拟总线受控直通的物理 USB 真机联调能力。 - [25:54](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1554s) 极客开发者可通过 Crosh 和 VMC 命令深入 Termina 虚拟机,利用 LXD 原生特性实现写时复制快照、多容器隔离以及运行 Arch Linux 等第三方发行版。 ## Key takeaways - [00:00](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=0s) 开发者普遍面临在同一台笔记本上处理报税与运行不可信脚本(如 curl | bash)的安全焦虑,Crostini 旨在通过沙盒隔离解决这一“双笔记本”困境。 - [02:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=166s) 超过半数的主流 Chromebook 已支持 Linux 环境,用户只需几次点击即可自动编排容器并开箱使用预装 Git 和 Vim 的 Debian 终端。 - [09:40](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=580s) Crostini 将 Linux 图形应用深度提取并融入 Chrome OS 原生桌面与窗口管理器中,避免了传统虚拟化桌面给用户带来的割裂感。 - [05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) 宿主虚拟化监视器 crosvm 采用内存安全语言 Rust 编写,其随机数生成器和 Wayland 渲染模块均被打散至独立的 Minijail 特权沙盒中执行。 - [05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) Guest 虚拟机内核由 Google 签名且呈只读状态,实际开发环境运行在 VM 内部派生的标准 LXD Debian 容器(Penguin)中,确保底座不可破坏。 - [11:36](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=696s) 文件共享采用 Rust 编写的沙盒化 9P 服务(9S),默认仅暴露用户明确右键授权或双击隐式打开的目录,杜绝勒索软件破坏宿主全盘文件。 - [15:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=946s) 容器内启动的本地 Web 服务通过 VSOCK 管道穿透并自动转发至宿主机守护进程,浏览器可直接通过 localhost 访问并将其安装为 PWA。 - [20:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1230s) Chrome OS 官方正式支持 Android Studio,通过专有安装包简化移动端开发套件的部署流程。 - [23:00](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1380s) 针对复杂的 USB 硬件攻击面,Crostini 在沙箱内重构了虚拟驱动,禁止容器自发枚举硬件总线,并强制依赖用户在 UI 中进行显式授权以防范硬件指纹追踪。 - [25:54](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1554s) 开发者可通过 Crosh 终端中的 vmc 工具直接调度 Termina 虚拟机,并在引擎盖下深度定制容器运行时。 - [28:21](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1701s) 基于 btrfs 文件系统的写时复制(COW)特性,开发者可以在 Termina 内使用 lxc snapshot 实现秒级且极低磁盘开销的环境备份与故障回滚。 - [28:21](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1701s) Termina VM 支持基于 LXD 的多容器并行架构,开发者既可克隆多个相互隔离的容器测试不同语言环境,也可拉取并运行 Arch Linux 等非 Debian 发行版。 - [32:28](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1948s) Google 计划将快照备份恢复、多容器管理等极客特性逐步打磨并下放至 Chrome OS 的图形设置界面中,持续贯彻兼顾安全与简易的设计理念。 ## Detailed walkthrough ### [00:00](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=0s) 开发者内心的安全焦虑与“双笔记本”困境 在 Google I/O 2019 第二天的尾声,Sudha Broslawsky(Crostini 设计师)、Dylan Reid(Chrome OS 虚拟化技术主管)与 Tom Buckley(Linux on Chromebooks 产品经理)共同登台,探讨代号为“Crostini”的 Chromebook Linux 支持技术。Tom Buckley 强调,当天的其他演讲都在探讨各种前沿框架和开发平台,但本场分享关注的是开发者自身的工作心态:“Instead what we want to talk about is you as developers and how you can get more peace of mind by using Linux on Chromebooks. We give you that peace of mind by balancing simplicity and security.” 为了揭示核心矛盾,Sudha 在现场做了一个小型互动调查。台下几乎所有开发者不仅用笔记本写代码,还会用同一台机器报税、收发个人邮件,并且全员都对安全问题感到担忧。Dylan Reid 随即分享了自己的真实写照:每当遇到技术瓶颈去 Google 搜索,往往会找到一串需要用 `curl` 下载并直接通过管道传给 `sudo bash` 执行的脚本。明知来自不可信网站(例如演示幻灯片中幽默标注的“evilsite.com”),但在项目截止日期的重压下总会侥幸破例。日积月累,系统里跑过什么代码连自己都搞不清楚,导致整台机器彻底失去信任度。过去为了自我保护,Dylan 甚至被迫每天背着两台笔记本电脑出门——一台用于存在安全风险的日常开发,另一台用于处理必须保持高度安全的私人事务。 ### [02:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=166s) 兼顾极简与专业的 Linux on Chromebooks Tom Buckley 指出,Chrome OS 自诞生以来的核心基因就是“简单与安全”,但在过去,这种对安全边界的严格限制导致系统无法运行开发者所需的各类专业工具。自 2018 年 Google I/O 宣布支持 Linux 以来,这一局面得到了彻底改变。如今超过 50% 的 Chromebook 设备(包括搭载第八代 Intel 处理器的 Lenovo Yoga Book C630 和 Acer Chromebook Spin 13 等主力机型)均已支持 Linux。 对于开发者而言,启用该功能仅需点击几下鼠标。系统会在后台自动拉取虚拟机镜像、初始化容器并完成整套环境配置,随后直接在启动器(Launcher)中提供标准的 Debian 终端。这个终端预装了 Git、Vim 等基础工具,支持通过 APT 包管理器安装海量开源软件,也允许直接双击运行 `.deb` 安装包。更关键的是,所安装的 GUI Linux 应用会无缝出现在 Chrome OS 启动器与原生窗口管理器中,与普通 Web 应用平起平坐,丝毫不破坏系统的优雅体验,同时也彻底隔绝了恶意软件窃取个人文件、监听网络流量或感染外设的风险。 - **快速部署体验**:无需繁琐配置,几次点击即自动完成虚拟机下载与容器编排。 - **开箱即用生态**:基于标准 Debian 发行版,内置 Git/Vim,支持 `apt` 与 `.deb` 包安装。 - **无缝桌面集成**:图形界面程序直接接入 Chrome OS 启动器及窗口管理体系,与原生应用浑然一体。 ### [05:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=330s) Crostini 的分层安全虚拟化架构 Dylan Reid 详细剖析了 Crostini 的深层系统架构。Chrome OS 传统的安全核心在于浏览器与渲染引擎的分离沙箱,渲染器无法执行多余的系统调用,内核攻击面被降到最低。然而,开发者工具在 Linux 下往往需要庞杂的权限,绝不能直接向宿主机内核开放。为了在保障安全的同时赋予开发者完整自由度,团队构建了“Chrome OS 宿主 -> 虚拟机 (crosvm) -> 容器 (LXD)”的分层架构。 ```mermaid flowchart TD accTitle: Crostini安全虚拟化多层架构 accDescr: 展示从Chrome OS宿主机、通过crosvm虚拟化、到只读VM及Debian LXD容器的分层隔离结构 subgraph Host["Chrome OS 宿主环境"] crosvm["crosvm (Rust 编写)"] subgraph Jails["特权沙盒隔离 (Minijail)"] J1["RNG 随机数生成器"] J2["Wayland 显示驱动"] J3["USB 设备驱动"] end crosvm --- Jails end subgraph GuestVM["只读终端虚拟机 (Google 签名内核)"] VMKernel["Linux 内核"] subgraph LXDContainer["Debian 系统容器 (LXD)"] DevTools["开发者环境 (Git, Vim, APT, GUI 应用)"] end VMKernel --- LXDContainer end crosvm -->|"跨虚拟机通信 (Virtio/Wayland)"| VMKernel ``` 首先,宿主机利用虚拟化引擎拉起一个由 Google 签名的只读 Guest VM。因为是只读镜像,开发者无论在内部如何折腾都不会破坏 VM 的启动基础,从根本上锁死核心底座;但只读环境无法安装软件,因此团队采用 Canonical 的 LXD 运行时,在 VM 内部派生出一个标准的 Debian 系统容器,真正开放给用户自由使用。 整个安全模型的最关键防线是位于 Chrome OS 宿主侧的虚拟机监视器——**crosvm**。Dylan 指出:“It's the last line of defense before something gets into Chrome OS.” 为了杜绝内存溢出与整型越界等常见漏洞,crosvm 完全采用内存安全语言 **Rust** 编写。此外,架构将与虚拟机通信的各个模块彻底细分,打散到独立沙盒(Jail)中执行最小权限隔离: - **随机数生成器(RNG)**:运行在空文件系统沙盒中,无任何网络访问权限,仅负责生成随机数。 - **显示驱动进程**:仅负责处理 Wayland 屏幕渲染协议,严禁访问网络或宿主机用户文件,即使被恶意代码完全攻破也无法外传任何隐私数据。 ### [09:40](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=580s) Crostini 的三大体验设计原则 为了让复杂的底层虚拟化技术不给开发者带来心智负担,Sudha Broslawsky 阐述了团队在设计体验时坚持的三项核心原则: 1. **直觉化(Intuitive)**:开发者多年来已经养成了固定的开发习惯与操作直觉,Crostini 的目标是贴合这些既有预期,提供完全自然的交互手感,“We want developers everywhere to be using Chromebooks and feel right at home doing it.” 2. **原生感(Native)**:团队完全可以在虚拟机里弹出一个完整的 Linux 桌面(如 XFCE 或 GNOME),但这是一种偷懒的做法。设计团队坚持将 Linux 图形软件深度提取并融入 Chrome OS 原生桌面,让每一个独立 Linux 窗口都具备原生窗体特征。 3. **极简性(Simple)**:“Our guiding principle is that complexity shouldn't interfere with the user experience.” 底层的多层虚拟化、容器编排与沙盒权限通信极为复杂,但设计团队的使命是将这些复杂度牢牢锁定在引擎盖之下,在安全考量与极致轻便之间找到最佳平衡点。 ### [11:36](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=696s) 开发者工作流之一:受限且无缝的文件共享机制 开发者在日常编码中需要频繁与文件系统打交道,无论是编辑器、编译器还是版本控制工具,都需要直接读写本地磁盘。然而,开发者的硬盘上除了代码之外,往往还存有个人照片、报税单甚至写了一半的小说。Tom Buckley 指出,如果直接把未受限制的文件系统暴露给开发工具,风险将不可估量:“Ransomware can hold all of that data hostage.” 勒索软件可能绑架所有私密数据,恶意程序可能将隐私文件上传至远程服务器,或者纯粹出于破坏欲将所有内容删个精光。Crostini 从设计之初就立足于这种威胁模型,核心原则是:底层绝对不能信任虚拟机内部执行的代码。 为了确保安全,Dylan Reid 解释团队采用了一种多层隔离的文件共享架构。所有用户文件都存放在底层的 Chrome OS 宿主机中,系统通过一个名为“9S”的 9P 服务器将选定的目录共享给虚拟机。9S 服务完全采用 Rust 编写以实现内存安全,经过大量的模糊测试(fuzz testing)以防止异常输入引发崩溃或越界,并被严格锁在沙箱(jail)中。虚拟机通过 Linux 内置的 9P 客户端挂载目录,再由 LXD 容器服务将其绑定挂载到运行开发工具的具体容器内。这意味着无论是容器、虚拟机,还是宿主机上的 9S 服务器本身,都只能看见被明确授权的文件。即便攻击者击穿了整个容器和虚拟机栈,回溯到 Chrome OS 宿主机层面,他们依然拿不到任何未被共享的用户文件。 ```mermaid flowchart LR accTitle: Crostini File Sharing Architecture accDescr: Chrome OS 9S server exports shared files to VM and LXD container subgraph Host["Chrome OS 宿主机"] Files["用户文件系统"] --> Jail["沙箱环境中的 9S 服务 (Rust)"] end subgraph VM["crosvm 虚拟机"] Jail -->|"9P 协议"| VMMount["Linux 9P 挂载点"] VMMount --> LXD["LXD 容器管理"] end subgraph Container["开发容器"] LXD --> Tools["开发工具 / 编辑器"] end ``` Sudha Broslawsky 随后展示了这种复杂底层在 UI 上的极简实现。虽然技术实现包含繁琐的 9P 挂载与容器 bind-mount,但用户体验几乎无感: - **Linux Files 专属目录**:系统开箱即提供一个名为“Linux Files”的文件夹,它直接对应 Linux 容器内部的 `$HOME` 主目录,放入其中的所有内容会自动同步可见。 - **按需右键共享**:对于系统其他位置的文件,Linux 默认没有任何访问权限。用户只需在“文件”应用中找到目标目录(例如存放在 Google Drive 上的 Illustrations 文件夹),右键选择“Share with Linux”,仅需两步即可打通访问权限;不需要时直接在系统“设置”中取消共享即可。 - **双击隐式临时共享**:在“下载”目录中双击某个数据文件时,系统会自动在 VS Code 中将其打开,并在后台进行隐式共享,该授权仅在本次开机运行期间有效,设备重启后自动失效。 --- ### [15:46](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=946s) 开发者工作流之二:本地 Web 服务器与网络沙箱穿透 构建 Web 应用是 Chrome OS 极为看重的场景,而启动本地 Web 服务器是现代 Web 开发的基础。然而,网络服务往往需要极低层级的网络访问权限,这就带来了极大的安全隐患。Tom Buckley 强调,具备启动 Web 服务器权限的恶意代码同样有能力窃听网络流量,分析用户访问了哪些网站,甚至窥探页面内容。因此,Crostini 既要保证网络完全隔离,又要让运行在 Chrome OS 上的浏览器能够访问开发容器里的服务。 Dylan Reid 揭秘了这套复杂的内部管道:当开发者在容器中输入命令启动服务器并监听端口时,该端口实际上处于虚拟机的独立网络命名空间内。而虚拟机本身运行在宿主机的另一个网络命名空间中,最终才连入 Chrome。在默认状态下,外部的 Chrome 浏览器根本无法直接连接这个内网端口。为了让开发者能够调试网页或 PWA(渐进式 Web 应用),团队在各个层级部署了专门的守护进程(daemons)。虚拟机内的守护进程一旦探测到容器打开了某个端口,就会捕获该信息并将其上报给 Chrome OS 宿主机;宿主机的守护进程随即响应并建立路由,双方通过专门用于宿主机与本地虚拟机通信的 VSOCK 协议进行数据转发。 ```mermaid flowchart TD accTitle: Web Server Port Forwarding Flow accDescr: Flow of HTTP traffic forwarded over VSOCK from container to Chrome browser subgraph Guest["虚拟机 / 容器"] Server["Web 服务器 (例如端口 8080)"] -->|"HTTP"| DaemonVM["Guest 监听守护进程"] end DaemonVM -->|"VSOCK 内部通信"| DaemonHost["Chrome OS 宿主守护进程"] subgraph Host["Chrome OS"] DaemonHost -->|"HTTP (localhost:8080)"| Browser["Chrome 浏览器 / Firefox"] end ``` 这种架构的精妙之处在于对开发者和浏览器的完全透明:“The key here is that the web server gets to talk HTTP. Chrome gets to talk HTTP. Everything's normal.” 此外,由于整个虚拟机环境由系统安全创建并管理,系统直接将转发过来的本地服务识别为“受信域(trusted domain)”,开发者可以直接在 Chrome OS 桌面上将开发的 PWA 安装为本地应用。在 Sudha Broslawsky 的现场演示中,开发者在终端运行命令启动 `pwa-starter-kit`,底部提示正在监听 8080 端口;打开浏览器输入 `localhost:8080` 便立刻加载成功,甚至能在 Linux 容器内安装的 Firefox 中并行对比测试。整个过程没有任何多余的权限确认弹窗,因为流量是由宿主机主动发起去访问虚拟机,而非不可信的虚拟机主动入侵宿主机。 --- ### [20:30](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1230s) 开发者工作流之三:Android Studio 与硬件级 USB 隔离机制 在移动开发领域,Google 正式宣布在 Chromebook 上官方支持 Android Studio,并量身打造了 Chrome OS 专用安装程序。开发 Android 应用不能仅靠软件,开发者还需要真机进行联调。虽然可以通过 Wi-Fi 走 ADB 远程调试,但最自然、最符合直觉的体验依然是直接插上 USB 数据线。然而,USB 接口同样伴随着巨大的安全攻击面。 Tom Buckley 列举了现实中的典型风险:Android 开发者在工作过程中除了连接手机,还会插入存有家庭照片的闪存盘、存有健康数据的可穿戴设备,甚至是用于工作鉴权的高权限物理安全密钥。恶意程序一旦获得未经限制的 USB 访问权,便能借助这些硬件设备跨机器追踪用户身份、横向传播病毒,甚至恶意篡改硬件固件。Dylan Reid 直言:“Yeah, implementing USB was a lot of fun for us. It might have been our most painful stack.” 宿主机的原生 USB 协议栈极为庞大且复杂,业界对规范的实现参差不齐,潜藏大量漏洞,绝不能直接向虚拟机开放。 为了兼顾调试需求与硬件安全,Crostini 采取了严格的虚拟化分权策略: - **沙箱化驱动隔离**:团队在 crosvm 的沙箱(jail)内部重新编写了虚拟 USB 驱动设备,严格限制其访问权限,该驱动既不能触碰宿主机的文件系统,也无法访问主机网络。 - **完全显式设备授权**:即便沙箱内的 USB 驱动出现未知 Bug,恶意代码也无法自行枚举或连接物理总线上的外设。系统规定,任何 USB 设备默认都不会暴露给 Linux 开发环境,必须由用户在系统界面中明确勾选确认授权。 - **常驻虚拟总线**:在虚拟机底层,系统始终维持着一条虚拟的 USB 总线拓扑,虚拟机随时能识别到该总线的存在,只有当用户在外部授权具体设备接入时,系统才动态将对应的设备透传挂载到该总线上。 ### [23:00](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1380s) USB 共享的安全性与隐私权设计 在深入演示之前,Dylan Reid 详细解释了外接设备在虚拟化架构中的流转过程与安全考量。默认情况下,宿主机不会向虚拟环境暴露任何已插入的 USB 设备。只有当用户主动授权将设备赋予虚拟机时,系统才会把该设备添加到虚拟总线上并呈现给 Guest 操作系统;接着,Guest 系统再负责将其转发到运行环境的容器内部,使容器最终能够访问该硬件。这一链条涉及创建设备、导出至虚拟机、导出至容器,并判定究竟允许哪些设备通过的多步校验。 ```mermaid flowchart LR accTitle: USB 设备直通流程 accDescr: 展现从 Chrome OS 宿主机经由 VM 到容器的 USB 设备转发链条 subgraph Host ["Chrome OS 宿主机"] USB["实体 USB 设备"] --> Jail["Rust 沙盒隔离组件"] end subgraph VM ["Termina 虚拟机"] Jail -->|"受控总线暴露"| GuestOS["Guest OS 转发层"] end subgraph Container ["Penguin 容器"] GuestOS --> App["开发者应用 / adb"] end ``` 在整个设计中,团队集中攻克了两个核心痛点: 1. **系统安全性**:通过 Minijail 严格约束转发组件,尽量将攻击面压缩到极小。此外,该组件完全使用 Rust 语言编写,具备先天的内存安全特性,并经过了持续的模糊测试(fuzzing)。 2. **用户隐私保护**:恶意代码往往会利用机器连接的 USB 设备列表作为硬件指纹来追踪用户。“and we wanted to make sure the untrusted code running inside the container couldn't be another way to do that.” Dylan Reid 强调,绝不能让容器内运行的不可信代码获得指纹识别追踪用户的能力。 ### [24:02](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1442s) 实机演示:USB 直通与 Android Studio 真机调试 Sudha Broslawsky 带来了本次演讲的最后一个功能演示,展示如何在开启 Linux 功能的 Chromebook 上接入实体手机并进行应用调试。当手机插入 Chromebook 时,系统只会弹出一个询问是否“连接至 Linux”的桌面通知。在此节点,唯独 Chrome OS 知道手机的存在,底层的 Linux 环境对该设备一无所知。Sudha 在终端中执行 USB 查询命令,列表里确实空空如也。 当她在系统通知中点击确认连接后,重新运行命令,手机设备立即出现在 Linux 的 USB 列表当中,表明 Linux 访问权限已成功打通。随后她打开 Android Studio,完成代码编写后直接点击“Run”并选择该实体手机,应用立刻秒级部署并在手机屏幕上跑了起来,进入完整的断点调试与测试状态。用户还可以在任何时候进入 Chrome OS 的系统“设置”面板,随时撤销或管理 Linux 对外设的访问权。 - 用户始终掌控 Linux 的外设访问边界,不会发生静默授权。 - 深度融合 Chrome OS 原生交互范式,兼顾简易度与平台直觉。 - 正如 Sudha Broslawsky 所总结:“The combination of principles of Chrome OS and Crostini make this experience pretty unique.” ### [25:54](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1554s) 极客玩法:Crosh 与 VMC 命令控制 VM 和容器 演示告一段落,Dylan Reid 重新登台接管演讲。他坦言官方日常主要推荐那些打磨成熟的标准工作流,但在 Crostini 的底层架构中,团队刻意保留了大量底层接口,以便开发者和极客们自行探索与定制。“We're tinkerers, right? We're supposed to be.” Dylan 调侃道,虽然这些进阶玩法官方不作承诺也不提供技术支持,但对于喜欢在引擎盖下探究系统机制的人来说极具吸引力。 所有操作均始于 Chrome OS 内置的开发者 Shell(通过快捷键 `Ctrl + Alt + T` 唤出)。在此界面下,官方引入了一个名为 `vmc` 的控制命令,用于直接调度虚拟机与容器: - `vmc list`:列出当前系统安装的所有虚拟机镜像。演示中显示默认的虚拟机名为 `Termina`。 - `vmc container <vm_name> <container_name>`:直接穿透进入指定虚拟机内的容器。例如系统默认的开发容器被命名为 `Penguin`。 - `vmc start <vm_name>`:仅启动并进入虚拟机宿主环境(Termina),而不直接进入内部的容器。Termina 是运行 LXD 守护进程的中间层,也是对容器进行深度管理、配置与替换的理想操作点。 ### [28:21](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1701s) 基于 LXD 的容器快照、多环境隔离与第三方发行版(Arch Linux) 在 Termina 虚拟机内部,用户可以直接使用业界标准的 `lxc` 命令行工具来管理容器。Dylan 指出,由于底层基于 btrfs 文件系统构建,得益于其写时复制(Copy-on-write)特性,打快照既高效又不会无端挥霍 Chromebook 宝贵的磁盘空间。针对容易折腾崩溃开发环境的情况,Dylan 演示了一整套基于快照的防翻车流程: ```shell # 创建名为 IO1 的快照以备恢复 lxc snapshot penguin IO1 # 查看容器详细状态及包含日期的快照列表 lxc info penguin # 出现故障时一键还原回快照状态 lxc restore penguin IO1 ``` 为了满足开发者在不同技术栈(例如一套环境配置 Python 2.7,另一套跑 Python 3;或者单独隔离 Go 语言与 Rust 依赖)之间的切换需求,Termina 支持创建多个并存的独立容器: - **复制容器**:通过 `lxc copy penguin kingfisher`,可以直接将默认容器克隆为名为 `kingfisher` 的新容器。新容器默认处于停止状态,使用 `lxc start kingfisher` 唤醒后,即可通过 `lxc exec kingfisher -- /bin/bash` 获取全新的隔离环境。 - **运行非 Debian 发行版**:官方虽然默认捆绑了 Debian 及其集成工具包,但完全不限制镜像来源。Dylan 现场通过 Canonical 运营的公共镜像服务器拉取并生成了一个名为 `ArchTest` 的 Arch Linux 容器。进入终端后,他熟练地敲下 `pacman` 包管理器命令并幽默地证明:“Look, it's actually Arch, I promise.” ### [32:28](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=1948s) 总结与未来展望 Tom Buckley 登台对整场演讲进行收尾。他首先向社区推荐了极为活跃的 Crostini Subreddit 论坛。那里的社区成员不仅会在官方发布新特性的第一时间(甚至在正式发布之前)挖掘出各种隐藏玩法,而且对初涉 Chromebook 的 Linux 新手非常包容友善。 Tom 总结道,Chrome OS 上的 Linux(Crostini)不仅已经扎实地支撑了主流的 Web 和 Android 开发工作流,未来还将持续演进。官方正致力于把今天演示的进阶极客特性——诸如原生的多容器管理、便捷的备份与恢复机制等——逐步打磨并下放至常规用户界面中。整个团队将一如既往地贯彻“简单”与“安全”两大设计基石,为全球开发者打造一流的便携开发平台。 ## Notable quotes > [09:40](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=580s) Our guiding principle is that complexity shouldn't interfere with the user experience. — Sudha Broslawsky > [09:40](https://www.youtube.com/watch?v=pRlh8LX4kQI&t=580s) We want developers everywhere to be using Chromebooks and feel right at home doing it. — Sudha Broslawsky ## Mentioned Dylan Reid, Tom Buckley, Sudha Broslawsky, Google, Chrome OS, Chromebook, Crostini, crosvm, LXD, Termina, Penguin, Debian, Arch Linux, Rust, Android Studio, Wayland, Minijail, VS Code, Google Drive, Lenovo Yoga Book C630, Acer Chromebook Spin 13, Subreddit ## Video description Learn how Linux for Chromebooks (Crostini) gives you a secure sandbox for development. Through a variety of demos, this talk will explain the architecture underlying Linux for Chromebooks and the design decisions that keep it easy to use. Watch more #io19 here: Web at Google I/O 2019 Playlist → https://goo.gle/io19web Google I/O 2019 All Sessions Playlist → https://goo.gle/io19allsessions Learn more on the I/O Website → https://google.com/io Subscribe to the Chrome Developers Channel → https://goo.gle/ChromeDevs Get started at → https://www.google.com/chrome/dev/ Speaker(s): Dylan Reid, Tom Buckley, Sudha Broslawsky TD69F6 event: Google I/O 2019; re_ty: Publish; fullname: Dylan Reid, Tom Buckley, Sudha Broslawsky; [Source](https://www.youtube.com/watch?v=pRlh8LX4kQI)

Source quotes

[9:40] Sudha Broslawsky: Our guiding principle is that complexity shouldn't interfere with the user experience. [9:40] Sudha Broslawsky: We want developers everywhere to be using Chromebooks and feel right at home doing it.

Source quotes

[9:40] Sudha Broslawsky: Our guiding principle is that complexity shouldn't interfere with the user experience. [24:02] Sudha Broslawsky: You, the user, are in full control at all times of what Linux has access to. [2:46] Tom Buckley: You don't have to worry about malware accessing your files, snooping on your traffic, or infecting your peripherals.

Original transcript

[0:00] [MUSIC PLAYING] [0:04] SUDHA BROSLAWSKY: Good afternoon, everyone. [0:06] I hope you are having a great time at the I/O. [0:09] We are here to talk to you about Linux for Chromebooks, also [0:12] known as Crostini. [0:14] We'll start by introducing ourselves. [0:16] My name is Sudha. [0:18] I'm a designer on Crostini for Chromebooks. [0:21] DYLAN REID: Hi, I'm Dylan. [0:22] I'm the Chrome OS Virtualization Lead. [0:25] TOM BUCKLEY: And I'm Tom, Product Manager [0:27] for Linux on Chromebooks. [0:31] Now it's the end of day two at I/O [0:33] and you've probably already been to a bunch [0:35] of different sessions that have talked about all [0:37] the new frameworks that you need to be using [0:40] or the platforms that you need to be building for, [0:42] and everyone's right, you absolutely should be, [0:44] but we're not really here to talk about that. [0:47] Instead what we want to talk about is you as developers [0:52] and how you can get more peace of mind [0:54] by using Linux on Chromebooks. [0:57] We give you that peace of mind by balancing [1:00] simplicity and security. [1:03] SUDHA BROSLAWSKY: On that note, let's do a quick user study. [1:07] How many of you are developers in the audience? [1:10] Wow, that's a full room, as expected. [1:13] Keep your hands raised. [1:15] How many of you use your computers [1:18] for anything else other than development, [1:20] like doing your taxes, checking email-- [1:24] again, 100% of you. [1:26] OK, one last question. [1:28] How many of you are worried about security? [1:33] DYLAN REID: Good, that's pretty-- [1:34] I mean, you all should be, so I'm [1:36] glad to see many hands up anyway. [1:40] So I don't know about you, but when I start a new project, [1:45] I get stuck a lot. [1:46] I hit a lot of walls and I hit a lot of barriers [1:49] and I go to look for a problem, go to look for a solution, [1:53] and I turn to Google. [1:55] And luckily, Google's almost always [1:56] got a great answer for me. [1:58] Unluckily, sometimes the answer looks like this. [2:02] And I know I shouldn't run this script from evilsite.com [2:07] and pipe it to Sudu, but that deadline's coming up [2:11] and maybe this site looks kind of legit, so in this case, [2:14] I'll make an exception and I'll do this. [2:17] And then it happens again and again, [2:19] and eventually, I end up with a system [2:21] that I don't trust as much as I should, [2:23] because I don't really know what code I've run on it anymore. [2:26] I don't have time to read all these scripts. [2:29] My solution to this has been to carry two laptops-- [2:33] one for my developer world and one for my everything [2:36] else world that I want to be secure in. [2:39] But recently, I've switched to using one laptop, [2:42] and Tom's going to talk about how I do that. [2:46] TOM BUCKLEY: So our goal with Chrome OS [2:48] has been to give you a simple and secure experience [2:51] from the start, but if you tried it previously, [2:54] you might have seen that it wasn't [2:55] quite ready for developers. [2:57] In order to be simple and secure, [2:59] we couldn't run all of the tools that developers [3:02] need to get their job done. [3:04] But that all changed at I/O last year [3:06] when we announced that we were going to start supporting Linux [3:09] on Chromebooks. [3:11] Linux on Chromebooks lets you run [3:13] all of your favorite editors, IDEs, and tools, [3:17] and it's now supported on over 50% of Chromebooks, including [3:22] great devices with eighth generation Intel [3:25] CPUs like the Lenovo Yoga Book C630 and the Acer Chromebook [3:30] Spin 13. [3:31] If you haven't seen it, we're going [3:33] to run through a few examples. [3:36] First off, how do you get it? [3:37] It's really easy. [3:38] It's just a couple clicks. [3:40] Now in the background, this is downloading a virtual machine, [3:43] setting up containers, configuring it all-- [3:45] Dylan's going to go more into that in a few minutes, [3:48] but for you as a developer, it's just a couple clicks [3:50] to get started. [3:51] And this adds a terminal to your launcher. [3:54] Now if you open that terminal, you'll [3:56] see that you have a pretty standard Debian environment [3:59] and we've already loaded in a bunch of the tools [4:01] that developers expect, like Git and Vim, [4:05] and if you need anything else, you have the APT Package [4:07] Manager and you can install whatever packages you need. [4:11] And if you want to instead install programs via .dev [4:15] files, you can do that, too. [4:17] This gives you access to thousands [4:19] of world-class developer tools. [4:24] Now once you've installed any graphical apps, [4:26] you'll find that they all show up in your launcher, [4:28] just like the rest of your Chrome OS apps, [4:31] and if you open them, they show up in your Window Manager-- [4:35] again, just like the rest of your Chrome OS apps. [4:39] This is the simple experience that people [4:41] have come to expect from Chrome OS [4:43] and we didn't want to change that with Linux. [4:45] But importantly, this is also secure. [4:48] You don't have to worry about malware accessing your files, [4:51] snooping on your traffic, or infecting your peripherals. [4:56] I'd ask you to trust us on that but this [4:58] is way too important for you to take on trust alone, [5:01] so over the course of this talk, Dylan and Sudha are going [5:05] to walk you through the principles [5:06] behind the architecture and design of Crostini. [5:10] We're then going to dissect some common developer flows to show [5:13] you how these principles apply. [5:16] And finally, we're going to share [5:18] some tips and tricks for advanced usage for the power [5:21] users out there. [5:22] So now I'm going to hand it over to Dylan [5:24] to talk about the architecture. [5:30] [APPLAUSE] [5:30] DYLAN REID: Good job. [5:34] OK. [5:34] So Chrome OS has always had a layered approach to security [5:39] and our big layer has always been [5:42] the browser and the renderer and running all untrusted code [5:45] in a nice isolated renderer, and that [5:47] keeps the attack surface of your core system [5:50] to an absolute minimum. [5:51] They're not allowed to make a lot of system calls. [5:53] They can't poke at random bits of your kernel. [5:56] And that worked really well for web pages, web apps. [6:00] However, for developer tools, I need [6:02] to install a lot of different programs. [6:04] They need a lot of different privileges. [6:07] They can do anything any app on Linux can do. [6:09] And that wasn't acceptable for us on the core of Chrome OS, [6:13] so we needed to add a layer. [6:15] So we added a virtualization layer, [6:18] and that lives in the main Chrome OS layer, [6:20] and that spins up a VM. [6:23] And now this VM has a much more limited interface [6:25] while still exposing a full Linux kernel to the programs [6:29] that run inside the VM. [6:30] The only way the VM can talk to Chrome OS proper [6:33] is through a small API that that cross-VM program on the left [6:39] up there exposes to the guest. [6:43] This is pretty good. [6:44] Now we've greatly reduced attack surface. [6:49] We were pretty happy with this. [6:50] We wanted to go a little further. [6:52] So we made sure that the guest VM was also signed by Google [6:56] and somewhat trusted. [6:58] This lets us trust some of the actions the guest VM takes, [7:02] and it's also read-only, so users can only [7:05] break things so much. [7:06] And that, no matter what you do, you're [7:08] going to be able to boot a VM. [7:10] However, with all that security solved, [7:13] we're back in a situation where you [7:15] don't have enough flexibility. [7:17] Your apps can't do anything. [7:19] It's a read-only thing. [7:20] You can't install anything in it. [7:22] So we added another layer, and for this, we stole-- [7:27] used-- LXD from Canonical. [7:32] That team's been very helpful in getting this spun up with us. [7:34] It's a pretty standard container runtime. [7:36] It's built for running system containers. [7:39] And in our case, we started a system container of Debian [7:43] and exposed that to the user. [7:47] So that cross-VM layer I was talking about, [7:49] that's kind of the most important part of the security [7:53] story here. [7:54] It's the last line of defense before something [7:56] gets into Chrome OS. [8:00] So we went and we focused on this for a long time [8:03] and made sure we got that as secure as possible. [8:06] We wrote it in a memory-safe programming language. [8:08] We chose Rust. [8:10] This eliminates buffer overflows and integer overflows [8:14] and a lot of common bugs related to memory safety that [8:17] are exploited by attackers. [8:20] We were pretty happy with that, but we again [8:23] added another layer of security here [8:25] in that we broke up the virtualization [8:28] program into pillars and made sure that each pillar that [8:32] interfaces with the guest only has access [8:34] to small parts of your host Chrome OS system. [8:38] So your host Chrome OS system, you've [8:39] got your bank's web page open, you've got your online tax [8:43] filing thing open, you've got all kinds [8:45] of personal identifiable information everywhere. [8:48] We really wanted to protect that. [8:50] But we needed to give the guest access to things, [8:52] like a random number, a display, a USB device. [8:56] So each of those got their own jail [8:58] and they can only see the thing they need. [9:01] So our random number generator can generate random numbers. [9:04] It can't access any files. [9:06] It's in an empty file system from its perspective. [9:09] It doesn't have any network access. [9:12] The display driver, it can access the display. [9:15] Again, it can't touch the network. [9:17] It can't go grab your files and upload them, [9:19] even if somebody gets into it and tries to make it do things [9:22] we didn't intend it to. [9:26] This is all a little complicated, [9:28] but we've added a great amount of system UI [9:31] to make this easy for you to use, [9:32] so when you're just doing your job as a developer, [9:35] you don't have to worry about these pretty pictures I've [9:38] drawn for you. [9:38] And Sudha will show you what we did. [9:40] SUDHA BROSLAWSKY: Thank you, Dylan. [9:42] Security is absolutely top of mind for us. [9:46] While crafting the Linux experience on Chromebooks, [9:48] we came up with three high-level design goals. [9:56] The first goal was to keep your experience intuitive. [10:01] Everyone here in this room has been [10:02] using computers for a long time and you have established [10:07] your workflows and habits. [10:09] So basically what we wanted to do [10:11] is to match to those expectations. [10:14] We wanted to provide an experience that's [10:17] natural to you. [10:19] We want developers everywhere to be using Chromebooks [10:22] and feel right at home doing it. [10:26] The second goal was to make your experience native. [10:30] We could have taken the easy path [10:32] by giving you a full Linux desktop in a VM [10:36] but that wasn't good enough. [10:39] Our goal was to bring the Linux apps you depend on [10:42] for development into your native Chrome OS experience. [10:47] The third goal was to make your experience simple, [10:51] and I think this is very important. [10:56] There's a lot of complexity that's going on under the hood [11:00] and we want to leave it there. [11:03] Our guiding principle is that complexity shouldn't interfere [11:07] with the user experience. [11:10] There's a couple of things we are trying to balance here. [11:14] The security concerns that come with installing Linux apps [11:18] on Chromebooks and the simplicity that [11:21] comes with sticking to design patterns [11:23] established by Chrome OS. [11:26] And our mission was to find that sweet spot. [11:35] TOM BUCKLEY: All right. [11:36] So now we're going to talk about three common developer flows [11:39] and see how they work with Crostini. [11:42] And the first of these is accessing files. [11:44] As developers, we have to do this all the time. [11:47] Our editors need to access files, [11:48] as do our compilers, our source control, and a whole lot more. [11:53] But the problem is that our file systems [11:55] have a lot more than just code. [11:58] They have our personal photos, our tax [12:00] returns, maybe that novel that you've been working on. [12:05] A lot can go wrong. [12:08] Ransomware can hold all of that data hostage. [12:12] Malware can upload your files to some random server. [12:15] Or maybe you just get something that goes and deletes [12:18] everything for the fun of it. [12:21] We built Crostini with those threats in mind [12:24] to limit what can go wrong, and Dylan will tell you how. [12:31] DYLAN REID: So our goal sharing files with your VM [12:33] and with your container was to make it easy [12:36] for you to get the files you needed for your development [12:39] tasks where you need them but not [12:41] expose things you don't want exposed to untrusted code. [12:44] Because ultimately, we don't trust the code [12:46] that's running inside this VM. [12:48] To do this, we took a layered approach. [12:51] Your files all live in Chrome OS at the very bottom, [12:57] and we share them out to the VM with a 9P server. [13:01] We named it 9S. [13:02] Again, we wrote it in Rust so it's memory safe, [13:05] we fuzzed it to make sure unexpected inputs don't cause [13:08] unexpected behavior, and we put it in a tight jail [13:12] so it can access only the files you share with it. [13:16] And it takes those files and exports them to the VM. [13:20] The VM mounts the 9P thing that's built into Linux, [13:23] and then LXD takes that mount and exposes it [13:25] into your container where your development tools are running. [13:29] The important thing here is that your container can only [13:32] see files that you say, I want to share with my development [13:35] environment. [13:37] Your VM can only see those same files. [13:39] And even the server that we wrote, running on Chrome OS, [13:42] can only see those files. [13:44] It doesn't get to see everything. [13:45] So somebody exploits this stack all the way back [13:48] into Chrome OS. [13:49] They still don't have access to the files you haven't [13:52] shared with the container. [13:55] That's a lot of stuff to set up. [13:57] Setting up 9P amounts, bind-mounting things [14:00] into containers. [14:02] We had to do this manually for a while when [14:04] we were developing it. [14:05] It was painful. [14:06] So I'll let Sudha show you how easy we made it for you. [14:10] SUDHA BROSLAWSKY: There are a lot of layers going on, [14:12] but let's see how simple this is in the UI. [14:17] Right out of the box, you have a directory [14:19] called Linux Files, which is your home [14:22] directory within Linux. [14:24] Anything in this directory is automatically [14:27] shared with Linux. [14:29] Outside of this directory, anywhere else on the device, [14:34] Linux doesn't have access to anything [14:36] until you grant permissions. [14:39] I'll walk you through a couple of examples here. [14:43] Let's say you're working on a project [14:45] and you see yourself needing files from this one [14:48] folder called Illustrations. [14:51] To share this, all you have to do [14:53] is access the right-click menu and click on Share with Linux. [14:58] And as simple as two steps, you've [15:01] now shared this folder with Linux. [15:04] If you notice, this is in Google Drive, and that's a cool thing. [15:10] When you don't want to share this anymore, [15:13] you can do that by going to Settings and Unsharing. [15:17] Here's another example where we made quick edits really simple [15:22] for you. [15:23] You have a data file in your Downloads folder, [15:26] and when you double-click, it automatically opens in VS code. [15:31] When this happens, in the background, [15:33] it's implicitly shared. [15:35] And the sharing lasts until you restart. [15:38] This is the balance of security and simplicity [15:41] we wanted to bring you. [15:46] TOM BUCKLEY: Thank you. [15:47] So, for our second developer flow [15:50] that we're going to talk about, we're [15:52] going to look at running a web server. [15:54] Now being Chrome OS, we care a lot [15:56] about people making great web apps, [15:57] and we want to make sure that they can [15:59] create those on a Chromebook. [16:01] And being able to run a web server [16:02] is pretty central to being able to build any web app. [16:08] Unfortunately, web servers also need [16:10] a pretty low level of access and that can cause some problems. [16:16] The code that can run a web server [16:18] is also capable of snooping on your internet traffic. [16:21] It can know what sites you're accessing, and in some cases, [16:24] even see the contents of those pages. [16:26] This means that a malicious web server could potentially track [16:29] everything that you're doing. [16:30] Now again, we thought of this as we [16:32] designed Crostini and we made sure that we [16:36] prevented this kind of attack. [16:39] Dylan will tell you how. [16:41] DYLAN REID: I can be called Linux, that's OK. [16:43] That's my job. [16:45] All right, so starting a web server from Crostini, simple. [16:50] We've got a good demo over in the web dev sandbox already. [16:53] Type a command. [16:54] You fire up your web server, just [16:55] like you would on any Linux distribution out there. [16:59] What's actually happening under the hood, [17:01] though, is you're in a container and you open up a port. [17:06] That port's in a network namespace inside a VM, [17:10] running under our special hypervisor which [17:13] puts its network stack in another namespace on the host, [17:16] and then finally out to Chrome. [17:20] So Chrome can't get back in, which is great for security. [17:23] You've got wonderful isolation. [17:25] But if I want to test this new PWA or web page [17:28] I'm running in my VM, how do I get Chrome to talk to it? [17:34] This was not simple. [17:36] So for that, we had to add some daemons along the way-- [17:39] actually, every layer gets a daemon for this. [17:43] The first one's running in the VM [17:46] and it's sitting there waiting to check [17:49] if any container that's running happens to open a port. [17:53] And then it's got to figure out which [17:55] container opened that port. [17:57] And bundles that information up, sends it to Chrome OS. [18:00] Says, hey, this port in this container is listening. [18:03] The user might want to use that port. [18:06] And on the Chrome OS, we say, OK. [18:08] The other daemon responds. [18:09] Says, I will set up a route to do some forwarding. [18:12] I'm going to forward all of this over VSOCK, [18:15] which is a protocol used to talk to local VMs on machines. [18:20] That's kept under the hood. [18:22] So either end, it talks HTTP into the daemons, [18:26] and the daemons talk VSOCK to each other. [18:28] So the key here is that the web server gets to talk HTTP. [18:32] Chrome gets to talk HTTP. [18:34] Everything's normal. [18:36] Everything works just like you would. [18:37] Well, under the hood, we've got all these extra daemons [18:40] and VSOCK forwarding going, but we've hidden that. [18:45] One other important thing, we've made it trusted. [18:48] So you can get all your PWA features. [18:50] You can install it to your desktop. [18:53] Even though it's not technically the same machine, [18:55] we know it is because we've got the information. [18:57] We set up the VM. [18:58] So we allow it to be trusted domain. [19:02] And all this complexity I think makes one of our best demos [19:05] today of how complicated we made it under the hood [19:08] and how simple you're going to see it as actual use. [19:10] SUDHA BROSLAWSKY: I totally agree [19:12] that this is very complicated under the hood, but in the UI, [19:16] it's exactly like you would expect it to be. [19:21] Let's say you're experimenting with building this cool PWA. [19:26] Here in terminal, you're in your folder, PWA Starter Kit. [19:31] You're running the commands to start your web server. [19:35] And if you see at the bottom of the screen, [19:38] it's listening at port 8080. [19:40] At this point, you can launch your browser, [19:44] go to local host 8080, and test your web app. [19:48] On the screen here, on the left, you have your web app [19:53] in Chrome, and on the right, if you're noticing it, [19:58] it's in Chrome. [19:59] Yes, you can test your web app on a Chromebook in Firefox, [20:04] too. [20:07] If you notice, we did not prompt you to give any permissions [20:11] while we were in this flow. [20:13] This is because the host is accessing the VM and not [20:17] the other way around. [20:18] Again, this is another way we kind of balanced [20:21] the security and simplicity factor we were talking about. [20:30] TOM BUCKLEY: All right. [20:31] Finally, for our third demo, we're [20:33] going to talk about testing an Android app. [20:36] Now this is really exciting because just yesterday, we [20:39] announced that Android Studio is officially [20:41] supported on Chromebooks, and we even [20:44] created an installer just for Chrome OS [20:46] to make it really easy to get started with. [20:49] Now of course, Android Studio isn't the only thing [20:51] that you need in order to build a great Android app. [20:55] You also need something to test that app on-- usually a phone-- [20:58] and while you could do that over Wi-Fi [21:00] with ADB remote and all this sort of stuff, [21:02] we wanted to make it easy-- just the experience that you'd [21:04] expect on any other device. [21:06] I can plug my phone in over USB and test my app that way. [21:11] Now, if I'm an Android developer, [21:13] sure, I'll plug my phone in to test my app, [21:16] but I'm also going to plug in a lot of other devices over USB [21:19] over the course of my day. [21:21] I may plug in a USB drive that has [21:23] a lot of family photos on it. [21:25] I may plug in a wearable that has some health information. [21:29] I may even plug in my security key [21:31] for work that gives me all of my access. [21:34] Malware can take advantage of these devices [21:36] to uniquely identify you as you move [21:39] between machines, to spread itself, [21:41] or even to make changes to them. [21:44] Again, we thought of these threats when designing Crostini [21:49] and made sure that we were preventing them. [21:55] DYLAN REID: Yeah, implementing USB was a lot of fun for us. [21:57] It might have been our most painful stack. [22:02] Same principles apply. [22:04] We've got our layers. [22:06] We protect the host. [22:07] There's a lot of attack surface in a host USB stack. [22:10] It's a very complicated kind of loosely-specced protocol. [22:14] Well it's an exact spec that's loosely [22:16] implemented by a lot of people. [22:19] So we've hidden that. [22:20] Kept that on the host side. [22:24] Wrote a device that we live in cross-VM jail. [22:27] Again, we've got a USB driver. [22:30] It's pretty complicated. [22:31] It's got a lot of code in it and I'm sure there's a bug or two. [22:35] So we made sure it was very well isolated. [22:38] It can't get to your files. [22:39] It can't get to the network. [22:41] It also can't get to any USB device. [22:44] You have to explicitly say, hey, I [22:45] want to give this USB device to my development environment. [22:50] And we've tried to make that as easy as possible. [22:52] And what actually happens under the hood, [22:54] we've always got an emulated USB bus running, [22:57] so the guest always sees, hey, I've got a USB bus, [23:00] there's just nothing plugged in. [23:02] And once you indicate that I want to give this to my VM, [23:05] it says, OK, I'm going to add this device to this bus [23:08] and then we show it to the guest. [23:09] And then the guest again in turn has [23:11] to forward that into the container [23:12] and the container can see it. [23:16] There's two things we really focused on here. [23:18] One was security. [23:19] Again, we addressed that with the jail [23:21] and we made sure that the attack surface [23:23] was as minimal as possible. [23:25] It's also written in Rust and it's nice and memory-safe [23:27] and it's fuzzed. [23:29] But the other issue here is privacy because people somehow [23:33] use lists of USB devices attached [23:35] to machines to fingerprint and track users, [23:37] and we wanted to make sure the untrusted code running [23:40] inside the container couldn't be another way to do that. [23:46] Again, this is a lot of steps. [23:49] We have to create a device. [23:50] We have to export it to a VM. [23:52] We have to export it to a container. [23:53] We have to decide which device to export or not. [23:57] And again, we'll have a demo that shows how easy it is. [24:02] SUDHA BROSLAWSKY: OK. [24:03] This is the last demo. [24:06] Let's say I'm on my Linux-enabled Chromebook [24:10] and you're plugging in your phone. [24:13] You'll see a notification that prompts [24:15] you to connect to Linux. [24:17] At this point, only Chrome OS has knowledge of your phone. [24:22] Linux doesn't even know that your phone exists [24:24] and that's a good thing. [24:28] If you see here, your phone is not listed in the USB list, [24:35] but when you rerun the command, once you [24:37] connect on the notification, your phone [24:40] shows up in the list. [24:43] At this point, you established access to Linux to your phone. [24:49] Let's say you're working on a project. [24:50] You're developing a cool app again in Android Studio, [24:55] and you're ready to test it out. [24:57] You hit Run and select the phone, and boom. [25:01] Just like that, you're able to test your app on your phone. [25:08] At this point, you can debug and test out your app. [25:12] Finally, you can go to Settings and manage what Linux access to [25:16] at any point of time. [25:21] So you can see how security is at the core of your Linux [25:24] experience on Chromebooks. [25:27] You, the user, are in full control [25:30] at all times of what Linux has access to. [25:34] We take advantage of a variety of UX patterns [25:37] to make it simple to use and also native to Chrome OS. [25:41] The combination of principles of Chrome OS and Crostini [25:47] make this experience pretty unique. [25:54] DYLAN REID: Thanks. [25:55] My turn. [25:57] All right, good. [25:58] We've got plenty of time. [26:00] So we've been talking about a lot of details [26:03] and I've been talking a lot about layers and jails, [26:06] and all that's important and it's a good reason for you [26:09] to trust our normal flows, and when I'm using my Chromebook, [26:14] I almost always stay within these common workflows [26:16] that we've polished and made sure work. [26:19] However, a lot of that technical detail. [26:22] I was talking about is still usable, [26:24] and we've left hooks in for you to play with it. [26:27] So I'm glad I've got time left so I [26:29] can go through a few of these examples and kind of just whet [26:31] your appetite for what else you can do. [26:33] We don't test this stuff. [26:36] We don't support this stuff. [26:38] We really want the standard flow to be enough for everybody. [26:41] But every once in a while, there might [26:43] be a reason you want to do something [26:45] a little more advanced, or you might just want to go [26:48] have fun and play with things under the hood. [26:49] We're tinkerers, right? [26:51] We're supposed to be. [26:53] So we'll go through and show how some of this stuff works. [26:58] All this is going to be from the Chrome OS shell. [27:00] This has been in Chrome OS since-- [27:02] well, longer than I have. [27:04] And so Control-Alt-T gets you a shell. [27:07] There's a set of debug commands you can run. [27:09] We're going to focus on one command, which is the VMC [27:12] command that we added to control virtual machines [27:15] and containers. [27:18] The basic command, you can do a VMC list. [27:20] It'll show you what VMs you have installed on your system. [27:26] The default VM is called Termina. [27:29] So hopefully the font's big enough [27:32] and you can see what size it is. [27:34] The Termina VM is the one that all the demos [27:37] were done for the slides before, so it's up and running. [27:41] We've made a shortcut to enter a container inside a VM. [27:44] So if you want to go into the default container, [27:46] the container's named Penguin. [27:48] Again, that's where we were doing all these demos from. [27:51] So there's a VMC container command [27:53] that gets you into there. [27:56] We'll pop out of there and then we'll [27:58] pop back into just the VM. [27:59] So VMC Start enters your virtual machine [28:04] without entering your container. [28:06] So if you go back to my layers, it's the one in the middle-- [28:09] the thing that LXD runs in. [28:11] And the reason you'd want to be in here [28:13] is if you want to manipulate or change containers. [28:21] So I mentioned we use LXD. [28:23] There's going to be a lot of LXC commands. [28:25] That's the LXD control program. [28:28] This is well-documented online and most of it [28:32] will work inside Chrome OS, just like it does [28:35] on a default Ubuntu install. [28:37] The first one you can do is a list. [28:39] You can see we've got Penguin running. [28:41] We have one container. [28:42] It's up and running. [28:43] It's got an IP address. [28:47] So we've got our one container. [28:49] We might want to play with it a little bit. [28:53] And before we do, maybe I want to make [28:55] sure I can get back to a state where I know it's good, right? [28:58] Because I've broken them before. [29:01] It's nice to be able to just go back [29:02] to where I was and play around without worrying. [29:06] So standard LXE command. [29:08] It's called Snapshot. [29:10] And you give it your container name [29:12] and you can give it the name of your snapshot, [29:15] and now you've got an image saved that you can go back [29:17] to if you break things. [29:20] There's a copy on write, too. [29:21] We used btrfs in the VM so you're not [29:24] eating up a ton of disk space. [29:27] We can get info on our container. [29:29] This gives a bunch of information. [29:32] Again, you can go poke around with this on a Chromebook [29:34] if you want to. [29:35] The important bit here is that we've [29:36] got one snapshot at the bottom, the IO1 snapshot we just [29:39] created. [29:41] You can have multiple snapshots. [29:43] It's got a date on it to help you remember if you didn't [29:46] use a very creative name. [29:49] And then when you want to restore it back, LXE Restore. [29:53] These are well-named commands. [29:54] They did a better job with this than I did. [29:59] If you really want to go and play with different things, [30:01] sometimes you want more than one container. [30:03] So I've got my Penguin container and I'm [30:07] going to go, say, install some different libraries [30:10] in this one. [30:10] Maybe I want to have a container that's [30:12] got Python 2.7 and a different one that's got Python 3. [30:15] Or maybe I want a different container [30:17] for writing Go than the container I [30:19] have for writing Rust. [30:23] So we let you do that. [30:24] You can create as many containers [30:25] as you want, disk space-limited. [30:27] These do cost disk space. [30:30] The most basic way to start off a new container [30:33] is to copy an existing one. [30:34] There's an LXE Copy command. [30:36] The example up here copies the default Penguin container over [30:40] to a new container named Kingfisher. [30:44] You can list the containers. [30:46] You've got two. [30:46] By default, containers are stopped, [30:48] so we have to start them. [30:50] Now we can list-- there it's running. [30:54] And you can jump in. [30:56] You say, I want to run Bash in Kingfisher. [30:58] And now I've got a shell in my new container [31:00] and I can go off and install whatever [31:02] random tool chain I didn't want in my default container. [31:07] Taking that one step further, we chose Debian [31:11] because it was kind of the easiest thing for us to do. [31:15] We don't want to tie you down to that, though. [31:17] We support the Debian workflow. [31:19] We support some guest packages that [31:21] are installed in Debian by default. [31:23] But some people want to use their favorite distro. [31:29] And there is a huge amount of distros [31:31] available from the image server that Canonical runs. [31:36] We'll install an Arch one here. [31:39] I'm not an Arch guy, I don't really know much about Arch, [31:41] but some of my coworkers talked me [31:43] into doing this and playing with it. [31:46] So now you can see we've got three containers. [31:48] And I've got two Debian containers, my Penguin [31:50] and my Kingfisher, and now I've got something called ArchTest. [31:53] And again, I can enter it by telling it to run Bash. [31:58] And if I want to install packages in this one, [32:01] I'll use PacMan instead of Act. [32:04] Look, it's actually Arch, I promise. [32:08] That's just a taste of what you can do from here. [32:11] If you go and look at the LXD and LXD documentation online, [32:14] you can get some more ideas. [32:17] There's even some help online about installing other ones [32:20] and getting them to integrate better with the GUI [32:22] if you want more than just a command line. [32:28] TOM BUCKLEY: All right. [32:29] So Dylan just showed you a bunch of the really cool tricks [32:32] you can do with Crostini when you go under the hood, [32:35] and if you're interested in this kind of thing, [32:37] we really recommend checking out the Crostini subreddit. [32:41] The folks there find features as soon as we release them, [32:45] sometimes even sooner, and they're also [32:48] really welcoming to new users of Linux on Chromebooks. [32:53] So if you have any questions, please check it out, [32:56] and a big thanks to the folks there. [33:00] So that's Linux on Chromebooks. [33:02] As you can see, we already support [33:04] a lot of web and Android developer flows. [33:07] And there's a lot more to come, both in supporting [33:10] other developers and in expanding [33:12] what we can do with new capabilities, [33:15] like multiple containers and backup and restore. [33:19] We're going to keep applying these principles of simplicity [33:22] and security to give you the best developer [33:25] experience possible. [33:27] Whenever you're ready, we hope you'll join us. [33:30] Thank you. [33:31] [APPLAUSE] [33:32] [MUSIC PLAYING]