Results 1 to 9 of 9
- 06-28-2011, 06:55 PM
Thread Author #1
Change hostname, harder than anticipated
Why: the learning experience, and a name that is easier on the eyes.
I've been trying all day to discover how Android designates its hostname, (the name it has on a network). By default it is "ANDROID_<16 digit hexdecimal id>", and on all other Linux systems it is set in /system/etc/hosts. However that file on Android seems to not define the #HOSTNAME. I've been poking and prodding at any file that can be viewed in a text editor, and have not been able to find what I'm looking for. I've done close to a hundred searches and have found nothing about what to modify. Is there something simple I'm overlooking? Can #HOSTNAME="nameofchoice" just be added to the hosts file?
Sidenote; We all know by now that I'm a droidnoob, so ill say it now so you don't have to.
Thanks for your time!Read what I wrote, before you go for my throat. - 06-28-2011, 07:00 PM #2Thanked by:
- 06-28-2011, 07:12 PM
Thread Author #3
- 06-28-2011, 08:34 PM
Thread Author #4
Re: Change hostname, harder than anticipated
Hmm, this doesn't seem to work... here's what I did
Which yields the error "cannot create newame: read only filesystem". I also triedCode:mount -o remount,rw -t yaffs2 /proc /proc echo ANDROID_EA102D43416E041D > newname /proc/sys/kernel/hostname
.Code:mount -o remount,rw -t yaffs2 /proc /proc echo newname > /proc/sys/kernel/hostname
Which yields no response from the terminal, hostname stays the same, and the hostname files contents do not change. I tried making a copy of the file, editing it manually, and then moving it in place of the old, which stuck until reboot, but never changed the hostname.
Am I misunderstanding the syntax? or the procedure entirely?Read what I wrote, before you go for my throat. - 06-28-2011, 08:58 PM #5
- 06-28-2011, 11:52 PM #6....**.../\…•^•…/\...**....
|..................................|Thanked by: - 06-29-2011, 01:07 AM #7
Re: Change hostname, harder than anticipated
Everything found under /proc is part of a virtual file system; the easiest way to change these is an init.d script so that it applies on boot, that's what the xda post is suggesting.
Write a script in notepad++ or gedit or similar (NOT notepad), something along the following lines
where CellPhoneHostName is the name you want applied.Code:#!/system/bin/sh # echo CellPhoneHostName > /proc/sys/kernel/hostname
save it with no extension something like: 88hostname
the number in the name refers to the order at which the scripts are executed on boot up, 1 being first, 99 being last. Most custom roms will have other init.d scripts setup so before you save it make sure the number you are using doesn't exist on your current rom. Just look in /system/etc/init.d/
usually there's just a few scripts in there.
Once you have your script written you will need to copy it to the /system/etc/init.d/ directory
than set the permission, could do it in a terminal, or an adb shell
chown 077 /system/etc/init.d/88hostname
substitute 88hostname for whatever you named your script.
I havn't ever tried to rename the network name on a phone, and I havn't tested this method; the file in question does exist, and the above script will successfully change it. Whether it will yield the correct results I'm not sure. Too lazy to check myself
Good luck
Edit: You didn't say what rom this was. Init.d scripting is not supported in stock.
Edit2: Haha, I must have been half asleep when I wrote this, for anyone trying to do that, the permissions would be chown 0777... Seems I missed 1, sorry lolLast edited by sblood86; 06-29-2011 at 11:25 PM.
Swiss cheese android; the aged stuff, with huge holes.
[MOD] Remap your hardware keys (LG Optimus S and V) || How-To Enable ADB for Kindle Fire (Ubuntu-Linux)Thanked by: - 07-01-2011, 12:00 PM #8
Re: Change hostname, harder than anticipated
If you are using asopCM7 you can edit it by hitting settings>applications> development and then scrolling to the bottom clicking on Device hostname.
- 07-01-2011, 05:30 PM #9


Reply



































