系统教程
您现在的位置是:首页>服务器系统>Ubuntu系统内容

处理ubuntu preseed过程中/etc/network/interfaces被覆盖问题

时间:2018-04-26 出处:未知复制分享人气(次) 【

通过 cobbler 和 pxe 批量安装 ubuntu 时,在 14.04 上的安装器里面有 bug ,导致在 preseed 的 late_command 中写的网络配置会被 netcfg 覆盖掉,使得 /etc/network/interface 配置总是为默认的配置。
 
在后续的 netcfg 中修正了这个问题,但是在此之前,需要通过额外的一点代码进行处理这个问题。
 
d-i preseed/late_command string true && \
wget -q -O- http://$http_server/cblr/svc/op/script/$what/$name/?script=preseed_late_default | chroot /target /bin/bash -s ;\
cp /target/etc/network/interfaces /target/etc/network/interfaces.orig ;\
echo"mv /etc/network/interfaces.orig /etc/network/interfaces && ifdown -a && ifup -a && sed -i '/fixnet.sh/d' /etc/rc.local" >/target/fixnet.sh
sed -i '/exit/ibash /fixnet.sh' /target/etc/rc.local 
 
在这段 preseed 的代码中,备份网络配置文件为 /etc/network/interfaces.orig ,防止被 netcfg 覆盖掉。写一个 fixnet.sh 的小脚本,在脚本中将备份的网络配置文件恢复,并在 rc.local 中加入调用。
 
修改相应的 cobbler 中相应的 preseed 文件,将 late_command 改为以上的代码,可解决 /etc/network/interfaces 文件被覆盖的问题。
 
后续 ubuntu 版本的安装器中,可通过:
d-i netcfg/target_network_config select ifupdown
 
指定使用 ifupdown ,来避免 /etc/network/interfaces 被覆盖。
    最新资讯
    热门内容
    小米移动电源能为iPad mini充几次电