newbit1/rootCROS

rootCROS.sh crashes on ChromeOS Samus R91 and Atlas R93

Closed this issue · 9 comments

localhost ~ # sudo bash ./rootCROS.sh
[-] Moving to the location /usr/local/crosswork
[*] Re-Execute the script proper
bash: /usr/local/crosswork/./rootCROS.sh: Permission denied
bash: line 0: exec: /usr/local/crosswork/./rootCROS.sh: cannot execute: Permission denied

I am running samus 91.

Is the rootCROS.sh executable? you can check with ls -l

Is fixed now -> #2

Is the rootCROS.sh executable? you can check with ls -l

Is fixed now -> #2

Is it working on atlas 93 recovery ?since I left rammus a long time ago
please tell me the full commands that are working.

shell
adb devices
cd $PORTAGE_CONFIGROOT && sudo su
curl -LO https://raw.githubusercontent.com/newbit1/rootCROS/master/rootCROS.sh
cd /usr/local/crosswork
ls -l
chmod +x rootCROS.sh
ls -l
bash ./rootCROS.sh

shell adb devices cd $PORTAGE_CONFIGROOT && sudo su curl -LO https://raw.githubusercontent.com/newbit1/rootCROS/master/rootCROS.sh cd /usr/local/crosswork ls -l chmod +x rootCROS.sh ls -l bash ./rootCROS.sh

Welcome to crosh, the Chrome OS developer shell.

If you got here by mistake, don't panic! Just close this tab and carry on.

Type 'help' for a list of commands.

If you want to customize the look/behavior, you can use the options page.
Load it by using the Ctrl-Shift-P keyboard shortcut.

crosh> shell
chronos@localhost / $ adb devices
List of devices attached

  • daemon not running; starting now at tcp:5037
  • daemon started successfully

chronos@localhost / $ cd $PORTAGE_CONFIGROOT && sudo su
localhost /usr/local # curl -LO https://raw.githubusercontent.com/newbit1/rootCROS/master/rootCROS.sh

