Bug 18077 - NetworkManager change hostname so drake tools don't start
Summary: NetworkManager change hostname so drake tools don't start
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: 5
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: All Packagers
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-28 01:01 CEST by Sandro kensan
Modified: 2018-04-24 18:58 CEST (History)
3 users (show)

See Also:
Source RPM: networkmanager / s2u
CVE:
Status comment:


Attachments

Description Sandro kensan 2016-03-28 01:01:30 CEST
Description of problem:

I have installed NetworkManager and I have start the service (boot too) by MCC/Service. My internet connection is always driven by Network center/network applet, in Network settings I have Allow interface to be controlled by NetworkManager: "Automatic".

So at restart I have the new hostname "linux.local":
https://answers.launchpad.net/ubuntu/+source/network-manager/+question/201303

and sometimes MCC don't start. Other drake tools don't works in command line mode.

My Internet connection is always driven by Network center/network applet.

So if the NM service is running but not driven the internet connection, drake tools don't start at random.

Now I have stopped the service NM and MCC and other drake tools works fine and start by CLI too.

P.S. I'm not always on, I have a 3G dongle, so my Internet connections start after the boot time.

I suppose the workaround is to change the hostname setted by NM to "localhost" but I have not found the way to do this.

Aspect result: start the service NM and have drake tools that start in graphic mode and start via CLI.

I have a small problem with num lock that is setted on at boot time but randomly shut down and I must press to power on. Now I have stop NM service and I suppose this small problem will be resolved.
Comment 1 Sandro kensan 2016-03-28 01:02:13 CEST
Similar bug:
https://bugs.mageia.org/show_bug.cgi?id=3782
Comment 2 Marja Van Waes 2016-03-28 10:35:48 CEST
Assigning to all packagers collectively, since there is no maintainer for this package.

CC: (none) => marja11
Assignee: bugsquad => pkg-bugs
Source RPM: (none) => networkmanager

Comment 3 Florian Hubold 2016-03-28 11:03:25 CEST
Seems this is still necessary: https://bugs.mageia.org/show_bug.cgi?id=3782#c48

CC: (none) => doktor5000
Source RPM: networkmanager => networkmanager / s2u

Comment 4 Sandro kensan 2016-03-28 16:12:22 CEST
Today all go fine, MCC starts,  $hostname is localhost and I have found a nice workaround:

Stop NM service, don't start at boot.
Add to the file /etc/rc.d/rc.local:
/bin/bash -c "sleep 150; date +%Y-%m-%d\ %H:%M:%S; systemctl start networkmanager" > /home/sandro/bin/log/nm.log&

reboot.

Note: rc.local have a known bug with proper workaround (it is not correctly handled by system.d). https://forums.mageia.org/en/viewtopic.php?f=23&t=10515#p60984
Comment 5 Frank Griffin 2016-03-28 18:11:22 CEST
Just out of curiosity, if you're driving all your interfaces from net-applet, why are you even installing NetworkManager ?

CC: (none) => ftg

Comment 6 Sandro kensan 2016-03-28 21:53:42 CEST
> Just out of curiosity, if you're driving all your interfaces from net-applet, 
> why are you even installing NetworkManager ?

The reason is that an useful program required it. I think I can substitute It with VNstat but I should do modify the source code (python) ad chance all the referrer to NM to VNstat.

The program is NTM, a system tray program for monitor my Internet connection that I pay every 28 days and I get maximum 12 Gbyte of data.

By the way you question is correct: not everybody install NM without use it.
But Ubuntu use it widespread so many programs recall it.
Comment 7 Florian Hubold 2016-03-28 22:11:43 CEST
Well, if you don't use networkmanager, why enable it? Does NTM need the networkmanager systemd services enabled?

