ubuntu14.04 networking restart

  Ubuntu14.04新装的系统,修改网卡配置文件之后。无法使用sudo /etc/init.d/networking restart 或者 sudo service networking restart重启网络服务。
  因为都是系统脚本可以通过sudo bash -x /usr/sbin/service networking restart 和 sudo bash -x /etc/init.d/networking restart获得更多的脚本信息。

wirehive@ubuntu:~$ sudo /etc/init.d/networking restart
wirehive@ubuntu:~$ echo $?
1
wirehive@ubuntu:~$ sudo service networking restart
stop: Job failed while stopping
start: Job is already running: networking
wirehive@ubuntu:~$ sudo bash -x /etc/init.d/networking restart
+ PATH=/sbin:/bin
+ RUN_DIR=/run/network
+ IFSTATE=/run/network/ifstate
+ STATEDIR=/run/network/state
+ '[' -x /sbin/ifup ']'
+ '[' -x /sbin/ifdown ']'
+ . /lib/lsb/init-functions
+++ run-parts --lsbsysinit --list /lib/lsb/init-functions.d
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/20-left-info-blocks ']'
++ . /lib/lsb/init-functions.d/20-left-info-blocks
++ for hook in '$(run-parts --lsbsysinit --list /lib/lsb/init-functions.d 2>/dev/null)'
++ '[' -r /lib/lsb/init-functions.d/50-ubuntu-logging ']'
++ . /lib/lsb/init-functions.d/50-ubuntu-logging
+++ LOG_DAEMON_MSG=
++ FANCYTTY=
++ '[' -e /etc/lsb-base-logging.sh ']'
++ true
+ CONFIGURE_INTERFACES=yes
+ EXCLUDE_INTERFACES=
+ VERBOSE=no
+ '[' -f /etc/default/networking ']'
+ verbose=
+ '[' no = yes ']'
+ case "$1" in
+ init_is_upstart
+ '[' -x /sbin/initctl ']'
+ /bin/grep -q upstart
+ /sbin/initctl version
+ return 0
+ exit 1
wirehive@ubuntu:~$ sudo bash -x service networking restart
++ basename service
+ VERSION='service ver. 0.91-ubuntu1'
++ basename service
+ USAGE='Usage: service < option > | --status-all | [ service_name [ command | --full-restart ] ]'
+ SERVICE=
+ ACTION=
+ SERVICEDIR=/etc/init.d
+ OPTIONS=
+ '[' 2 -eq 0 ']'
+ cd /
+ '[' 2 -gt 0 ']'
+ case "${1}" in
+ '[' -z '' -a 2 -eq 1 -a networking = --status-all ']'
+ '[' 2 -eq 2 -a restart = --full-restart ']'
+ '[' -z '' ']'
+ SERVICE=networking
+ shift
+ '[' 1 -gt 0 ']'
+ case "${1}" in
+ '[' -z networking -a 1 -eq 1 -a restart = --status-all ']'
+ '[' 1 -eq 2 -a '' = --full-restart ']'
+ '[' -z networking ']'
+ '[' -z '' ']'
+ ACTION=restart
+ shift
+ '[' 0 -gt 0 ']'
+ '[' -r /etc/init/networking.conf ']'
+ which initctl
+ grep -q upstart
+ initctl version
+ case "${ACTION}" in
+ stop networking
stop: Job failed while stopping
+ :
+ exec start networking
start: Job is already running: networking
wirehive@ubuntu:~$

  折磨了我好几个小时也没有处理好。最后查询资料发现,从Ubuntu14.04之后不再支持sudo /etc/init.d/networking restart 或者 sudo service networking restart的初始化脚本。取而代之的是脚本sudo ifdown eth0 && sudo ifup eth0。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值