localhost /usr/local # cd /usr/local/crosswork
bash: cd: /usr/local/crosswork: No such file or directory
localhost /usr/local # ls -l
total 16
-rw-r--r--. 1 root root 15269 Nov 1 07:25 rootCROS.sh
localhost /usr/local # chmod +x rootCROS.sh
localhost /usr/local # ls -l
total 16
-rwxr-xr-x. 1 root root 15269 Nov 1 07:25 rootCROS.sh
localhost /usr/local # bash ./rootCROS.sh
[-] Moving to the location /usr/local/crosswork
PWD=/usr/local/crosswork
[-] Downloading rootAVD.sh
########################################################################################################################################################## 100.0%########################################################################################################################################################## 100.0%
[] Downloading Magisk.zip
########################################################################################################################################################## 100.0%########################################################################################################################################################## 100.0%
[-] Downloading busybox
########################################################################################################################################################## 100.0%########################################################################################################################################################## 100.0%
[-] Downloading unsquashfs
########################################################################################################################################################## 100.0%########################################################################################################################################################## 100.0%
[-] Downloading mksquashfs
########################################################################################################################################################## 100.0%########################################################################################################################################################## 100.0%
[
] Init ADB
[!] Give ADB some moments to boot up
[!] Device has no ADB Service running
[] Creating fake ramdisk.img
[
] Cleaning up the android-sh working space
[] Creating the android-sh working space
[!] We are in a ChromeOS shell
[-] Api Level Arch Detect
[-] Device Platform: x64
[-] ARCH32 x86
[-] Device SDK API: 28
[-] First API Level: 28
[-] Switch to the location of the script file
[
] Extracting busybox from script ...
[!] Found a working busybox Binary:
[!] BusyBox v1.33.1-Magisk (2021-05-08 15:20:41 PDT) multi-call binary.
[] Extracting Magisk.zip ...
[-] Checking AVDs Internet connection...
[!] AVD is online
[!] Checking available Magisk Versions
[?] Choose a Magisk Version to install and make it local
[1] Local '23.0' (ENTER)
[2] Canary ea75a09f(23011)
[3] Stable 23.0
[4] Alpha a3eafdd2-alpha(23011)
[1] You choose Magisk Local Version '23.0'
[
] Re-Run rootAVD in Magisk Busybox STANDALONE (D)ASH
[!] We are in a ChromeOS shell
[-] We are now in Magisk Busybox STANDALONE (D)ASH
[] rootAVD with Magisk '23.0' Installer
[-] Get Flags
[
] System-as-root, keep dm/avb-verity
[-] Encrypted data, keep forceencrypt
[] RECOVERYMODE=true
[-] KEEPVERITY=true
[
] KEEPFORCEENCRYPT=true
[] No 64-Bit Binarys found, please consider Magisk Alpha
[-] copy all x86 files from /data/data/com.android.shell/Magisk/lib/x86 to /data/data/com.android.shell/Magisk
[
] Detecting ramdisk.img compression
[!] Ramdisk.img uses gzip compression
[-] taken from shakalaca's MagiskOnEmulator/process.sh
[] executing ramdisk splitting / extraction / repacking
[
] After decompressing ramdisk.img, magiskboot will work
Detected format: [gzip]
[-] Test patch status and do restore
[-] Checking ramdisk status
[-] STATUS=0
[-] Stock boot image detected
[-] Patching ramdisk
[] adding overlay.d/sbin folders to ramdisk
Loading cpio: [ramdisk.cpio]
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Dump cpio: [ramdisk.cpio]
[!] PATCHFSTAB=false
[!] Skipping fstab.ranchu patch with /dev/block/sda
[?] If you want fstab.ranchu patched, Call rootAVD with PATCHFSTAB
[!] AddRCscripts=false
[!] Skip adding .rc scripts into ramdisk.img/sbin/.rc
[?] If you want .rc scripts added into ramdisk.img/sbin/.rc, Call rootAVD with AddRCscripts
[!] patching the ramdisk with Magisk Init
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Add entry [overlay.d/sbin/magisk32.xz] (0644)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true]
Loading cpio: [ramdisk.cpio.orig]
Backup mismatch entry: [init] -> [.backup/init]
Record new entry: [overlay.d] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk32.xz] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk64.xz] -> [.backup/.rmlist]
Create directory [.backup] (0000)
Add entry [.backup/.magisk] (0000)
Dump cpio: [ramdisk.cpio]
[
] repacking back to ramdisk.img format
[!] Rename Magisk.zip to Magisk.apk
[] Trying to install Magisk.apk
Success
[
] cleaning up /usr/local/crosswork/fin
Parallel unsquashfs: Using 4 processors
2510 inodes (11080 blocks) to write

[============================================================================================================================================/] 11080/11080 100%

created 2271 files
created 336 directories
[created 239 symlinks
created 0 devices
created 0 fifos
created 0 sockets
============================================================================================================================================-] ============================================================================================================================================-] 11080/11080 100%Make your changes and Enter when finshed to continue^A^[[Fching ramdisk
[] adding overlay.d/sbin folders to ramdisk
Loading cpio: [ramdisk.cpio]
Create directory [overlay.d] (0750)
Create directory [overlay.d/sbin] (0750)
Dump cpio: [ramdisk.cpio]
[!] PATCHFSTAB=false
[!] Skipping fstab.ranchu patch with /dev/block/sda
[?] If you want fstab.ranchu patched, Call rootAVD with PATCHFSTAB
[!] AddRCscripts=false
[!] Skip adding .rc scripts into ramdisk.img/sbin/.rc
[?] If you want .rc scripts added into ramdisk.img/sbin/.rc, Call rootAVD with AddRCscripts
[!] patching the ramdisk with Magisk Init
Loading cpio: [ramdisk.cpio]
Add entry [init] (0750)
Add entry [overlay.d/sbin/magisk32.xz] (0644)
Add entry [overlay.d/sbin/magisk64.xz] (0644)
Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true]
Loading cpio: [ramdisk.cpio.orig]
Backup mismatch entry: [init] -> [.backup/init]
Record new entry: [overlay.d] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk32.xz] -> [.backup/.rmlist]
Record new entry: [overlay.d/sbin/magisk64.xz] -> [.backup/.rmlist]
Create directory [.backup] (0000)
Add [
] Patching Overlay with fake ramdisk.img
entry [.backup/.magisk] (0000)
Dump cpio: [ramdisk.cpio]
[] repacking back to ramdisk.img format
[!] Rename Magisk.zip to Magisk.apk
[
] Trying to install Magisk.apk
Success
[*] cleaning up /usr/local/crosswork/fin
Parallel unsquashfs: Using 4 processors
2510 inodes (11080 blocks) to write

