LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian
User Name
Password
Debian This forum is for the discussion of Debian Linux.

Notices


Reply
  Search this Thread
Old 03-17-2010, 08:29 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Restarting Network Service


I haven't been active in Debian for two years back when Lenny was still in 'testing' and noticed that for some reason it is no longer protocol to restart network services using the 'init.d' scripts. I also noticed the same for Ubuntu (which I don't use or could care about) and am trying to understand what is the correct way now for Debian and what changed? I did a search on Google but didn't turn up any results.

Is it no longer correct to run:

Code:
/etc/init.d/network restart
 
Old 03-17-2010, 10:49 PM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
I think the "correct" way to restart daemons these days is to use invoke-rc.d. For example

Code:
invoke-rc.d network restart
Using invoke-rc.d will only start the service if it is supposed to be running at the current runlevel. This behavior can be bypassed with the --force flag.

I think the idea for using invoke-rc.d is partly because, although it is currently only for sys V init, in principle it could be adapted to any init system.

Evo2.
 
Old 03-18-2010, 01:26 PM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Not working for me...

Code:
root@perfserv1:~# invoke-rc.d network restart
invoke-rc.d: unknown initscript, /etc/init.d/network not found.
 
Old 03-18-2010, 04:23 PM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
Sorry, I was repeating your typo, it should be "networking" not "network".

Cheers,

Evo2.

P.S. You should us <Tab> completion, then these sort or errors don't happen.

Last edited by evo2; 03-18-2010 at 04:24 PM. Reason: P.S.
 
Old 03-18-2010, 04:29 PM   #5
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
I guess I am really lost. Did Debian change something on how it used to manage restarting services like 'network'? I ran your suggested command and it hung:

Code:
root@mail:~# invoke-rc.d networking restart
Running /etc/init.d/networking restart is deprecated because it may not enable again some interfaces ... (warning).
Reconfiguring network interfaces...
It never came back so I had to reboot the server. I used to remember when I could run the /etc/init.d/network restart command and it was smooth as butter...I don't understand why this changed. I shouldn't have to reboot for a simple IP change.
 
Old 03-18-2010, 04:31 PM   #6
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
You never said that you just wanted to restart *one* interface. In that case, assuming eth0, you should do
Code:
ifdown eth0
ifup eth0
Evo2.

P.S. You may have chosen to, but did not *have* to reboot the machine

Last edited by evo2; 03-18-2010 at 04:33 PM. Reason: P.S.
 
Old 03-19-2010, 03:56 AM   #7
AleLinuxBSD
Member
 
Registered: May 2006
Location: Italy
Distribution: Ubuntu, ArchLinux, Debian, SL, OpenBSD
Posts: 274

Rep: Reputation: 42
sudo /etc/init.d/networking restart
while you have done:
sudo /etc/init.d/network restart
 
Old 03-19-2010, 04:18 AM   #8
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726

Rep: Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706Reputation: 1706
Quote:
Originally Posted by AleLinuxBSD View Post
sudo /etc/init.d/networking restart
while you have done:
sudo /etc/init.d/network restart
It seems that point is that the /etc/init.d/networking script no longer works with the "restart" argument. The reasoning being that "restart" would just call "stop", which would bring down all interfaces, and then call "start" which would bring up the interfaces marked "auto" in the /etc/network/interfaces file. This is seen as a potential problem, because there may have been interfaces that were up before (perhaps bought up manually), that were not marked "auto" and therefore would not be bought back up on a "restart".

Evo2.
 
1 members found this post helpful.
Old 08-05-2012, 10:37 AM   #9
rsduhamel
LQ Newbie
 
Registered: Apr 2011
Posts: 5

Rep: Reputation: 0
I just got blindsided by this when I upgraded Ubuntu server 10.04 to 12.04--and it took a lot of Googling and experimenting to find the straight dope.

"/etc/init.d/networking restart" works as before; it just now throws a warning that it may not work. This is because most people don't understand what "networking restart" does. When it doesn't work as expected they think it's broken. "networking restart" does not restart interfaces that do not have the auto directive in /etc/network/interfaces (thanks to evo2 for this piece of the puzzle).

"networking restart" works fine with Ubuntu server (as of 12.04) because the network interface has the auto directive by default; it just throws the warning. It does not work with Debian 6 because the auto directive is not in /etc/network/interfaces by default. However, if you add "auto eth0" to the configuration, restart works. This is of course with my setup, i.e. a single wired Ethernet card. Your mileage may vary.

However, lesson learned, I now use "ifdown eth0;ifup eth0" after reconfiguring the interface.

Last edited by rsduhamel; 08-05-2012 at 10:47 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Restarting samba service dahoule Linux - Networking 13 12-11-2012 12:17 PM
Restarting dns service sandeepthug Linux - Newbie 8 12-17-2008 10:36 AM
squid service not restarting celebnavin Linux - Server 1 11-22-2007 08:45 AM
Remotely restarting a service seefor Linux - Networking 3 02-15-2007 01:52 AM
restarting network service in windows nick021 Linux - General 1 12-16-2006 05:20 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Debian

All times are GMT -5. The time now is 02:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration