Launching /system/bin/sh from ssh server - Android Q&A, Help & Troubleshooting

Hi all,
I'm trying to embed an ssh server to the app I'm developing. Hopefully the server start correctly (it is implemented using the apache mina library).
The problem is that when I try to login using putty on my desktop computer, I get this error:
Code:
/system/bin/sh: No controlling tty: open /dev/tty: No such device or address
/system/bin/sh: can't find tty fd
/system/bin/sh: warning: won't have full job control
I've already tried with root permissions, but I get the same error.
What am I doing wrong ? Thanks for the help !

Related

[Q] Read commands' output inside su process

Hello, maybe here someone will help me
I'm writing a file manager app and I want to allow it for browsing with root permissions.
All I have so far is creation of a Process object using Runtime.exec("su"). Then I get output stream from it and write "ls" command. And here goes the question. How to read the output of the "ls"? Getting the input stream from the process gives me stdout of the "su" which is useless.
glodos said:
Hello, maybe here someone will help me
I'm writing a file manager app and I want to allow it for browsing with root permissions.
All I have so far is creation of a Process object using Runtime.exec("su"). Then I get output stream from it and write "ls" command. And here goes the question. How to read the output of the "ls"? Getting the input stream from the process gives me stdout of the "su" which is useless.
Click to expand...
Click to collapse
Use the -c option of su:
Code:
su -c 'ls -l /system/'
I think I'm closer, but still it doesn't work
I have this:
Code:
p = Runtime.getRuntime().exec("/system/bin/su -c 'ls -d -1 "+directory.getAbsolutePath()+"/*'");
So the command for a directory /data will be:
Code:
/system/bin/su -c 'ls -d -1 /data/*'
But it gives me:
Code:
W/su (13979): request rejected (0->0 'ls)
I have tried putting the command's parts into array but then system asks for su permission on every command. For ex. ls /data needs permission and ls /system needs another permission beacuse the command is different.
Not much I can think of to do about that. I had a similar issue once upon a time and I dealt with it by using a script that read its commands from a data file. I'd write the datafile to my program's designated directory (no special permissions required), then run a single command with su and that script would read the datafile to know what to do, otherwise, I had a ****load of su requests bothering the user.
You've got a point there, but making it work with a file manager, where the commands are related to user interaction would be very difficult. Anyway I will put it into my consideration.
I wonder how all these root explorers are made but none of the developers, which I asked so far, were so kind to give me some tips
glodos said:
You've got a point there, but making it work with a file manager, where the commands are related to user interaction would be very difficult. Anyway I will put it into my consideration.
I wonder how all these root explorers are made but none of the developers, which I asked so far, were so kind to give me some tips
Click to expand...
Click to collapse
Well, I suppose you could keep a process open to a shell with root permissions and once open, keep input and output pipes routed to it and send and receive commands as needed.
Gene Poole said:
Well, I suppose you could keep a process open to a shell with root permissions and once open, keep input and output pipes routed to it and send and receive commands as needed.
Click to expand...
Click to collapse
Well, that's what I've tried to do, but as I mentioned in the first post, output pipe gives me stdout of the su process which doesn't write any output (but "ls" does).
glodos said:
Well, that's what I've tried to do, but as I mentioned in the first post, output pipe gives me stdout of the su process which doesn't write any output (but "ls" does).
Click to expand...
Click to collapse
No, I don't think you're following me. Just run su -c 'sh' and it should run a shell and keep it open. From there, you create an input stream, output stream and possibly an error stream, then write commands like "ls -l /system\n" (the \n triggers the shell to execute it) to the output stream, then read the results form the input stream. You keep doing this as needed and when you're done just send "exit\n".
Oh, I understand now. I'll try it ASAP.
Edit:
It works now, but I have problems with stopping the loop. Here is my piece of code:
Code:
String[] cmd = new String[]{"su", "-c", "/system/bin/sh"};
console = Runtime.getRuntime().exec(cmd);
BufferedWriter stdin = new BufferedWriter(new OutputStreamWriter(console.getOutputStream()));
stdin.write("ls -d -1 "+directory.getAbsolutePath()+"/*\n");
BufferedReader stdout = new BufferedReader(new InputStreamReader(console.getInputStream()));
String read;
data1 = new String();
while((read=stdout.readLine())!=null){
data1+=read + "\n";
}
The problem is, that it hangs at some point on invocation of "stdout.readLine()". I have read that it waits for some data to come and it will never be null.
Furthermore if my ls command returns nothing (which can happen) it always hangs forever on readLine().
Anyway I'll try to do something with this. Maybe there is a workaround and reading will not block.
Thank you for your effort, it was really helpful.
glodos said:
The problem is, that it hangs at some point on invocation of "stdout.readLine()". I have read that it waits for some data to come and it will never be null.
Furthermore if my ls command returns nothing (which can happen) it always hangs forever on readLine().
Anyway I'll try to do something with this. Maybe there is a workaround and reading will not block.
Thank you for your effort, it was really helpful.
Click to expand...
Click to collapse
Sorry to ressurect such an old thread. I'd been having the same problem with reads blocking using BufferedReader, InputStream and other variants. Turns out BufferedReader has a ready() method which indicates whether a read() will block. This code works for me:
Code:
String outputStr;
BufferedReader reader = new BufferedReader(new InputStreamReader(suProcess.getInputStream()));
while (reader.ready()) {
outputStr += reader.readLine();
}
Hope it helps someone from the repeating the same frustrations. Heck I hope it helps me in the future in case I forget this

How do I install Ubuntu on Infuse 4G?

Hey guys. I am attempting to install Ubuntu on my rooted Samsung Infuse 4G. I have consulted several how-to articles here and elsewhere, but after several hours of work I am still stuck on the final lines of code in the terminal emulator app that a YouTube tutorial suggested. Below is the code that I have entered thus far, and the error code at the bottom of the list:
-----------------
Ubuntu Chroot Bootloader v0.1
Ubuntu Bootloader is now installed!
This process does NOT damage Android OS!
Original Installer by Charan Singh
Modified for Ubuntu Chroot by Max Lee at AndroLinux.com ,G2Hacks.com and NexusOneHacks.net
To enter the Ubuntu Linux console just type 'bootubuntu'
# bootubuntu
losetup: /dev/block/loop1/sdcard/ubuntu/ubuntu.img: Not a directory
mount: Invalid argument
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
Setting localhost on /etc/hosts
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
failed.
failed.
failed.
failed.
losetup: /dev/loop1: Device or resource busy
# bootubuntu
mknod: /dev/loop1: File exists
losetup: /dev/block/loop1/sdcard/ubuntu/ubuntu.img: Not a directory
mount: Invalid argument
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
Setting localhost on /etc/hosts
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
failed.
failed.
failed.
failed.
losetup: /dev/loop1: Device or resource busy
#
---------------------
I have tried two different installation methods. The first one focused on accessing the advanced shell through Windows Command Prompt. This didn't work because the prompt froze after I typed in "advanced shell" (several attempts brought same results) .
I then tried the "easy" version that involved the terminal emulator app in the place of the command prompt. Assumedly, if I can resolve this last issue without causing any more, I should be able to access Ubuntu through Android VNC. It may be important to note that the time before last when I typed in the above code, I got a different error code. That error read: losetup: /dev/loop1: no such device or address. I don't know what made it change.
I can provide further info if needed. Can anyone plz help?
Sent from my SAMSUNG-SGH-I997 using XDA App
Sent from my SAMSUNG-SGH-I997 using XDA App
Sorry, as far as I know there is currently no way to install Ubuntu on the Infuse 4G. But I'll be working on a rom for it and I'll contact you if it works.
Sorry.
Sent from my SGH-I997 using xda premium
calvinllyman said:
Hey guys. I am attempting to install Ubuntu on my rooted Samsung Infuse 4G. I have consulted several how-to articles here and elsewhere, but after several hours of work I am still stuck on the final lines of code in the terminal emulator app that a YouTube tutorial suggested. Below is the code that I have entered thus far, and the error code at the bottom of the list:
-----------------
Ubuntu Chroot Bootloader v0.1
Ubuntu Bootloader is now installed!
This process does NOT damage Android OS!
Original Installer by Charan Singh
Modified for Ubuntu Chroot by Max Lee at AndroLinux.com ,G2Hacks.com and NexusOneHacks.net
To enter the Ubuntu Linux console just type 'bootubuntu'
# bootubuntu
losetup: /dev/block/loop1/sdcard/ubuntu/ubuntu.img: Not a directory
mount: Invalid argument
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
Setting localhost on /etc/hosts
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
failed.
failed.
failed.
failed.
losetup: /dev/loop1: Device or resource busy
# bootubuntu
mknod: /dev/loop1: File exists
losetup: /dev/block/loop1/sdcard/ubuntu/ubuntu.img: Not a directory
mount: Invalid argument
mount: No such file or directory
mount: No such file or directory
mount: No such file or directory
net.ipv4.ip_forward = 1
Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
bootubuntu: cannot create /data/local/ubuntu/etc/resolv.conf: directory nonexistent
Setting localhost on /etc/hosts
bootubuntu: cannot create /data/local/ubuntu/etc/hosts: directory nonexistent
READY TO ROCK AND ROLL BABY!
Brought to you by NexusOneHacks.net and the open source community!
chroot: can't execute '/bin/bash': No such file or directory
Shutting down Ubuntu
failed.
failed.
failed.
failed.
losetup: /dev/loop1: Device or resource busy
#
---------------------
Click to expand...
Click to collapse
OK. While you can't do it on the infuse. Ever. You could get the lg optimus g which once Ubuntu touch gets CDMA will get Ubuntu touch soon after!
Sent from my LG-LS970 using xda app-developers app

ssh: No controlling tty

I have a rooted a GT-I9195 (SGS4-mini) done with CF-Auto-Root and the latest Busybox. I then decided to use the "Ssh server" from The Olive Tree, since it is simple, small, free, but unfortunately have ads. For on-device/local shell, I use the Android Terminal Emulator and everything works great, including su and shell environment.
However, I have a really strange bahaviour when connecting using ssh via WiFi, and trying to su.
First when connecting via ssh, I get the following message.
Code:
[SIZE=2]$ ssh -2 -4 -t [email protected] -p 50555
Authenticated with partial success.
[email protected]'s password:
/system/bin/sh: No controlling tty: open /dev/tty: No such device or address
/system/bin/sh: can't find tty fd
/system/bin/sh: warning: won't have full job control
[email protected]:/ $[/SIZE]
I have Googled this and there's little useful info. On one site they even say:
Code:
[SIZE=2]Getting a controlling tty
[B]How does one get a controlling terminal? [COLOR=Red]Nobody knows[/COLOR], this is a great mystery.[/B]
The System V approach is that the first tty opened by the process
becomes its controlling tty. The BSD approach is that one has to
explicitly call
ioctl(fd, TIOCSCTTY, ...);
to get a controlling tty.
Linux tries to be compatible with both, as always, and this results in
a very obscure complex of conditions. Roughly:
The [B]TIOCSCTTY [/B]ioctl will give us a controlling tty, provided that (i)
the current process is a session leader, and (ii) it does not yet have
a controlling tty, and (iii) maybe the tty should not already control
some other session; if it does it is an error if we aren't root, or we
steal the tty if we are all-powerful.
Opening some terminal will give us a controlling tty, provided that
(i) the current process is a session leader, and (ii) it does not yet
have a controlling tty, and (iii) the tty does not already control
some other session, and (iv) the open did not have the [B]O_NOCTTY[/B] flag,
and (v) the tty is not the foreground VT, and (vi) the tty is not the
console, and (vii) maybe the tty should not be master or slave pty.
[/SIZE]
Now this is not the end of the world, if it was not that it doesn't understand normal terminal control characters and in addition, when I do su, I loose the command prompt. However, using the "-i" (interactive) switch gets me the "#" prompt, but environment is still completely messed up:
Code:
[SIZE=2][email protected]:/ $ [B]su -c /system/bin/sh -i[/B]
/system/bin/sh: No controlling tty: open /dev/tty: No such device or address
/system/bin/sh: can't find tty fd
/system/bin/sh: warning: won't have full job control
[email protected]:/ #[/SIZE]
I've never had or seen this issue before. Any ideas?
(Also, where would I put a source to my .bashrc and make sure it runs when su'ing or ssh?)
PS. The phone is using a stock 4.2.2 SELinux kernel.
Code:
[SIZE=2]Device: Samsung Galaxy S4 Mini LTE (GT-I9195)
Board/Platform: MSM8930AB (Snapdragon 400)
Baseband: I9195XXUBML4
Kernel: 3.4.0-2340422
[email protected] #1
Build: JDQ39.I9195XXUBML4
SE: SEPF_GT-I9195_4.2.2_0022
ro.build.date: Sat Dec 21 01:46:00 KST 2013
ro.build.description: serranoltexx-user 4.2.2 JDQ39 I9195XXUBML4
[/SIZE]
I still have no idea of what's causing those error messages above, also because logcat is not telling us anything interesting either. Only as Warning from "System.err", but without any useful information. However, I have got some improvement in the terminal behavior when doing the initial ssh connection.
One problem seem to be that the TERM environment variable was copied from local machine (PC side) to remote server (Android phone), thus giving TERM=cygwin to the Android shell. This can be disabled or changed as follows.
Some relevant SSH options:
Code:
[SIZE=2]
-e escape_char
Sets the escape character for sessions with a pty (default: `~'). The escape
character is only recognized at the beginning of a line. The escape charac-
ter followed by a dot (`.') closes the connection; followed by control-Z sus-
pends the connection; and followed by itself sends the escape character once.
Setting the character to "none" disables any escapes and makes the session
fully transparent.
-T Disable pseudo-tty allocation.
-t Force pseudo-tty allocation. This can be used to execute arbitrary screen-
based programs on a remote machine, which can be very useful, e.g. when
implementing menu services. Multiple -t options force tty allocation, even
if ssh has no local tty.
[/SIZE]
Some relevant SSH -o options:
Code:
[SIZE=2][B]RequestTTY[/B]
Specifies whether to request a pseudo-tty for the session. The argument may
be one of: "no" (never request a TTY), "yes" (always request a TTY when stan-
dard input is a TTY), "force" (always request a TTY) or "auto" (request a TTY
when opening a login session). This option mirrors the -t and -T flags for
ssh(1).
[B]
SendEnv[/B]
Specifies what variables from the local environ(7) should be sent to the
server. Note that environment passing is only supported for protocol 2. The
server must also support it, and the server must be configured to accept
these environment variables. Refer to AcceptEnv in sshd_config(5) for how to
configure the server. Variables are specified by name, which may contain
wildcard characters. Multiple environment variables may be separated by
whitespace or spread across multiple SendEnv directives. The default is not
to send any environment variables.
[/SIZE]
So by using the ssh -T option (which is equivalent to using '-o RequestTTY="no"'), we are disabling "pseudo-tty allocation" which doesn't work anyway, but with the effect of not forwarding local TERM to server, and thus setting it to default "vt100" which accepts backspace (but not insert). But a better way is to actually set the TERM variable on our own. This is done by simply adding it as a prefix to the ssh command like this:
Code:
[SIZE=2]TERM=[B]vt220[/B] ssh -t [email protected] -p 50555[/SIZE]
(This effectively, but temporarily overrides the local TERM value and forwards it to remote server shell.)
RanTime!
Since Google intruduced the SELinux/SEAndroid features, they have essentially fukced up the entire AOS ecosystem as based on good-old normal Linux environments and all the years of standards therein. Basically nothing works as before and as logically intended or preferred and I bet from now on, developers will have to spend a significant and expensive time, on just trying to setup their various developer environments and jump through the hoops of dikchead Google engineers, rather than on actual developing. A very sad story all thanks to the populist "security" eye-candy marketing.
The SU time!
Apparently after having read about the various quirks and issues in using an SELinux Enforced based AOS {4}, it seem that the issue from OP is probably due to one of 3 things or a combination thereof.
My su binary (SuperSU 1.94) is not yet handling SElinux properly
The SSHd server is not handling SELinux properly
Lack of properly set SSH and SHELL environment files on the server side
As for (1) I just have to wait and see. For (2) we can only test with other SSHd servers/solutions which I don't know what to use. (They're all, either not free or full of ads. WTF!) And finally, for (3) we can only test, since I don't have the source code...
Unfortunately listing the SuperSU (1.94) command line options is not very helpful, since they're rather poorly explained. While some of the option themselves just doesn't work (for me). It would have been great if @Chainfire could write a more detailed how-to {2} for all these options, but then again we should be extremely grateful he's written anything at all.
Code:
[SIZE=2]Usage: su [options] [--] [-] [LOGIN] [--] [args...]
------------------------------------------------------------------------------------
Options:
-c, --command COMMAND pass COMMAND to the invoked shell
-cn, --context CONTEXT switch to SELinux CONTEXT before invoking
-h, --help display this help message and exit
-, -l, --login pretend the shell to be a login shell
-m, -p,
-mm, --mount-master connect to a shell that can manipulate the
master mount namespace - requires su to be
running as daemon, must be first parameter
--preserve-environment do not change environment variables
-s, --shell SHELL use SHELL instead of the default detected shell
-v, --version display public version and exit
-V display internal version and exit
Usage#2: su LOGIN COMMAND...
Usage#3: su {-d|--daemon|-ad|--auto-daemon|-r|--reload}
auto version starts daemon only on SDK >= 18 or
if SELinux is set to enforcing
Usage#4: su {-i|--install|-u|--uninstall}
perform post-install / pre-uninstall maintenance
[/SIZE]
References:
[1] [Chainfire G+] Next Android version: even more breakage
[2] [Chainfire] How-To SU (Guidelines for problem-free su usage)
[3] SuperSU Download
[4] [Google] Validating Security-Enhanced Linux in Android
From THIS very old post by @mirabilos , it is possible that command-line TAB-completion and up-arrow is not working on all mksh binaries. So perhaps we just need a new static mksh binary installed?
Tab expansion is pretty broken on BSD with xterm and GNU screen, but the same seems to work better on ssh’ing out to Linux, I wonder why, since all software involved is the same… except tput though. But it works like that and is usable. With post-R40 mksh, you can get about with even less hacks (more similarity to AT&T ksh).
Click to expand...
Click to collapse
However, this still doesn't explain why I have no controlling tty for ssh sessions.
Also I tested a new and different SSH server called SSHelper, which has more features and is better maintained, without ads, but is also 6 times larger at ~ 6MB, because of included OpenSSH, FTP and webserver log functionality. When logging in via ssh I get:
Code:
...
Server refused to allocate pty
Followed by an empty non-responsive connection.
Is this the same as […]this problem elsewhere? Man, I'm searching for ideas and keep coming back to your questions all over the 'net
To clarify, I talked to someone at Google; they renamed mksh into just sh lately, but this should have no adverse effect. They currently ship R48 and “would have updated it if I knew there was a new version”. That being said, the code of the shell itself is not at fault here.
The “no controlling tty” message here is a red herring: you do not have access to a tty at all, let alone a ctty
As I said elsewhere, use “ssh -t” and either change the SELinux policies to allow pty/tty pair allocation, or disable it (possibly set it into permissive mode).
@mirabilos: Yes, thanks for that info. I haven't updated this thread since I started it, in anticipation of a writeup about SELinux. However, that proves to be a little over my head, so it will take some time. What is clear though, is that the above problem is connected with the SEAndroid protection mechanisms, which in turn have been mangled and incorporated into Samsungs KNOX.
Also I have been busy making the SSHelper support thread:
[APP][INFO|SUPPORT] SSHelper (The free Android SSH Server Application)
There I have also added a small section about mksh.
@ E:V:A - I recently put together a little package containing all necessary bins/scripts to create a SSH server (via dropbear and dropbearkey) (properly secured, not public) and connect with a SSH client (ssh). The package also contains bins/scripts to create a Telnet server (via utelnetd) and connect with Telnet client (via "static busybox" telnet). Everything works with superuser that I've tested. Linked in my signature and attached to post as well.
Instructions (for anyone who sees this and would like a guide)::
Basically just extract it anywhere with:
Code:
tar -xf easy.ssh.and.telnetz.clients+servers.tar.gz
(if it's in /sdcard/Download which is probable, do "cd /sdcard/Download" then run the above)
Change directory inside the folder:
Code:
cd ./ssh.telnetz
There are 6 scripts: ssh.start(connect to ssh server via ssh), sshd.start(create ssh server), ssh.kill(kill ssh processes and remove ssh server keys), and... 3x telnet scripts for the telnet equivalents.
Running scripts and optional parameters:
Code:
./telnetd.start [ shell ]
e.g. TELNET_PORT=8080 ./telnetd.start /system/bin/mksh
./telnet.start [ ip port ]
e.g. ./telnet.start 192.168.0.3 8080
./sshd.start [ <dropbear_flags_and_options ]
e.g. ./sshd.start (default port is 8090)
./ssh.start [ ip port shell ]
e.g. ./ssh.start 192.168.0.3 8090 /system/bin/mksh
Default ip is the loopback 127.0.0.1 so you can test running a server and connecting to it on your phone at the same time. Just change params as described above to connect from/to your phone (phone is client/server).
***As far as I have tested on Android 4.4.4, this works perfectly as root or restricted user. You can get a su'd ssh shell by starting the sshd.start with /system/xbin/su or just entering su after you've connected as a restricted user.***
I've finally found a work-around for the crippled /dev/pts job-control and su combination. There are two small problems that combines to this issue.
1. The SELinux policy is screwed up by Samsung. And others?
2. The /dev/pts is mounted wrong by default.
The work-around:
Make sure you're device is already in Enforcing mode, so that you get the proper su prompt (#).
1. Open terminal session 1.
Code:
[SIZE=2]
## On Terminal 1
ssh -2 [email protected] -p 2222
$ su -c /system/bin/sh -i
# su 0 setenforce 0
# umount /dev/pts
# su -cn u:r:init:s0 -c "busybox mount -t devpts -o rw,seclabel,relatime,mode=620,gid=5 devpts /dev/pts"[/SIZE]
2. Now go to Terminal 2 and login:
Code:
[SIZE=2]## On terminal 2
ssh -2 [email protected] -p 2222
$
[/SIZE]
(You now have job-control but no su possibility.)
3. Now go back to Terminal 1 and enable Enforcing mode:
Code:
[SIZE=2]## On Terminal 1
# su 0 setenforce 1
[/SIZE]
4. Now go back to Terminal 2 and escalate to su:
Code:
[SIZE=2]## On terminal 2
$ su -c /system/bin/sh -i
# [/SIZE]
Unfortunately if you exit the su (#) shell, you'll have to repeat steps 2-4 of the procedure.

[Q&A] [APP] Linux-on-Android project (Complete Linux Installer)

Q&A for [APP] Linux-on-Android project (Complete Linux Installer)
Some developers prefer that questions remain separate from their main development thread to help keep things organized. Placing your question within this thread will increase its chances of being answered by a member of the community or by the developer.
Before posting, please use the forum search and read through the discussion thread for [APP] Linux-on-Android project (Complete Linux Installer). If you can't find an answer, post it here, being sure to give as much information as possible (firmware version, steps to reproduce, logcat if available) so that you can get help.
Thanks for understanding and for helping to keep XDA neat and tidy!
+1 Like Tweet Rate Thread Add Poll [Q] Android 4.4.2 i9506 "Complete Linux Inst
"Complate Linux Installer" program after I installed the "ubuntu image", "BusyBox", "terminal emulator" and "vnc" I've installed.
The phone has root;
But "Complate Linux Installer" from the image, in the image whenever you start with the error I'm having. If you have information or who will be able to direct; I'm waiting for help.
"Checking loop device... MISSING
Creating loop device... /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh[130]: /data/data/com.zpwebsites.linuxonandroid/files/busybox: Permission denied FAİLED
Error: UNABLE TO CREATE LOOP DEVİCE!
1 [email protected]:/stoage/extSdCard/ubuntu #"
you should type 'su' on the first to get the root permission.
Sent from my A0001 using XDA Free mobile app
busyboX permission denied
Hi,
i have this problem
[email protected]:/ $
[email protected]:/ $ cd /sdcard/ubuntu
[email protected]:/sdcard/ubuntu $ su
sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /sdcard/ubuntu/ubuntu.img
sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /sdcard/ubuntu/ubuntu.img
[email protected]:/storage/emulated/legacy/ubuntu # sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /sdcard/ubuntu/ubuntu.img
MD5 file found, use to check .img file? (y/n)
y
Validating image checksum... /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh[81]: /data/data/com.zpwebsites.linuxonandroid/files/busybox: Permission denied
FAILED!
Error: Checksum failed! The image is corrupted!
1|[email protected]:/storage/emulated/legacy/ubuntu #
the app have permission root. I have reinstalling busybox from launch, but not work.
i have change permission in folder data/data/com.zpwebsites.linuxonandroid/files/ in 0777, but not work.
thanks
damooo90 said:
Hi,
i have this problem
[email protected]:/ $
[email protected]:/ $ cd /sdcard/ubuntu
[email protected]:/sdcard/ubuntu $ su
sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /sdcard/ubuntu/ubuntu.img
sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /sdcard/ubuntu/ubuntu.img
[email protected]:/storage/emulated/legacy/ubuntu # sh /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh /sdcard/ubuntu/ubuntu.img
MD5 file found, use to check .img file? (y/n)
y
Validating image checksum... /data/data/com.zpwebsites.linuxonandroid/files/bootscript.sh[81]: /data/data/com.zpwebsites.linuxonandroid/files/busybox: Permission denied
FAILED!
Error: Checksum failed! The image is corrupted!
1|[email protected]:/storage/emulated/legacy/ubuntu #
the app have permission root. I have reinstalling busybox from launch, but not work.
i have change permission in folder data/data/com.zpwebsites.linuxonandroid/files/ in 0777, but not work.
thanks
Click to expand...
Click to collapse
you don't get the permission .if you get the '$' will be turn into '#'
Sent from my A0001 using XDA Free mobile app
Linux on Android
Hi,
when I start Linux on the App "Linux on Android" i see the folling Error Message "/root/init.sh: line 133 [: ==: unary operator expected". I can't not start the VNC Connection. Whout I con Do?
Thanks for request, Stefan Harbich
I can not run..
How to run on Xiaomi Mi4, It's have internal rom don't have sd card..
makgun said:
I had tried your bootscript.sh but it doesn't work again.
Full log with terminal is
"[email protected]:/ $
[email protected]:/ $ su
/data/data/com.zpwebsites.linuxonandroid/files/busybox chroot /data/local/mnt /root/init.sh
/data/data/com.zpwebsites.linuxonandroid/files/busybox chroot /data/local/mnt /root/init.sh
ox chroot /data/local/mnt /root/init.sh <
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
Start VNC server? (y/n)
y
/root/init.sh: line 110: [: ==: unary operator expected
Start SSH server? (y/n)
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
* Starting OpenBSD Secure Shell server sshd ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
[ OK ]
If connecting from a different machine on the same network as the android device use the address below:
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
eth0: error fetching interface information: Device not foundSave settings as defaults? (y/n) (You can always change it later in the app)
y
Config saved to /root/cfg/linux.config
To shut down the Linux environment, just enter 'exit' at this terminal - and WAIT for all shutdown routines to finish!
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
ERROR: ld.so: object '/vendor/lib/libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
[email protected]:/# "
Click to expand...
Click to collapse
This is happening becuase of SU, chainfire's uses it's own shell.
Clockworkmod SU, defaults back to /, so the cd made before su command cause script to fail. On newer android ChainsDD doesn't work.
App needs to be updated to do su before cd for CWM, and or run su with these options
for Chainfire's "su -p -s /system/bin/sh"
Great app guys. My only issue besides a black screen I've been battling with vnc..is when I download a distro and attempt to open to zip I get "bad file size" and a series of numbers. The only one that didn't do that to me was the small version ofdebian. It anyone has the large or small version of either ubuntu id appreciate a link. And yes I've tried redownloading multiple times.
The torrents have no seeders and the sound forge site always gives be a bad download.
Also if anyone has a good vnc alternative id love to hear about it
nowucmenowudont3 said:
Great app guys. My only issue besides a black screen I've been battling with vnc..is when I download a distro and attempt to open to zip I get "bad file size" and a series of numbers. The only one that didn't do that to me was the small version ofdebian. It anyone has the large or small version of either ubuntu id appreciate a link. And yes I've tried redownloading multiple times.
The torrents have no seeders and the sound forge site always gives be a bad download.
Also if anyone has a good vnc alternative id love to hear about it
Click to expand...
Click to collapse
The torrents seem to have no seeders, I would download from sourceforge, try the 12.04 imgs they seem to work for the bigger imgs. Can always update them to 13 or 14.
need help
i got this app /terminal / vnc/ images and im sure my kernel support loop devices but when i press 'start linux" button it just opens terminal but nothing happens and i dont have any clue what to do (i tried kali and ubuntu images)
(sorry for my bad english)
Hello world,
So I recently tried this Complete Linux Installer. I did all the steps as I should but when I click "Launch" it only opens Terminal Emulator and nothing happens.
So I decided to run the commands manually. It says:
MD5 file found, use to check .img file? (y/n)
n
Checking loop device... FOUND
mount: mounting /dev/block/loop255 on /data/local/mnt failed: Device or resource busy
Error: Unable to mount the loop device!
Or:
bootscript.sh /sdcard/ubuntu/ubuntu-13.10.LARGE.ext4.img <
MD5 file found, use to check .img file? (y/n)
y
Validating image checksum... md5sum: can't open 'ubuntu-13.10.LARGE.ext4.img': No such file or directory
FAILED!
Error: Checksum failed! The image is corrupted!
Does anybody know what is wrong?
Edit:
Got it working now. Big thanks to developers
Problem with launching linux.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Everything what Complete Linux Installer do,is this. And its different of that, what it should do. This result I got everytimes when I want to start linux. Know anybody what with this?
Blank screen
I've got a blank screen in the VNC Client. Everything seems to be running fine though. I tried running Debian.
@GrandMarshall I did have the same issue, but pressing enter with my tablet's keyboard seems to do the trick =)
Problem in Ubuntu Chrome and Mozilla...
It seem that i can open it with connection... but chrome didn't showing the pages even loaded. And the built-in mozilla always crashes...
How can i update , or install some apps or browser in Ubuntu 12 in ? Or How to paste some file and manually install it via Terminal Emulator?
Pls help guys.. thanks a lot in advance for those who will help me
-noob
---------- Post added at 01:11 PM ---------- Previous post was at 12:19 PM ----------
Mozilla always crashes : , help to install or paste the application file to ubuntu dorectory ...
VNC Connection Refused
I've been trying to install Kali Linux on my Samsung Galaxy S3 GT-i9300, but the VNC connection does not seem to work for me. I've tried reinstalling everything several times. I've done everything after the book.
Each time I try to connect this error comes up.
VNC connection failed!
failed to connect to localhost/127.0.0.1 (port 5900):
connect failed: ECONNREFUSED (Connection refused)
I dont have any idea what to do now.
installation of wn722n wifi adapter
Hey I'm trying to connect an external wifi adapter (tp-link wn722n). It shows in lsusb but when I run iwconfig it Returns no wireless extention. Tried to download ath9k and install but now it returns kenral-headers not installed. Now when I'm Trying to install kenral headers (apt-get install linux-headers) it returns wit various options. Which one do I choose? Am I missing something ? Please help.
Got Kali running
I got Ubuntu 13.10 small running as well as kali ext4 the extracted 4 GB in size version
ubuntu runs almost out of the box
for kali I have edited a few file. i'm just gonne post a few but if you want to know what is edited I got some time to sum it up
bootscript.sh version 7.9 added some lines and fixed personal external sdcard
/home/kalilinux/.vnc/xstartup changed desktop start command
/home/kalilinux/.config/lxpanel/LXDE/ copied content from /usr/share/lxpanel/profile/default/* or /usr/share/lxpanel/profile/two_panels/* on the picture I used two_panels profile obviously
/etc/timezone for bash time
/etc/localtime for X time
kalilinux.ext4.img on a linux desktop mounted the image and edited /root/init.sh fixed typo in first boot part. so the image on the site is by default not good I could share mine if anyone is interested
/root/init.sh fixed permissions on the external sdcard as well as added symlinks from the home directory to the manualy added mounts
fixed apt-get key problem so everything is working just have to update the apt-get key sollution to the edited image that would make it complete
lines edited in bootscript.sh and /root/init.sh depend on each other
so not too much and I prefer Kali over ubuntu
s1.postimg.org/qbd8fa84f/kalilinux.png
as seen here got 1.4Gb free space
s12.postimg.org/hzarrjq31/kalilinux1.png
sorry no working links cause I never post stuff http the above lines to see the images
---------- Post added at 03:01 PM ---------- Previous post was at 02:46 PM ----------
HDFord said:
I've been trying to install Kali Linux on my Samsung Galaxy S3 GT-i9300, but the VNC connection does not seem to work for me. I've tried reinstalling everything several times. I've done everything after the book.
Each time I try to connect this error comes up.
VNC connection failed!
failed to connect to localhost/127.0.0.1 (port 5900):
connect failed: ECONNREFUSED (Connection refused)
I dont have any idea what to do now.
Click to expand...
Click to collapse
on your device after startup and having root try :/ # getenforce
this should output "Enforcing or Permissive" you want Permissive and if you have Enforcing change it with :/ # setenforce 0
Enforcing being 1
Permissive being 0
Exit the linux enviroment and reload the image again
if you can now login with VNC on your android device localhost on port 5900
if this worked add " setenforce 0 " without quotes on the first empty line available of your bootscript.sh
and add " setenforce 1 " on the last line of the bootscript.sh
Let me know how you get on
unset LD_PRELOAD
If you get ERROR: ld.so: object 'libNimsWrap.so' from LD_PRELOAD cannot be preloaded: ignored.
add " unset LD_PRELOAD " without quotes on the first empty line of your bootscript.sh
Hi,
How may I make ubuntu play sounds through my Zenfone 6's audio system?
thanks!
Pedro

Finding the cause of permission denials which doesn't appear in the logcat

Hello.
I'm developing a native app for Android, and I'm occasionally confronted with permission denied which doesn't trigger a log in the logcat logs.
For example, trying to run:
Code:
cat /proc/1/maps
from the adb shell prompt results in a permission denied message sent to stderr, but nothing appears in the logcat. It's not a unix permissions problem as well, as anyone should be able to read the file:
Code:
1|[email protected]:/ $ ls -lZ /proc/1/maps
[B]-r--r--r--[/B] root root u:r:init:s0 maps
It happens in some other situations as well, in which I have less control of the environment.
Is it possible that this is caused by some dontaudit rules in the policy? I ran sesearch --dontaudit /sepolicy but didn't find there any relevant rules.
Does anyone here know why are some denials sent to the log and some don't, and how to debug such cases?
Thanks!

Categories

Resources