逐字稿 · CC BY 4.0

Chromebook 上的 Linux(Crostini):安全開發 — Google I/O 2019

本頁標題、字幕、摘要與閱讀筆記為已儲存的 AI 譯文,可能有誤。時間戳與來源一致,可展開查看原始字幕,並對照原影片核對。

Google 工程師說明 Chromebook 上的 Linux(Crostini)如何在虛擬機中隔離開發者工作負載,同時確保 Chrome OS 使用者資料安全。

Chrome for Developers · 發佈於 · 34 分鐘 · 英文 · 授權:CC BY 4.0 · 來源:在 YouTube 觀看

逐字稿來源:創作者上傳至 YouTube 的字幕。AI 標點由 Vidleaf 加入;原始措辭與時間戳錨點均保留。原始逐字稿可在下方取得。

AI 生成摘要

Sudha Broslawsky、Dylan Reid 與 Tom Buckley 介紹 Chromebook 上的 Linux(Crostini),說明開發者可藉由在簡潔與安全之間取得平衡,而非採用新框架,來獲得安心。自 I/O 大會宣布以來,Chromebook 上的 Linux 可執行常用的編輯器、IDE 與工具,並在超過 50% 台 Chromebook 上獲得支援;設定只需點擊幾下,虛擬機器會在下載、容器於背景完成設定的同時,留下一個終端機與標準 Debian 環境,支援 Git、Vim、APT 與 .deb,而圖形應用程式則會出現在啟動器中。安全性仰賴 Chrome OS 的分層做法:一個虛擬化層,其以 Rust 撰寫的跨 VM 程式僅暴露少量 API,並拆分為受隔離的支柱(隨機數、顯示、USB),再由 Canonical 的 LXD 提供 Debian 系統容器。檔案分享使用一個名為 9S 的 Rust 9P 伺服器,運行於嚴密的隔離環境中,因此容器、VM 與伺服器各自只能看到共享的檔案,而 Linux Files 目錄則作為 Linux 的家目錄。在使用者授予權限之前,Linux 無法存取裝置的其他部分,資料夾可透過右鍵「與 Linux 共用」來分享,包括 Google Drive 資料夾,且可在設定中移除分享。網頁伺服器在虛擬機器內的容器中、於 Hypervisor 之下運行,並透過以 VSOCK 為基礎的連接埠轉送,讓 Chrome 能以受信任網域的身分存取 localhost 8080。USB 裝置必須明確授予,其防護包括跨 VM 隔離、最小攻擊面、Rust 的記憶體安全與模糊測試,部分原因是 USB 裝置清單可被用來對使用者進行指紋辨識。可從 Chrome OS 殼層(Control-Alt-T)取得進階工具,包括用於 Termina VM 與 Penguin 容器的 VMC 指令、透過 LXD 使用 LXC 指令,以及 btrfs 寫入時複製快照。LXC Restore 可將容器還原至已儲存的快照,而多個容器則允許各自獨立的設定,並可透過 LXC Copy 建立;選擇 Debian 是因為它是最容易的選項,但使用者並不受限於它,Canonical 的映像伺服器提供許多發行版,例如使用 PacMan 的 Arch 容器。結語指出,許多網頁與 Android 開發者的流程已獲得支援,未來將著重於其他開發者、多個容器以及備份與還原,同時套用簡潔與安全。

由逐字稿生成。請對照原始影片檢查連結的段落。

含時間戳的章節摘要

I/O 大會上的 Chromebook 專用 Linux(Crostini)

講者介紹與議程框架

  • [0:04] Sudha Broslawsky,Chromebook 上 Crostini 的設計師,與 Chrome OS 虛擬化負責人 Dylan Reid 及 Chromebook 上 Linux 的產品經理 Tom Buckley 一同為本場議程開場。
  • [0:31] 本場議程並非推銷新框架或平台,而是聚焦於開發者如何藉由使用 Chromebook 上的 Linux、在簡潔與安全之間取得平衡,來獲得安心。

關於開發與安全性的觀眾投票

  • [1:07] 觀眾投票顯示,現場滿是開發者,他們也會用電腦處理報稅和電子郵件等非開發工作,而且許多人擔心安全性。
  • [1:34] Dylan Reid 表示,觀眾確實該擔心安全性,他很樂見許多人舉手。

Dylan 的難題:不受信任的程式碼與兩台筆電

  • [1:40] 開始新專案時,Dylan 會卡住並求助於 Google,但有時答案來自不受信任網站的指令碼,他仍因期限壓力照樣執行。
  • [2:17] 反覆執行這類指令碼,讓他對系統的信任度越來越低,因為他已不知道自己執行過哪些程式碼,也沒時間讀完所有指令碼。
  • [2:29] 他的解決方案是帶兩台筆電——一台開發用,一台處理其他所有事情的安全筆電——但他最近改用單一筆電,由 Tom 說明原因。

Linux 支援現況與入門方式

  • [2:46] Chrome OS 從一開始就以簡單又安全的體驗為目標,但過去無法執行開發者需要的所有工具;去年 I/O 大會宣布 Chromebook 支援 Linux 後,情況有了改變。
  • [3:11] Chromebook 上的 Linux 可執行慣用的編輯器、IDE 和工具,目前支援超過 50% 款 Chromebook,包括搭載第八代 Intel CPU 的裝置,例如 Lenovo Yoga Book C630 和 Acer Chromebook Spin 13。
  • [3:36] 入門只需點幾下;背景會下載虛擬機器、設定容器並完成所有配置,開發者只會看到啟動器中新增了一個終端機。

Debian 環境、應用程式與安全保證

  • [3:54] 終端機提供標準 Debian 環境,預載開發者期望的工具,例如 Git 和 Vim,還有 APT 套件管理員以及透過 .deb 檔案安裝程式的能力,可使用數千種開發工具。
  • [4:24] 安裝的圖形應用程式會像其他 Chrome OS 應用程式一樣出現在啟動器和視窗管理員中,維持 Chrome OS 簡單的體驗。
  • [4:45] 這套設定也很安全:使用者不必擔心惡意軟體存取檔案、窺探流量或感染周邊裝置,Dylan 和 Sudha 將說明架構與設計原則,而不是只請大家信任。

議程結構總覽

預定議程與交棒

  • [5:10] 這場演講將剖析常見的開發者流程,說明這些原則如何套用。
  • [5:16] 演講最後會提供進階、高階使用者用法的提示與技巧。
  • [5:22] 講者交棒給 Dylan 討論架構。

Chrome OS Linux 開發環境的安全性

渲染器隔離與虛擬機層的必要性

  • [5:34] Chrome OS 一向採用分層式安全防護,瀏覽器與渲染器會把所有不受信任的程式碼放在隔離的渲染器中執行,讓核心系統的攻擊面降到最低。
  • [5:51] 渲染器程式碼不得發出許多系統呼叫,也不能任意存取核心的隨機部分,這對網頁與網頁應用程式而言運作良好。
  • [6:00] 開發者工具需要安裝許多程式,其權限等同於任何 Linux 應用程式,這在 Chrome OS 核心上無法接受,因此加入了虛擬化層。
  • [6:15] 虛擬化層位於 Chrome OS 主要層中,會啟動一個介面受限許多的虛擬機,同時仍對虛擬機內的程式提供完整的 Linux 核心。

經簽署的唯讀客體虛擬機及其彈性限制

  • [6:30] 虛擬機只能透過跨虛擬機程式向客體暴露的小型 API 與 Chrome OS 本體溝通,大幅縮小攻擊面。
  • [6:52] 客體虛擬機改由 Google 簽署並具備一定信任度,使其部分動作可被信任;它也是唯讀的,因此使用者最多只能弄壞有限的部分,而且永遠能重新啟動虛擬機。
  • [7:10] 安全問題雖如此解決,彈性卻不足:應用程式能做的不多、環境是唯讀的,而且什麼都無法安裝。

為開發者彈性而加入的 LXD 容器層

  • [7:22] 於是又加入一層,採用 Canonical 的 LXD,這是為系統容器打造的標準容器執行環境,並由該團隊協助啟動。
  • [7:39] 啟動了一個 Debian 系統容器並開放給使用者。

作為最後防線的 Rust 跨虛擬機層

  • [7:47] 跨虛擬機層被形容為整體安全防護中最重要的部分,也是任何東西進入 Chrome OS 之前的最後一道防線,因此長期投入重點關注。
  • [8:06] 跨虛擬機層以記憶體安全的語言 Rust 撰寫,消除了緩衝區溢位、整數溢位,以及許多攻擊者常利用的記憶體安全漏洞。

虛擬化介面的支柱式隔離

  • [8:23] 虛擬化程式被拆分成多個支柱,每個與客體介接的支柱只能存取主機 Chrome OS 系統的一小部分,藉此保護網銀頁面、線上報稅等個人資料。
  • [8:50] 客體所需的資源,例如亂數、顯示器與 USB 裝置,各自擁有專屬的監牢,只能看見自己需要的部分。
  • [9:01] 亂數產生器可以產生亂數,但無法存取檔案——它看到的是空的檔案系統——也沒有網路存取權。
  • [9:12] 顯示驅動程式可以存取顯示器,但無法觸及網路,也無法抓取和上傳檔案,即使有人入侵它並試圖讓它做出非預期的行為也是如此。
  • [9:26] 新增系統介面是為了讓開發人員輕鬆做到這一點,這樣他們在執行工作時就不必擔心底層的安全架構。

Chromebook 上的 Linux:三大設計目標

符合開發人員習慣的直覺體驗

  • [9:56] 第一個設計目標是保持體驗直覺。
  • [10:09] 團隊希望符合使用者既有的工作流程與習慣,並提供對他們而言自然的體驗。
  • [10:19] 目標是讓各地的開發人員使用 Chromebook 時都能感到賓至如歸。

原生整合,而非完整的 Linux 虛擬機桌面

  • [10:26] 第二個目標是讓體驗原生化。
  • [10:30] 在虛擬機中提供使用者完整的 Linux 桌面是簡單的做法,但被認為不夠好。
  • [10:39] 目標是將開發人員所依賴的 Linux 應用程式帶入原生的 Chrome OS 體驗中。

簡潔性,以及在設計模式中平衡安全性

  • [10:47] 第三個目標是讓體驗簡單。
  • [10:56] 底層存在許多複雜性,團隊希望將其留在底層,以免干擾使用者體驗。
  • [11:10] 團隊正在權衡在 Chromebook 上安裝 Linux 應用程式的安全顧慮,以及遵循設計模式所帶來的簡潔性。

Crostini 檔案分享與安全性

促使限制檔案存取的需求的威脅

  • [11:53] 開發人員的檔案系統不僅包含程式碼,還包含個人照片、報稅資料和其他敏感檔案,因此可能出錯的地方很多。
  • [12:08] 勒索軟體可能挾持資料作為人質,惡意軟體可能將檔案上傳到隨機的伺服器,或者某些東西可能直接刪除所有內容。
  • [12:21] Crostini 在設計時就考量了這些威脅,以限制可能出錯的範圍。

分層的 9P 分享架構

  • [12:31] 目標是在需要的地方提供所需的開發檔案,同時不將檔案暴露給不受信任的程式碼,因為在虛擬機內執行的程式碼最終並不受信任。
  • [12:48] 檔案位於 Chrome OS 底層,並透過名為 9S 的 9P 伺服器分享給 VM,該伺服器以 Rust 撰寫、經過模糊測試,並置於嚴密的隔離環境中,因此只能存取共享的檔案。
  • [13:20] VM 掛載內建的 Linux 9P 支援,而 LXD 會將該掛載點暴露到執行開發工具的容器中。
  • [13:29] 容器、VM 以及 Chrome OS 上的 9S 伺服器各自只能看到使用者選擇共享的檔案,因此即使整個堆疊被完全入侵,也無法觸及未共享的檔案。

透過介面簡化共享流程

  • [14:17] Linux 檔案目錄會作為 Linux 的家目錄,其中的任何內容都會自動與 Linux 共享。
  • [14:29] 在裝置上的其他位置,除非使用者授予權限,否則 Linux 無法存取。
  • [14:51] 像是 Illustrations 這樣的資料夾,可以透過右鍵選單中的「與 Linux 共享」選項來共享,包括 Google 雲端硬碟中的資料夾,之後也可以在設定中移除共享。
  • [15:23] 在「下載」中按兩下資料檔案,會自動在 VS Code 中開啟,並隱含共享該檔案直到重新啟動,兼顧安全性與簡便性。

在 Crostini 中安全地執行網頁伺服器

網頁伺服器在 Chrome OS 上的重要性

  • [15:54] Chrome OS 重視打造優質網頁應用程式的使用者,並希望確保他們能在 Chromebook 上開發這類應用程式。
  • [16:01] 能夠執行網頁伺服器,是建置任何網頁應用程式的核心能力。

低階網頁伺服器存取的安全風險

  • [16:08] 網頁伺服器需要相當低階的存取權限,這可能引發問題。
  • [16:16] 能執行網頁伺服器的程式碼,同樣也能窺探網際網路流量、得知存取了哪些網站,在某些情況下甚至能看到頁面內容。
  • [16:26] 惡意的網頁伺服器可能追蹤使用者的一切行為。
  • [16:30] Crostini 在設計時已考量到這點,並旨在防範這類攻擊。

底層的網路隔離層

  • [16:45] 從 Crostini 啟動網頁伺服器很簡單:輸入指令並啟動,就像在任何 Linux 發行版上一樣。
  • [16:59] 在底層,使用者位於容器中,並在 VM 內的網路命名空間中開啟連接埠。
  • [17:10] 該 VM 執行於特殊的 Hypervisor 之下,其網路堆疊位於主機上的另一個命名空間,之後流量才會送往 Chrome。
  • [17:20] Chrome 無法反向進入,這對安全性極為有利,並提供了絕佳的隔離效果。

讓 Chrome 與 VM 通訊的常駐程式

  • [17:25] 要讓 Chrome 與在 VM 中執行的新 PWA 或網頁通訊,並不是件簡單的事。
  • [17:36] 為了實現這點,過程中必須加入常駐程式,每一層都有一個常駐程式。

Chrome OS Linux 容器連接埠轉送

連接埠偵測與 VSOCK 轉送常駐程式

  • [17:43] VM 中的常駐程式會等待偵測任何執行中的容器開啟連接埠,並辨識出是哪個容器開啟的。
  • [17:57] VM 常駐程式會將這項資訊打包並傳送給 Chrome OS,指出容器中有連接埠正在監聽,使用者可能想使用它。
  • [18:08] Chrome OS 上的第二個常駐程式會回應,建立一條透過 VSOCK 轉送流量的路由;VSOCK 是用來與本機 VM 通訊的協定。
  • [18:22] 兩端都以 HTTP 與常駐程式通訊,常駐程式之間則以 VSOCK 通訊,因此網頁伺服器和 Chrome 都使用一般的 HTTP。

受信任網域與 PWA 功能

  • [18:45] 這套設定會被設為受信任,讓使用者能享有所有 PWA 功能,並可將應用程式安裝到桌面。
  • [18:53] 雖然技術上這不是同一台機器,但系統因為是自己設定了 VM 而知道這點,因此允許受信任網域。
  • [19:02] 講者稱這是他們最棒的示範之一:將複雜度隱藏於底層,實際使用卻很簡單。

在連接埠 8080 上測試 PWA 而不出現權限提示

  • [19:21] 在示範中,使用者在終端機的 PWA Starter Kit 資料夾中,執行指令來啟動一個在連接埠 8080 監聽的網頁伺服器。
  • [19:40] 接著使用者可以啟動瀏覽器、前往 localhost 8080,測試這個網頁應用程式。
  • [19:59] 這個網頁應用程式可以在 Chromebook 上以 Firefox 及 Chrome 測試。
  • [20:07] 整個流程中沒有出現任何權限提示,因為是主機在存取 VM,而不是反過來,藉此兼顧安全性與簡易性。

在 Chromebook 上測試 Android 應用程式

Chrome OS 上的 Android Studio 支援

  • [20:39] Android Studio 現已正式支援 Chromebook,並特別為 Chrome OS 製作了安裝程式,讓入門變得輕鬆。
  • [20:49] 打造出色的 Android 應用程式也需要一台裝置來測試,通常是一支手機。

USB 裝置測試與 Crostini 安全性

  • [21:06] 可以透過 USB 連接手機來測試應用程式,提供與其他任何裝置相同的體驗。
  • [21:16] 開發人員白天也會連接許多其他 USB 裝置,例如存有家庭照片的 USB 隨身碟、含有健康資訊的穿戴式裝置,或工作用的安全性金鑰。
  • [21:34] 惡意軟體可能利用這些裝置在不同機器間唯一識別使用者、自我散播,或對它們進行變更。
  • [21:44] 設計 Crostini 時已考量這些威脅,並採取了防護措施來防止它們。

Chrome OS Linux(Crostini)中的 USB 支援

將 USB 堆疊與主機隔離

  • [21:55] 實作 USB 很有趣,但可能是團隊最痛苦的堆疊,並套用了相同的分層原則。
  • [22:06] 主機受到保護,因為主機 USB 堆疊有大量攻擊面,它是一份由許多人寬鬆實作的精確規格。
  • [22:24] USB 驅動程式位於跨 VM 的監獄中且隔離良好,因此無法觸及使用者的檔案、網路或任何 USB 裝置。

透過模擬匯流排明確共用裝置

  • [22:44] 使用者必須明確授權 USB 裝置給其開發環境,團隊也盡可能讓這件事變得簡單。
  • [22:52] 模擬的 USB 匯流排一律執行,因此客體會看到空匯流排,直到使用者指出應將某裝置交給 VM,該裝置才會被加入匯流排。
  • [23:09] 客體接著必須將裝置轉送至容器,容器才能看到它。

安全性與隱私目標

  • [23:16] 安全性透過監獄、最小攻擊面、Rust 的記憶體安全及模糊測試來處理。
  • [23:29] 隱私是一項顧慮,因為已連接 USB 裝置的清單會被用來建立使用者指紋並追蹤使用者,因此不受信任的容器程式碼不應成為另一種達成此事的方式。
  • [23:46] 此流程涉及許多步驟——建立裝置、將其匯出至 VM、將其匯出至容器,以及決定要匯出哪個裝置——而示範展示了這有多麼簡單。

示範:將手機連接到 Chromebook 上的 Linux

  • [24:06] 在支援 Linux 的 Chromebook 上,插入手機會顯示通知,提示使用者將其連接到 Linux;此時只有 Chrome OS 知道這支手機。
  • [24:28] 在使用者透過通知連接之前,手機不會列在 USB 清單中;連接後它便會出現,Linux 也能存取它。
  • [24:49] 在 Android Studio 中,使用者按下「執行」、選擇手機,即可在手機上測試及偵錯應用程式。
  • [25:12] 設定功能讓使用者隨時管理 Linux 可存取的資源,讓使用者保有完整控制權。

使用者控制的原生使用者體驗模式

  • [25:21] 安全性是 Chromebook 上 Linux 體驗的核心,使用者隨時都能完整控制 Linux 可存取的資源。
  • [25:34] 各種使用者體驗模式讓這項功能易於使用且原生於 Chrome OS,融合了 Chrome OS 與 Crostini 的原則。

Chrome OS 進階虛擬機與容器工具

