Coder Social home page Coder Social logo

guardianproject / lildebi Goto Github PK

View Code? Open in Web Editor NEW
225.0 38.0 55.0 9.14 MB

UNMAINTAINED please adopt! we can no longer maintain this

Home Page: https://guardianproject.info/code

License: GNU General Public License v3.0

Shell 27.77% Java 70.65% Python 1.58%

lildebi's Introduction

UNMAINTAINED we no longer have the time to maintain this app, but would love to see someone take it over and continue developing it!

Lil' Debi

This is an app to setup and manage a Debian install in parallel on an Android phone. It can build a Debian install from scratch or use an existing image. It manages the starting and stopping of the Debian install.

It uses cdebootstrap to build up the disk image as a chroot, and then provides start and stop methods for handling mounting, fsck, starting/stopping sshd, etc.

It is 100% free software. Ultimately, our aim is to have the whole process for every bit of this app documented so that it can be freely inspected, modified, ported, etc. We want this app to build a trusted Debian install on the phone, so free software is the only way to get there. This is currently functional alpha software, so do not rely on it to produce a trusted Debian install. Please do try it out, use it, and report criticisms, bugs, improvements, etc.

Installing Debian

The process of installing Debian with Lil' Debi is self-explanatory, just run the app and click the Install... button. But it doesn't yet work on all phones. If the install process fails on your phone, you can still use Lil' Debi by downloading a pre-built Debian image. It should work with any Debian/Ubuntu/Mint armel image file. Here is a Debian image file that was built by Lil' Debi:

https://github.com/guardianproject/lildebi/downloads

Download the file, uncompress it and rename it 'debian.img' and copy it to your SD Card. Launch Lil' Debi, and you should now see the button says "Start Debian". Click the button to start your new Debian install.

Build Setup

On Debian/Ubuntu/Mint/etc.:

sudo apt-get install autoconf automake libtool transfig wget patch \
     texinfo ant make openjdk-7-jdk faketime

On Mac OS X, you will need Fink, MacPorts, or Brew to install some of these dependencies. For example, GNU tar is required, OS X's tar will not work. Also, faketime is needed to make repeatable builds of busybox.

Both the Android SDK and the Android NDK are needed:

SDK: http://developer.android.com/sdk/ NDK: http://developer.android.com/sdk/ndk/

Building

Building Lil' Debi is a multi-step process including clone the sources, getting busybox code as a submodule, building the native utilities, and then finally building the Android app. Here are all those steps in a form to run in the terminal:

  git clone https://github.com/guardianproject/lildebi
  cd lildebi
  git submodule init
  git submodule update
  make NDK_BASE=/path/to/your/android-ndk -C external assets
  ./setup-ant
  ant debug

Once that has completed, you can install it however you would normally install an .apk file. You will find the .apk in the bin/ folder. An easy way to install it via the terminal is to run:

  adb install bin/LilDebi-debug.apk

Deterministic Release

Having a deterministic, repeatable build process that produces the exact same APK wherever it is run has a lot of benefits:

  • makes it easy for anyone to verify that the official APKs are indeed generated only from the sources in git

  • makes it possible for FDroid to distribute APKs with the upstream developer's signature instead of the FDroid's signature

To increase the likelyhood of producing a deterministic build of LilDebi, run the java build with faketime. The rest is already included in the Makefiles. This is also included in the ./make-release-build.sh script. Running a program with faketime causes that program to recent a fixed time based on the timestamp provided to faketime. This ensures that the timestamps in the files are always the same.

  faketime "`git log -n1 --format=format:%ai`" \
  ant clean debug

The actual process that is used for making the release builds is the included ./make-release-build script. To reproduce the official releases, run this script. But be aware, it will delete all changes in the git repo that it is run in, so it is probably best to run it in a clean clone. Then you can compare your release build to the official release using the included ./compare-to-official-release script. It requires a few utilities to work. All of them are Debian/Ubuntu packages except for apktool. Here's what to install:

  apt-get install unzip meld bsdmainutils

Or on OSX with brew:

  brew install apktool unzip

If you want to reproduce a build and the cdebootstrap-static package is no longer available, you can download it from snapshot.debian.org. For example:

NDK build options

The following options can be set from the make command line to tailor the NDK build to your setup:

  • NDK_BASE (/path/to/your/android-ndk)
  • NDK_PLATFORM_LEVEL (7-17 as in android-17)
  • NDK_ABI (arm, mips, x86)
  • NDK_COMPILER_VERSION (4.4.3, 4.6, 4.7, clang3.1, clang3.2)
  • HOST (arm-linux-androideabi, mipsel-linux-android, x86)

Original Sources

cdebootstrap

http://packages.debian.org/unstable/cdebootstrap

cdebootstrap is downloaded directly from Debian, extracted, and then tar'ed into the included tarball assets/cdebootstrap.tar. See external/cdebootstrap/Makefile for details.

busybox

git://busybox.net/busybox.git

busybox is included as a git submodule and built from source by externals/Makefile using a custom config file.

gpgv

git://git.gnupg.org/gnupg.git

