docker-android icon indicating copy to clipboard operation
docker-android copied to clipboard

[Documentation and its use case] Changing init.rc and ramdisk.img

Open vovinio opened this issue 6 years ago • 3 comments

I'm trying to change the init.rc file through the ramdisk.img. I found that the ramdisk.img is saved under /root/system-images/android-26/google_apis/x86/ramdisk.img

I've unpacked the ramdisk.img via the following guide and than repacked it back. http://linuxkernel51.blogspot.com/2016/11/unpack-modify-and-repack-ramdiskimg.html

When I copy the new image to the /root/system-images/android-26/google_apis/x86/ramdisk.img destination and restarting the docker container the container fails to boot.

" 2019-05-26 08:51:30,281 INFO exited: openbox (exit status 1; not expected) 2019-05-26 08:51:30,284 INFO exited: x11vnc (exit status 1; not expected) 2019-05-26 08:51:33,216 INFO exited: auto-recording (exit status 0; expected) 2019-05-26 08:51:34,220 INFO spawned: 'xvfb' with pid 161 2019-05-26 08:51:34,223 INFO spawned: 'openbox' with pid 162 2019-05-26 08:51:34,225 INFO spawned: 'x11vnc' with pid 163 2019-05-26 08:51:34,227 INFO exited: xvfb (exit status 1; not expected) 2019-05-26 08:51:34,233 INFO gave up: xvfb entered FATAL state, too many start retries too quickly 2019-05-26 08:51:34,234 INFO exited: x11vnc (exit status 1; not expected) 2019-05-26 08:51:34,240 INFO gave up: x11vnc entered FATAL state, too many start retries too quickly 2019-05-26 08:51:34,240 INFO exited: openbox (exit status 1; not expected) 2019-05-26 08:51:35,242 INFO gave up: openbox entered FATAL state, too many start retries too quickly 2019-05-26 08:51:36,421 INFO exited: docker-appium (exit status 1; not expected) "

Am I doing something wrong in the process?

Docker Image: budtmo/docker-android-x86-8.0

Expected Behavior

Change in ramdisk.img should apply changes in init.rc file.

Actual Behavior

docker container fails to load.

vovinio avatar May 26 '19 16:05 vovinio

Well, this works:

  • copy ramdisk.img to a chosen location
  • mkdir ramdisk
  • cd ramdisk
  • gzip -dc ../ramdisk.img | cpio -i

Make all needed changes in init.rc ot other files.

  • find . | cpio -o -H newc > gzip > ../newramdisk.img
  • copy the new ramdisk.img to /root/system-images/android-26/google_apis/x86/ramdisk.img inside the working container and restart it.

vovinio avatar May 26 '19 20:05 vovinio

Hi @vovinio ,

Thank you for creating issue. May I know what is your use case of changing init.rc? could you also update documentation about it and create a PR? so other can benefit from it.

budtmo avatar May 29 '19 12:05 budtmo

Hi @budtmo,

I'm doing research tasks and studying android. I wanted to change the init.rc file to control different system properties, though, this is not possible through the init.rc file and requires going deeper (changing the source code itself and compiling it).

I will update the documentation regarding the init.rc and the possible use cases for it.

vovinio avatar Jun 03 '19 12:06 vovinio