nolirium / aroc

Android root on Chrome OS
GNU General Public License v3.0
128 stars 51 forks source link

Root error on dev channel 65.0.3299.0 10230.0.0 (Official Build) dev-channel eve Intel #2

Open mmirg opened 6 years ago

mmirg commented 6 years ago

I'm receiving "out of space" errors when running the first script on a Pixelbook.

du -sh /opt/google/containers/android/rootfs/root/
2.0G    /opt/google/containers/android/rootfs/root/

It seems like I need to increase the size of the image created by the script? Can I just try to double the size and see if it works?

curl -Ls https://raw.githubusercontent.com/nolirium/aroc/master/01Root.sh | sudo sh
Test Rooting scripts for Android on Chrome OS

Version 0.23

Unofficial scripts to copy SuperSU files to an Android system image on Chrome OS

Part 1 of 2

In order to modify system files, the Chrome OS system partition needs to have been mounted writeable.
If you haven't already disabled rootfs verification, you will need to do so before proceeding with this script.

You should be able to disable rootfs verification by running the following command, then rebooting.

sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification --partitions 4

Alternatively, run the command below, then follow the prompt.

sudo /usr/share/vboot/bin/make_dev_ssd.sh --remove_rootfs_verification

Press Ctrl+C to cancel if you still need to do the above.

Be aware that modifying the system partition could cause automatic updates to fail, may result in having to powerwash or restore from USB potentially causing loss of data! Please make sure important files are backed up.

Copying /etc/init/arc-setup-env to /usr/local/Backup
Setting 'export WRITABLE_MOUNT=1', 'export ANDROID_DEBUGGABLE=1' and 'export SHARE_FONTS=0' in /etc/init/arc-setup-env
The file at /opt/google/containers/android/system.raw.img is already a symlink!
Removing symlink
Using /opt/google/containers/android/system.raw.img.bk
Creating new Android system image at /usr/local/Android_Images/system.raw.expanded.img

571884544 bytes (572 MB, 545 MiB) copied, 1 s, 572 MB/s
1060000+0 records in
1060000+0 records out
1085440000 bytes (1.1 GB, 1.0 GiB) copied, 7.61684 s, 143 MB/s

Formatting system.raw.expanded.img as ext4 filesystem

mke2fs 1.43.6 (29-Aug-2017)
Discarding device blocks: done                            
Creating filesystem with 265000 4k blocks and 66384 inodes
Filesystem UUID: 6f04eb04-681a-4175-851a-8b8ca4c43e13
Superblock backups stored on blocks: 
        32768, 98304, 163840, 229376

Allocating group tables: done                            
Writing inode tables: done                            
Writing superblocks and filesystem accounting information: done

Mounting system.raw.expanded.img
SELinux successfully set to 'Permissive' temporarily
Copying Android system files
cp: error writing '/usr/local/Android_Images/Mounted/./system/priv-app/GoogleContacts/GoogleContacts.apk': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/GoogleContacts/oat': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/GoogleExtServicesRelease': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/GoogleFeedbackRelease': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/GoogleLoginServiceRelease': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/GooglePackageInstallerRelease': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/GoogleServicesFrameworkRelease': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/HotwordEnrollmentOKGoogleCHROMEARC': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/HotwordEnrollmentTGoogleCHROMEARC': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/HotwordEnrollmentXGoogleCHROMEARC': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/ManagedProvisioning': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/MediaProvider': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/MusicFX': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/PhoneskyRelease': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/PrebuiltGmsCoreRelease': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/ProxyHandler': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/Settings': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/SettingsProvider': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/Shell': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/StatementService': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/StorageManager': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/SystemUI': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/TelephonyProvider': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/VpnDialogs': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/priv-app/WallpaperCropper': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/usr': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./system/xbin': No space left on device
cp: error writing '/usr/local/Android_Images/Mounted/./ueventd.cheets.rc': No space left on device
cp: error writing '/usr/local/Android_Images/Mounted/./ueventd.rc': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./var': No space left on device
cp: cannot create directory '/usr/local/Android_Images/Mounted/./vendor': No space left on device
Creating symlink to /usr/local/Android_Images/system.raw.expanded.img
Now placing SuperSU files. Locations as indicated by the SuperSU update-binary script.