(In reply to Sandro kensan from comment #4)
> Note: rc.local have a known bug with proper workaround (it is not correctly
> handled by system.d).
> https://forums.mageia.org/en/viewtopic.php?f=23&t=10515#p60984

That thread is about preload, which caused issues and should already be disabled by a later update.
Comment 8 Sandro kensan 2016-03-28 22:23:26 CEST
(In reply to Florian Hubold from comment #7)
> Well, if you don't use networkmanager, why enable it? Does NTM need the
> networkmanager systemd services enabled?

Yes. If I stop the Service NM, NTM don't start and I get an error.

> (In reply to Sandro kensan from comment #4)
> > Note: rc.local have a known bug with proper workaround (it is not correctly
> > handled by system.d).
> > https://forums.mageia.org/en/viewtopic.php?f=23&t=10515#p60984
> 
> That thread is about preload, which caused issues and should already be
> disabled by a later update.

Your suggest to mask preload is useful to have rc.local working as service. Without the mask the boot phase stop. BTW it is an other problem. If you want I open a new bug.
Comment 9 Frank Griffin 2016-03-29 01:23:44 CEST
NM's record of playing well with nm-applet is pretty spotty.  The sharing is accomplished by specifying in /etc/NetworkManager/NetworkManager.conf:

[main]
plugins=keyfile,ifcfg-rh

It's the "ifcfg-rh:" that causes NM to go look for /etc/sysconfig/network-scripts/ifcfg-(interfeacename) and decide whether to try to control the interface based on whether some keyword (I forget which) tells NM to keep its paws off or not.

Most people who have decided to use NM have dropped back to simply use

[main]
plugins=keyfile

and let NM handle everything.  

As for your hostname problems, if you're going to use a DHCP service which supplies a hostname, you have to accept what they give you, or else use another keyword:

[keyfile]
hostname=xxxxx

This will force the hostname to xxxxx regardless of what DHCP returns.
Comment 10 Frank Griffin 2016-03-29 01:33:35 CEST
Your other option is to edit /etc/dhcpcd.conf and change:

# A list of options to request from the DHCP server.
option domain_name_servers, domain_name, domain_search, host_name

to eliminate "host_name".  This will prevent DHCP from returning a hostname and may give you what you want.  You may still have to use the NM conf "hostname" to specify "localdomain.localhost" if that's what you want.
Comment 11 Florian Hubold 2016-03-29 16:13:31 CEST
@Frank: Sorry, but this doesn't help with the actual underlying problem that should be fixed at NM level, see my comment 3 and the explanation in the older bug linked there.
Comment 12 Frank Griffin 2016-03-29 16:29:22 CEST
@Florian: Yes, I read the older bug, and you are correct that if the hostname changes NM should be running s2u.  However, it sounds like the OP wants the hostname set identically whether NM or net-applet is doing it.  If he's getting localhost.localdomain from net-applet, then he doesn't have "get hostname from DHCP" checked in drakconnect, and drakconnect is providing localhost.localdomain by default.  If NM gives him linux.local, it's either getting that from DHCP or supplying it as NM's default.  In the former case, disabling host_name in the DHCP client is what's needed, and in the latter case he needs to change NM's default with the "hostname" keyword in the conf file.  The older bug only comes into play if the hostname actually changes, which does not seem to be what he wants.
Comment 13 Sandro kensan 2016-03-29 21:35:47 CEST
(In reply to Frank Griffin from comment #9)

> [keyfile]
> hostname=xxxxx
> 
> This will force the hostname to xxxxx regardless of what DHCP returns.

Yes I know. I have find this info by googling without success.
It is my conf file:

[main]
plugins=ifcfg-rh,keyfile

[keyfile]
hostname=localhost

Is it correct? However I don't get success, I have always $hostname print linux.local.

BTW It is a workaround simpler than mine if it works.

@Florian: My expectation is that an important program like NM works fine in Mageia and indeed a simple installation break Mageia. I have resolved my problem, now NM works fine in my linux box but all the workaround are not simple and are not nice, it is better to delete the bug if the bug exists.

In the next step of mageia (mageia 6) I have to recreate the workaround at installation time and it takes time and I must to remember the how to do.
Comment 14 Florian Hubold 2016-03-29 23:48:59 CEST
(In reply to Sandro kensan from comment #13)
> @Florian: My expectation is that an important program like NM works fine in
> Mageia and indeed a simple installation break Mageia. I have resolved my
> problem, now NM works fine in my linux box but all the workaround are not
> simple and are not nice, it is better to delete the bug if the bug exists.
> 
> In the next step of mageia (mageia 6) I have to recreate the workaround at
> installation time and it takes time and I must to remember the how to do.

I'm using NM since Mageia 3 as a normal DHCP client which is a pretty standard setup and and never encountered such an issue. It would be good if you provide some clearly reproducable steps to recreate the issue you see.

FWIW I've described how to switch to networkmanager in this forum thread: https://forums.mageia.org/en/viewtopic.php?f=25&t=5782
Comment 15 Sandro kensan 2016-03-30 00:45:26 CEST
@Florian
They are the steps:

1) install NM: http://www.kensan.it/tmp/urpmi.txt
2) Start MCC=>System=>Service=>NetworkManager (running and On boot V)
3) reboot
4) $hostname print linux.local

P.S. this is my net-applet configuration:
http://www.kensan.it/tmp/net-applet.png
Comment 16 Sandro kensan 2016-03-30 01:04:53 CEST
EDIT:
in my configuration when $hostname print linux.local don't start for example #logdrake

Now I have the message:
# logdrake
Ignore the following Glib::Object::Introspection & Gtk3 warnings
Subroutine Gtk3::main redefined at /usr/lib/perl5/vendor_perl/5.20.1/Gtk3.pm line 296.

and logdrake starts.
Comment 17 José Jorge 2016-03-30 17:23:16 CEST
(In reply to Sandro kensan from comment #15)
> They are the steps:
> 
> 1) install NM: http://www.kensan.it/tmp/urpmi.txt
> 2) Start MCC=>System=>Service=>NetworkManager (running and On boot V)
> 3) reboot
> 4) $hostname print linux.local
> 
I could not reproduce with this steps.
Between, the only place where I put the hostname is /etc/sysconfig/network and it is not overwritten either by drakconf or networkmanager...

CC: (none) => lists.jjorge

