Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save SayantanRC/19b6ec0bd85030f5c1f0d795eb20f6d7 to your computer and use it in GitHub Desktop.
Save SayantanRC/19b6ec0bd85030f5c1f0d795eb20f6d7 to your computer and use it in GitHub Desktop.
Chrome OS - Brunch - Recover after a failed update

Chrome OS - Brunch - Recover after a failed update

In case if update fails / is not applied correctly when following https://github.com/sebanc/brunch#update-only-the-brunch-framework the following steps can be done to recover the brunch installation.

NOTE: These steps are from the developer sebanc himself.

Requirements

  1. A linux environment (installed or from live USB). Also knowledge of linux terminal and usage of dd.
  2. The latest chrome os recovery image from https://cros-updates-serving.appspot.com/.
  3. The brunch release from https://github.com/sebanc/brunch/releases.

Procedure

  1. Open a terminal.
  2. Locate the place where the chrome os image chromeos.img is. You can use any file explorer.
  3. cd to that path in the terminal.
  4. Mount the chrome os image as loop device number 99.
    sudo losetup --partscan /dev/loop99 chromeos.img
    
  5. Check if all the partitions are listed by using lsblk. The output should be something like:
    /run/.../src/oses >>> sudo losetup --partscan /dev/loop99 chromeos.img          
    [sudo] password for src: 
    /run/.../src/oses >>> lsblk                                                     
    NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    loop99        7:99   0    29G  0 loop 
    ├─loop99p1  259:0    0  19.8G  0 part 
    ├─loop99p2  259:1    0    32M  0 part 
    ├─loop99p3  259:2    0     4G  0 part 
    ├─loop99p4  259:3    0    32M  0 part 
    ├─loop99p5  259:4    0     4G  0 part 
    ├─loop99p6  259:5    0   512B  0 part 
    ├─loop99p7  259:6    0     1G  0 part 
    ├─loop99p8  259:7    0    16M  0 part 
    ├─loop99p9  259:8    0   512B  0 part 
    ├─loop99p10 259:9    0   512B  0 part 
    ├─loop99p11 259:10   0     8M  0 part 
    └─loop99p12 259:11   0    32M  0 part 
    
  6. Extract the recovery image (in .bin format). Rename it to recovery.bin.
  7. Mount to as loop device number 100.
    sudo losetup --partscan /dev/loop100 recovery.bin
    
  8. Just like step 5, check the partition using lsblk. The whole list should be like:
    /run/.../src/Stuff >>> sudo losetup --partscan /dev/loop100 recovery.bin        
    /run/.../src/Stuff >>> lsblk                                                    
    NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    loop99         7:99   0    29G  0 loop 
    ├─loop99p1   259:0    0  19.8G  0 part 
    ├─loop99p2   259:1    0    32M  0 part 
    ├─loop99p3   259:2    0     4G  0 part 
    ├─loop99p4   259:3    0    32M  0 part 
    ├─loop99p5   259:4    0     4G  0 part 
    ├─loop99p6   259:5    0   512B  0 part 
    ├─loop99p7   259:6    0     1G  0 part 
    ├─loop99p8   259:7    0    16M  0 part 
    ├─loop99p9   259:8    0   512B  0 part 
    ├─loop99p10  259:9    0   512B  0 part 
    ├─loop99p11  259:10   0     8M  0 part 
    └─loop99p12  259:11   0    32M  0 part 
    loop100        7:100  0     3G  0 loop 
    ├─loop100p1  259:12   0   8.2M  0 part 
    ├─loop100p2  259:13   0   512M  0 part 
    ├─loop100p3  259:14   0   2.3G  0 part 
    ├─loop100p4  259:15   0    32M  0 part 
    ├─loop100p5  259:16   0     2M  0 part 
    ├─loop100p6  259:17   0   512B  0 part 
    ├─loop100p7  259:18   0   512B  0 part 
    ├─loop100p8  259:19   0    16M  0 part 
    ├─loop100p9  259:20   0   512B  0 part 
    ├─loop100p10 259:21   0   512B  0 part 
    ├─loop100p11 259:22   0     8M  0 part 
    └─loop100p12 259:23   0    32M  0 part 
    
  9. Use dd to flash loop100p3 (i.e. partition 3 from recovery image) to loop99p5 (i.e. partition 5 from corrupted chrome os image).
    sudo dd if=/dev/loop100p3 of=/dev/loop99p5 status=progress
    
  10. Extract the rootc.img file from the brunch release.
  11. Use dd to flash the rootc.img file to loop99p7 (i.e. partition 7 of corrupted chrome os image).
    sudo dd if=rootc.img of=/dev/loop99p7 status=progress
    
  12. All done. Unmount both the loop devices.
    sudo losetup -d /dev/loop99
    sudo losetup -d /dev/loop100
    
  13. Finally, reboot and boot into chrome os as usual.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment