cmc/cleberg.net

My personal web garden & blog.

clone: git clone https://gitbay.org/cmc/cleberg.net.git

main: content/blog/2022-09-21-graphene-os.org · raw

  1#+date:        [2022-09-21 Wed 00:00:00]
  2#+title:       Installing GrapheneOS on Pixel 6 Pro
  3#+description: How to install GrapheneOS on a Pixel 6 Pro.
  4#+slug:        graphene-os
  5#+filetags:    :linux:privacy:
  6
  7* Introduction
  8
  9After using iOS for a couple of years, I finally took the plunge and purchased a
 10Pixel 6 Pro in order to test and use [[https://grapheneos.org][GrapheneOS]].
 11
 12The installation process was rather quick once you have the tools and files you
 13need. Overall, it can be done in just a few minutes.
 14
 15* Gathering Tools & Files
 16
 17** Android Tools
 18
 19First, in order to interact with the device, we will need the [[https://developer.android.com/studio/releases/platform-tools.html][Android platform
 20tools]]. Find the Linux download and save the ZIP folder to your preferred
 21location.
 22
 23Once we've downloaded the files, we will need to unzip them, enter the
 24directory, and move the necessary executables to a central location, such as
 25=/usr/bin/=. For this installation, we only need the =fastboot= and =adb=
 26executables.
 27
 28#+begin_src sh
 29cd ~/Downloads
 30#+end_src
 31
 32#+begin_src sh
 33unzip platform-tools_r33.0.3-linux.zip
 34cd platform-tools
 35sudo mv fastboot /usr/bin/
 36sudo mv adb /usr/bin
 37#+end_src
 38
 39** GrapheneOS Files
 40
 41Next, we need the [[https://grapheneos.org/releases][GrapheneOS files]] for our device and model. For example, the
 42Pixel 6 Pro is codenamed =raven= on the release page.
 43
 44Once we have the links, let's download them to our working directory:
 45
 46#+begin_src sh
 47curl -O https://releases.grapheneos.org/factory.pub
 48curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip
 49curl -0 https://releases.grapheneos.org/raven-factory-2022091400.zip.sig
 50#+end_src
 51
 521. Validate Integrity
 53
 54   In order to validate the integrity of the downloaded files, we will need the
 55   =signify= package and Graphene's =factory.pub= file.
 56
 57   #+begin_src sh
 58   sudo dnf install signify
 59   #+end_src
 60
 61   #+begin_src sh
 62   curl -O https://releases.grapheneos.org/factory.pub
 63   #+end_src
 64
 65   Then we can validate the files and ensure that no data was corrupted or
 66   modified before it was saved to our device.
 67
 68   #+begin_src sh
 69   signify -Cqp factory.pub -x raven-factory-2022091400.zip.sig && echo verified
 70   #+end_src
 71
 722. Unzip Files
 73
 74   Once the files are verified, we can unzip the Graphene image and enter the
 75   directory:
 76
 77   #+begin_src sh
 78   unzip raven-factory-2022091400.zip && cd raven-factory-2022091400
 79   #+end_src
 80
 81* Installation Process
 82
 83** Enable Developer Debugging & OEM Unlock
 84
 85Before we can actually flash anything to the phone, we will need to enable OEM
 86(Original Equipment Manufacturer) Unlocking, as well as either USB (Universal
 87Serial Bus) Debugging or Wireless Debugging, depending on which method we will
 88be using.
 89
 90To start, enable developer mode by going to =Settings= > =About= and tapping
 91=Build Number= seven (7) times. You may need to enter your personal identified
 92number (PIN) to enable this mode.
 93
 94Once developer mode is enabled, go to =Settings= > =System= > =Devloper Options=
 95and enable OEM Unlocking, as well as USB or Wireless Debugging. In my case, I
 96chose USB Debugging and performed all actions via USB cable.
 97
 98Once these options are enabled, plug the phone into the computer and execute the
 99following command:
100
101#+begin_src sh
102adb devices
103#+end_src
104
105If an unauthorized error occurs, make sure the USB mode on the phone is changed
106from charging to something like "File Transfer" or "PTP" (Picture Transfer
107Protocol). You can find the USB mode in the notification tray.
108
109** Reboot Device
110
111Once we have found the device via =adb=, we can either boot into the bootloader
112interface by holding the volume down button while the phone reboots or by
113executing the following command:
114
115#+begin_src sh
116adb reboot bootloader
117#+end_src
118
119** Unlock the Bootloader
120
121The phone will reboot and load the bootloader screen upon startup. At this
122point, we are ready to start the actual flashing of GrapheneOS onto the device.
123
124*NOTE*: In my situation, I needed to use =sudo= with every =fastboot= command,
125but not with =adb= commands. I am not sure if this is standard or a Fedora
126quirk, but I'm documenting my commands verbatim in this post.
127
128First, we start by unlocking the bootloader so that we can load other ROMs:
129
130#+begin_src sh
131sudo fastboot flashing unlock
132#+end_src
133
134** Flashing Factory Images
135
136Once the phone is unlocked, we can flash it with the =flash-all.sh= script found
137inside the =raven-factory-2022091400= folder we entered earlier:
138
139#+begin_src sh
140sudo ./flash-all.sh
141#+end_src
142
143This process should take a few minutes and will print informational messages as
144things progress. Avoid doing anything on the phone while this process is
145operating.
146
147** Lock the Bootloader
148
149If everything was successful, the phone should reboot a few times and finally
150land back on the bootloader screen. At this point, we can re-lock the bootloader
151to enable full verified boot and protect the device from unwanted flashing or
152erasure of data.
153
154#+begin_src sh
155sudo fastboot flashing lock
156#+end_src
157
158Once done, the device will be wiped and ready for a fresh set-up!