超出標準工作流程的進階調校不受支援

  • [26:19] 精心打造的常見工作流程背後的技術細節仍可使用,並保留了供使用者實驗的掛鉤。
  • [26:33] 這些進階功能未經測試也不受支援,因為標準流程本就設計得足以滿足所有人。
  • [26:41] 偶爾可能會有需要執行更進階操作的理由,或者使用者單純想以調校者的身分深入探索。

存取 Chrome OS 殼層與 VMC 指令

  • [26:58] 所有範例都從 Chrome OS 殼層執行,這個殼層在 Chrome OS 中存在的時間比講者待在這裡的時間還久。
  • [27:04] 按下 Control-Alt-T 會開啟一個殼層,其中包含一組除錯指令。
  • [27:09] 重點在於 VMC 指令,它是為了控制虛擬機與容器而加入的。

列出虛擬機並進入 Termina 與 Penguin

  • [27:18] VMC list 會顯示系統上已安裝的虛擬機,而預設虛擬機稱為 Termina。
  • [27:34] Termina 是先前所有簡報示範所使用的虛擬機,目前正在執行中。
  • [27:41] 一個快速鍵可進入虛擬機內的容器;預設容器名為 Penguin,也是執行示範的地方。
  • [27:51] VMC container 指令會進入預設容器,而 VMC Start 則會進入虛擬機但不進入容器。

在虛擬機中使用 LXC 指令與快照

  • [28:21] 由於 Chrome OS 使用 LXD,許多 LXC 指令在 Chrome OS 內的運作方式與預設的 Ubuntu 安裝相當類似。
  • [28:37] LXC list 會顯示單一 Penguin 容器正在執行,並附有 IP 位址。
  • [28:53] LXC Snapshot 指令會接收容器名稱與快照名稱,以儲存映像檔,供出問題時回復使用。
  • [29:20] 快照在 VM 中使用 btrfs 的寫時複製,因此不會佔用大量磁碟空間。
  • [29:27] 容器資訊會在底部顯示剛建立的快照,而且可以存在多個快照,每個都有日期。

使用 LXC Copy 建立多個容器

  • [29:49] LXC Restore 會將容器還原到已儲存的快照。
  • [30:01] 多個容器可允許各自獨立的設定,例如一個使用 Python 2.7,另一個使用 Python 3,或是分開的 Go 與 Rust 環境。
  • [30:23] 使用者可以建立任意數量的容器,僅受磁碟空間限制,因為容器確實會佔用磁碟空間。
  • [30:30] 啟動新容器的基本方式是 LXC Copy,例如將 Penguin 複製成名為 Kingfisher 的新容器。
  • [30:44] 新容器預設為停止狀態,因此必須先啟動,才能將其列為執行中並在內部執行 Bash。

Chromebook 上的 Linux:容器與發行版

在新容器中安裝工具

  • [30:58] 新容器中的 shell 可讓您安裝不想放在預設容器中的隨意工具鏈。

Debian 預設與替代發行版

  • [31:07] 選擇 Debian 是因為它是最簡單的選項,但使用者並不受限於它。
  • [31:17] 支援 Debian 工作流程以及 Debian 預設安裝的一些客體套件。
  • [31:29] Canonical 營運的映像伺服器提供許多發行版。

Arch 容器與 PacMan

  • [31:36] 名為 ArchTest 的 Arch 容器會與 Debian 容器 Penguin 和 Kingfisher 一起安裝。
  • [31:53] 進入 Arch 容器的方式是讓它執行 Bash,並使用 PacMan 而非 Act 來安裝套件。

進一步文件與 GUI 整合

  • [32:11] 線上的 LXD 文件提供更多想法,包括安裝其他發行版,以及讓它們與 GUI 更妥善整合、超越命令列的協助。

Crostini 子版推薦

  • [32:29] Tom Buckley 推薦 Crostini 子版,人們會在功能發布後立即找到它們,有時甚至更早,而且對 Chromebook 上 Linux 的新使用者很友善。

結語:開發人員支援與未來功能

擴充開發人員流程與新功能

  • [33:04] 講者指出,許多網頁與 Android 開發人員流程已獲得支援,未來還會有更多。
  • [33:07] 未來的工作包括支援其他開發人員,並擴充多個容器、備份與還原等功能。

原則與加入邀請

  • [33:19] 團隊將持續套用簡潔與安全原則,提供最佳的開發人員體驗。
  • [33:27] 講者邀請聽眾在準備好時隨時加入,並向他們致謝。

免裝外掛讀取附時間戳記的現有字幕,匯出 TXT、SRT 或 Markdown。免費 YouTube 字幕擷取工具。

前 3 段雙語對照預覽 · 免消耗額度

以下展示前 3 段已儲存繁體中文譯文與英文原版字幕的逐段對照(零額度消耗):

[0:00]

[音樂播放] SUDHA BROSLAWSKY:大家午安。希望各位在 I/O 玩得愉快。我們今天要談的是 Chromebook 上的 Linux,也就是 Crostini。我們先自我介紹。我叫 Sudha,是 Chromebook Crostini 的設計師。DYLAN REID:嗨,我是 Dylan,Chrome OS 虛擬化負責人。TOM BUCKLEY:我是 Tom,Chromebook 上 Linux 的產品經理。

[MUSIC PLAYING] SUDHA BROSLAWSKY: Good afternoon, everyone. I hope you are having a great time at the I/O. We are here to talk to you about Linux for Chromebooks, also known as Crostini. We'll start by introducing ourselves. My name is Sudha. I'm a designer on Crostini for Chromebooks. DYLAN REID: Hi, I'm Dylan. I'm the Chrome OS Virtualization Lead. TOM BUCKLEY: And I'm Tom, Product Manager for Linux on Chromebooks.

[0:31]

現在是 I/O 第二天的尾聲,各位可能已經參加過許多場次,聽過各種你該使用的新框架,或是你該為哪些平台開發,大家說得都對,你確實應該這麼做,但我們今天不是要談這個。我們想談的是各位開發人員,以及如何透過 Chromebook 上的 Linux 獲得更安心的體驗。我們透過平衡簡潔與安全,為你帶來那份安心。

Now it's the end of day two at I/O and you've probably already been to a bunch of different sessions that have talked about all the new frameworks that you need to be using or the platforms that you need to be building for, and everyone's right, you absolutely should be, but we're not really here to talk about that. 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.

[1:03]

SUDHA BROSLAWSKY:說到這裡,我們來做個快速的使用者調查。現場有多少人是開發人員?哇,果然座無虛席。手先別放下。有多少人會用電腦做開發以外的事,例如報稅、收發電子郵件——同樣,100% 的人。好,最後一個問題。有多少人擔心安全性?DYLAN REID:很好,那相當——我是說,各位都應該擔心,所以我很高興看到這麼多人舉手。

SUDHA BROSLAWSKY: On that note, let's do a quick user study. How many of you are developers in the audience? Wow, that's a full room, as expected. Keep your hands raised. How many of you use your computers for anything else other than development, like doing your taxes, checking email-- again, 100% of you. OK, one last question. How many of you are worried about security? DYLAN REID: Good, that's pretty-- I mean, you all should be, so I'm glad to see many hands up anyway.

[0:00] [音樂播放] SUDHA BROSLAWSKY:大家午安。希望各位在 I/O 玩得愉快。我們今天要談的是 Chromebook 上的 Linux,也就是 Crostini。我們先自我介紹。我叫 Sudha,是 Chromebook Crostini 的設計師。DYLAN REID:嗨,我是 Dylan,Chrome OS 虛擬化負責人。TOM BUCKLEY:我是 Tom,Chromebook 上 Linux 的產品經理。

[0:31] 現在是 I/O 第二天的尾聲,各位可能已經參加過許多場次,聽過各種你該使用的新框架,或是你該為哪些平台開發,大家說得都對,你確實應該這麼做,但我們今天不是要談這個。我們想談的是各位開發人員,以及如何透過 Chromebook 上的 Linux 獲得更安心的體驗。我們透過平衡簡潔與安全,為你帶來那份安心。

[1:03] SUDHA BROSLAWSKY:說到這裡,我們來做個快速的使用者調查。現場有多少人是開發人員?哇,果然座無虛席。手先別放下。有多少人會用電腦做開發以外的事,例如報稅、收發電子郵件——同樣,100% 的人。好,最後一個問題。有多少人擔心安全性?DYLAN REID:很好,那相當——我是說,各位都應該擔心,所以我很高興看到這麼多人舉手。

[1:40] 我不知道各位如何,但我開始新專案時經常卡關。我碰到很多阻礙和障礙,於是我去尋找問題、尋找解決方案,轉向 Google。幸運的是,Google 幾乎總能給我很好的答案。不幸的是,有時答案長這樣。我知道我不該從 evilsite.com 執行這個指令碼,再把它管線傳給 Sudu,但截止期限快到了,而且這個網站看起來還算正派,所以這次我就破例這麼做。

[2:17] 然後這種情況一再發生,最後我得到一個系統,我對它的信任程度不如應有的那麼高,因為我已經不太清楚自己到底在上面跑了哪些程式碼。我沒有時間讀完所有這些指令碼。我對這個問題的解法是帶兩台筆記型電腦——一台用於我的開發者世界,另一台用於我其他想要確保安全的世界。但最近,我改成只用一台筆記型電腦,而 Tom 要來談談我是怎麼做到的。TOM BUCKLEY:所以我們對 Chrome OS 的目標,一直是從一開始就給你簡單又安全的體驗,但如果你之前試過,可能會發現它對開發者來說還沒完全準備好。

[2:57] 為了做到簡單又安全,我們無法執行開發者完成工作所需的全部工具。但去年 I/O 大會上一切都改變了,當時我們宣布要開始在 Chromebook 上支援 Linux。Chromebook 上的 Linux 讓你執行所有你慣用的編輯器、IDE 和工具,現在已支援超過 50% 款 Chromebook,包括搭載第八代 Intel CPU 的優質裝置,例如 Lenovo Yoga Book C630 和 Acer Chromebook Spin 13。