Only gpgv is needed, so it is built from GnuPG v1.4.x. It is built statically to get around PIE vs non-PIE. If an executable is built fully statically, with no dynamic linking at all, then the same binary will work on both PIE systems (android-21 and above), and systems where PIE does not work (older than android-16).

lildebi's People

Contributors

adamjhogan avatar dtai avatar eighthave avatar patcon avatar sdkie avatar thehunmonkgroup avatar tias avatar toobaz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lildebi's Issues

How to setup or change the Default SSHd Password

The installer worked like a charm device is a ASUS-TF300T with CM10.1, the problem I have is after the installer complete's (which seems to fly by the way!)

The post start script default is set-up as: /etc/init.d/ssh start

Then it scroll's up on screen that SSHd is running and I dont have a command line window, just the screen telling me SSH is running, so I tried to connect to root@localhost via connectBot and it prompts me for the password. Then I tried every password I have, even the one I've already manually set for SSHd with DigiControl.

No Joy? Does anyone have any idea what the default SSHd password is or how I would get a prompt on the command shell where I can actually use the Debian command line natively?

manufacturer: Asus
model: TF300T
product: EeePad
brand: Asus
device: tf300t
board: cardhu
ID: JDQ39E
CPU ABI: armeabi-v7a
release: 4.2.2
incremental: eng..20130518.100005
codename: REL
SDK: 17

Thanking you in advance for your help.

Side note: Its genuinely been that long since I've used Linux that it did not occour to me how I was supposed to interact with the shell.. I see it plain as day now that I shouldnt be trying to setup sshd in Android... Doh! But instead should be using Chroot from within the debian installer and change the passwords from there.. My bad you can close this issue. I fixed it!

lildebi fails when it runs out of loopback device files

It seems to be quite common that installed apps (that were moved to sdcard) eat up loopback devices.
But when no unused loopback device files are available, lildebi fails to start or install debian.
So it makes sense to teach assets/lildebi-common to create new loop device files, when none are available.

The following patch (hereby put in the public domain) does that. It has been tested on one device and worked (it was applied to /data/data/info.guardianproject.lildebian/app_bin/lildebi-common).

diff -Naur orig/assets/lildebi-common fixed/assets/lildebi-common
--- orig/assets/lildebi-common  2013-04-15 20:37:30.000000000 +0200
+++ fixed/assets/lildebi-common 2013-04-15 21:43:55.000000000 +0200
@@ -91,7 +91,20 @@
             return
         fi
     done
-    # if the above doesn't succeed, ask the system as a fallback
+    # if the above doen't succeed, try to create new 
+    # loopback device files (installed apps can eat up all available
+    # loopback device files)
+    if [ -e /dev/block/loop0 ]; then
+        i=0
+        while [ "$i" -lt 255 -a -e "/dev/block/loop$i" ]; do
+            i=$((i+1));
+        done
+        loopdev="/dev/block/loop$i"
+        mknod "$loopdev" b 7 $i
+        echo $loopdev
+        return
+    fi
+    # if the above still doesn't succeed, ask the system as a fallback
     echo `$app_bin/losetup -f`
 }
 

debootstrap external not installed properly

make -C external assets doesn't seem to install the deboostrap executable into assets/ -- the other externals are installed properly. i'm not a makefile expert, but it just looks like it's missing from the install command.

/etc/resolv.conf is 0600 by default

First congrats for your project, love it !

I've tried to get network access from a user in my chroot, and after fixing the user groups, I still couldn't resolve DNS because /etc/resolv.conf was only readable by root.

I believe that file should be made readable by all users by default (-rw-r--r--) and not only by root as it is actually.

Display / Commandshell Issue

Hello,
I have noticed an issue with my HTC ChaCha, running on Cyanogenmod 7.
The installation of lildebi works flawless but the terminal to execute commands does not appear under the log. Therefore I am not able to change the default root password.

I wanted to use debian via ssh but need a password to connect towards the device

Exo
image

i got an FC at the end of installation

when the installation is done (i think) and the mount happens, there is an FC:

06-18 02:03:51.020: ERROR/AndroidRuntime(1143): FATAL EXCEPTION: Thread-11
06-18 02:03:51.020: ERROR/AndroidRuntime(1143): android.util.AndroidRuntimeException: Calling startActivity() from outside of an Activity context requires the FLAG_ACTIVITY_NEW_TASK flag. Is this really what you want?
06-18 02:03:51.020: ERROR/AndroidRuntime(1143): at android.app.ContextImpl.startActivity(ContextImpl.java:647)
06-18 02:03:51.020: ERROR/AndroidRuntime(1143): at android.content.ContextWrapper.startActivity(ContextWrapper.java:258)
06-18 02:03:51.020: ERROR/AndroidRuntime(1143): at info.guardianproject.lildebi.InstallService$InstallThread.run(InstallService.java:128)
06-18 02:03:51.110: WARN/ActivityManager(260): Force finishing activity info.guardianproject.lildebi/.InstallActivity

NDK_TOOLCHAIN definition

