# Reinstall network manager



## CannonFodder (Mar 24, 2011)

I was getting rid of all the random programs that I don't need on my desktop and realized too late I removed networkmanager, How do I re-install it or at least access the internet to reinstall the package.
I can't access the internet without it.


----------



## Duality Jack (Mar 24, 2011)

Jesus, which OS? I suppose you could try a repair-install if you have the disks.


----------



## ToeClaws (Mar 24, 2011)

Yes, need to know the OS first. In most OS's, the NIC can be addressed manually to get you back on the Net, then the right package/program can be grabbed to put things back.


----------



## CannonFodder (Mar 24, 2011)

ToeClaws said:


> Yes, need to know the OS first. In most OS's, the NIC can be addressed manually to get you back on the Net, then the right package/program can be grabbed to put things back.


 I use Ubuntu.


----------



## ToeClaws (Mar 24, 2011)

Then you can temporarily set a network address for your Ethernet NIC to get the Network manager again.  Do this with a wired connection since wireless is a lot trickier.  What you'll need to know is a free IP on your network, the subnet mask of your network, the gateway and a DNS server or two.

First, open a command terminal and go to the /etc directory.  Then list the contents of the resolv.conf file like this:


```
cd /etc
cat resolv.conf
```

If there are some IPs in there, then your system already knows some DNS servers to use.  If there are not, you'll need at add at least one.  To add one (or more), use the editor nano like this:


```
sudo nano resolv.conf
```