[3:31] 如果你還沒看過,我們要快速示範幾個例子。首先,要怎麼取得?非常簡單,只要點幾下。現在在背景中,這正在下載虛擬機器、設定容器、完成所有配置——Dylan 幾分鐘後會更深入說明,但對你這位開發者來說,只要點幾下就能開始。這會在你的啟動器中加入一個終端機。現在如果你開啟那個終端機,你會看到一個相當標準的 Debian 環境,我們已經預先載入許多開發者期待的工具,例如 Git 和 Vim,如果你還需要其他東西,你有 APT 套件管理員,可以安裝任何你需要的套件。

[4:11] 而如果你想改用 .dev 檔案來安裝程式,也可以這麼做。這讓你得以使用數千種世界級的開發者工具。現在一旦你安裝了任何圖形應用程式,你會發現它們全都會出現在你的啟動器中,就像你其他的 Chrome OS 應用程式一樣,而如果你開啟它們,它們會出現在你的視窗管理員中——同樣就像你其他的 Chrome OS 應用程式一樣。這就是人們對 Chrome OS 所期待的簡單體驗,我們不想因為 Linux 而改變這一點。

[4:45] 但重要的是,這同時也是安全的。你不必擔心惡意軟體存取你的檔案、窺探你的流量,或感染你的周邊裝置。我本想請你相信我們這一點,但這件事太重要了,不能只靠信任,所以在這場演講中,Dylan 和 Sudha 會帶你了解 Crostini 架構與設計背後的原理。接著我們會剖析一些常見的開發者流程,向你展示這些原理如何應用。

[5:16] 最後,我們會分享一些給進階使用者的進階用法技巧與訣竅。現在我把時間交給 Dylan 來談架構。[掌聲] DYLAN REID:做得好。好。Chrome OS 一直以來都採取分層的安全策略。而我們最大的一層一直都是瀏覽器與渲染器,把所有不受信任的程式碼跑在一個妥善隔離的渲染器中,這讓你的核心系統的攻擊面降到最低。

[5:51] 它們不被允許發出大量系統呼叫。它們不能隨意亂碰你核心的任意部分。這對網頁和網頁應用程式來說運作得非常好。然而,對開發者工具而言,我需要安裝許多不同的程式。它們需要許多不同的權限。它們能做任何 Linux 應用程式能做的事。這對我們在 Chrome OS 核心上來說是不可接受的,所以我們需要再加一層。於是我們加入了虛擬化層,它位於主要的 Chrome OS 層中,並啟動一個 VM。

[6:23] 現在這個 VM 的介面受到更多限制,同時仍向在 VM 內執行的程式提供完整的 Linux 核心。VM 與 Chrome OS 本體溝通的唯一途徑,是透過左上方那個跨 VM 程式向客體暴露的小型 API。這相當不錯。現在我們大幅減少了攻擊面。我們對此相當滿意。我們想再更進一步。所以我們確保客體 VM 也由 Google 簽署,並在某種程度上受到信任。

[6:58] 這讓我們能信任客體 VM 所採取的某些動作,而且它是唯讀的,所以使用者最多也只能弄壞到某個程度。而且,無論你做了什麼,你都能夠啟動一個 VM。然而,在解決了所有這些安全問題之後,我們又回到了一個彈性不足的處境。你的應用程式什麼都不能做。它是唯讀的。你無法在裡面安裝任何東西。所以我們又加了一層,而為此,我們從 Canonical 借用了——使用了——LXD。

[7:32] 那個團隊在協助我們啟動這項專案上幫了很大的忙。它是相當標準的容器執行環境,專門用來執行系統容器。在我們的情況中,我們啟動了一個 Debian 系統容器,並將它開放給使用者。所以,我剛才提到的跨 VM 層,可說是這裡安全防護故事中最重要的部分。它是在任何東西進入 Chrome OS 之前的最後一道防線。因此我們投入了很長的時間專注於此,確保我們把它做得盡可能安全。

[8:06] 我們用記憶體安全的程式語言來撰寫,選擇了 Rust。這消除了緩衝區溢位、整數溢位,以及許多攻擊者會利用的記憶體安全相關常見錯誤。我們對此相當滿意,但我們又在這裡加上了另一層安全防護,也就是把虛擬化程式拆解成多個支柱,並確保每個與客體介接的支柱,只能存取你主機 Chrome OS 系統的一小部分。

[8:38] 在你的主機 Chrome OS 系統上,你可能開著銀行的網頁、開著線上報稅的東西,到處都是各種個人識別資訊。我們真的很想保護這些資料。但我們又需要讓客體存取一些東西,例如亂數、顯示器、USB 裝置。所以這些各自都有自己的牢籠,只能看見自己需要的東西。因此我們的亂數產生器可以產生亂數,卻無法存取任何檔案。從它的角度來看,它身處在一個空的檔案系統中。

[9:09] 它沒有任何網路存取權。顯示驅動程式可以存取顯示器,同樣地,它碰不到網路,也無法去抓你的檔案並上傳出去,即使有人入侵了它、試圖讓它做出我們不打算讓它做的事也一樣。這一切有點複雜,但我們加上了大量的系統介面,讓你輕鬆使用,所以當你只是做好開發者本分時,不必擔心我為你畫的這些漂亮圖示。接下來 Sudha 會示範我們做了什麼。

[9:40] SUDHA BROSLAWSKY:謝謝你,Dylan。安全絕對是我們最重視的事。在 Chromebook 上打造 Linux 體驗時,我們提出了三個高階設計目標。第一個目標是讓你的體驗保持直覺。這個房間裡的每個人用電腦都很久了,也建立了自己的工作流程和習慣。所以基本上我們想做的,就是符合這些期待。

[10:14] 我們希望提供對你而言自然的體驗。我們希望各地的開發者都能使用 Chromebook,並且得心應手。第二個目標是讓你的體驗原生。我們原本可以走輕鬆的路,在 VM 中給你完整的 Linux 桌面環境,但那還不夠好。我們的目標是把你開發時所依賴的 Linux 應用程式,帶進你原生的 Chrome OS 體驗中。

[10:47] 第三個目標是讓你的體驗簡單,我認為這非常重要。底層有許多複雜性在運作,我們希望把它留在那裡。我們的指導原則是,複雜性不應干擾使用者體驗。我們在這裡試圖平衡幾件事:在 Chromebook 上安裝 Linux 應用程式所帶來的安全顧慮,以及遵循 Chrome OS 既有設計模式所帶來的簡單性。

[11:26] 我們的任務就是找到那個恰到好處的平衡點。TOM BUCKLEY:好的。那麼現在我們要談談三個常見的開發者流程,看看它們如何與 Crostini 搭配運作。第一個是存取檔案。身為開發者,我們必須一直這麼做。我們的編輯器需要存取檔案,我們的編譯器、原始碼控管以及許多其他工具也一樣。但問題是,我們的檔案系統裡不只有程式碼。

[11:58] 裡面有我們的個人照片、報稅資料,也許還有你一直在寫的那本小說。很多地方都可能出錯。勒索軟體可能把這些資料全部挾持為人質。惡意軟體可能把你的檔案上傳到某個隨機伺服器。或者你只是碰到某個東西,它為了好玩就把一切刪光。我們在打造 Crostini 時就考量了這些威脅,以限制可能出錯的範圍,Dylan 會告訴你我們怎麼做。DYLAN REID:所以我們與 VM 及容器共享檔案的目標,是讓你輕鬆取得開發工作所需的檔案,放在你需要的地方,但不會把你不想暴露的東西暴露給不受信任的程式碼。

[12:44] 因為歸根究柢,我們不信任在這個 VM 內執行的程式碼。為了做到這點,我們採取了分層的做法。你的檔案全都位於最底層的 Chrome OS,我們透過 9P 伺服器把它們分享給 VM。我們把它命名為 9S。同樣地,我們用 Rust 撰寫,所以記憶體安全;我們對它進行模糊測試,確保非預期的輸入不會造成非預期的行為;我們還把它關在嚴密的牢籠裡,讓它只能存取你分享給它的檔案。

[13:16] 然後它會取用這些檔案,並將它們匯出到 VM。VM 會掛載內建於 Linux 的 9P 機制,接著 LXD 會取用該掛載點,並將其暴露到執行開發工具的容器中。這裡的重點在於,你的容器只能看到你指定要與開發環境共用的檔案。你的 VM 也只能看到這些相同的檔案。甚至我們撰寫、在 Chrome OS 上執行的伺服器,也只能看到這些檔案。它無法看到所有內容。因此,即使有人一路利用這個堆疊入侵回 Chrome OS,

[13:49] 他們仍然無法存取你尚未與容器共用的檔案。要設定的東西還真多。設定 9P 掛載、將項目綁定掛載到容器中。我們在開發期間曾手動進行這些操作一段時間。那很痛苦。所以,我會讓 Sudha 示範我們如何為你簡化這些操作。SUDHA BROSLAWSKY:這裡涉及許多層,但讓我們看看在 UI 中這有多簡單。開箱即用,你會有一個名為 Linux Files 的目錄,也就是你在 Linux 中的主目錄。

[14:24] 此目錄中的任何內容都會自動與 Linux 共用。在此目錄之外,裝置上的其他任何位置,Linux 都無法存取任何內容,除非你授予權限。我將在這裡帶你瀏覽幾個範例。假設你正在進行一個專案,並發現自己需要名為 Illustrations 的這個資料夾中的檔案。若要共用此資料夾,你只需存取右鍵選單,然後按一下「與 Linux 共用」。

