guardianproject / lildebi

UNMAINTAINED please adopt! we can no longer maintain this
https://guardianproject.info/code
GNU General Public License v3.0
226 stars 55 forks source link

Cannot initially access Lil' Debi environment - root password unknown and shell does not work #184

Open eyesonly opened 8 years ago

eyesonly commented 8 years ago

On both my Nexus 7 tablet and Galaxy Nexus phone, Lil' Debi installed Debian stable (jessie) for armel - 600MB [i.e. default options], and could see that the ssh server was started, but I could not access the chroot via Connectbot as root's password was unknown and it would not accept no password.

I attempted to gain a shell using both Terminal Emulator and Connectbot's Local Shell, but it gave an error on both devices:

root@maguro:/ # /data/data/info.guardianproject.lildebi/app_bin/shell grep: /debian/etc/passwd: No such file or directory chroot: can't execute '/bin/bash': No such file or directory

Eventually, I did gain access by copying the image to my Linux desktop, mounting the image and manually editing /root/.ssh/authorized_keys to allow my pubkey access, but this is probably not something beginners would think of.

The Lil' Debi setting "Install on Internal Storage: /data/debian" was NOT ticked, and the .apk installed was version 0.5.4 from F-droid.

eighthave commented 8 years ago

this means that your install did not complete correctly. Missing /bin/bash is the classic sign that the install failed before it could install all of the packages.

Can you post your install log?

eyesonly commented 8 years ago

Install log from my Galaxy Nexus (Android 4.3) is here: https://www.dropbox.com/s/g6jfoim1pgdwyys/install.log?dl=0

eyesonly commented 8 years ago

Not sure anymore that the problem is /bin/bash (which exists in the chroot), but perhaps the problem seems to be a duplicate of "installed OK but "Debian not mounted", Issue #141, and from reading around quite a few folks seem to be saying the SSH daemon is starting but they can't work out how to login.

For when the Java app has started Debian, /data/debian appears to be empty within Terminal Emulator after starting (even though the chroot is active and I can ssh into it, and after SSHing into the chroot /bin/bash is available).

These are the Android Logs:

08-06 10:54:48.054 I/ActivityManager(412): START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=info.guardianproject.lildebi/.LilDebi bnds=[40,185][200,385]} from pid 702
08-06 10:54:48.257 I/ActivityManager(412): Start proc info.guardianproject.lildebi for activity info.guardianproject.lildebi/.LilDebi: pid=16951 uid=10109 gids={50109, 3003, 1028, 1015}
08-06 10:54:48.445 I/LilDebi (16951): savedInstanceState was null
08-06 10:54:48.453 I/LilDebi (16951): Not upgrading '/data/data/info.guardianproject.lildebi/app_bin'
08-06 10:54:48.734 I/ActivityManager(412): Displayed info.guardianproject.lildebi/.LilDebi: +488ms
08-06 10:54:51.585 I/LilDebiAction(16951): exec: su -s /data/data/info.guardianproject.lildebi/app_bin/sh
08-06 10:54:51.617 I/LilDebiAction(16951): cd /data/data/info.guardianproject.lildebi/app_bin
08-06 10:54:51.617 I/LilDebiAction(16951): export PATH=/data/data/info.guardianproject.lildebi/app_bin
08-06 10:54:51.617 I/LilDebiAction(16951): LANG=en_GB ./start-debian.sh /data/data/info.guardianproject.lildebi/app_bin /storage/emulated/legacy /sdcard/debian.img /data/debian  && /data/data/info.guardianproject.lildebi/app_bin/chroot /data/debian /bin/bash -c "/etc/init.d/rc 2"
08-06 10:54:51.617 I/LilDebiAction(16951): exit
08-06 10:55:06.554 I/LilDebi (16951): Done!

And after this has run note that /data/debian is empty and that the shell cannot be launched within Terminal emulator:

u0_a87@maguro:/ $ su
root@maguro:/ # ls /data/debian

