Hostname changes when booting Windows

Here you'll find a place for solutions and hints.

Please use one of the support subforums below for questions or if you have any issues and need support.

Hostname changes when booting Windows

Postby Parckwart » Mar 30th, '14, 18:41

On my laptop I dual boot Windows 7 and Mageia 4 using GRUB2. Everytime I boot into Windows the hostname of Mageia changes to localhost.localdomain. That's annoying. How can I make it stop? :)
Parckwart
 
Posts: 11
Joined: Oct 27th, '13, 10:12

Re: Hostname changes when booting Windows

Postby madeye » Mar 30th, '14, 19:16

What does the contents of /etc/hostname show?

Run the following in a terminal and include the result in a message here in the forum.
Code: Select all
cat /etc/hostname
- Madeye

When I supply commands in an answer, please make sure you understand them before you run them! Use google or man to check!
User avatar
madeye
 
Posts: 110
Joined: Jul 23rd, '11, 12:36
Location: Aabenraa, Denmark

Re: Hostname changes when booting Windows

Postby Parckwart » Mar 30th, '14, 19:24

That's the file I edit to change the hostname. Currently it's NB3422 which is the hostname I want. But after I once booted Windows, it's localhost.localdomain again.
Parckwart
 
Posts: 11
Joined: Oct 27th, '13, 10:12

Re: Hostname changes when booting Windows

Postby doktor5000 » Mar 30th, '14, 19:33

Please show the output of
Code: Select all
cat /etc/hostname
cat /etc/hosts
cat /etc/sysconfig/network
grep -i -e dhcp -e dns /etc/sysconfig/network-scripts/ifcfg-*
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Hostname changes when booting Windows

Postby Parckwart » Mar 30th, '14, 19:58

Code: Select all
[parckwart@localhost ~]$ cat /etc/hostname
NB3422
[parckwart@localhost ~]$ cat /etc/hosts
127.0.0.1               localhost
[parckwart@localhost ~]$ cat /etc/sysconfig/network
HOSTNAME=localhost.localdomain
NETWORKING=yes
CRDA_DOMAIN=US
[parckwart@localhost ~]$ grep -i -e dhcp -e dns /etc/sysconfig/network-scripts/ifcfg-*
/etc/sysconfig/network-scripts/ifcfg-enp0s25:BOOTPROTO=dhcp
/etc/sysconfig/network-scripts/ifcfg-enp0s25:DHCP_CLIENT=dhclient
/etc/sysconfig/network-scripts/ifcfg-enp0s25:PEERDNS=yes
/etc/sysconfig/network-scripts/ifcfg-wlp3s0:BOOTPROTO=dhcp
/etc/sysconfig/network-scripts/ifcfg-wlp3s0:DHCP_CLIENT=dhclient
/etc/sysconfig/network-scripts/ifcfg-wlp3s0:PEERDNS=yes

Interesting. So do I have to change the HOSTNAME in /etc/sysconfig/network?
Parckwart
 
Posts: 11
Joined: Oct 27th, '13, 10:12

Re: Hostname changes when booting Windows

Postby doktor5000 » Mar 30th, '14, 21:08

Parckwart wrote:
Code: Select all
[parckwart@localhost ~]$ cat /etc/hosts
127.0.0.1               localhost
[parckwart@localhost ~]$ cat /etc/sysconfig/network
HOSTNAME=localhost.localdomain


Interesting. So do I have to change the HOSTNAME in /etc/sysconfig/network?

Yes, and also for good measure in /etc/hosts (add a new line for 127.0.0.1 with your hostname)
AFAIK /etc/hostname is only used by systemd (hostnamectl)
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Hostname changes when booting Windows

Postby madeye » Mar 30th, '14, 21:46

That's very Interresting. I don't even have HOSTNAME= in /etc/sysconfig/network
Maybe that's why my /etc/hostname is never overwritten.
- Madeye

When I supply commands in an answer, please make sure you understand them before you run them! Use google or man to check!
User avatar
madeye
 
Posts: 110
Joined: Jul 23rd, '11, 12:36
Location: Aabenraa, Denmark

Re: Hostname changes when booting Windows

Postby doktor5000 » Mar 30th, '14, 21:55

Well, it all depends how you set the hostname initially.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 17630
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany


Return to The magician suggests...

Who is online

Users browsing this forum: No registered users and 1 guest

cron