José Jorge 2016-03-30 17:23:33 CEST

CC: lists.jjorge => (none)

Comment 18 Sandro kensan 2016-03-30 20:48:47 CEST
(In reply to José Jorge from comment #17)
> (In reply to Sandro kensan from comment #15)
> > They are the steps:
> > 
> > 1) install NM: http://www.kensan.it/tmp/urpmi.txt
> > 2) Start MCC=>System=>Service=>NetworkManager (running and On boot V)
> > 3) reboot
> > 4) $hostname print linux.local
> > 
> I could not reproduce with this steps.

Now I have try the steps, exactly only the 2, 3, 4) steps and $logdrake starts and MCC too, but numlock don't starts and the light is off. Sometime MCC and the other drake tools don't starts.

> Between, the only place where I put the hostname is /etc/sysconfig/network
> and it is not overwritten either by drakconf or networkmanager...

I have try to put HOSTNAME=localhost without success, $hostname print linux.local
Comment 19 Sandro kensan 2016-03-30 22:37:48 CEST
Ok, some other steps.
I have disabled the add service that maybe confuse and that I have add (rc-local and vnstat).

If I reboot with my router on for five times I have num lock led power off and MCC starts all the times, same for $logdrake.

If I power off the router and power on when pc is power on then I have numlock led off and MCC don't start, same for $logdrake that shows the usual message:

Ignore the following Glib::Object::Introspection & Gtk3 warnings
No protocol specified
Cannot be run in console mode.

I have try to connect the Ethernet cable to the router after 1 minute the Restart time (power on time), my boot time is 1:40 (from power on and the bell) and the result is MCC don't start like $logdrake.

If I disable the service NM my numlock led is on and MCC start.

I suppose that if the Ethernet cable is connected at about 1/2 the boot time then MCC don't start. BTW numlock is almost always off when the desktop appear.
Comment 20 Sandro kensan 2016-03-31 01:57:28 CEST
Ok, it is the final result:

1) install NM: http://www.kensan.it/tmp/urpmi.txt
2) Start MCC=>System=>Service=>NetworkManager (running and On boot V)
3) create /etc/rc.d/rc.local :
   $ cat rc.local 
   #!/bin/sh
   exit 0
4) Start rc-local.service on boot
5) if the pc don't boot add this mask:
   # systemctl mask preload.service
6) set autologin and set numlock led on at boot time
7) reboot
8) $hostname print linux.local

Aspect result: Numlock led on
Actual result: Numlock led off

Now I have a boot window time of 1:40 minute from power on to the bell and there is an interval time of 60 seconds that has unexpected result. If in this interval Ethernet cable is plug in the router, for example in my pc after 1 minute of the boot time, then Led (Numlock) is off, MCC don't start and $ logdrake don't start with various messages like:

(*)Invalid MIT-MAGIC-COOKIES-1 Key Cannot be run in console mode
or
(#)No protocol specified Cannot be run in console mode

My experiments:
Trouter = time of power on my modem router 3G
Tpc = time of power on PC

Trouter-Tpc    RESULTS
-------------------------------------
+20 sec        MCC (OK), $ logdrake(OK), LED Numlock(off)
+10 sec        No Autologin, show the login request with the text Linux.local
 0  sec        MCC (don't start), $ logdrake(don't start), LED Numlock(off), (*)
-10 sec        MCC (don't start), $ logdrake(don't start), LED Numlock(off), (*)
-20 sec        MCC (don't start), $ logdrake(don't start), LED Numlock(off), (#)
... idem for -20, -30, -40, -50 and -60 sec ...
-60 sec        MCC (don't start), $ logdrake(don't start), LED Numlock(off), (#)
-70 sec        MCC (don't start), $ logdrake(OK), LED Numlock(off)
-80 sec        MCC (OK), $ logdrake(OK), LED Numlock(off)
Comment 21 Sandro kensan 2016-03-31 23:57:14 CEST
I have done a fresh installation of mageia5  in my SSD and I'm not able to replicate the main bug.

Now I have only this little bug:

1) #urpmi NetworkManager
2) Start MCC=>System=>Service=>NetworkManager (On boot V)
3) set autologin and set numlock led on at boot time
4) reboot
5) $hostname print localhost.localdomain
6) Numlock led is off

The only little bug is Numlock off.
Comment 22 Marja Van Waes 2018-04-24 18:58:53 CEST
(In reply to Sandro kensan from comment #21)
> I have done a fresh installation of mageia5  in my SSD and I'm not able to
> replicate the main bug.
> 
> Now I have only this little bug:
> 
> 1) #urpmi NetworkManager
> 2) Start MCC=>System=>Service=>NetworkManager (On boot V)
> 3) set autologin and set numlock led on at boot time
> 4) reboot
> 5) $hostname print localhost.localdomain
> 6) Numlock led is off
> 
> The only little bug is Numlock off.

Thanks, closing as fixed then.

If the other issue is still valid in Mageia 6, then please check whether there's an existing bug report for it, before filing one. Thanks :-)

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.