1

I am facing the problem mentioned here : Original Problem

I saw on this thread 2 something close to my problem, but when i try to type the command suggested i mean this one

sudo vi /etc/init.sh

I get the following error

enter image description here

I read on the net that there is no sudo for android and that I should type su instead and that's whay I did so i get this error :

enter image description here

What is correct way to do that ?

In case you can help for my first topic it will be great, but if not please at least tell me what is the right command so that i try the solution of the link above, maybe it help me to solve my problem.

I am new to android and don't know at all linux that's why i am asking.

Thanks in advance.

Community
  • 1
  • 1
JustGreat
  • 551
  • 1
  • 11
  • 26
  • Maybe you didn't read that I know nothing about emulator, android and linux, so would you please clarify ? for you, my prompt indicates much while for me I don't understand at all my prompt..please explain to me, and if you have any answer for the main topi that cause me problem i will be thankfull, as it seems you are skillfull in such systems, while I know only windows – JustGreat Apr 09 '14 at 14:51

2 Answers2

2

su means "Switch User" and just typing su will switch you to root

su is not sudo, so typing su vi will try to switch you to the vi user, which obviously doesn't exist

you need to do su and vi in two separate commands

however, it seems like you are already root, so just typing vi will be sufficient.

however, tread carefully, because using the root user without understand exactly what you are doing is a good way to mess the system up completely

Chris Pickard
  • 147
  • 1
  • 3
  • Thanks for this clarification...In fact as mentioned it's just a vm emulator, so i can mess with it and delete it at anytime ... I am new to android so i am setting up this vm to use it as emulator to start programming for android ... To get back to the question, the guy suggested people to try following – JustGreat Apr 09 '14 at 15:17
  • sudo vi /etc/init.sh add 4 lines below to init.sh netcfg eth0 dhcp echo nameserver > /etc/resolv.conf dnsmasq setprop net.dns1 8.8.8.8 Would you please explain to me if i am already rooted which is true, what should I type instead to do the same ? and if you can explain to me what are doing these commands so I understand that ? Thanks a lot...once again in case you first would like to know why i am doing this, my basic problem is the one mentioned here : http://stackoverflow.com/questions/22943704/no-network-in-android-x86-on-virtualbox-4-4-2 – JustGreat Apr 09 '14 at 15:17
1

There is no need for sudo or su or anything like that, as the adb shell on the emulator already runs as root.

In fact your prompt root@x86 is conveniently indicating as much.

Whatever commands you are wishing to run as root may or may not be available or wise to utilize - but whatever you invoke will run as root, if it runs at all.

For the record, in addition to being unneeded your su command is probably not working because su thinks vi is the user you want to become. Chances are you need to use some flag to tell it that what follows is a command - perhaps -c however if you have an su usable for escalation then you have must have a nonstandard one that differs from AOSP sources, so its behavior cannot be precisely predicted without knowing the details of the specific implementation you are using.

Chris Stratton
  • 39,853
  • 6
  • 84
  • 117
  • Thanks for trying to help, What do you mean is that the commands I try to run won't work because they are not supposed to work because i have an android X86 version ? sorry for such question, but am completly new to that domain ... would you please check my main problem mentioned above and tell me if I can adapt any of these commands to make the installation of my android on the VM ? Details are in links mentionned in my post, if you check them you will understand what I need to do – JustGreat Apr 09 '14 at 14:55
  • That's a different question, and far too vague of one for this forum. Someone has apparently given you some advice for how to modify your system - but apparently incomplete or mistaken advice, as they didn't realize you'd already be root. Normally such an oversight (or even simply making configuration changes you don't understand based on unverified advice) would be a poor and risky idea. But you are playing with an *emulator* which is about the closest thing to a safe a learning environment as can be imagined; if you break it, just delete the virtual image and make a new one. – Chris Stratton Apr 09 '14 at 14:57
  • yes that's why I posted the question here to understand what is the purpose of these commands...As you said am on a virtual device so no risk, I can delete it and create it again...but even I need to understand what I am doing and if it's really gonna help me to solve my network problem ! I think that to setup the vm it requires networkd and that my emulator is not finding the connection, if you can check please this http://stackoverflow.com/questions/22943704/no-network-in-android-x86-on-virtualbox-4-4-2 you will understand me. – JustGreat Apr 09 '14 at 15:02