Once in the editor, add a couple lines like this (I'll use a couple OpenDNS IPs here):


```
nameserver 8.8.8.8
nameserver 8.8.4.4
```

Press Ctrl+X and it will ask you if you want to save - do so.

Next, you need to assign an IP to the Ethernet interface.  To see what interfaces you have, type the following:


```
ifconfig -a
```

You should get something that looks like this:


```
eth0      Link encap:Ethernet  HWaddr 00:11:11:6e:2a:39  
          inet addr:192.168.5.17  Bcast:192.168.5.255  Mask:255.255.255.0
          inet6 addr: fe80::211:11ff:ff6e:2a38/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1314361 errors:0 dropped:0 overruns:0 frame:0
          TX packets:688656 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:333616852 (333.6 MB)  TX bytes:682493081 (682.4 MB)

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:88071 errors:0 dropped:0 overruns:0 frame:0
          TX packets:88071 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:606155418 (606.1 MB)  TX bytes:606155418 (606.1 MB)
```

eth0 is typically the interface you want (though sometimes it may be eth1, or have a different name, but 90% of the time it's eth0).  The difference being that yours won't have an IP assigned to it.

To assign an IP temporarily, enter the IP and subnet you wish to use like this:


```
ifconfig eth0 192.168.5.17 netmask 255.255.255.0 up
```

In this case, I used a fictional IP and class C network mask.  Next, you need to add a route for the default gateway:


```
route add default gw 192.168.5.1 eth0
```

Again, I used a fictional IP for the gateway - replace it with whatever yours is.  You should now be able to connect to the Net.  Fire up a package manager like Apt and get the network manager again:


```
sudo apt-get install network-manager
```

The network manager should download, install and pick up your original configuration.


----------



## theinkfox (Mar 24, 2011)

the problem is, what if he is using a global ip address ?
in that case you are not able asign a fixed ip

maybe you could download the packages from another computer and install them without getting online
then click twice the packages files and it's done

for 10.10 version


----------



## Runefox (Mar 24, 2011)

Whatever happened to the system-wide DHCP client? When did that fall behind the GUI tools? Shouldn't network-manager be a front-end for that?


----------



## ToeClaws (Mar 24, 2011)

theinkfox said:


> the problem is, what if he is using a global ip address ?
> in that case you are not able asign a fixed ip
> 
> maybe you could download the packages from another computer and install them without getting online
> ...


 
There is one potential gotcha here - if the package has dependencies, you'll need to download them as well and have them available for the installer.


----------



## CannonFodder (Mar 24, 2011)

ToeClaws said:


> ```
> sudo apt-get install network-manager
> ```
> The network manager should download, install and pick up your original configuration.


 Okay I get to this part and it says,
network-manager is already the newest version.
0 upgraged, 0 newly installed, 0 to remove and 0 not upgraded.

:\
Does that mean I have it installed?  and if so, I don't see the icon anywhere for it or the applet on the panel.


----------



## ToeClaws (Mar 24, 2011)

Hmm... yep, that would seem to imply it's installed, but maybe not running.  It is called in a couple ways - one is as an UpStart service to activate it's core functionality, then as an applet for use inside of your session.

Try this in a terminal... type:


```
status network-manager
```

Does it return a line with start/running in it?  Or "stop/waiting"?  If the latter, you can try starting it manually with:


```
start network-manager
```

Then go into the GUI and see if it's there.  If it's still not there, or if it was running (without you having to start it) and was not present in the GUI, then the command that launches the applet might have been disabled or removed.

Inside the GUI, click on System then Preferences (or if not using the default menu, just find where ever preferences is).  There is an entry on there called "Startup Applications", and Network Manager should be in there.  If it is and doesn't have a checkmark next to it, put on back.  It should start out when you log out then log back in.  If it's no longer on the list, you'll have to add it back manually.  Create an entry with the name "Network Manager", and for the command, use "nm-applet --sm-disable", and put whatever you want for the comment.


----------



## CannonFodder (Mar 24, 2011)

ToeClaws said:


> Hmm... yep, that would seem to imply it's installed, but maybe not running.  It is called in a couple ways - one is as an UpStart service to activate it's core functionality, then as an applet for use inside of your session.
> 
> Try this in a terminal... type:
> 
> ...


 Okay found it, it's there it's running I put a launcher on the panel but it won't run when I click the icon.


----------



## ToeClaws (Mar 24, 2011)

Oooookay... this is getting odd.  I wonder if some other aspect of networking isn't running.  If you type (in the terminal):


```
initctrl list | grep network
```

Do you see several listings come up?  There should be one for Network manager, some for Network Interfaces, some for Network-interface-security, and also networking.  For Network Manager to work, you may have to shutdown the "networking" one if it's on, which you can do with:


```
stop networking
```

Then reload the GUI and try again. The two processes tend to fight with one another if both running.  If that's not it, I'm officially out of ideas. :/  Can you tell us specifically what you were uninstalling/cleaning to originally cause this?


----------



## CannonFodder (Mar 24, 2011)

hold on I'll give you the exact error message
when I try to start network-manager, this happens

```
start: Rejected send message, 1 matched rules; type="method_call", sender=":1.44" (uid=1000 pid=1459 comm="start) interface="com.ubuntu.Upstart0_6.Job" member="Start" error name="(unset)" requested_reply=0 destination="com.ubuntu.Upstart" (uid=0 pid=1 comm="/sbin/init"))
```


----------



## theinkfox (Mar 24, 2011)

ToeClaws said:


> There is one potential gotcha here - if the package has dependencies, you'll need to download them as well and have them available for the installer.


 
all the dependencies are included on the link


----------



## theinkfox (Mar 24, 2011)

CannonFodder said:


> hold on I'll give you the exact error message
> when I try to start network-manager, this happens
> 
> ```
> ...


 
it looks like the package is there , but it is not compiled
could it be posible ??


----------



## CannonFodder (Mar 24, 2011)

theinkfox said:


> it looks like the package is there , but it is not compiled
> could it be posible ??


 What do I do?


----------



## theinkfox (Mar 24, 2011)

CannonFodder said:


> What do I do?


 
actually i don't know, but for sure if you have the instalation cd you can use it as a repositories library
then you can update or even repair your entire system
folow this guidance

https://help.ubuntu.com/community/Repositories/Ubuntu

if it doesn't work i hope you have a separately /home partition, becuase if it's the case then just repair the entire instalation, your data is safe


----------



## ToeClaws (Mar 24, 2011)

It can't be a compilation issue since the .deb packages from the repositories are already combined binaries and libraries.  I wonder if it's a damaged package?  You can try (once getting the network stuff in manually) to purge the old package and reinstall it like this:


```
sudo apt-get purge network-manager
sudo apt-get install -f
sudo apt-get install network-manager
```

The middle command will fix any potentially broken packages or unmet dependencies.  If that still doesn't resolve it, then I'm at a loss to say what's going on with the Network-manager.  Maybe at that point the better thing to do is just side-step the issue by switching to a different manager like WICD.  You can do that like this:


```
sudo apt-get purge network-manager
sudo apt-get install wicd
```

And maybe that'll be an end to your issue.


----------



## CannonFodder (Mar 24, 2011)

ToeClaws said:


> It can't be a compilation issue since the .deb packages from the repositories are already combined binaries and libraries.  I wonder if it's a damaged package?  You can try (once getting the network stuff in manually) to purge the old package and reinstall it like this:
> 
> 
> ```
> ...


 It says "unable to fetch some archives, maybe run apt-get update or try with --fix-missing?"


----------



## CannonFodder (Mar 25, 2011)

Hold on, I'll give you the error message when I click the application launcher,

```
There was a error launching the application.
Details: Failed to execute child process "nm-applet" (no such file or directory)
```


----------



## ToeClaws (Mar 25, 2011)

You get that error message because if you uninstalled Net-Manager, than the applet no longer exists.  As for the missing files - try doing a "sudo apt-get update" first before installing an alternate manager like WICD, or reinstalling Network-Manager.


----------



## CannonFodder (Mar 25, 2011)

ToeClaws said:


> You get that error message because if you uninstalled Net-Manager, than the applet no longer exists.  As for the missing files - try doing a "sudo apt-get update" first before installing an alternate manager like WICD, or reinstalling Network-Manager.


 "sudo apt-get update" didn't work, so I tried to download the package on my usb and install it from there, so I go-

```
cd /media/USB
dpkd -i a.deb
```
and it gives me a no such directory or file exists.


----------



## CannonFodder (Mar 25, 2011)

Okay so I just said screw it and installed WICD, but when I launch it says, "Could not connect to wicd's D-Bus interface. Check the wicd log for error messages."


----------



## ToeClaws (Mar 26, 2011)

Before doing the apt-get stuff (be it update or installing) you have to do that original set of steps I gave you to put a temporary address on the NIC again, otherwise it won't connect.

*shakes head* and man, this is an odd problem - it seems like there's something more at play, something with part of the networking's automation. :/  

There does come a point though where (regardless of OS) you have to ask yourself what's quicker - troubleshooting the problem, or reinstalling the OS.  If you put your /home into a separate partition, then at least it would be extremely quick and easy to reinstall.  If not... well, as long as you backup the contents of /home (including the hidden files), you could restore it and basically return to the system to the state it was in.  It may also work as such if you choose to do the partitioning manually and just don't format it.  

I'm not sure what else to try. :/  Never seen the networking in error quite like that.  Can you provide a list of what you removed when you were doing your cleaning?


----------



## CannonFodder (Mar 26, 2011)

ToeClaws said:


> Before doing the apt-get stuff (be it update or installing) you have to do that original set of steps I gave you to put a temporary address on the NIC again, otherwise it won't connect.








No wonder.


----------



## CannonFodder (Mar 26, 2011)

```
eth0


Link encap:Ethernet HWaddr 00:0f:20:72:95:9b
BROADCAST MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Interrupt:20

lo

Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
inet6 addr: ::1/128 Scope:Host
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:8 errors:0 dropped:0 overruns:0 frame:0
TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:0
RX bytes:480 (480.0 B) TX bytes:480 (480.0 B)
```


----------



## net-cat (Mar 26, 2011)

If you're sitting behind a standard router (provided by your ISP or purchased at a store,) in most cases, you can temporarily restore internet connectivity by doing this:


```
sudo dhclient eth0
```

If that doesn't restore internet connectivity, then yes. You have to do all that stuff ToeClaws mentioned.

Once that's done, if apt-get is reporting that it's already at the latest version, you probably just mistakenly deleted it off the panel. Right click the panel, add to panel, etc. (I don't have the exact instructions because I don't use Ubuntu at home anymore. I can check when I get to work on Monday if you haven't figured it out by then.)


----------



## CannonFodder (Mar 26, 2011)

net-cat said:


> If you're sitting behind a standard router (provided by your ISP or purchased at a store,) in most cases, you can temporarily restore internet connectivity by doing this:
> 
> 
> ```
> ...


 It says,

```
No DHCPOFFERS received.
No working leases in persistent database - sleeping.
```


----------



## theinkfox (Mar 26, 2011)

CannonFodder said:


> It says,
> 
> ```
> No DHCPOFFERS received.
> ...



are you sure that your internet connection is properly working?
becuase, if it's ok, that's exactly what i was waiting to happen (i'm not a linux expert, i'm just speculating)
because of this 



CannonFodder said:


> ```
> eth0
> 
> 
> ...


 
not a single packet transmitted or received, and not an auto-asigned ip visible (169.254.xxx.xxx)


----------



## CannonFodder (Mar 26, 2011)

theinkfox said:


> are you sure that your internet connection is properly working?
> becuase, if it's ok, that's exactly what i was waiting to happen (i'm not a linux expert, i'm just speculating)
> because of this
> 
> ...


 Ah I think I got it, will try in a minute.


----------



## CannonFodder (Mar 26, 2011)

Success!


----------



## theinkfox (Mar 26, 2011)

CannonFodder said:


> Success!


 
so, what did you do?


----------



## CannonFodder (Mar 27, 2011)

theinkfox said:


> so, what did you do?


 I used my laptop to find my ip and netmask, then did every step through and through, then finally I was able to establish a connection with

```
sudo dhclient eth0
```
So I checked to make sure it worked by rebooting, no connection, then entered it again, worked fine; so then cause it wasn't wanting to work I put the code as a startup application.  Now it works completely fine.


----------



## theinkfox (Mar 27, 2011)

CannonFodder said:


> I used my laptop to find my ip and netmask, then did every step through and through, then finally I was able to establish a connection with
> 
> ```
> sudo dhclient eth0
> ...


 

then instead of that
use this

```
sudo gedit /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp

sudo /etc/init.d/networking restart
```

i'm glad that you solved your problem


----------



## ToeClaws (Mar 27, 2011)

Heh - the potential issues in getting DHCP to work is why I went with giving you the manual way of configuring the NIC.  In the end, it's quicker.


----------

