How to install GSI on Samsung Galaxy Tab Active3


Question

I am trying to flash an Android 12 GSI onto my Samsung Galaxy Tab Active3. Goal is to install the GSI without root / voiding the warranty. My company produces an app which is primarily used on Android on Galaxy Tab Active devices. It's expected Galaxy Tab Active3 will get Android 12 update in the next few months and we wanted to do some regression testing in advance of that. Hence the need to get Android 12 GSI onto the Tab Active3.


Device is an arm64 so I downloaded the arm64+gms version of Android 12 GSI (from Google's website). I have successfully unlocked the bootloader, and enabled DSU support. The device supports Project Treble and the VNDK isolated namespace, so in theory should support GSIs.


Everything I tried so far has failed. Any ideas to get it working?


Manual DSU


I have tried to install the GSI by manually starting the DSU via activity manager. Every time it just says "Installation failed" after reaching about 50% progress. I have tried setting different sizes for the USERDATA: 8GB (Google's recommended size), 2GB and 1GB. I get the same error every time. The device has around 40GB free space and the GSI image size is around 2GB, so it shouldn't be anything to do with the space requirements.


Logcat reports an error:


11-11 13:10:09.620  1103  3695 I DynamicSystemService: Failed to install system
11-11 13:10:09.621 16445 23403 E InstallationAsyncTask: java.io.IOException: Failed to start installation with requested size: 1257738436

This doesn't help unfortunately; it is thrown from the following file and this is just thrown if there is any error in the underlying dynamic installation:


https://android.googlesource.com/platform/frameworks/base/+/refs/heads/master/packages/DynamicSystemInstallationService/src/com/android/dynsystem/InstallationAsyncTask.java


PS: Unfortunately the device does not support DSU Loader even though it's running Android 11 (searching for "dsu" in the settings returns no relevant results). Apparently none of the Samsung devices are supporting DSU Loader.


Fastboot and FastbootD


The device can be rebooted into fastboot mode (adb reboot bootloader) but every command just hangs forever (except for fastboot devices, which does detect the device). I tried fastboot reboot fastboot, but it just reboots into the standard mode of the device and does not enter a fastboot userspace mode (fastbootd mode) as some have suggested it should.


Heimdall


At least one person has said they can patch GSIs using Heimdall: https://forum.xda-developers.com/t/can-i-flash-gsi-roms-with-odin.4029921/


That person was able to flash their GSI to the SYSTEM partition, but my device doesn't have a SYSTEM partition. The partitions are like SUPER, PRISM, etc.


I'm not able to get Heimdall working properly on Windows 10. I have tried with WinUSB, libusb0 and libusbK, but the same is true for all of them. After rebooting the device into ODIN mode, the device can be detected with heimdall detect, but I can't do anything more including heimdall print-pit, as I get a "Failed to access device. libusb error: -12" error.


I managed to set up Heimdall on an Ubuntu instance of WSL and map the USB using USBIPD. Inside WSL, heimdall print-pit does work but I can't get further to flashing anything (I tried to flash the GSI to SUPER, not sure if this was a good idea but anyway it failed) as I get a "Protocol initialisation failed!" error.


Odin


I am not sure if Odin even supports GSIs and I can't find anyone saying it supports them. I have tried flashing the GSI as an AP in Odin 3.12, 3.13, 3.14 and the patched 3.14 which removes signature checks. But every time it just fails.


Custom recovery


Just to also note, it seems none of the custom recoveries (TWRP, SHRP, Orangefox etc) support the Tab Active3, or I could have tried to flash those using Heimdall/Odin and then use them to flash the GSI. But I feel it's likely I would have had the same issues, at least with Heimdall.


EDIT: Heimdall on native Linux


@Robert in the comments below suggested I run Heimdall on native Linux rather than on WSL or the Windows version. This worked better and fixed the issues I was having before with Heimdall.


I then tried to flash VBMETA (the one which is bundled with the GSI) using Heimdall which worked, however my device is now soft-bricked, can only boot into Download Mode, and gives the following error:


ODIN MODE (AVB fail)
vbmeta: Public key used to sign data rejected. (5)
vbmeta: VERIFICATION_DISABLED bit is set.
CUSTOM VBMETA
VBMETA : No sign info
VBMETA ,

@alecxs in the comments had suggested flashing a VBMETA generated from avbtool instead; I tried this also, but got almost the same situation and a very slightly different error output:


ODIN MODE (AVB fail)
vbmeta: Error verifying vbmeta image: OK_NOT_SIGNED (3)
vbmeta: VERIFICATION_DISABLED bit is set.
CUSTOM VBMETA
VBMETA : No sign info
VBMETA ,

EDIT 2: Heimdall on WSL again, VBMETA findings, and how I got DSU working


I found that both Heimdall on native Linux and Heimdall on WSL actually suffer from the same problem. You can only post one command to the device, then subsequent commands fail with "protocol initialisation failed". On WSL I was doing things like heimdall print-pit --no-reboot and that's why I was facing issues when flashing. Basically, if you get protocol initialisation failed, just reboot the device and it should work.


Samsung devices seem to do a signature check on VBMETA and only accept official Samsung-signed ones. I found two different VBMETA images in my stock ROM - vbmeta.img and vbmeta_samsung.img. I happened to notice that vbmeta_samsung.img has the same file size as the vbmeta disable images. By the time I'd got this fixed I'd flashed vbmeta_samsung.img and then done a factory reset. I'm not sure if this was strictly necessary though, as after flashing vbmeta.img it still worked. Not sure if re-flashing original stock vbmeta.img will have re-enabled AVB though. Although I'd say it's unlikely, as even Google themselves say you need to disable AVB in order to use DSU.


How I got DSU fixed eventually (aside from the above) - I had made a really stupid error when running the DSU command. For KEY_SYSTEM_SIZE I was passing the gzipped system size, not original system image size. This is why the installation always failed after 50%, because it was only installing 50% of the system image. Also another really important thing to note is that after running DSU, you have to restart the system from the DSU notification and not from the normal power menu of the device.


Answer

Just posting this for future reference - I did manage to install Android 12 GSI on the Samsung Galaxy Tab Active3 using DSU (not DSU Loader) eventually, and the problem turned out to be something really stupid. When supplying the value for KEY_SYSTEM_SIZE in the DSU install command, I had supplied the gzipped size rather than original image size. This is why the installation failed after 50% because it was only processing 50% of the uncompressed image (compression ratio was approximately 50%).


There was lots of discussion in the question comments about disabling AVB - I want to note that you do not have to disable AVB in order to follow these instructions. I verified this with a colleague who had a brand new device and we were able to install the GSI with DSU without disabling AVB.


There is little point in me posting detailed steps because they're essentially just the vanilla steps from Google to installing any GSI through DSU. At a high level:



  1. Enable OEM unlock in your developer options (if you can't see it and your device is fairly new, there are a number of guides online you can follow around setting your device clock manually to "trick" the device into thinking it's not such a new device)

  2. Unlock the bootloader (power off device, hold down vol up+down, plug in power cable, long press vol up, press vol up again to confirm)

  3. The device will automatically factory reset - go through setup again and make sure you enable WiFi

  4. Enable the DSU feature flag: adb shell setprop persist.sys.fflag.override.settings_dynamic_system true

  5. Launch DSU: see https://developer.android.com/topic/dsu#launch (make sure when you supply the KEY_SYSTEM_SIZE this is the original image size not gzipped image size which is where I went wrong)

  6. Make sure you reboot your device from the DSU notification (you have to expand it to see the restart option) and not from the normal power menu


Topics


2D Engines   3D Engines   9-Patch   Action Bars   Activities   ADB   Advertisements   Analytics   Animations   ANR   AOP   API   APK   APT   Architecture   Audio   Autocomplete   Background Processing   Backward Compatibility   Badges   Bar Codes   Benchmarking   Bitmaps   Bluetooth   Blur Effects   Bread Crumbs   BRMS   Browser Extensions   Build Systems   Bundles   Buttons   Caching   Camera   Canvas   Cards   Carousels   Changelog   Checkboxes   Cloud Storages   Color Analysis   Color Pickers   Colors   Comet/Push   Compass Sensors   Conferences   Content Providers   Continuous Integration   Crash Reports   Credit Cards   Credits   CSV   Curl/Flip   Data Binding   Data Generators   Data Structures   Database   Database Browsers   Date &   Debugging   Decompilers   Deep Links   Dependency Injections   Design   Design Patterns   Dex   Dialogs   Distributed Computing   Distribution Platforms   Download Managers   Drawables   Emoji   Emulators   EPUB   Equalizers &   Event Buses   Exception Handling   Face Recognition   Feedback &   File System   File/Directory   Fingerprint   Floating Action   Fonts   Forms   Fragments   FRP   FSM   Functional Programming   Gamepads   Games   Geocaching   Gestures   GIF   Glow Pad   Gradle Plugins   Graphics   Grid Views   Highlighting   HTML   HTTP Mocking   Icons   IDE   IDE Plugins   Image Croppers   Image Loaders   Image Pickers   Image Processing   Image Views   Instrumentation   Intents   Job Schedulers   JSON   Keyboard   Kotlin   Layouts   Library Demos   List View   List Views   Localization   Location   Lock Patterns   Logcat   Logging   Mails   Maps   Markdown   Mathematics   Maven Plugins   MBaaS   Media   Menus   Messaging   MIME   Mobile Web   Native Image   Navigation   NDK   Networking   NFC   NoSQL   Number Pickers   OAuth   Object Mocking   OCR Engines   OpenGL   ORM   Other Pickers   Parallax List   Parcelables   Particle Systems   Password Inputs   PDF   Permissions   Physics Engines   Platforms   Plugin Frameworks   Preferences   Progress Indicators   ProGuard   Properties   Protocol Buffer   Pull To   Purchases   Push/Pull   QR Codes   Quick Return   Radio Buttons   Range Bars   Ratings   Recycler Views   Resources   REST   Ripple Effects   RSS   Screenshots   Scripting   Scroll Views   SDK   Search Inputs   Security   Sensors   Services   Showcase Views   Signatures   Sliding Panels   Snackbars   SOAP   Social Networks   Spannable   Spinners   Splash Screens   SSH   Static Analysis   Status Bars   Styling   SVG   System   Tags   Task Managers   TDD &   Template Engines   Testing   Testing Tools   Text Formatting   Text Views   Text Watchers   Text-to   Toasts   Toolkits For   Tools   Tooltips   Trainings   TV   Twitter   Updaters   USB   User Stories   Utils   Validation   Video   View Adapters   View Pagers   Views   Watch Face   Wearable Data   Wearables   Weather   Web Tools   Web Views   WebRTC   WebSockets   Wheel Widgets   Wi-Fi   Widgets   Windows   Wizards   XML   XMPP   YAML   ZIP Codes