/etc/hostname gets modified on reboot of ubuntu box


 
Thread Tools Search this Thread
Operating Systems Linux Ubuntu /etc/hostname gets modified on reboot of ubuntu box
# 1  
Old 12-14-2010
/etc/hostname gets modified on reboot of ubuntu box

Hi,
I have a ubuntu box with /etc/hostname entry like abcd-lx . However, if the machine shuts down without a proper shutdown , on reboot, the enter in /etc/hostname looks like %vserverguest%

Also, /etc/hosts gets an invalid entry in place of abcd-lx.

If anyone has any idea, please help!

Thanks,
M
# 2  
Old 12-27-2010
That's strange, it shouldn't change. You can also set the hostname using sysctl, maybe try that

sysctl kernel.hostname=NEW_HOSTNAME
# 3  
Old 12-27-2010
Is this your private machine, or are you using a VPS hoster?
# 4  
Old 12-28-2010
if the problem resists, the (most) final solution is to make a script into but that will write the value you want into /etc/hostname
Use gksudo for a password prompt (because editing suck a file needs extra permissions)
# 5  
Old 12-28-2010
An application is apparently modifying the contents of those file; probably at shutdown? The cleanest way, would be to find the guilty. Perhaps you could temporary rename /etc/hostname and see if someone complains?

The workaround of "rewriting the value in /etc/hostname" shall only work if you do so after the application...

HTH, Loïc
# 6  
Old 12-28-2010
I can't remind the name of the application, but there is a built-in or something application that shows you when a file was modified. I 'd used it 2-3 years ago. You can go find it, and then let it run from start-up till shutdown to see when the name changes. This way you'll find more effectively the guilty.
# 7  
Old 12-29-2010
Perhaps using inotifywait? (utility available in the inotify-tools package)

Cheers, Loïc
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Hostname -f hostname: Unknown host

deleted (0 Replies)
Discussion started by: hce
0 Replies

2. Emergency UNIX and Linux Support

HP UX - ILO Console hostname different than Machine Hostname...

Hi All, So we added a new HP-UX 11.31 machine. Copied OS via Ignite-UX (DVD)over from this machine called machine_a. It was supposed to be named machine_c. And it is when you log in...however when I'm in the ILO console before logging in, it says: It should say: What gives? And how do... (4 Replies)
Discussion started by: zixzix01
4 Replies

3. Solaris

Reboot solaris box(What are all the command outputs)

Hi What are all the command outputs we have to note and keep it for safe before rebooting or shutting down a solaris box (5 Replies)
Discussion started by: newtoaixos
5 Replies

4. Ubuntu

ip on ubuntu installed using Virtual Box

Hi All I have few computers in the same network using a wifi router. In Each of them I installed VirtualBox and I created an image of Ubuntu 8.04 The thing is that each of those images has the same ip eth0=10.0.2.15. Do you know how can I make possible each virtual machine having another IP or... (2 Replies)
Discussion started by: manustone
2 Replies

5. Shell Programming and Scripting

How to get a filename modified by attaching modified timestamp

Hi, I want to modify a filename in AIX by attaching the last modified timestamp. I want the timestamp completely in numerical format (eg:200905081210. yr-2009, mnth - 05, date -08, hr - 12, mins - 10). For example if the filename is a.log and it was modified on April 6th 2008 at 21.00. I... (16 Replies)
Discussion started by: Ruks
16 Replies

6. Solaris

Created a partition and modified vfstab, recieve error after reboot

Hi there Should mention, I am Oracle DBA. Installed Solaris 10 on VM Ware. Created a partition, no hassle there. Modified vfstab, but made a typo, after reboot, received error message. See attached... Any ideas, be greatly appreciated. (2 Replies)
Discussion started by: Ackers
2 Replies

7. UNIX for Dummies Questions & Answers

how to retrieve original contents of a modified file (modified using vi)

Made changes to a file using vi editor and saved those changes now realised that the changes are not required How can I get the previous version of the file.i.e the one which was there on which I had made changes (3 Replies)
Discussion started by: novice100
3 Replies

8. UNIX for Dummies Questions & Answers

Solaris - unknown hostname - how can I change hostname?

Hello, I am new to Solaris. I am using stand alone Solaris 10.0 for test/study purpose and connecting to internet via an ADSL modem which has DHCP server. My Solaris is working on VMWare within winXP. My WinXP and Solaris connects to internet by the same ADSL modem via its DHCP at the same... (1 Reply)
Discussion started by: XNOR
1 Replies

9. Solaris

different between soft reboot and hard reboot

Hi Guru's Can any want here could explain to me the different between soft reboot and hard reboot . Best Regards Seelan (3 Replies)
Discussion started by: seelan3
3 Replies

10. Shell Programming and Scripting

Script to Reboot a linux box from a windows box

HI All, I need a script to reboot a linux box from a windows box. The script needs to run automatically whenever a sitescope alerts with an error message. Have searched for this in the forums, but could not get something relative. Pls. let me know the various alternatives we have to do... (2 Replies)
Discussion started by: Crazy_murli
2 Replies
Login or Register to Ask a Question