Hence the 'shell' script cannot login (since it can't find /bin/bash within the chroot)

And to confirm, I can connect via SSH to the Debian chroot environment even though /data/debian appears to be empty. I'm not sure if the button in the Java app should change it's text, but after the above it still says "Start Debian" rather than "Stop Debian".

After knowing how the Java app starts Debian, I rebooted the phone and tried to manually start Debian outside of the Java app simply by launching it from within Terminal Emulator using this custom script:

/data/local/jstart.sh:

#!/data/data/info.guardianproject.lildebi/app_bin/sh
cd /data/data/info.guardianproject.lildebi/app_bin
export PATH=/data/data/info.guardianproject.lildebi/app_bin
LANG=en_GB ./start-debian.sh /data/data/info.guardianproject.lildebi/app_bin /storage/emulated/legacy /sdcard/debian.img /data/debian  && /data/data/info.guardianproject.lildebi/app_bin/chroot /data/debian /bin/bash -c "/etc/init.d/rc 2"
exit

And this is what the Terminal emulator shows from running the above script:

u0_a87@maguro:/ $ su -s /data/data/info.guardianproject.lildebi/app_bin/sh
# /data/data/info.guardianproject.lildebi/app_bin/sh /data/local/jstart.sh
----------------------------------------
start-debian.sh
Configuration that will be started:
app_bin: /data/data/info.guardianproject.lildebi/app_bin
mnt: /data/debian
sdcard: /storage/emulated/legacy
install_path: /sdcard/debian.img
sha1file: /data/data/info.guardianproject.lildebi/debian.img.sha1
loopdev: /dev/block/loop3
> /system/bin/e2fsck -pv /sdcard/debian.img
/sdcard/debian.img: recovering journal
/sdcard/debian.img: clean, 24262/128000 files, 156975/512000 blocks
> /data/data/info.guardianproject.lildebi/app_bin/losetup /dev/block/loop3 /sdcard/debian.img
root mount for everything Debian
> mount -t      ext4 /dev/block/loop3 /data/debian
none /acct cgroup rw,relatime,cpuacct 0 0
/dev/block/platform/omap/omap_hsmmc.0/by-name/cache /cache ext4 rw,seclabel,nosuid,nodev,noatime,errors=panic,user_xattr,barrier=1,nomblk_io_submit,data=ordered 0 0
/dev/block/platform/omap/omap_hsmmc.0/by-name/userdata /data ext4 rw,seclabel,nosuid,nodev,noatime,errors=panic,user_xattr,barrier=1,nomblk_io_submit,data=ordered 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
tmpfs /mnt/asec tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
tmpfs /mnt/obb tmpfs rw,seclabel,relatime,mode=755,gid=1000 0 0
/dev/fuse /mnt/shell/emulated fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /storage/emulated/0 fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/dev/fuse /storage/emulated/legacy fuse rw,nosuid,nodev,relatime,user_id=1023,group_id=1023,default_permissions,allow_other 0 0
/sys/kernel/debug /sys/kernel/debug debugfs rw,relatime 0 0
/dev/block/platform/omap/omap_hsmmc.0/by-name/system /system ext4 ro,seclabel,relatime,user_xattr,barrier=1,data=ordered 0 0
'/debian' not found, making a symlink to the chroot.
My ssh host key fingerprint and random art:
1024 6a:5e:7a:9a:ae:ef:7e:ab:62:aa:79:9f:56:14:cb:3a /etc/ssh/ssh_host_dsa_key.pub (DSA)
+---[DSA 1024]----+
|                 |
|      .          |
|     . o         |
|      +          |
|     o  S        |
|    E ..         |
|     oo .        |
| .. ++ +o        |
|oo.=+B@=..       |
+-----------------+
256 96:7e:d1:1a:86:7f:d0:e5:80:8b:fa:6b:4e:60:16:29 /etc/ssh/ssh_host_ecdsa_key.pub (ECDSA)
+---[ECDSA 256]---+
|                 |
|       .   .     |
|    E o   . . .  |
|     . . + + +   |
|      + S * o .  |
|     o = o =     |
|      . o + .    |
|       o.. .     |
|       o+.       |
+-----------------+
256 1c:e3:0e:23:b2:fc:2e:28:15:d3:d8:97:d2:e1:5a:06 /etc/ssh/ssh_host_ed25519_key.pub (ED25519)
+--[ED25519 256]--+
|                 |
|    E .          |
|   + + oo        |
|  + + Bo o       |
|  .o.*o S        |
| ..o.. +         |
| oo     .        |
|o ..             |
|.  oo            |
+-----------------+
2048 8b:20:bf:9f:7f:9c:05:d7:19:a8:0c:1f:5a:1d:18:6a /etc/ssh/ssh_host_rsa_key.pub (RSA)
+---[RSA 2048]----+
|          .+.o   |
|        ..+ o .  |
|        E* o . o |
|       .. = . o  |
|  . .   S  o     |
|   o . . .  .    |
|    . . .. o     |
|     . .  +      |
|    ..o...       |
+-----------------+
Debian chroot mounted and started.
Using makefile-style concurrent boot in runlevel 2.
Starting periodic command scheduler: cron.
Starting system message bus: dbus.
Starting OpenBSD Secure Shell server: sshd.
Starting NetBIOS name server: nmbd.
Starting SMB/CIFS daemon: smbd.
Starting MTA: exim4.
# echo $?
0
# ls /data/debian
acct
app-cache
bin
boot
cache
d
data
dbdata
debian
dev
efs
etc
home
lib
lost+found
media
mnt
opt
pds
proc
root
run
sbin
sdcard
shell
sqlite_stmt_journals
srv
storage
sys
system
tmp
usr
var
vendor
#  /data/data/info.guardianproject.lildebi/app_bin/shell
chroot: can't execute '/bin/su': No such file or directory
# ls /bin
/bin: No such file or directory
# ls /system/xbin
daemonsu
dexdump
su
sugote
sugote-mksh
#

As before I am able to SSH into the chroot.

For the record, I do use SuperSU.

I do find it strange that things are slightly different when starting Debian from the app versus from the Terminal Emulator, but in both cases I still can't get a shell by calling /data/data/info.guardianproject.lildebi/app_bin/shell (but have no problems via SSH). Even though "mount magic" does explain the discrepancy (my Android here is 4.3) it still doesn't help users who have just installed Debian and don't know root's password. Can Lil' Debi not set a password for root by default?

madhungarian commented 8 years ago

I am experiencing this exact issue. I really have no idea how to access chroot at this point.

eyesonly commented 8 years ago

Hi maghungarian,

Two possible workarounds:

  1. Try uninstalling SuperSU which is the cause of the problem
  2. As described above, you can also take the Lil'debi image file, copy it over to a Linux machine, mount it on Linux (mount -o loop...), add your public key (to /root/.ssh/authorized_keys), unmount and copy it back to your device.
madhungarian commented 8 years ago

I wasn't using SuperSU, I was using KingoRoot with it's embedded SuperUser app. I'll keep messing with it, but I'd rather not go the SSH route.

sierawski commented 7 years ago

Hey, I had problem with similar symptoms as @eyesonly wrote. It happened when I started terminal emulator through Lil'debi and haven't run 'su'. However, running 'su' still left me with 'segmentation fault' message.

Workaround was starting terminal emulator by myself. Then 'su' and /debian/shell worked correctly.

Hope it may help someone.