0

I used this QUESTION to configure the default of Ubuntu 14.10 to start in RUNLEVEL 1

but when I switch to another RUNLEVEL (2,3,or 5) , there is no network connection and I have to start the network using command NetworkManger

is this a normal behaviour , and if not how to configure the network to start automatically when I switch run levels

Fat Mind
  • 2,445
  • 4
  • 25
  • 41

1 Answers1

0

Network manager is in fact a (local) server, that acts on requests of a (local) client. This client is normaly the network applet in a desktop and thus of course belongs to a GUI session.

Small explain

-----------------------------------------------------------------------------------------------------------------------------
| run level |             name                |     Description                                                             |
-----------------------------------------------------------------------------------------------------------------------------
|     2     |         Multi-User Mode         | Does not configure network interfaces and does not export networks services |
|     3     | Multi-User Mode with Networking | Starts the system normally                                                  |
|     4     | Not used / user definable       | For special purposes                                                        | 
|     5     | System normally with GUI        | Run level 3 + display manager                                               |
-----------------------------------------------------------------------------------------------------------------------------

Propose for you is to disable Network Manager and configure interfaces manually.

Stop the Network Manager process

sudo service network-manager stop

Disable it

echo "manual" | sudo tee /etc/init/network-manager.override

or you can remove NetworkManager from the system

sudo apt-get purge network-manager

Then you need to manually set network

Edit /etc/network/interfaces and write ip,netmask ...

auto eth0
iface eth0 inet static
address xxx.xxx.x.xx
gateway xxx.xxx.x.x
netmask xxx.xxx.xxx.x
network xxx.xxx.x.x
broadcast xxx.xxx.x.xxx

After entering all the details you need to restart networking services using the following command

sudo /etc/init.d/networking restart

Setting up DNS

Edit /etc/resolv.conf

sudo nano /etc/resolv.conf

write

nameserver dns_server_ip
nameserver dns2_server_ip

After this step, your network will be configured without NM and will be work on run level 3 and 5.

Edit 1

You can start any app when login into GUI automatically if you put a .desktop file in ~/.config/autostart to run applications after a user login. This may have following content:

nano ~/.config/autostart/nm.desktop

[Desktop Entry]
Type=Application
Name=<Name of application as displayed>
Exec=<command to execute>
Icon=<full path to icon>
Comment=<optinal comments>
X-GNOME-Autostart-enabled=true
2707974
  • 10,553
  • 6
  • 33
  • 45
  • as far as i know , runlevel 2 to 5 are almost the same and they all have GUI , and this is what I get when I use init 2 , and my question is how i start NetworkManger automatically not remove it – Fat Mind May 21 '15 at 17:08
  • I made Edit 1 in answer – 2707974 May 22 '15 at 06:54
  • 1
    This client is normaly the network applet in a desktop and thus of course belongs to a GUI session Wait, what about booting to command line ? If NetworkManager starts with GUI login, why then it works when booting to tty ? nmcli ? There's also dmesg entries for NetworkManager when system boots – Sergiy Kolodyazhnyy May 22 '15 at 07:05