for some reason, I can only make successfully if I define NDK_TOOLCHAIN outright. defining NDK_BASE is not enough. I had this issue before this commit using the x86_64 ndk, and just edited external/Makefile's definition of NDK_TOOLCHAIN to point to the right place. I'm not sure what's going wrong :/
fresh source code, trying to make with just NDK_BASE defined gives me a command not found for 'arm-linux-androideabi-gcc' though it's right where you'd expect it, and defining NDK_TOOLCHAIN as
NDK_TOOLCHAIN=/opt/android/android-ndk-r8e/toolchains/arm-linux-androideabi-4.6/prebuilt/linux-x86_64/
in the make line works like a charm. I assume this has something to do with the 64bit NDK commit.

Consider some means of "securing"

Consider some means of "securing" the debian installation... installing to the sdcard - where any application which has sdcard privileges can modify the debian installation probably isn't a good idea. (I don't want to chroot into an untrusted environment :/ ).

Problem with built in busybox (I assume) causes install to fail

I have tried 2012-02-24_18-36-51 and 2012-03-15_17-00-47 but both have the same problem, I tried 2011-06-09_11-54-10 for some perspective and that had different problems.

So, the later two version fail quietly with only saying that it failed to find modprobe and test.sh

I climbed in to the directory and tried the busybox that was in there and it worked.

Don't know where else to go. The directions to continue with the prebuilt image are incomplete.

can't ssh in after 'apt-get install ssh' etc

ssh is installed, and running, but I cannot ssh into the device over a wireless lan.

this is for both 'root' and a new user.

it seems to auth fine, but then drop due to a broken pipe. here is the 'ssh -v' output:

debug1: Authentication succeeded (password).
Authenticated to 10.0.1.10 ([10.0.1.10]:22).
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
Write failed: Broken pipe

modprobe ext2

In InstallService
https://github.com/guardianproject/lildebi/blob/master/src/info/guardianproject/lildebi/InstallService.java#L88
the command 'modprobe ext2' is run.

On my system (asus transformer, honeycomb), this gives the error 'modprobe: chdir(/lib/modules): No such file or directory