[14:58] 只要兩個步驟,你現在就已將此資料夾與 Linux 共用。如果你注意到,這是在 Google 雲端硬碟中,這點很棒。當你不想再共用此資料夾時,可以前往「設定」並取消共用。這裡還有另一個範例,我們讓快速編輯變得非常簡單。你的「下載」資料夾中有一個資料檔案,當你按兩下時,它會自動在 VS Code 中開啟。

[15:31] 發生這種情況時,在背景中,它會被隱含地共用。共用狀態會持續到你重新啟動為止。這就是我們想帶給你的安全性與簡易性之間的平衡。TOM BUCKLEY:謝謝。那麼,針對我們要討論的第二個開發者流程,我們將探討執行網頁伺服器。由於是 Chrome OS,我們非常重視人們製作優質的網頁應用程式,我們希望確保他們能在 Chromebook 上建立這些應用程式。而能夠執行網頁伺服器,對於建置任何網頁應用程式來說相當核心。

[16:08] 可惜的是,網頁伺服器也需要相當低階的存取權限,這可能會造成一些問題。能執行網頁伺服器的程式碼,同樣也能窺探你的網際網路流量。它能知道你正在存取哪些網站,在某些情況下,甚至能看到那些頁面的內容。這表示惡意的網頁伺服器可能追蹤你的一舉一動。我們在設計 Crostini 時也考量到這點,並確保我們防範了這類攻擊。

[16:39] Dylan 會告訴你怎麼做。DYLAN REID:叫我 Linux 也可以,沒問題。這是我的工作。好,從 Crostini 啟動網頁伺服器很簡單。我們在網頁開發沙箱裡已經有一個不錯的示範。輸入指令。你就像在任何 Linux 發行版上一樣啟動網頁伺服器。不過,底層實際發生的事是:你在一個容器裡,並開啟一個連接埠。那個連接埠位於 VM 內的網路命名空間中,而這個 VM 執行在我們特殊的 hypervisor 之下,它會把網路堆疊放到主機上的另一個命名空間,最後再對外連到 Chrome。

[17:20] 所以 Chrome 無法反向連入,這對安全性來說很棒。你獲得了絕佳的隔離。但如果我想測試在 VM 裡執行的這個新 PWA 或網頁,我要怎麼讓 Chrome 與它通訊?這並不簡單。為此,我們必須沿途加入一些常駐程式——實際上,每一層都會有一個常駐程式來處理這件事。第一個常駐程式在 VM 裡執行,它會待命,檢查是否有任何執行中的容器剛好開啟了連接埠。

[17:53] 接著它必須判斷是哪個容器開啟了那個連接埠。然後把這項資訊打包起來,傳送給 Chrome OS。告訴它:嘿,這個容器裡的這個連接埠正在監聽。使用者可能想使用那個連接埠。而在 Chrome OS 上,我們回應:好。另一個常駐程式會回應:我會設定一條路由來做轉送。我要把這一切透過 VSOCK 轉送出去,VSOCK 是用來與機器上的本機 VM 通訊的協定。這一切都藏在底層。所以兩端都是對常駐程式講 HTTP,而常駐程式之間則透過 VSOCK 互相通訊。

[18:28] 所以關鍵在於:網頁伺服器能講 HTTP。Chrome 能講 HTTP。一切都很正常。一切都如你所預期般運作。嗯,底層其實有這些額外的常駐程式和 VSOCK 轉送在運作,但我們把它隱藏起來了。另一件重要的事是,我們讓它成為受信任的。這樣你就能享有所有 PWA 功能。你可以把它安裝到桌面。雖然技術上來說不是同一台機器,但我們知道它是,因為我們握有相關資訊。是我們設定這個 VM 的。

[18:58] 所以我們允許它成為受信任的網域。我認為這些複雜性讓它成為我們今天最棒的示範之一,展示了我們在底層把它做得有多複雜,而你在實際使用時會看到它有多簡單。SUDHA BROSLAWSKY:我完全同意。底層確實非常複雜,但在介面上,它完全就像你預期的那樣。假設你正在嘗試建置這個很酷的 PWA。在終端機這裡,你在你的資料夾裡,PWA Starter Kit。

[19:31] 你正在執行指令來啟動你的網頁伺服器。如果你看畫面底部,它正在連接埠 8080 上監聽。此時,你可以啟動瀏覽器,前往本機 8080,測試你的網頁應用程式。在畫面上,左邊是你在 Chrome 中的網頁應用程式,而右邊,如果你有注意到的話,它也是在 Chrome 中。是的,你也可以在 Chromebook 上透過 Firefox 測試你的網頁應用程式。

[20:07] 如果你有注意到,我們在這個流程中並沒有提示你授予任何權限。這是因為是主機在存取 VM,而不是反過來。同樣地,這是我們平衡先前談到的安全性與簡易性的另一種方式。TOM BUCKLEY:好的。最後,在我們的第三個示範中,我們要談談測試 Android 應用程式。這真的很令人興奮,因為就在昨天,我們宣布 Android Studio 在 Chromebook 上正式支援,我們甚至專門為 Chrome OS 建立了一個安裝程式,讓入門變得非常容易。

[20:49] 當然,Android Studio 並不是建置優秀 Android 應用程式唯一需要的東西。你還需要一個東西來測試那個應用程式——通常是手機——雖然你可以透過 Wi-Fi 搭配 ADB 遠端連線之類的方式來做,但我們想讓它變簡單——就像你在任何其他裝置上預期的那種體驗。我可以透過 USB 接上我的手機,用那種方式測試我的應用程式。現在,如果我是一名 Android 開發人員,當然,我會接上手機來測試我的應用程式,但在我一天的工作過程中,我也會透過 USB 接上許多其他裝置。

[21:21] 我可能會接上一個裝有許多家庭照片的 USB 隨身碟。我可能會接上一個含有一些健康資訊的穿戴式裝置。我甚至可能會接上我工作用的安全性金鑰,它能給我所有的存取權限。惡意軟體可以利用這些裝置,在你於不同機器之間移動時唯一識別你、自我散播,甚至對它們進行變更。同樣地,我們在設計 Crostini 時就考慮到這些威脅,並確保我們能防範它們。DYLAN REID:是啊,實作 USB 對我們來說非常有趣。

[21:57] 這可能是我們最痛苦的堆疊。相同的原則依然適用。我們有自己的層。我們保護主機。主機的 USB 堆疊有非常多的攻擊面。它是一種非常複雜、規格鬆散的協定。嗯,它其實是精確的規格,只是被許多人鬆散地實作。所以我們把它藏了起來。把它留在主機端。我們寫了一個裝置,讓它活在跨 VM 的隔離環境中。

[22:27] 同樣地,我們有一個 USB 驅動程式。它相當複雜。裡面有很多程式碼,我確信一定有一兩個錯誤。所以我們確保它被隔離得非常完善。它無法存取你的檔案。它無法存取網路。它也無法存取任何 USB 裝置。你必須明確地說,嘿,我想把這個 USB 裝置交給我的開發環境。而我們試著讓這件事盡可能簡單。而實際上底層發生的事是,我們一直有一個模擬的 USB 匯流排在運作,所以客體永遠會看到,嘿,我有一個 USB 匯流排,只是沒有插上任何東西。

[23:02] 而一旦你表示我想把這個交給我的 VM,它就會說,好,我要把這個裝置加到這個匯流排上,然後我們把它呈現給客體。接著客體又必須把它轉送進容器,容器才能看到它。我們在這裡真正聚焦於兩件事。一是安全性。同樣地,我們用隔離環境來處理這點,並確保攻擊面盡可能最小。它也是用 Rust 寫的,記憶體安全又完善,而且有做模糊測試。但這裡的另一個問題是隱私,因為人們不知怎麼地會利用連接到機器的 USB 裝置清單來對使用者做指紋辨識與追蹤,而我們想確保在容器內執行的不受信任程式碼,不能成為另一種達成此事的方式。

[23:46] 同樣地,這有很多步驟。我們必須建立一個裝置。我們必須將它匯出到 VM。我們必須將它匯出到容器。我們必須決定要匯出哪個裝置、不匯出哪個裝置。同樣地,我們會有示範,展示這有多簡單。SUDHA BROSLAWSKY:好。這是最後一個示範。假設我在我的 Linux 版 Chromebook 上,而你插上你的手機。你會看到一則通知,提示你連線到 Linux。

[24:17] 此時,只有 Chrome OS 知道你的手機。Linux 甚至不知道你的手機存在,這是件好事。如果你看這裡,你的手機並沒有列在 USB 清單中,但當你重新執行指令,一旦你在通知上連線,你的手機就會出現在清單中。此時,你就建立了 Linux 對你手機的存取權。

[24:49] 假設你正在進行一個專案。你又用 Android Studio 開發了一個很酷的應用程式,而且準備好要測試它了。你按下「執行」並選擇手機,然後砰!就這樣,你能夠在手機上測試你的應用程式了。此時,你可以除錯並測試你的應用程式。最後,你可以前往「設定」,隨時管理 Linux 能存取哪些項目。所以你可以看到,安全性是 Chromebook 上 Linux 體驗的核心。

[25:27] 你,也就是使用者,隨時都能完全掌控 Linux 能存取哪些項目。我們運用了各種使用者體驗模式,讓它簡單易用,同時也貼近 Chrome OS 的原生風格。Chrome OS 與 Crostini 的原則結合起來,讓這個體驗相當獨特。DYLAN REID:謝謝。換我了。

[25:57] 好的,很好。我們還有很多時間。我們談了很多細節,我也講了很多關於層和隔離環境的事,這些都很重要,也是你有理由信任我們一般流程的原因;而當我使用我的 Chromebook 時,我幾乎總是待在這些我們精心打磨並確認可用的常見工作流程裡。不過,我剛談到的許多技術細節仍然可用,而且我們留了一些掛鉤讓你自行把玩。

