Debian This forum is for the discussion of Debian Linux.
|
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
03-17-2010, 08:29 PM
|
#1
|
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905
Rep:
|
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
|
|
|
03-17-2010, 10:49 PM
|
#2
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
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.
|
|
|
03-18-2010, 01:26 PM
|
#3
|
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905
Original Poster
Rep:
|
Not working for me...
Code:
root@perfserv1:~# invoke-rc.d network restart
invoke-rc.d: unknown initscript, /etc/init.d/network not found.
|
|
|
03-18-2010, 04:23 PM
|
#4
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
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.
|
|
|
03-18-2010, 04:29 PM
|
#5
|
Senior Member
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905
Original Poster
Rep:
|
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.
|
|
|
03-18-2010, 04:31 PM
|
#6
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
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.
|
|
|
03-19-2010, 03:56 AM
|
#7
|
Member
Registered: May 2006
Location: Italy
Distribution: Ubuntu, ArchLinux, Debian, SL, OpenBSD
Posts: 274
Rep:
|
sudo /etc/init.d/networking restart
while you have done:
sudo /etc/init.d/network restart
|
|
|
03-19-2010, 04:18 AM
|
#8
|
LQ Guru
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,726
|
Quote:
Originally Posted by AleLinuxBSD
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.
|
08-05-2012, 10:37 AM
|
#9
|
LQ Newbie
Registered: Apr 2011
Posts: 5
Rep:
|
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.
|
|
|
All times are GMT -5. The time now is 02:07 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|