No harm is done, but this call (and hence the error) is not needed in many cases.
Could support for ext2 not be detected automatically (using /proc/filesystems as in https://github.com/guardianproject/lildebi/wiki/Checking-Your-Device perhaps)?

Even more ideally, an error could be shown to the user in case ext2 is not supported (even after a modprobe) making the app more robust.

But just to be clear: this is a suggestion, the modprobe command does not make the install fail (it did put me on the wrong foot in searching for the real cause though)

busybox version

According to the README, the busybox used is built in 2007 from the raw sources.

That's pretty old, in fact, I notice quite a few differences in behaviour between my 1.19.3 version and the 1.8.1 version in lildebi...

If you simply want a new binary, you can get the popular busybox built by stericson here:
https://code.google.com/p/busybox-android/source/browse/trunk/assets/busybox19_3.png
(its not really a png, no idea why he added that suffix)

Or, if you want to build it from source using the standard NDK, check out the build scripts and the patches at:
http://matrixrewriter.com/wiki/tiki-index.php?page=Building+BusyBox+binaries+for+Android

Kind regards,
Tias

Device files missing

My Mele-A2000 has a /dev/block/sda under Android, but in Debian's chroot there's no corresponding file. I think the start-debian.sh script should "mount -o rbind /dev /debian/dev" instead of selectively binding /dev/.

I added a "test-mount-bind /dev" just before the "mount...devpts" in start-debian.sh to work around this problem.

I think it would also be convenient to do something like

mkdir /debian/android
mount -o rbind / /debian/android

so as to make it easy to access any Android-side file from Debian.

gpgv tanks in chroot

My initial attempts at the Debian install on my Nexus 7 were tanking at the point when chroot is used to do the second stage debootstrap, saying "gpgv not installed, but required for Release verification".

I verified that the script copied the supplied gpgv to /data/debian/usr/local/bin/

Now here's the weird part: running /data/debian/usr/local/bin/gpgv --version with no chroot returns the version information just fine. Then I:

export PATH=/usr/sbin:/usr/bin:/sbin:/bin:/usr/local/bin
/system/bin/chroot /data/debian bash
which gpgv

and that returns /usr/local/bin/gpgv just fine. But then I run gpgv --version from the chroot, and it gives me an error, saying the file can't be found!

A bunch of googling around didn't give me any hints, so I eventually gave up and threw a KEYRING="--no-check-certificate" at the appropriate spot in create-debian-setup.sh, which at least got my install to complete successfully.

Would love to know why the provided version of gpgv is tanking only in the chroot, as I would prefer to keep the GPG stuff in there if I can.

Install failed after busybox symlinks were not created

I'm trying to install LilDebi on a mk808 dongle running Android 4.1 and it failed right away: after starting LilDebi (installed from F-Droid), I clicked "Install...", selected 300MB, then clicked "Install" at which point some text was printed (maybe 3-4 lines of text, the last line probably started with "exec: ") but before I had a chance to read that text I was brought back to the dialog where I can push "Install...".
Is there a way to see the (error?) message? Or is there a way to run the install script by hand from a text terminal?

test-mount-bind doesn't check if origin is mountpoint before bindmounting

From start-debian.sh:
test-mount-bind() {
test -d $1 &&
mount -o bind $1 $mnt/$1
}

Fails to do The Right Thing when $1 is not a mountpoint for an existing mount.

Real-world example:
/mnt/secure/asec and /mnt/secure/.android_secure exist as dir, but neither /mnt/secure nor /mnt/secure/asec nor /mnt/secure/.android_secure are mounted. test -d returns true, of course, but since there is nothing mounted on those files, the bindmount fails.

Crude proposal:
test -d $1 && [ -n "mount | awk -v mnt=$mnt '$2==mnt{print}'" ] && mount -o bind $1 $mnt/$1

This example might not work on your regular system, because e.g. util-linux-ng mount formats its output as 'devpath on mountpoint etc', whereas the mount binary on my android systems leave out the "on". If your mount output has the mountpoint in field 3, just use '$3==mnt{print}', of course.

Cheers,

Manuel

running SSHD during install tanks stop script

for regular stopping, the default pre-stop action, /etc/init.d/ssh stop shuts down SSHD so it's not caught as an open file during the stop script.

but when the stop script is run during install SSHD has been started by the package install, and i don't believe the pre-stop script is called there, as verified by the following install log output:

./stop-debian.sh                                                                                                                                                      
Initialising shell variables                                                                                                                                          
Checking for open files in Debian chroot...                                                                                                                           
Files that are still open:                                                                                                                                            
/debian/dev/null                                                                                                                                                      
/debian/dev/null                                                                                                                                                      
/debian/dev/null                                                                                                                                                      
/debian/usr/sbin/sshd   socket:[32503]                                                                                                                                
/debian/usr/sbin/sshd   socket:[32505]                                                                                                                                

Not stopping debian because of open files 

the following patch fixes this issue:

diff --git a/assets/create-debian-setup.sh b/assets/create-debian-setup.sh
index 113b0ee..daae7dd 100755
--- a/assets/create-debian-setup.sh
+++ b/assets/create-debian-setup.sh
@@ -178,6 +179,11 @@ chroot $mnt apt-get -y install ssh policyrcd-script-zg2 molly-guard
 cp $app_bin/policy-rc.d $mnt/etc/policy-rc.d
 chmod 755 $mnt/etc/policy-rc.d

+# Stop SSHD here, otherwise the stop script will see it as an open file and
+# abort.
+echo "> /etc/init.d/ssh stop"
+chroot $mnt /etc/init.d/ssh stop
+
 echo "> apt-get -y install locales"
 chroot $mnt apt-get -y install locales

debootstrap verify_checksum() failing

one of the commits of Aug 07, 2012 seems to have broken the checksum validation in debootstrap. this was working perfectly until i pulled the updates from that day.

now when first phase debootstrap runs, any package that it tries to download fails with a validation error.

hacking in the following to verify_checksum() in /debian/usr/share/debootstrap/functions:

info VALIDATING "Validation failed: %s, %s, %s, %s" "$expsize" "$relsize" "$expchecksum" "$relchecksum"

i get results like:

I: Retrieving adduser
I: Validating adduser
I: Validation failed: 250368, 250368, edfaffdb7beea7e0e5db61c3b1b210e9, fc4c586d12c9e5e16edc707ec920f2f2e7122689e206fda78374886e7aecfaba

maybe an issue with the embedded md5sum that was recently added to the static busybox executable? i wasn't able to determine that, just a guess.

during install, Release and Arch show defaults even if other selections were made

When I select a different release and architecture than the default (say, Jessie and armhf) and then start the installation, the Release and Arch still show "stable" and "armel" respectively. The correct versions are still being installed, but it's confusing as the user may think they did not actually set their intended options.

install not working on Galaxy Nexus

Hi all,

I'm trying to setup Debian on my rooted Galaxy Nexus with Android 4.1.1 using lildebi. I built it successfully and pushed it on my phone. Next, i started lildebi app and wanted to download and install debian - no success. Hence, I downloaded the image and pushed it on the SD card. Now, when I push the button "Configure Image" I get the output "Unknown id: sh". I attached my ddms log too:

08-07 13:28:56.799: E/su(12776): Unknown id: sh
08-07 13:28:56.806: I/LilDebi(12063): cd /data/data/info.guardianproject.lildebi/app_bin
08-07 13:28:56.806: E/LilDebi(12063): Error!!!
08-07 13:28:56.806: E/LilDebi(12063): java.io.IOException: write failed: EPIPE (Broken pipe)
08-07 13:28:56.806: E/LilDebi(12063): at libcore.io.IoBridge.write(IoBridge.java:462)
08-07 13:28:56.806: E/LilDebi(12063): at java.io.FileOutputStream.write(FileOutputStream.java:187)
08-07 13:28:56.806: E/LilDebi(12063): at java.io.OutputStream.write(OutputStream.java:82)
08-07 13:28:56.806: E/LilDebi(12063): at info.guardianproject.lildebi.LilDebi.writeCommand(LilDebi.java:196)
08-07 13:28:56.806: E/LilDebi(12063): at info.guardianproject.lildebi.LilDebi$CommandThread.run(LilDebi.java:166)
08-07 13:28:56.806: E/LilDebi(12063): Caused by: libcore.io.ErrnoException: write failed: EPIPE (Broken pipe)
08-07 13:28:56.806: E/LilDebi(12063): at libcore.io.Posix.writeBytes(Native Method)
08-07 13:28:56.806: E/LilDebi(12063): at libcore.io.Posix.write(Posix.java:178)
08-07 13:28:56.806: E/LilDebi(12063): at libcore.io.BlockGuardOs.write(BlockGuardOs.java:191)
08-07 13:28:56.806: E/LilDebi(12063): at libcore.io.IoBridge.write(IoBridge.java:457)
08-07 13:28:56.806: E/LilDebi(12063): ... 4 more

I would appreciate any hints and ideas.

Stephan

stop debian failed on install procedure, working install though

Looking at the install.log for an Acer Iconia A500, I found that the ./stop-debian step seems to fail.

./stop-debian.sh
Initialising shell variables
Checking for open files in Debian chroot...
unmounting everything
umount: can't umount /debian: Device or resource busy

losetup -d /dev/block/loop7
losetup: /dev/block/loop7: Device or resource busy

Debian chroot stopped and unmounted.

+ /data/data/info.guardianproject.lildebi/app_bin/start-debian.sh /data/data/info.guardianproject.lildebi/app_bin /mnt/sdcard /mnt/sdcard/debian.img /debian

Restarting it at the end seems to correct this and the install seems to work.

Use ext3?

How can I use ext3 for debian.img? I'm getting annoyed at the fsck problems at startup. I tried "tune2fs -j /dev/loop7" which appeared to work, but at the next boot the FS is force-converted to ext2 somehow.

non-root daemons must be added to aid_inet to get network access

after 'apt-get install tor' and then '/etc/init.d/rc 2' i get the follow output:

Using makefile-style concurrent boot in runlevel 2.
Starting polipo: DNS: couldn't create socket: Permission denied
polipo.
Starting enhanced syslogd: rsyslogd already started.
Starting OpenBSD Secure Shell server: sshd.
Starting periodic command scheduler: cron failed!
Raising maximum number of filedescriptors (ulimit -n) to 16384.
Starting tor daemon: tor...
done.

and from /var/log/tor/log i get:

"Jun 21 20:56:30.778 [warn] Error creating network socket: Permission denied"

so apps, other than SSHD, are unable to create sockets.

can't stop debian

debian won't stop when i click the stop debian button, i first had the bash not found then tried installing again and it worked, i also tried that issue thing with the link to google to see if my wget was broken and it came back ok, how do i force stop lildebi

Cannot run dbench in chroot

I'm not sure this is an issue with lildebi but I'll post it here first.

I wanted to test the speed of the disk, so headed to dbench. It fails on the following :

root@localhost:/tmp# dbench -t 60 2
dbench version 4.00 - Copyright Andrew Tridgell 1999-2004

Running for 60 seconds with load '/usr/share/dbench/client.txt' and minimum warmup 12 secs
can't get private shared memory of 1040 bytes: Function not implemented

running SSHD prevents stop script from completing

the test in stop-debian.sh for open files catches a running SSHD and prevents the stop script from completing. this means you have to shut down SSHD manually from an adb shell or somesuch before running the stop script -- kind of a pain. seeing as how things are configured for the start script to fire SSHD up, it makes sense that the stop script should shut it down.

if the fix suggested at #25 (comment) goes in, then adding this before the open files test should do it:

# Stop SSHD here, otherwise the open file test below will fail.
test -e $mnt/etc/init.d/ssh && chroot /data/debian /etc/init.d/ssh stop

Install fails on Samsung Galaxy Note 2

Here is the content from the install log:

Attached is an log sent by Lil' Debi. For more info, see:
https://github.com/guardianproject/lildebi

manufacturer: samsung
model: GT-N7105
product: t0ltexx
brand: samsung
device: t0lte
board: smdk4x12
ID: JRO03C
CPU ABI: armeabi-v7a
release: 4.1.1
incremental: N7105XXALIJ
codename: REL
SDK: 16

cd /data/data/info.guardianproject.lildebi/app_bin

./create-debian-setup.sh /data/data/info.guardianproject.lildebi/app_bin /storage/sdcard0 /storage/sdcard0/debian.img /debian stable http://ftp.us.debian.org/debian/ 600

exit

  • export PATH=/data/data/info.guardianproject.lildebi/app_bin:/system/bin:/system/xbin:/sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
    Initialising shell variables
  • test -e /data/data/info.guardianproject.lildebi/app_bin/lildebi-common
  • . /data/data/info.guardianproject.lildebi/app_bin/lildebi-common
  • echo Initialising shell variables
  • export TERM=linux
  • export HOME=/root
  • export HOSTNAME=debian
  • [ 7 -lt 1 ]
  • app_bin=/data/data/info.guardianproject.lildebi/app_bin
  • export PATH=/data/data/info.guardianproject.lildebi/app_bin:/usr/sbin:/usr/bin:/sbin:/bin:/system/sbin:/system/bin:/system/xbin
  • [ -z ]
  • sdcard=/storage/sdcard0
  • [ -z ]
  • imagefile=/storage/sdcard0/debian.img
  • [ -z ]
  • mnt=/debian
  • [ -z ]
  • release=stable
  • [ -z ]
  • mirror=http://ftp.us.debian.org/debian/
  • [ -z ]
  • imagesize=600
  • test -d /data/data/info.guardianproject.lildebi/app_bin
  • test -d /storage/sdcard0
  • test -z /storage/sdcard0/debian.img
  • test -z /debian
  • loopdev=/dev/block/loop7
  • busybox_path=/data/data/info.guardianproject.lildebi/app_bin
  • busybox=/data/data/info.guardianproject.lildebi/app_bin/busybox
  • mount -o remount,rw rootfs /
  • [ ! -e /bin ]
  • echo No '/bin' found, linking it to busybox utils
  • cd /
  • ln -s /data/data/info.guardianproject.lildebi/app_bin /bin
    No '/bin' found, linking it to busybox utils
    Creating chroot mountpoint at /debian
  • [ ! -e /debian ]
  • echo Creating chroot mountpoint at /debian
  • mkdir /debian
  • chmod 755 /debian
  • mount -o remount,ro rootfs /
  • grep ext2 /proc/filesystems
    Create the image file:
  • [ -z ext2 ]
  • export DEBOOTSTRAP_DIR=/debian/usr/share/debootstrap
  • echo Create the image file:
  • test -e /storage/sdcard0/debian.img
  • dd if=/dev/zero of=/storage/sdcard0/debian.img seek=600 bs=1M count=1
    1+0 records in
    1+0 records out
    1048576 bytes (1.0MB) copied, 0.034023 seconds, 29.4MB/s
  • test -d /debian
  • test -e /storage/sdcard0/debian.img
  • mke2fs_options=-L debian_chroot -F /storage/sdcard0/debian.img
  • test -x /system/bin/mke2fs
  • mke2fs -L debian_chroot -F /storage/sdcard0/debian.img
    Filesystem label=debian_chroot
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    38480 inodes, 153856 blocks
    7692 blocks (5%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=4194304
    5 block groups
    32768 blocks per group, 32768 fragments per group
    7696 inodes per group
    Superblock backups stored on blocks:
    32768, 98304
  • losetup /dev/block/loop7 /storage/sdcard0/debian.img
    losetup: /dev/block/loop7
  • mount -o loop,noatime,errors=remount-ro /dev/block/loop7 /debian
    mount: mounting /dev/block/loop7 on /debian failed: Device or resource busy
  • exit

Being a bear of very little brain, this suggests the issue is with losetup?

.start-debian.sh: line 21: `test-mount-bind': not a valid identifier

I installed lildebi on my Lenovo LePad y1011, running Android 2.2.1, and it worked great. But since second run, it fails to start, giving only the following output:

./start-debian.sh
Initialising shell variables
.start-debian.sh: line 21: `test-mount-bind': not a valid identifier

By the way, I would like to try to change that problematic line, but I can't understand where the script "start-debian.sh" is stored.

Notice I tried to completely remove Debian and restart from scratch: again, it installs, works great, but second time it doesn't start.

/proc and other mounts don't exist

this code is broken:

# create live mtab
test -e $mnt/etc/mtab && rm $mnt/etc/mtab
ln -s /proc/mounts $mnt/etc/mtab

specifically because /proc/mounts is not accessible from inside the chroot.

is the most reasonable approach to simply copy the contents of /proc/mount to /data/debian/etc/mtab?

Provide a keyring file and pass on --keyring=KEYRING to deboostrap!

Provide a keyring file and pass on --keyring=KEYRING to deboostrap!

(if you look at the manual for deboostrap you will find this
" --keyring=KEYRING
Download signatures for retrieved Release files and check them
against KEYRING. By default, Release file signatures are not
checked.
"
) So... It is probably a good idea to provide a keyring!

Installation fails on devices with broken wget [READ THIS if /bin/bash can not be found!]

NOTE TO USERS: If you see the error message 'Can not execute /bin/bash: No such file or directory' when trying to start LilDebi after installation, this bug might concern you.

Some Android devices seem to ship broken wget (or break wget in weird ways).

To check if your device is one of these, open a shell (using adb shell or the like) and enter the following line (make sure that you're connected to the internet!):
wget http://google.com -O /dev/null; if [ $? -gt 0 ]; then echo "broken"; else echo "okay"; fi

If your output contains "broken" (and there's the line "wget: bad address 'google.com'"), your wget is broken.

The effect on LilDebi is that debootstrap can't retrieve any files from the Debian mirrors, leaving the installation unfinished (debootstrap would, amongst others, install apt-get, so the following stages of the installation will also fail.

WORKAROUND: If you still want to install LilDebi, please download the debian image from https://github.com/guardianproject/lildebi/downloads and run the following commands (on your computer, not on Android):
bunzip debian-squeeze.img.bz2 # uncompresses the image
adb push debian-squeeze.img /sdcard/debian.img # Pushes the image to the right place on Android
Then start LilDebi on Android, press 'Configure Debian', then 'Start Debian'. You will see an error message saying that /etc/init.d/ssh could not be found.
Switch to your adb shell and execute /data/local/bin/debian, then enter the following line:
apt-get install ssh && exit
Confirm the installation (press "y" when apt-get asks you) and wait a few seconds. After apt-get is done, switch to LilDebi and press "Stop Debian" and "Start Debian" again. LilDebi should start without errors now.

SOLUTION (by hc):
Build a custom busybox that includes a non-broken wget.

lilDebi install fails - NookColor CM7.1

CyanogenMod-7.1.0-encore (kernel - 2.6.32.9 erik@myhost #151)

To be clear, this is running off the SD card, not natively installed. Some of the troubleshooting I've done so far:

First, is the device filesystem compatible?

# cat /proc/filesystems
** snip **
nodev   devpts
    ext3
    ext2
    ext4
** snip **

Next, is wget broken?

# wget http://google.com -O /dev/null; if [ $? -gt 0 ]; then echo "broken"; else echo "okay"; fi
Connecting to google.com (74.125.227.51:80)
Connecting to www.google.com (74.125.227.51:80)
null                 100% |*******************************| 12198   0:00:00 ETA
okay

So we know the device supports ext2 and that wget is working as expected. Now, when I run lilDebi, it fails. Below is the logcat from ddms:

02-08 08:20:30.437: I/LilDebi(25251): cd /data/data/info.guardianproject.lildebi/app_bin
02-08 08:20:30.437: I/LilDebi(25251): ./start-debian.sh /data/data/info.guardianproject.lildebi/app_bin /mnt/sdcard /mnt/sdcard/debian.img /data/debian  && chroot /data/debian /bin/bash -c "/etc/init.d/ssh start"
02-08 08:20:30.700: E/su(25579): sudb - Opening database
02-08 08:20:30.700: E/su(25579): sudb - Database opened
02-08 08:20:30.702: E/su(25579): sudb - Database closed
02-08 08:20:30.708: D/su(25579): 10151 info.guardianproject.lildebi executing 0 /system/bin/sh using shell /system /bin/sh : sh
02-08 08:20:31.618: I/LilDebi(25251): Done!

I haven't been able to figure out (yet) how to access the output from lilDebi in a way that allows me to copy/paste it in full here. ./app_log is empty after running the app. Here's a screencap:

screencap

Just to see if there's anything mounted at /data/debian, per @eighthave

# mount
mount
mount: not found

but if I:

# busybox mount
rootfs on / type rootfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
tmpfs on /mnt/asec type tmpfs (rw,relatime,mode=755,gid=1000)
tmpfs on /mnt/obb type tmpfs (rw,relatime,mode=755,gid=1000)
none on /dev/cpuctl type cgroup (rw,relatime,cpu)
/dev/block/mmcblk0p2 on /rom type vfat (rw,noatime,nodiratime,uid=1000,gid=1000,fmask=0117,dmask=0007,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,errors=remount-ro)
/dev/block/mmcblk1p2 on /system type ext4 (ro,relatime,barrier=1,data=ordered)
/dev/block/mmcblk1p3 on /data type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered,noauto_da_alloc)
/dev/block/mmcblk0p7 on /cache type ext4 (rw,nosuid,nodev,noatime,barrier=1,data=ordered)
/sys/kernel/debug on /sys/kernel/debug type debugfs (rw,relatime)
** snip **

There is a lot more output from that command, but nothing shows as mounted on /data/debian, most likely because mount is failing for some reason.

Yesterday, just for kicks, I tried appending busybox to all standalone instances of mount in the shell scripts. lilDebi failed with -- as far as I can tell -- exactly the same output. That could have something to do with the fact that I didn't pick through the scripts with a fine-toothed comb to really see how they were interacting with one another. It was kind of a quick shot in the dark.

If there's any other testing I can do, let me know.

leverage /etc/rcX.d symlinks during start/stop scripts

it struck me recently that it should be feasible to leverage the symlinks at /etc/rcX.d to perform service startup/shutdown during the start/stop scripts. this would allow users to maintain their services in the debian install using the standard update-rc.d approach, instead of custom start/stop scripts.

we should just be able to get a list of the symlinks in the appropriate directory, then loop through and call them with the appropriate start/stop argument, no? the one hitch is that some services (like the network service) shouldn't be called. i think we could work around that by maintaining a small blacklist of services that the start/stop scripts will never call.

i'm not sure about this approach, but at least thought it was worth mentioning as an idea. if you'd like me to work up a patch for it, i'm willing, just let me know.

Can't rezise the chroot

Not sure if this is the correct place to put this, but I chose the default 600MB option when starting Debian and it worked great, but I'm later finding that it wasn't enough. I'd like to resize the chroot but I can't seem to find any documentation on doing this. Is there a set of commands I can run or a file I can edit inside or outside the chroot to resize it?

unknown option -- warning=no-timestamp

I'm getting the same issue as the person in comment 10557 on https://guardianproject.info/code/lildebi/ @2013/04/15 at 10:13 am:

Installing testing (wheezy) with lildebi 0.4.1 yields errors in the install logfile.

Somewhat after

  • chroot /debian apt-get -y install –no-install-recommends ssh policyrcd-script

there is:

unknown option — warning=no-timestamp
dpkg-deb: error: subprocess tar returned error exit status 1
dpkg: error processing /var/cache/apt/archives/libprocps0_1%3a3.3.3-3_armel.deb subprocess dpkg-deb –control returned error exit status 2

which is repeated for each of the 17 installed packages.
Finally, there is:
E: Sub-process /usr/bin/dpkg returned an error code (1)

I get the same thing with testing or stable on a nexus 7 running CM10.1. Installation of sshd fails, so the initial setup script and init script both fail.

New image size is limited to default partition

If you attempt to install Lil Debi on Motorola Photon Q on external storage (SD card), you are limited to maximum size of image that Lil Debi detects as main storage.

Photon Q default setup is

/storage/sdcard0 = internal memory
/storage/sdcard1 = SD card

I have no idea why it does this or if it is standard Android behavior but it's annoyed me in the past.

Steps to reproduce:

  1. Change image path to external (in my case, /storage/sdcard1) in Lil Debi preferences
  2. Create image small enough to fit on /storage/sdcard1 but too big for /storage/sdcard0
  3. Lil Debi reports back with error that there is not enough space to create new image even though there is

/sdcard is a symlink pointing to /storage/sdcard0

/mnt consists of:

asec
external1
obb
sdcard
secure

only secure has something in it.

You can resize the image manually with various tricks (append output of dd to image from /dev/zero to image, resize2fs, etc) but I am not sure how much of this is support on default install and what tools come with it. You may have to do this from a real Linux box.

Can supply more information if requested, run Gentoo on my other comps so not illiterate.

install fails with "mount: mounting /dev/block/loop4 on /debian failed: Invalid argument"

On a stock Nexus One and an HTC Wildfire running CM7.2, the install process will fail after it creates the debian.img file and formats it, it cannot mount it, and dies with the error:

mount: mounting /dev/block/loop4 on /debian failed: Invalid argument

The workaround is to download the debian.img file from the Download page here and put it into the SD card (i.e. /mnt/sdcard)

pkgdetails not found

When I bulid lildebi from source (current HEAD, cab1402), the install fails because it can not find 'pkgdetails' in the setup.

Is it possible that the 'build pkgdetails from source instead of using binary in git' is not finished yet?

There is no way to specify the location of the image

android.os.Environment.getExternalStorageDirectory() on the Lenovo Thinkpad Tablet returns a partition on the built-in storage instead of the removable SD card, and there is no way in Lil' Debi to specify a different location for the image.

This also prevents one from having multiple images or putting the image anywhere but the root directory of the SD card.

Force Shutdown option

When something goes wrong in the chroot and Lildebi says it can' t stop because some sessions are still open, it would be nice to have a feature to force the shutdown (kill -9 style)

start-debian.sh observations on error checking

Howdy.

On Android 4.1.1 (rooted Google Nexus) I had two Google Play applications that ended up preventing /dev/loop7 from working. Two apps in particular proved to be trouble for me, automatically taking /dev/loop7 on system boot (even if the apps were never launched). “Camera Zoom FX”, “Volume Rocker” :

# losetup
/dev/loop7: 0 /data/app-asec/slide.cameraZoom-1.asec

 # losetup
 /dev/loop7: 0 /data/app-asec/volumerocker.core-1.asec

lildebi gives a lot of errors and the script doesn't really deal with this very gracefully. Some suggestions for the start-debian.sh script

losetup: [ $? = 1 ] indicates that there will be a failure.

The mount also returns a 255 result on failure

# root mount for everything Debian
 mount -t ext2 $loopdev $mnt

if [ $? = 255 ] ; then
    echo "Mount returned 255 result"
    sleep 1
fi

at the same place in the script, I suggest some kind of sanity-check that the mount worked

if [ ! -f $mnt/bin/sh ]; then                                                    
     echo "Your mnt $mnt path is missing /bin/sh"
    exit                                                                        
fi                                                                              

generate /etc/passwd and /etc/group from Android data

In Android each app runs as its own user and has its own group. This information is listed in /data/system/packages.list. When starting Debian, Lil Debi should generate /etc/passwd and /etc/group from this file.

when i chroot in terminal/shell i get nothing...

after what seemed like a successful install/bootstarp, the LilDebi startup seems to work.

however, when I open terminal or connect via ADB shell, and type 'chroot /data/debian /bin/bash' I get a blank directory and have no binary commands available.

Unable to start service info.guardianproject.lildebi.InstallService

java.lang.RuntimeException: Unable to start service info.guardianproject.lildebi.InstallService@40fa4680 with null: java.lang.NullPointerException
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2376)
at android.app.ActivityThread.access$1900(ActivityThread.java:123)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1210)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:4424)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:784)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:551)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.NullPointerException
at info.guardianproject.lildebi.InstallService.onStartCommand(InstallService.java:59)
at android.app.ActivityThread.handleServiceArgs(ActivityThread.java:2359)
... 10 more

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.