[26:27] 所以我很高興還有時間,可以帶大家看幾個例子,稍微勾起你的興趣,看看你還能做些什麼。這些東西我們不測試,也不支援。我們真心希望標準流程對每個人都夠用。但偶爾可能會有理由讓你想要做些更進階的事,或者你只是想找點樂子,玩玩底層的東西。我們都是愛動手玩的人,對吧?我們本來就該如此。所以我們會帶大家看看其中一些東西是怎麼運作的。

[26:58] 這些全都會從 Chrome OS 的 shell 進行。這個功能在 Chrome OS 裡已經存在——嗯,比我還久。所以按 Control-Alt-T 就能開啟 shell。你可以執行一組除錯指令。我們會聚焦在一個指令上,也就是我們新增用來控制虛擬機和容器的 VMC 指令。最基本的指令,你可以執行 VMC list。它會顯示你系統上安裝了哪些 VM。預設的 VM 叫做 Termina。

[27:29] 希望字體夠大,你能看清楚它的大小。Termina VM 就是先前所有簡報示範所用的那一個,所以它正在運作中。我們做了一個捷徑,可以進入 VM 內的容器。所以如果你想進入預設容器,這個容器叫做 Penguin。再說一次,那就是我們進行所有這些示範的地方。有一個 VMC container 指令可以讓你進入那裡。我們會先退出那裡,然後再回到單純的 VM。

[27:59] 所以 VMC Start 會進入你的虛擬機器,而不會進入你的容器。所以如果你回到我的分層圖,就是中間那一層——LXD 執行所在的地方。而你會想待在這裡的原因,是如果你想操作或變更容器。我提過我們使用 LXD。會有很多 LXC 指令。那是 LXD 的控制程式。這在網路上有完善的說明文件,而且大部分在 Chrome OS 裡都能運作,就像在預設的 Ubuntu 安裝上一樣。

[28:37] 你可以做的第一件事是列出清單。你可以看到我們有 Penguin 在執行。我們有一個容器。它已啟動並正在執行。它有一個 IP 位址。所以我們有了我們的一個容器。我們可能想稍微玩玩它。而在我們這麼做之前,也許我想確保我能回到一個我知道它沒問題的狀態,對吧?因為我以前把它們弄壞過。能夠直接回到我原本的狀態、隨意嘗試而不用擔心,這很方便。所以是標準的 LXE 指令。

[29:08] 它叫做 Snapshot。你給它你的容器名稱,也可以給它你的快照名稱,現在你就有一個儲存下來的映像檔,如果弄壞了東西可以回到這個狀態。它也有寫時複製。我們在虛擬機器裡用了 btrfs,所以不會吃掉大量磁碟空間。我們可以取得容器的資訊。這會提供一堆資訊。同樣地,如果你想的話,可以在 Chromebook 上到處試試這個。這裡的重點是,我們在底部有一個快照,就是我們剛剛建立的 IO1 快照。

[29:41] 你可以有多個快照。上面有日期,幫助你記得,如果你沒有用很有創意的名稱的話。然後當你想還原回去時,用 LXE Restore。這些指令命名得很好。他們在這方面做得比我好。如果你真的想嘗試不同的東西,有時候你會想要不只一個容器。所以我有我的 Penguin 容器,我要去,比如說,在這個容器裡安裝一些不同的函式庫。也許我想要一個裝有 Python 2.7 的容器,另一個裝有 Python 3 的容器。

[30:15] 或者也許我想要一個跟寫 Rust 用的容器不同的容器來寫 Go。所以我們讓你這麼做。你可以建立任意數量的容器,受磁碟空間限制。這些確實會佔用磁碟空間。建立新容器最基本的方式是複製一個現有的容器。有一個 LXE Copy 指令。上面的範例把預設的 Penguin 容器複製到一個名為 Kingfisher 的新容器。你可以列出容器。

[30:46] 你已經有兩個了。預設情況下,容器是停止的,所以我們必須啟動它們。現在我們可以列出——它正在執行。你可以跳進去。你說,我想在 Kingfisher 裡執行 Bash。現在我在新容器裡有一個 shell,我可以去安裝任何我原本不想放在預設容器裡的隨機工具鏈。再進一步,我們選擇 Debian 是因為對我們來說這是最容易做的事。不過我們不想把你綁死在這個選擇上。

[31:17] 我們支援 Debian 工作流程。我們支援一些預設安裝在 Debian 裡的客體套件。但有些人想用他們最愛的發行版。而 Canonical 營運的映像伺服器上有大量可用的發行版。我們在這裡安裝一個 Arch 的。我不是 Arch 使用者,我對 Arch 了解不多,但我的一些同事說服我這麼做並玩玩看。所以現在你可以看到我們有三個容器。

[31:48] 我有兩個 Debian 容器,我的 Penguin 和我的 Kingfisher,現在我有一個叫做 ArchTest 的東西。同樣地,我可以透過告訴它執行 Bash 來進入它。如果我想在這個容器裡安裝套件,我會用 PacMan 而不是 Act。你看,它真的是 Arch,我保證。這只是你在這裡能做什麼的一點體驗。如果你去線上查看 LXD 和 LXD 文件,你可以得到更多想法。線上甚至有一些說明,關於安裝其他發行版並讓它們更好地與圖形介面整合,如果你想要的不只是命令列的話。

[32:28] TOM BUCKLEY:好的。所以 Dylan 剛剛向你展示了許多 Crostini 在底層運作時能做的很酷技巧,如果你對這類事情感興趣,我們強烈建議你去看看 Crostini 的 subreddit。那裡的人們在我們發布功能時就會發現它們,有時甚至更早,而且他們也非常歡迎 Chromebook 上 Linux 的新使用者。所以如果你有任何問題,請去看看,也非常感謝那裡的人們。

[33:00] 這就是 Chromebook 上的 Linux。如你所見,我們已經支援許多網頁和 Android 開發者的工作流程。未來還會有更多,無論是支援其他開發者,還是擴展我們能用新能力做到的事,例如多個容器以及備份與還原。我們會繼續套用這些簡單與安全的原則,為你提供盡可能最好的開發者體驗。當你準備好時,我們希望你能加入我們。謝謝。

[33:31] [掌聲] [音樂播放]

查看英文原始字幕

[0:00] [MUSIC PLAYING] SUDHA BROSLAWSKY: Good afternoon, everyone. I hope you are having a great time at the I/O. We are here to talk to you about Linux for Chromebooks, also known as Crostini. We'll start by introducing ourselves. My name is Sudha. I'm a designer on Crostini for Chromebooks. DYLAN REID: Hi, I'm Dylan. I'm the Chrome OS Virtualization Lead. TOM BUCKLEY: And I'm Tom, Product Manager for Linux on Chromebooks.

[0:31] Now it's the end of day two at I/O and you've probably already been to a bunch of different sessions that have talked about all the new frameworks that you need to be using or the platforms that you need to be building for, and everyone's right, you absolutely should be, but we're not really here to talk about that. 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.

[1:03] SUDHA BROSLAWSKY: On that note, let's do a quick user study. How many of you are developers in the audience? Wow, that's a full room, as expected. Keep your hands raised. How many of you use your computers for anything else other than development, like doing your taxes, checking email-- again, 100% of you. OK, one last question. How many of you are worried about security? DYLAN REID: Good, that's pretty-- I mean, you all should be, so I'm glad to see many hands up anyway.

[1:40] So I don't know about you, but when I start a new project, I get stuck a lot. I hit a lot of walls and I hit a lot of barriers and I go to look for a problem, go to look for a solution, and I turn to Google. And luckily, Google's almost always got a great answer for me. Unluckily, sometimes the answer looks like this. And I know I shouldn't run this script from evilsite.com and pipe it to Sudu, but that deadline's coming up and maybe this site looks kind of legit, so in this case, I'll make an exception and I'll do this.

[2:17] 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. I don't have time to read all these scripts. My solution to this has been to carry two laptops-- one for my developer world and one for my everything else world that I want to be secure in. But recently, I've switched to using one laptop, and Tom's going to talk about how I do that. TOM BUCKLEY: So our goal with Chrome OS has been to give you a simple and secure experience from the start, but if you tried it previously, you might have seen that it wasn't quite ready for developers.

[2:57] In order to be simple and secure, we couldn't run all of the tools that developers need to get their job done. But that all changed at I/O last year when we announced that we were going to start supporting Linux on Chromebooks. Linux on Chromebooks lets you run all of your favorite editors, IDEs, and tools, and it's now supported on over 50% of Chromebooks, including great devices with eighth generation Intel CPUs like the Lenovo Yoga Book C630 and the Acer Chromebook Spin 13.

[3:31] If you haven't seen it, we're going to run through a few examples. First off, how do you get it? It's really easy. It's just a couple clicks. Now in the background, this is downloading a virtual machine, setting up containers, configuring it all-- Dylan's going to go more into that in a few minutes, but for you as a developer, it's just a couple clicks to get started. And this adds a terminal to your launcher. Now if you open that terminal, you'll see that you have a pretty standard Debian environment and we've already loaded in a bunch of the tools that developers expect, like Git and Vim, and if you need anything else, you have the APT Package Manager and you can install whatever packages you need.

[4:11] And if you want to instead install programs via .dev files, you can do that, too. This gives you access to thousands of world-class developer tools. Now once you've installed any graphical apps, you'll find that they all show up in your launcher, just like the rest of your Chrome OS apps, and if you open them, they show up in your Window Manager-- again, just like the rest of your Chrome OS apps. This is the simple experience that people have come to expect from Chrome OS and we didn't want to change that with Linux.

[4:45] But importantly, this is also secure. You don't have to worry about malware accessing your files, snooping on your traffic, or infecting your peripherals. I'd ask you to trust us on that but this is way too important for you to take on trust alone, so over the course of this talk, Dylan and Sudha are going to walk you through the principles behind the architecture and design of Crostini. We're then going to dissect some common developer flows to show you how these principles apply.