Creating SuperSU directory in system/priv-app, copying SuperSU apk, and setting its permissions and contexts
mkdir: cannot create directory ‘/usr/local/Android_Images/Mounted/system/priv-app/SuperSU’: No space left on device
chown: cannot access '/usr/local/Android_Images/Mounted/system/priv-app/SuperSU': No such file or directory
chgrp: cannot access '/usr/local/Android_Images/Mounted/system/priv-app/SuperSU': No such file or directory
sh: 688: cd: can't cd to /usr/local/Android_Images/Mounted/system/priv-app/SuperSU
cp: cannot create regular file '/usr/local/Android_Images/Mounted/system/priv-app/SuperSU/SuperSU.apk': No such file or directory
chmod: cannot access '/usr/local/Android_Images/Mounted/system/priv-app/SuperSU/SuperSU.apk': No such file or directory
chcon: cannot access '/usr/local/Android_Images/Mounted/system/priv-app/SuperSU/SuperSU.apk': No such file or directory
chown: cannot access '/usr/local/Android_Images/Mounted/system/priv-app/SuperSU/SuperSU.apk': No such file or directory
chgrp: cannot access '/usr/local/Android_Images/Mounted/system/priv-app/SuperSU/SuperSU.apk': No such file or directory
Copying su to system/xbin/su,daemonsu,sugote, and setting permissions and contexts
sh: 290: cd: can't cd to /usr/local/Android_Images/Mounted/system/xbin
cp: cannot create regular file '/usr/local/Android_Images/Mounted/system/xbin/su': No such file or directory
cp: cannot create regular file '/usr/local/Android_Images/Mounted/system/xbin/daemonsu': No such file or directory
cp: cannot create regular file '/usr/local/Android_Images/Mounted/system/xbin/sugote': No such file or directory
chmod: cannot access '/usr/local/Android_Images/Mounted/system/xbin/su': No such file or directory
chmod: cannot access '/usr/local/Android_Images/Mounted/system/xbin/daemonsu': No such file or directory
chmod: cannot access '/usr/local/Android_Images/Mounted/system/xbin/sugote': No such file or directory
chown: cannot access '/usr/local/Android_Images/Mounted/system/xbin/su': No such file or directory
chown: cannot access '/usr/local/Android_Images/Mounted/system/xbin/daemonsu': No such file or directory
chown: cannot access '/usr/local/Android_Images/Mounted/system/xbin/sugote': No such file or directory
chgrp: cannot access '/usr/local/Android_Images/Mounted/system/xbin/su': No such file or directory
chgrp: cannot access '/usr/local/Android_Images/Mounted/system/xbin/daemonsu': No such file or directory
chgrp: cannot access '/usr/local/Android_Images/Mounted/system/xbin/sugote': No such file or directory
chcon: cannot access '/usr/local/Android_Images/Mounted/system/xbin/su': No such file or directory
chcon: cannot access '/usr/local/Android_Images/Mounted/system/xbin/daemonsu': No such file or directory
chcon: cannot access '/usr/local/Android_Images/Mounted/system/xbin/sugote': No such file or directory
Creating directory system/bin/.ext/.su
mkdir: cannot create directory ‘/usr/local/Android_Images/Mounted/system/bin/.ext’: No space left on device
Copying su to system/bin/.ext/.su and setting permissions and contexts
sh: 322: cd: can't cd to /usr/local/Android_Images/Mounted/system/bin/.ext
cp: cannot create regular file '/usr/local/Android_Images/Mounted/system/bin/.ext/.su': No such file or directory
chmod: cannot access '/usr/local/Android_Images/Mounted/system/bin/.ext/.su': No such file or directory
chcon: cannot access '/usr/local/Android_Images/Mounted/system/bin/.ext/.su': No such file or directory
chown: cannot access '/usr/local/Android_Images/Mounted/system/bin/.ext/.su': No such file or directory
chgrp: cannot access '/usr/local/Android_Images/Mounted/system/bin/.ext/.su': No such file or directory
Copying supolicy to system/xbin, libsupol to system/lib and setting permissions and contexts
sh: 714: cd: can't cd to /usr/local/Android_Images/Mounted/system/xbin
cp: cannot create regular file '/usr/local/Android_Images/Mounted/system/xbin/supolicy': No such file or directory
chmod: cannot access '/usr/local/Android_Images/Mounted/system/xbin/supolicy': No such file or directory
chown: cannot access '/usr/local/Android_Images/Mounted/system/xbin/supolicy': No such file or directory
chgrp: cannot access '/usr/local/Android_Images/Mounted/system/xbin/supolicy': No such file or directory
chcon: cannot access '/usr/local/Android_Images/Mounted/system/xbin/supolicy': No such file or directory
cp: error writing '/usr/local/Android_Images/Mounted/system/lib/libsupol.so': No space left on device
Copying sh from system/bin/sh to system/xbin/sugote-mksh and setting permissions and contexts
cp: cannot create regular file '../xbin/sugote-mksh': No such file or directory
sh: 740: cd: can't cd to /usr/local/Android_Images/Mounted/system/xbin
chmod: cannot access '/usr/local/Android_Images/Mounted/system/xbin/sugote-mksh': No such file or directory
chcon: cannot access '/usr/local/Android_Images/Mounted/system/xbin/sugote-mksh': No such file or directory
Adding extra files system/etc/.installed_su_daemon and system/etc/install-recovery.sh
cp: error writing '/usr/local/Android_Images/Mounted/system/etc/install-recovery.sh': No space left on device
Symlinking system/bin/install-recovery.sh to system/etc/install-recovery.sh
Adding system/bin/daemonsu-service.sh
cp: error writing '/usr/local/Android_Images/Mounted/system/bin/daemonsu-service.sh': No space left on device
Creating file init.super.rc in Android rootfs
Adding daemonsu service to init.super.rc
Adding 'import /init.super.rc' to existing init.rc
sed: couldn't flush /usr/local/Android_Images/Mounted/system/../sedoWOQvh: No space left on device
Removing temporary files

