3

I have a root'd G1 phone, and I would like to set its hostname. As root I can run the hostname command and set it, but the name does not survive reboot.

First, I tried creating a /etc/hostname file that only contained my hostname, but that did not work.

Next, I edited /etc/hosts like this:

127.0.0.1     g1-phone localhost

However that failed as well. Are there any other methods I can try to set the hostname permanently?

apaderno
  • 28,547
  • 16
  • 75
  • 90
Rob
  • 3,687
  • 2
  • 32
  • 40

1 Answers1

3

Cyanogen ROM for Android phones includes a userinit.sh script that you can customize. The About page describes it as such:

Runs /system/sd/userinit.sh after A2SD setup and before starting the runtime for user scripts

http://www.cyanogenmod.com/about

I haven't tried putting the hostname command in there because I have read in the forums that it is easy to break that script and either brick or have to reset your phone.

Rob
  • 3,687
  • 2
  • 32
  • 40