[5:16] And finally, we're going to share some tips and tricks for advanced usage for the power users out there. So now I'm going to hand it over to Dylan to talk about the architecture. [APPLAUSE] DYLAN REID: Good job. OK. So Chrome OS has always had a layered approach to security and our big layer has always been the browser and the renderer and running all untrusted code in a nice isolated renderer, and that keeps the attack surface of your core system to an absolute minimum.

[5:51] They're not allowed to make a lot of system calls. They can't poke at random bits of your kernel. And that worked really well for web pages, web apps. However, for developer tools, I need to install a lot of different programs. They need a lot of different privileges. They can do anything any app on Linux can do. And that wasn't acceptable for us on the core of Chrome OS, so we needed to add a layer. So we added a virtualization layer, and that lives in the main Chrome OS layer, and that spins up a VM.

[6:23] And now this VM has a much more limited interface while still exposing a full Linux kernel to the programs that run inside the VM. The only way the VM can talk to Chrome OS proper is through a small API that that cross-VM program on the left up there exposes to the guest. This is pretty good. Now we've greatly reduced attack surface. We were pretty happy with this. We wanted to go a little further. So we made sure that the guest VM was also signed by Google and somewhat trusted.

[6:58] This lets us trust some of the actions the guest VM takes, and it's also read-only, so users can only break things so much. And that, no matter what you do, you're going to be able to boot a VM. However, with all that security solved, we're back in a situation where you don't have enough flexibility. Your apps can't do anything. It's a read-only thing. You can't install anything in it. So we added another layer, and for this, we stole-- used-- LXD from Canonical.

[7:32] That team's been very helpful in getting this spun up with us. It's a pretty standard container runtime. It's built for running system containers. And in our case, we started a system container of Debian and exposed that to the user. 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. So we went and we focused on this for a long time and made sure we got that as secure as possible.

[8:06] We wrote it in a memory-safe programming language. We chose Rust. This eliminates buffer overflows and integer overflows and a lot of common bugs related to memory safety that are exploited by attackers. We were pretty happy with that, but we again added another layer of security here in that we broke up the virtualization program into pillars and made sure that each pillar that interfaces with the guest only has access to small parts of your host Chrome OS system.

[8:38] So your host Chrome OS system, you've got your bank's web page open, you've got your online tax filing thing open, you've got all kinds of personal identifiable information everywhere. We really wanted to protect that. But we needed to give the guest access to things, like a random number, a display, a USB device. So each of those got their own jail and they can only see the thing they need. So our random number generator can generate random numbers. It can't access any files. It's in an empty file system from its perspective.

[9:09] It doesn't have any network access. The display driver, it can access the display. Again, it can't touch the network. It can't go grab your files and upload them, even if somebody gets into it and tries to make it do things we didn't intend it to. This is all a little complicated, but we've added a great amount of system UI to make this easy for you to use, so when you're just doing your job as a developer, you don't have to worry about these pretty pictures I've drawn for you. And Sudha will show you what we did.

[9:40] SUDHA BROSLAWSKY: Thank you, Dylan. Security is absolutely top of mind for us. While crafting the Linux experience on Chromebooks, we came up with three high-level design goals. The first goal was to keep your experience intuitive. Everyone here in this room has been using computers for a long time and you have established your workflows and habits. So basically what we wanted to do is to match to those expectations.

[10:14] We wanted to provide an experience that's natural to you. We want developers everywhere to be using Chromebooks and feel right at home doing it. The second goal was to make your experience native. We could have taken the easy path by giving you a full Linux desktop in a VM but that wasn't good enough. Our goal was to bring the Linux apps you depend on for development into your native Chrome OS experience.

[10:47] The third goal was to make your experience simple, and I think this is very important. There's a lot of complexity that's going on under the hood and we want to leave it there. Our guiding principle is that complexity shouldn't interfere with the user experience. There's a couple of things we are trying to balance here. The security concerns that come with installing Linux apps on Chromebooks and the simplicity that comes with sticking to design patterns established by Chrome OS.

[11:26] And our mission was to find that sweet spot. TOM BUCKLEY: All right. So now we're going to talk about three common developer flows and see how they work with Crostini. And the first of these is accessing files. As developers, we have to do this all the time. Our editors need to access files, as do our compilers, our source control, and a whole lot more. But the problem is that our file systems have a lot more than just code.

[11:58] They have our personal photos, our tax returns, maybe that novel that you've been working on. A lot can go wrong. Ransomware can hold all of that data hostage. Malware can upload your files to some random server. Or maybe you just get something that goes and deletes everything for the fun of it. We built Crostini with those threats in mind to limit what can go wrong, and Dylan will tell you how. DYLAN REID: So our goal sharing files with your VM and with your container was to make it easy for you to get the files you needed for your development tasks where you need them but not expose things you don't want exposed to untrusted code.

[12:44] Because ultimately, we don't trust the code that's running inside this VM. To do this, we took a layered approach. Your files all live in Chrome OS at the very bottom, and we share them out to the VM with a 9P server. We named it 9S. Again, we wrote it in Rust so it's memory safe, we fuzzed it to make sure unexpected inputs don't cause unexpected behavior, and we put it in a tight jail so it can access only the files you share with it.

[13:16] And it takes those files and exports them to the VM. The VM mounts the 9P thing that's built into Linux, and then LXD takes that mount and exposes it into your container where your development tools are running. The important thing here is that your container can only see files that you say, I want to share with my development environment. Your VM can only see those same files. And even the server that we wrote, running on Chrome OS, can only see those files. It doesn't get to see everything. So somebody exploits this stack all the way back into Chrome OS.

[13:49] They still don't have access to the files you haven't shared with the container. That's a lot of stuff to set up. Setting up 9P amounts, bind-mounting things into containers. We had to do this manually for a while when we were developing it. It was painful. So I'll let Sudha show you how easy we made it for you. SUDHA BROSLAWSKY: There are a lot of layers going on, but let's see how simple this is in the UI. Right out of the box, you have a directory called Linux Files, which is your home directory within Linux.

[14:24] Anything in this directory is automatically shared with Linux. Outside of this directory, anywhere else on the device, Linux doesn't have access to anything until you grant permissions. I'll walk you through a couple of examples here. Let's say you're working on a project and you see yourself needing files from this one folder called Illustrations. To share this, all you have to do is access the right-click menu and click on Share with Linux.

[14:58] And as simple as two steps, you've now shared this folder with Linux. If you notice, this is in Google Drive, and that's a cool thing. When you don't want to share this anymore, you can do that by going to Settings and Unsharing. Here's another example where we made quick edits really simple for you. You have a data file in your Downloads folder, and when you double-click, it automatically opens in VS code.

[15:31] When this happens, in the background, it's implicitly shared. And the sharing lasts until you restart. This is the balance of security and simplicity we wanted to bring you. TOM BUCKLEY: Thank you. So, for our second developer flow that we're going to talk about, we're going to look at running a web server. Now being Chrome OS, we care a lot about people making great web apps, and we want to make sure that they can create those on a Chromebook. And being able to run a web server is pretty central to being able to build any web app.

[16:08] Unfortunately, web servers also need a pretty low level of access and that can cause some problems. The code that can run a web server is also capable of snooping on your internet traffic. It can know what sites you're accessing, and in some cases, even see the contents of those pages. This means that a malicious web server could potentially track everything that you're doing. Now again, we thought of this as we designed Crostini and we made sure that we prevented this kind of attack.

[16:39] Dylan will tell you how. DYLAN REID: I can be called Linux, that's OK. That's my job. All right, so starting a web server from Crostini, simple. We've got a good demo over in the web dev sandbox already. Type a command. You fire up your web server, just like you would on any Linux distribution out there. What's actually happening under the hood, though, is you're in a container and you open up a port. That port's in a network namespace inside a VM, running under our special hypervisor which puts its network stack in another namespace on the host, and then finally out to Chrome.

[17:20] So Chrome can't get back in, which is great for security. You've got wonderful isolation. But if I want to test this new PWA or web page I'm running in my VM, how do I get Chrome to talk to it? This was not simple. So for that, we had to add some daemons along the way-- actually, every layer gets a daemon for this. The first one's running in the VM and it's sitting there waiting to check if any container that's running happens to open a port.

[17:53] And then it's got to figure out which container opened that port. And bundles that information up, sends it to Chrome OS. Says, hey, this port in this container is listening. The user might want to use that port. And on the Chrome OS, we say, OK. The other daemon responds. Says, I will set up a route to do some forwarding. I'm going to forward all of this over VSOCK, which is a protocol used to talk to local VMs on machines. That's kept under the hood. So either end, it talks HTTP into the daemons, and the daemons talk VSOCK to each other.

[18:28] So the key here is that the web server gets to talk HTTP. Chrome gets to talk HTTP. Everything's normal. Everything works just like you would. Well, under the hood, we've got all these extra daemons and VSOCK forwarding going, but we've hidden that. One other important thing, we've made it trusted. So you can get all your PWA features. You can install it to your desktop. Even though it's not technically the same machine, we know it is because we've got the information. We set up the VM.

[18:58] So we allow it to be trusted domain. And all this complexity I think makes one of our best demos today of how complicated we made it under the hood and how simple you're going to see it as actual use. SUDHA BROSLAWSKY: I totally agree that this is very complicated under the hood, but in the UI, it's exactly like you would expect it to be. Let's say you're experimenting with building this cool PWA. Here in terminal, you're in your folder, PWA Starter Kit.

[19:31] You're running the commands to start your web server. And if you see at the bottom of the screen, it's listening at port 8080. At this point, you can launch your browser, go to local host 8080, and test your web app. On the screen here, on the left, you have your web app in Chrome, and on the right, if you're noticing it, it's in Chrome. Yes, you can test your web app on a Chromebook in Firefox, too.