Done!

Please check the output of this script for any errors.

Please reboot now, then run script 02SEPatch.sh.
mmirg commented 6 years ago

Increasing the size of the image using count=2194629 (which I imagine is too big since du says that the rootfs directory is 2110834 but I bumped it up just in case) allowed the script to run and for successful rooting.

nolirium commented 6 years ago

Just wanted to (belatedly) say thanks for both pointing this issue out, and following up with your workaround.

I've now had a chance to inspect the Pixelbook recovery image (but not the Pixelbook itself unfortunately), and I can see that its system.raw.img is indeed about double the size of the older Intel Chromebook's. Comparing the files therein with e.g. the R11's, the difference appears to be the inclusion of x84_64 compatible files, where previously the subsystem appeared to only contain (and support) x86. Interesting! ...The chief space hog seems to be the 64 bit PrebuiltGmsCoreRelease. I wonder if all the newer Chromebooks will support 64 bit Android going forward.

Anyway, It looks we can quite easily add a conditional to the script which checks for ro.product.cpu.abilist64=x86_64, perhaps by reading build.prop, or maybe piping getprop to the android-sh script, e.g. printf "getprop ro.product.cpu.abilist64" | android-sh then adjusting the size of the created container accordingly.

Maybe something slightly smaller than what worked for you would be good for now, although I guess we may want to reserve some extra space for potential customizations, such as hosts files, extra fonts and so on (per the other open issue here, the rooting process currently breaks certain non-English fonts which are mounted in a weird way from Chrome OS, and the easiest fix appears to be just copying the required ones over into /system/fonts/chromeos, which can take up extra space...

Coming from a device with 16 gigs of storage, I've been keen to preserve 'disk space', although this is less of an issue on the newer devices, I suppose...

hall757 commented 6 years ago

Take advantage of sparse files to use just enough space and no more on the real file system.

/usr/bin/truncate/truncate -s 2G /usr/local/Android_Images/system.raw.expanded.img

nolirium commented 6 years ago

Interesting suggestion, will look into this. Cheers!