[============================================================================================================================================/] 11080/11080 100%

created 2271 files
created 336 directories
[created 239 symlinks
created 0 devices
created 0 fifos
created 0 sockets
============================================================================================================================================-] ============================================================================================================================================-] 11080/11080 100%Make your changes an[-] Extracting ramdisk.cpio
[] Injecting Magisk into init.rc
[
] create Backup File of /etc/selinux/arc/policy/policy.30
[] Inject SELinux with Magisk built-in rules via android-sh
[!] Set Permissions and Context from
[-] /etc/selinux/arc/contexts/files/file_contexts to /etc/selinux/arc/policy/policy.30
[
] Change Owner:Group to 0:0
[-] Change Mod to 0644
[] Change Context to u:object_r:cros_selinux_config_file:s0
[!] Set Permissions and Context from
[-] /usr/local/crosswork/fin/sepolicy to /usr/local/crosswork/fin/sepolicy.magisk
[
] Change Owner:Group to 655360:655360
[-] Change Mod to 0644
[] Change Context to u:object_r:sepolicy_file:s0
[
] create Backup File of /opt/google/containers/android/system.raw.img
[-] Generating SquashFS with Magisk
rm: cannot remove '/opt/google/containers/android/system.raw.img': No such file or directory
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on /opt/google/containers/android/system.raw.img, block size 131072.
[============================================================================================================================================-] 10911/10911 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments,
compressed xattrs, compressed ids
duplicates are removed
Filesystem size 506780.75 Kbytes (494.90 Mbytes)
42.82% of uncompressed filesystem size (1183569.02 Kbytes)
Inode table size 59640 bytes (58.24 Kbytes)
31.59% of uncompressed inode table size (188808 bytes)
Directory table size 31464 bytes (30.73 Kbytes)
40.61% of uncompressed directory table size (77487 bytes)
Xattr table size 862 bytes (0.84 Kbytes)
18.40% of uncompressed xattr table size (4684 bytes)
Number of duplicate files found 133
Number of inodes 2865
Number of files 2282
Number of fragments 440
Number of symbolic links 244
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 339
Number of ids (unique uids + gids) 7
Number of uids 4
android-root (655360)
unknown (656360)
root (0)
unknown (656396)
Number of gids 7
android-root (655360)
unknown (656360)
unknown (657360)
root (0)
unknown (656388)
unknown (656396)
unknown (656363)
[] Set Magisk SquashFS System
[
] Change Context to u:object_r:cros_system_file:s0
[] cleaning up /usr/local/crosswork/fin
localhost /usr/local # [
] adding overlay.d/sbin folders to ramdisk
bash: [*]: command not found
localhost /usr/local # Loading cpio: [ramdisk.cpio]
bash: Loading: command not found
localhost /usr/local # Create directory [overlay.d] (0750)
bash: syntax error near unexpected token (' localhost /usr/local # Create directory [overlay.d/sbin] (0750) bash: syntax error near unexpected token ('
localhost /usr/local # Dump cpio: [ramdisk.cpio]
bash: Dump: command not found
localhost /usr/local # [!] PATCHFSTAB=false
bash: [!]: command not found
localhost /usr/local # [!] Skipping fstab.ranchu patch with /dev/block/sda
bash: [!]: command not found
localhost /usr/local # [?] If you want fstab.ranchu patched, Call rootAVD with PATCHFSTAB
bash: [?]: command not found
localhost /usr/local # [!] AddRCscripts=false
bash: [!]: command not found
localhost /usr/local # [!] Skip adding .rc scripts into ramdisk.img/sbin/.rc
bash: [!]: command not found
localhost /usr/local # [?] If you want .rc scripts added into ramdisk.img/sbin/.rc, Call rootAVD with AddRCscripts
bash: [?]: command not found
localhost /usr/local # [!] patching the ramdisk with Magisk Init
bash: [!]: command not found
localhost /usr/local # Loading cpio: [ramdisk.cpio]
bash: Loading: command not found
localhost /usr/local # Add entry [init] (0750)
bash: syntax error near unexpected token (' localhost /usr/local # Add entry [overlay.d/sbin/magisk32.xz] (0644) bash: syntax error near unexpected token ('
localhost /usr/local # Add entry [overlay.d/sbin/magisk64.xz] (0644)
bash: syntax error near unexpected token (' localhost /usr/local # Patch with flag KEEPVERITY=[true] KEEPFORCEENCRYPT=[true] bash: Patch: command not found localhost /usr/local # Loading cpio: [ramdisk.cpio.orig] bash: Loading: command not found localhost /usr/local # Backup mismatch entry: [init] -> [.backup/init] bash: [.backup/init]: No such file or directory localhost /usr/local # Record new entry: [overlay.d] -> [.backup/.rmlist] bash: [.backup/.rmlist]: No such file or directory localhost /usr/local # Record new entry: [overlay.d/sbin] -> [.backup/.rmlist] bash: [.backup/.rmlist]: No such file or directory localhost /usr/local # Record new entry: [overlay.d/sbin/magisk32.xz] -> [.backup/.rmlist] bash: [.backup/.rmlist]: No such file or directory localhost /usr/local # Record new entry: [overlay.d/sbin/magisk64.xz] -> [.backup/.rmlist] bash: [.backup/.rmlist]: No such file or directory localhost /usr/local # Create directory [.backup] (0000) bash: syntax error near unexpected token ('
localhost /usr/local # Add entry [.backup/.magisk] (0000)
bash: syntax error near unexpected token (' localhost /usr/local # Dump cpio: [ramdisk.cpio] bash: Dump: command not found localhost /usr/local # [*] repacking back to ramdisk.img format bash: [*]: command not found localhost /usr/local # [!] Rename Magisk.zip to Magisk.apk bash: [!]: command not found localhost /usr/local # [*] Trying to install Magisk.apk bash: [*]: command not found localhost /usr/local # Success bash: Success: command not found localhost /usr/local # [*] cleaning up /usr/local/crosswork/fin bash: [*]: command not found localhost /usr/local # Parallel unsquashfs: Using 4 processors bash: Parallel: command not found localhost /usr/local # 2510 inodes (11080 blocks) to write bash: syntax error near unexpected token ('
localhost /usr/local #
localhost /usr/local # [============================================================================================================================================/] 11080/11080 100%
bash: [============================================================================================================================================/]: No such file or directory
localhost /usr/local #
localhost /usr/local # created 2271 files
bash: created: command not found
localhost /usr/local # created 336 directories
bash: created: command not found
localhost /usr/local # [created 239 symlinks
bash: [created: command not found
localhost /usr/local # created 0 devices
bash: created: command not found
localhost /usr/local # created 0 fifos
bash: created: command not found
localhost /usr/local # created 0 sockets
bash: created: command not found
localhost /usr/local # ============================================================================================================================================-] ============================================================================================================================================-] 11080/11080 100%Make your changes an
bash: ============================================================================================================================================-]: command not found
localhost /usr/local #

I rerun the script inside crosswork folder, and it showed me in the end:
`[*] Change Context to u:object_r:sepolicy_file:s0
[-] /opt/google/containers/android/system.raw.img Backup exists already
[-] Generating SquashFS with Magisk
Parallel mksquashfs: Using 4 processors
Creating 4.0 filesystem on /opt/google/containers/android/system.raw.img, block size 131072.
[============================================================================================================================================-] 10911/10911 100%

Exportable Squashfs 4.0 filesystem, gzip compressed, data block size 131072
compressed data, compressed metadata, compressed fragments,
compressed xattrs, compressed ids
duplicates are removed
Filesystem size 506780.79 Kbytes (494.90 Mbytes)
42.82% of uncompressed filesystem size (1183570.06 Kbytes)
Inode table size 59637 bytes (58.24 Kbytes)
31.59% of uncompressed inode table size (188808 bytes)
Directory table size 31475 bytes (30.74 Kbytes)
40.62% of uncompressed directory table size (77487 bytes)
Xattr table size 862 bytes (0.84 Kbytes)
18.40% of uncompressed xattr table size (4684 bytes)
Number of duplicate files found 133
Number of inodes 2865
Number of files 2282
Number of fragments 440
Number of symbolic links 244
Number of device nodes 0
Number of fifo nodes 0
Number of socket nodes 0
Number of directories 339
Number of ids (unique uids + gids) 7
Number of uids 4
android-root (655360)
unknown (656360)
root (0)
unknown (656396)
Number of gids 7
android-root (655360)
unknown (656360)
unknown (657360)
root (0)
unknown (656388)
unknown (656396)
unknown (656363)
[] Set Magisk SquashFS System
[
] Change Context to u:object_r:cros_system_file:s0
[*] cleaning up /usr/local/crosswork/fin
localhost /usr/local/crosswork # `

But after rebooting, root worked yet modules are not working.
Thanks

After launching the script, apps can no longer access the audio files on my other partitions.

@MohammedMehdiTBER what is your host machine which you installed the atlas 93 recovery on?
I don't use the ADB command to run the script. I am using:

cd $PORTAGE_CONFIGROOT && sudo su
curl -LO https://raw.githubusercontent.com/newbit1/rootCROS/master/rootCROS.sh
bash ./rootCROS.sh

If you have already root access, the script seems to have worked.

Why the modules are not working are already explained under limitations

Regarding your audio files, no clue. If you can explain this more detailed I can try to reproduce it, to see
if/where it hangs. Like where you put the files with your stock image, how you access them, and then
after the root script, what you are trying to access them again.

@MohammedMehdiTBER what is your host machine which you installed the atlas 93 recovery on? I don't use the ADB command to run the script. I am using:

cd $PORTAGE_CONFIGROOT && sudo su
curl -LO https://raw.githubusercontent.com/newbit1/rootCROS/master/rootCROS.sh
bash ./rootCROS.sh

If you have already root access, the script seems to have worked.

Why the modules are not working are already explained under limitations

Regarding your audio files, no clue. If you can explain this more detailed I can try to reproduce it, to see if/where it hangs. Like where you put the files with your stock image, how you access them, and then after the root script, what you are trying to access them again.

I have the ChromeOS installed on /dev/sda3, and I want to access audio files in /dev/sda1 while using ChromeOS.
I can access them from file manager, but not from audio players apks I installed.
Maybe It just doesn't detect the NTFS sda1 goodly.
Maybe I need to create a symbolic link in my sda2 linux partition so the sda3 chromeos detects it in linux.

This sounds like, that you couldn't access these Audio files even before you installed Magisk with the script?!
I've tried the script with Atlas 93, and it doesn't work. It seems the Bash behaves very different from rammus.

Try another Audio Player or copy your Audios with the file manager to the internal storage, so your player
can see it.

If there is any update regarding Atlas 93, I will make a notice on the Readme and this Issue.

Edit:
Should be fixed for both by now.