[20:07] If you notice, we did not prompt you to give any permissions while we were in this flow. This is because the host is accessing the VM and not the other way around. Again, this is another way we kind of balanced the security and simplicity factor we were talking about. TOM BUCKLEY: All right. Finally, for our third demo, we're going to talk about testing an Android app. Now this is really exciting because just yesterday, we announced that Android Studio is officially supported on Chromebooks, and we even created an installer just for Chrome OS to make it really easy to get started with.

[20:49] Now of course, Android Studio isn't the only thing that you need in order to build a great Android app. You also need something to test that app on-- usually a phone-- and while you could do that over Wi-Fi with ADB remote and all this sort of stuff, we wanted to make it easy-- just the experience that you'd expect on any other device. I can plug my phone in over USB and test my app that way. Now, if I'm an Android developer, sure, I'll plug my phone in to test my app, but I'm also going to plug in a lot of other devices over USB over the course of my day.

[21:21] I may plug in a USB drive that has a lot of family photos on it. I may plug in a wearable that has some health information. I may even plug in my security key for work that gives me all of my access. Malware can take advantage of these devices to uniquely identify you as you move between machines, to spread itself, or even to make changes to them. Again, we thought of these threats when designing Crostini and made sure that we were preventing them. DYLAN REID: Yeah, implementing USB was a lot of fun for us.

[21:57] It might have been our most painful stack. Same principles apply. We've got our layers. We protect the host. There's a lot of attack surface in a host USB stack. It's a very complicated kind of loosely-specced protocol. Well it's an exact spec that's loosely implemented by a lot of people. So we've hidden that. Kept that on the host side. Wrote a device that we live in cross-VM jail.

[22:27] Again, we've got a USB driver. It's pretty complicated. It's got a lot of code in it and I'm sure there's a bug or two. So we made sure it was very well isolated. It can't get to your files. It can't get to the network. It also can't get to any USB device. You have to explicitly say, hey, I want to give this USB device to my development environment. And we've tried to make that as easy as possible. And what actually happens under the hood, we've always got an emulated USB bus running, so the guest always sees, hey, I've got a USB bus, there's just nothing plugged in.

[23:02] And once you indicate that I want to give this to my VM, it says, OK, I'm going to add this device to this bus and then we show it to the guest. And then the guest again in turn has to forward that into the container and the container can see it. There's two things we really focused on here. One was security. Again, we addressed that with the jail and we made sure that the attack surface was as minimal as possible. It's also written in Rust and it's nice and memory-safe and it's fuzzed. But the other issue here is privacy because people somehow use lists of USB devices attached to machines to fingerprint and track users, and we wanted to make sure the untrusted code running inside the container couldn't be another way to do that.

[23:46] Again, this is a lot of steps. We have to create a device. We have to export it to a VM. We have to export it to a container. We have to decide which device to export or not. And again, we'll have a demo that shows how easy it is. SUDHA BROSLAWSKY: OK. This is the last demo. Let's say I'm on my Linux-enabled Chromebook and you're plugging in your phone. You'll see a notification that prompts you to connect to Linux.

[24:17] At this point, only Chrome OS has knowledge of your phone. Linux doesn't even know that your phone exists and that's a good thing. If you see here, your phone is not listed in the USB list, but when you rerun the command, once you connect on the notification, your phone shows up in the list. At this point, you established access to Linux to your phone.

[24:49] Let's say you're working on a project. You're developing a cool app again in Android Studio, and you're ready to test it out. You hit Run and select the phone, and boom. Just like that, you're able to test your app on your phone. At this point, you can debug and test out your app. Finally, you can go to Settings and manage what Linux access to at any point of time. So you can see how security is at the core of your Linux experience on Chromebooks.

[25:27] You, the user, are in full control at all times of what Linux has access to. We take advantage of a variety of UX patterns to make it simple to use and also native to Chrome OS. The combination of principles of Chrome OS and Crostini make this experience pretty unique. DYLAN REID: Thanks. My turn.

[25:57] All right, good. We've got plenty of time. So we've been talking about a lot of details and I've been talking a lot about layers and jails, and all that's important and it's a good reason for you to trust our normal flows, and when I'm using my Chromebook, I almost always stay within these common workflows that we've polished and made sure work. However, a lot of that technical detail. I was talking about is still usable, 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 can go through a few of these examples and kind of just whet your appetite for what else you can do. We don't test this stuff. We don't support this stuff. We really want the standard flow to be enough for everybody. But every once in a while, there might be a reason you want to do something a little more advanced, or you might just want to go have fun and play with things under the hood. We're tinkerers, right? We're supposed to be. 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. This has been in Chrome OS since-- well, longer than I have. And so Control-Alt-T gets you a shell. There's a set of debug commands you can run. We're going to focus on one command, which is the VMC command that we added to control virtual machines and containers. The basic command, you can do a VMC list. It'll show you what VMs you have installed on your system. The default VM is called Termina.

[27:29] So hopefully the font's big enough and you can see what size it is. The Termina VM is the one that all the demos were done for the slides before, so it's up and running. We've made a shortcut to enter a container inside a VM. So if you want to go into the default container, the container's named Penguin. Again, that's where we were doing all these demos from. So there's a VMC container command that gets you into there. We'll pop out of there and then we'll pop back into just the VM.

[27:59] So VMC Start enters your virtual machine without entering your container. So if you go back to my layers, it's the one in the middle-- the thing that LXD runs in. And the reason you'd want to be in here is if you want to manipulate or change containers. So I mentioned we use LXD. There's going to be a lot of LXC commands. That's the LXD control program. This is well-documented online and most of it will work inside Chrome OS, just like it does on a default Ubuntu install.

[28:37] The first one you can do is a list. You can see we've got Penguin running. We have one container. It's up and running. It's got an IP address. So we've got our one container. We might want to play with it a little bit. And before we do, maybe I want to make sure I can get back to a state where I know it's good, right? Because I've broken them before. It's nice to be able to just go back to where I was and play around without worrying. So standard LXE command.

[29:08] It's called Snapshot. And you give it your container name and you can give it the name of your snapshot, and now you've got an image saved that you can go back to if you break things. There's a copy on write, too. We used btrfs in the VM so you're not eating up a ton of disk space. We can get info on our container. This gives a bunch of information. Again, you can go poke around with this on a Chromebook if you want to. The important bit here is that we've got one snapshot at the bottom, the IO1 snapshot we just created.

[29:41] You can have multiple snapshots. It's got a date on it to help you remember if you didn't use a very creative name. And then when you want to restore it back, LXE Restore. These are well-named commands. They did a better job with this than I did. If you really want to go and play with different things, sometimes you want more than one container. So I've got my Penguin container and I'm going to go, say, install some different libraries in this one. Maybe I want to have a container that's got Python 2.7 and a different one that's got Python 3.

[30:15] Or maybe I want a different container for writing Go than the container I have for writing Rust. So we let you do that. You can create as many containers as you want, disk space-limited. These do cost disk space. The most basic way to start off a new container is to copy an existing one. There's an LXE Copy command. The example up here copies the default Penguin container over to a new container named Kingfisher. You can list the containers.

[30:46] You've got two. By default, containers are stopped, so we have to start them. Now we can list-- there it's running. And you can jump in. You say, I want to run Bash in Kingfisher. And now I've got a shell in my new container and I can go off and install whatever random tool chain I didn't want in my default container. Taking that one step further, we chose Debian because it was kind of the easiest thing for us to do. We don't want to tie you down to that, though.

[31:17] We support the Debian workflow. We support some guest packages that are installed in Debian by default. But some people want to use their favorite distro. And there is a huge amount of distros available from the image server that Canonical runs. We'll install an Arch one here. I'm not an Arch guy, I don't really know much about Arch, but some of my coworkers talked me into doing this and playing with it. So now you can see we've got three containers.

[31:48] And I've got two Debian containers, my Penguin and my Kingfisher, and now I've got something called ArchTest. And again, I can enter it by telling it to run Bash. And if I want to install packages in this one, I'll use PacMan instead of Act. Look, it's actually Arch, I promise. That's just a taste of what you can do from here. If you go and look at the LXD and LXD documentation online, you can get some more ideas. There's even some help online about installing other ones and getting them to integrate better with the GUI if you want more than just a command line.

[32:28] TOM BUCKLEY: All right. So Dylan just showed you a bunch of the really cool tricks you can do with Crostini when you go under the hood, and if you're interested in this kind of thing, we really recommend checking out the Crostini subreddit. 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. So if you have any questions, please check it out, and a big thanks to the folks there.

[33:00] So that's Linux on Chromebooks. As you can see, we already support a lot of web and Android developer flows. And there's a lot more to come, both in supporting other developers and in expanding what we can do with new capabilities, like multiple containers and backup and restore. We're going to keep applying these principles of simplicity and security to give you the best developer experience possible. Whenever you're ready, we hope you'll join us. Thank you.

[33:31] [APPLAUSE] [MUSIC PLAYING]

在 Vidleaf 工作台中開啟

搜尋逐字稿、選取行、複製帶時間戳的引文、翻譯。

署名

「Linux for Chromebooks:安全開發(Google I/O '19)」由 Chrome for Developers(https://www.youtube.com/@chromedevs)製作,以 CC BY 4.0(https://creativecommons.org/licenses/by/4.0/)授權釋出。來源影片:https://www.youtube.com/watch?v=pRlh8LX4kQI。本頁為該影片的文字轉錄稿,並加入了段落分隔與時間戳記;創作者與 Vidleaf 並無隸屬關係,亦不為其背書。Vidleaf 加入了 AI 標點與 AI 生成的摘要;原始措辭仍可於本頁取得。

你是創作者或權利持有人嗎?請求更正或移除:copyright@vidleaf.app(參見 關於這些頁面)。

最後更新