meefik / linuxdeploy

Install and run GNU/Linux on Android
https://meefik.github.io/linuxdeploy
GNU General Public License v3.0
5.27k stars 680 forks source link

What is the initial script in the img file created by Linux Deploy? #75

Closed zhangew closed 6 years ago

zhangew commented 11 years ago

Dear Meefik,

I'm trying to use LinuxonAndroid's ubuntu.sh to start the img file created by Linux Deploy, But when the ubuntu.sh executing /root/init.sh, it said that the file does not exist, I think it might be the filename's sake.

So, would you like to tell me what is the initial script which should be executed first?

Thank you!

zhangew commented 11 years ago

I started the old img on my Galaxy Mega 6.3 successfully!

Here is the method:

  1. Install Linux Deploy and configure it according to the img files's imformation.
  2. Install busybox(free version is enough)
  3. Login the android by termianl.
  4. Run the commands to start: (1) su - (2) export MNT_TARGET=/data/local/linux/mnt (3) sh /data/local/linux/bin/linuxdeploy start you will see all "mounts" worked, but ssh and vnc start failed. I have run the origin command manually, it said "chroot, su, no such file or directory". And if I edited the linuxdeploy script to for example: chroot $MNT_TARGET /bin/su - root -c 'ssh-keygen -A' it said "chroot: can't execute su: permission denied". So please continue reading (4). (4) Start ssh and(or) vnc manually in the termianl(for my fedora18 img file): chroot $MNT_TARGET /bin/su - root -c 'ssh-keygen -A' chroot $MNT_TARGET /bin/su - root -c 'which sshd' no error reported. (please find the command lines in the script 'linuxdeploy', the comment is clear. Different distros use different command lines.)

So far, the sshd has already been started successfully, and you can use your favorite ssh client to connect to it. VNC is similar, copy the command from the script linuxdeploy and run it manually, with modifying "su" to "/bin/su".

5.How to stop it (I have not tried it yet, but I can reason it in my mind, because I'm going to bed I'll try it tomorrow)?

(1) You should stop the sshd manully too: chroot $MNT_TARGET /bin/su - root -c 'kill -9 $(cat /var/run/sshd.pid)' sleep 1 pkill -9 sshd

If you have started VNC, you should do the VNC's stopping command as well.

(2) sh /data/local/linux/bin/linuxdeploy stop this command should release the resources and umount all chroot filesystems.

That's all.

I posted the steps here, because I really started it, and I guess there might be a bug in current Linux Deploy when it is running on Galaxy S4 and Mega 6.3. But I am not capable to find the reason and solve it. So, please just treat them as a temporary solution and some threads for Meefik to solve it finally.

The command line usages above come from:

  1. http://forum.xda-developers.com/showthread.php?p=43869663
  2. http://forum.xda-developers.com/showthread.php?t=2381181

And I mixed them and applied them to LinuxDeploy's script.

Thanks and best regards.

twaik commented 6 years ago

Linux Depeloy does not use init.sh or any other script inside container to start the system services. It starts services directly. See https://github.com/meefik/linuxdeploy-cli