Commit 304eb320 authored by Ryan Jackson's avatar Ryan Jackson

Fixes for ubuntu 10.4 (lucid lynx)

Includes hack to "fix" upstart dependency problems:

A) eth* interfaces are probed by ifupdown serially instead of in
   parallel.
B) Legacy initscript support waits for the the control net probe
   to finish (with either success or failure) before running legacy
   initscripts.
parent 895b9a79
......@@ -6145,6 +6145,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/linux9/GNUmakefile tmcd/linux9/supfile \
tmcd/fedora/GNUmakefile tmcd/fedora/supfile \
tmcd/linux-sg/GNUmakefile tmcd/ubuntu7/GNUmakefile \
tmcd/ubuntu10/GNUmakefile \
tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \
tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \
tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \
......
......@@ -935,6 +935,7 @@ outfiles="$outfiles Makeconf GNUmakefile \
tmcd/linux9/GNUmakefile tmcd/linux9/supfile \
tmcd/fedora/GNUmakefile tmcd/fedora/supfile \
tmcd/linux-sg/GNUmakefile tmcd/ubuntu7/GNUmakefile \
tmcd/ubuntu10/GNUmakefile \
tmcd/freebsd5/GNUmakefile tmcd/freebsd5/supfile \
tmcd/freebsd6/GNUmakefile tmcd/freebsd6/supfile tmcd/freebsd6/netif-emulab \
tmcd/freebsd7/GNUmakefile tmcd/freebsd7/supfile tmcd/freebsd7/netif-emulab \
......
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2007, 2009 University of Utah and the Flux Group.
# All rights reserved.
#
#
# XXX ONLY RUN THIS INSTALL ON AN UBUNTO LINUX TESTBED NODE!
#
# Trivial. These things just need to be installed into the right place
# on a testbed node before cutting an image.
#
#
SRCDIR = @srcdir@
TESTBED_SRCDIR = @top_srcdir@
OBJDIR = ../..
SUBDIR = tmcd/ubuntu7
include $(OBJDIR)/Makeconf
SCRIPTS =
#
# Force dependencies on the scripts so that they will be rerun through
# configure if the .in file is changed.
#
all: supfile ifcfgs
include $(TESTBED_SRCDIR)/GNUmakerules
SYSETCDIR = $(DESTDIR)/etc
ETCDIR = $(DESTDIR)$(CLIENT_ETCDIR)
BINDIR = $(DESTDIR)$(CLIENT_BINDIR)
VARDIR = $(DESTDIR)$(CLIENT_VARDIR)
RCDIR = $(SYSETCDIR)
RRCDIR = /etc
INSTALL = /usr/bin/install -c
COMMON = $(SRCDIR)/../common
install client-install: common-install etc-install \
script-install bin-install sysetc-fixup
@echo "Remember to install the PEM files if necessary"
simple-install: common-install script-install bin-install
dir-install:
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/dhcp3
$(INSTALL) -m 755 -o root -g root -d $(SYSETCDIR)/network
common-install: dir-install
(cd ../common; $(MAKE) DESTDIR=$(DESTDIR) local-install)
bin-install: dir-install
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) bin-install)
$(INSTALL) -m 755 $(SRCDIR)/findcnet $(BINDIR)/findcnet
etc-install: dir-install common-sysetc-install
common-sysetc-install: dir-install
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) RRCDIR=$(RRCDIR) sysetc-install)
sysetc-fixup:
rm -rf $(SYSETCDIR)/modules.conf $(SYSETCDIR)/cron.pend $(SYSETCDIR)/sysconfig $(SYSETCDIR)/init.d/ntpd
rm -f $(SYSETCDIR)/dhclient-enter-hooks \
$(SYSETCDIR)/dhclient-exit-hooks
$(INSTALL) -m 755 $(SRCDIR)/dhclient-exit-hooks \
$(SYSETCDIR)/dhcp3/dhclient-exit-hooks
$(INSTALL) -m 755 $(SRCDIR)/dhclient-enter-hooks \
$(SYSETCDIR)/dhcp3/dhclient-enter-hooks
rm -f $(RRCDIR)/rc.local $(SYSETCDIR)/rc.local
$(INSTALL) -m 644 $(SRCDIR)/rc-sysinit.conf $(SYSETCDIR)/init
$(INSTALL) -m 644 $(SRCDIR)/rsyslog-emulab.conf $(SYSETCDIR)/rsyslog.d/60-emulab.conf
$(INSTALL) -m 755 $(SRCDIR)/rc.local $(SYSETCDIR)/rc.local
$(INSTALL) -m 644 $(SRCDIR)/interfaces $(SYSETCDIR)/network/interfaces
$(INSTALL) -m 755 $(SRCDIR)/ntp.sh $(RCDIR)/init.d/ntp
script-install: dir-install $(SCRIPTS)
(cd ../linux; $(MAKE) DESTDIR=$(DESTDIR) RCDIR=$(RCDIR) script-install)
sfs-install:
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004-2009 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# Sweet! dhclient on linux wants to DHCP on the loopback interface
# thus screwing up its default setting. Put a stop to that early on!
#
if [ xxx$interface = xxxlo ]; then
exit_status=1
return
fi
echo "`date`: ${interface}: ${reason}" >>$LOGDIR/dhclient-enter.log 2>&1
#
# XXX Hack to force the duplex on interfaces
#
setduplex() {
_if=$1
_rc=0
if [ -x /sbin/ethtool ]; then
_ethtool=/sbin/ethtool
else
_ethtool=/usr/sbin/ethtool
fi
_out=`$_ethtool $_if`
if [ $? -eq 0 ]; then
_hmb=`echo $_out | grep -c 'Speed: 100Mb/s'`
_fdx=`echo $_out | grep -c 'Duplex: Full'`
else
_out=`/sbin/mii-tool $_if`
_hmb=`echo $_out | grep -c '100 Mbit'`
_fdx=`echo $_out | grep -c 'full duplex'`
fi
if [ $_hmb -ne 0 -a $_fdx -ne 0 ]; then
echo "$_if: speed/duplex correct"
else
echo -n "$_if: fixing speed/duplex..."
if $_ethtool $_if >/dev/null 2>&1; then
$_ethtool -s $_if autoneg off speed 100 duplex full
else
/sbin/mii-tool --force=100baseTx-FD $_if
fi
_rc=$?
echo "returns $_rc"
fi
return $_rc
}
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW -a x$reason != xREBIND ]
then
# do nothing
true
elif [ x"$new_domain_name_servers" = "x1.1.1.1" ]; then
#
# ElabinElab support.
#
# XXX oh so hacky. Real boss is set to return 1.1.1.1 as a name server
# for nodes in inner elabs. This is the hack de jour for determining
# who has responded to our DHCP request. If it is outer boss and we are
# an inner node, we want to decline this offer and not configure the
# interface
#
exit_status=1
#
# XXX it just keeps getting better! The Ubuntu (Debian?) dhclient-script
# doesn't check that status code and just plows ahead. Thus we will wind
# up with a resolv.conf file with 1.1.1.1 as the name server. So if we
# currently have a legit resolv.conf (one without a 1.1.1.1 nameserver),
# save that off so we can restore it in the exit hook.
#
if grep -q 1.1.1.1 /etc/resolv.conf; then
echo "`date`: ${interface}: resolv.conf already bad"
else
echo "`date`: ${interface}: saving current resolv.conf"
cp -p /etc/resolv.conf /etc/resolv.conf.good
fi >>$LOGDIR/dhclient-enter.log 2>&1
#
# XXX since we now know that we are in an inner elab and we know which
# interface is the real control net, we force 100Mb full-duplex on all
# other (experimental) interfaces. This is necessary to ensure a
# response from the inner control net.
#
for _if in `ifconfig -s | awk '{ print $1 }' | grep -v Iface`
do
if [ $_if != "lo" -a x$_if != x$interface ]; then
setduplex $_if >>$LOGDIR/dhclient-enter.log 2>&1
fi
done
#
# XXX sleep here so we don't pummel boss with REQUEST/DECLINE pairs.
#
sleep 3
elif [ "$new_network_number" = "10.200.1.0" ]; then
#
# XXX sometime we can get a reply even if the duplex is wrong.
# If we get such a reply and we are inside an inner elab, again
# force 100Mb full-duplex to make sure we continue to communicate
# with the server.
#
setduplex $interface >>$LOGDIR/dhclient-enter.log 2>&1
fi
echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-enter.log 2>&1
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2009 University of Utah and the Flux Group.
# All rights reserved.
#
. /etc/emulab/paths.sh
echo "`date`: ${interface}: ${reason}" >>$LOGDIR/dhclient-exit.log 2>&1
if [ x$reason != xREBOOT -a x$reason != xBOUND -a x$reason != xRENEW -a x$reason != xREBIND ]
then
exit 0
fi
#
# ElabinElab support
#
# The enter-hooks script should weed out outer boss calls, so there
# should be nothing to do here. However, just in case we smack em down
# again here.
#
# XXX we will get here on Ubuntu (Debian?), as the exit status of the
# enter hook is not checked (see dhclient-enter-hook). At this point
# we have a bogus resolv.conf file and we must fix it up.
#
if [ x"$new_domain_name_servers" = "x1.1.1.1" ]; then
echo -n "`date`: ${interface}: exit with bad name server..."
if [ -f /etc/resolv.conf.good ]; then
echo "replacing"
mv /etc/resolv.conf.good /etc/resolv.conf
else
echo "no good replacement, removing"
cp /dev/null /etc/resolv.conf
fi
exit_status=1
exit 1
fi >>$LOGDIR/dhclient-exit.log 2>&1
#
# Remember our server IP, real hostname, router IP, etc.
#
echo $new_dhcp_server_identifier > $BOOTDIR/bossip
echo $new_host_name > $BOOTDIR/realname
echo $new_routers > $BOOTDIR/routerip
echo $new_ip_address > $BOOTDIR/myip
echo $new_subnet_mask > $BOOTDIR/mynetmask
if [ -n "$interface" ]; then
echo $interface > $BOOTDIR/controlif
fi
#
# If this is a newnode boot, boss (inner or outer) will have returned with
# no hostname. We don't need to record anything in this case, so skip it.
#
if [ x"$new_host_name" = x ]; then
exit 0
fi
#
# We have observed problems where changing the speed/duplex of a link
# leaves DNS a little wonky. So we whack on it til it responds so that
# the sethostname script won't fail.
#
if [ "$new_network_number" = "10.200.1.0" ]; then
for i in 0 1 2; do
if `$BINDIR/tmcc bossinfo >/dev/null 2>&1`; then
break
fi
echo "`date`: ${interface}: waiting for DNS.." >>$LOGDIR/dhclient-exit.log 2>&1
sleep $i
done
fi
#
# See if the Testbed configuration software wants to change the hostname.
#
$BINDIR/sethostname.dhclient >>$LOGDIR/dhclient.log 2>&1
echo "`date`: ${interface}: ${reason}: done" >>$LOGDIR/dhclient-exit.log 2>&1
#
# The killing of dhclient and shutdown of other interfaces is handled
# by the dhclient caller (sysconfig/network-scripts/ifcfg-eth99)
#
exit 0
#!/bin/sh
#
# Find the Emulab control network interface.
#
# When called the first time (an invocation on any interface when
# /var/emulab/boot/controlif does not exist) we run DHCP and find the
# control network.
#
# On all invocations, we check the contents of that file against the
# interface we were called with and return "cnet" if we are the control
# net. Otherwise we just return the physical interface name.
#
export LANG=C
iface="$1"
lockdir=/var/lock/findcnet
. /etc/emulab/paths.sh
while ! mkdir $lockdir 2> /dev/null; do
sleep 1
done
#
# We use /var/run to store the current idea of the cnet interface
# because we want it to go away on reboot.
#
cnetfile="/var/run/cnet"
cnetif=''
if [ -f $cnetfile ]; then
cnetif=`cat $cnetfile`
else
#
# Find a list of candidate interfaces
#
_iflist=`ifconfig -a | grep '^eth' | awk '{ print $1 }'`
echo "`date`: $iface: findcnet running dhclient on: $_iflist"
#
# If dhclient returns success, then it has configured the first interface
# and gone into background mode. At that point we don't care about it any
# more and just kill it. We also shutdown all the other interfaces (which
# dhclient will leave "up").
#
if [ -x /sbin/dhclient ] && /sbin/dhclient -q $_iflist ; then
killall dhclient
rm -f /var/run/dhclient.pid
echo "`date`: $iface: findcnet dhclient returned"
[ -f $BOOTDIR/controlif ] && cp $BOOTDIR/controlif $cnetfile
cnetif=`cat $cnetfile`
for _if in $_iflist; do
[ $_if = $cnetif ] && continue
echo "`date`: taking $_if down"
ifconfig $_if down
done
fi
# Emit this upstart event to allow boot to continue, even
# if we couldn't get a dhcp lease.
/sbin/initctl emit -n 'emulab-findcnet-done'
fi >>$LOGDIR/dhclient.log 2>&1
#
# In case ifup/ifdown try to feed us anything
#
while read foo bar; do
echo "`date`: $iface: findcnet got \"$foo $bar\" from caller"
done >>$LOGDIR/dhclient.log 2>&1
if [ -z "$cnetif" ]; then
echo "`date`: $iface: findcnet got empty $cnetfile" >>$LOGDIR/dhclient.log
fi
echo "`date`: $iface: cnet is $cnetif" >>$LOGDIR/dhclient.log
if [ "$cnetif" = $iface ]; then
echo cnet
else
echo $iface
fi
rm -rf $lockdir
exit 0
root:x:0:stoller,rdjackso,ricci,johnsond,ayers,kevina,operator,danderse,dreading,gary,mike,elabckup
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:
audio:x:29:
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
libuuid:x:101:
crontab:x:102:
syslog:x:103:
fuse:x:104:
mlocate:x:105:
ssh:x:106:
lpadmin:x:107:
sambashare:x:108:
admin:x:109:
tuser:x:1000:
ntp:x:110:
ssl-cert:x:111:
root:*::stoller,rdjackso,ricci,johnsond,ayers,kevina,operator,danderse,dreading,gary,mike,elabckup
daemon:*::
bin:*::
sys:*::
adm:*::
tty:*::
disk:*::
lp:*::
mail:*::
news:*::
uucp:*::
man:*::
proxy:*::
kmem:*::
dialout:*::
fax:*::
voice:*::
cdrom:*::
floppy:*::
tape:*::
sudo:*::
audio:*::
dip:*::
www-data:*::
backup:*::
operator:*::
list:*::
irc:*::
src:*::
gnats:*::
shadow:*::
utmp:*::
video:*::
sasl:*::
plugdev:*::
staff:*::
games:*::
users:*::
nogroup:*::
libuuid:!::
crontab:!::
syslog:!::
fuse:!::
mlocate:!::
ssh:!::
lpadmin:!::
sambashare:!::
admin:!::
tuser:!::
ntp:!::
ssl-cert:!::
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
#
# XXX abuse of mapping function follows.
# The findcnet script DHCPs on all interfaces the first time it is invoked
# and uses the results of that for every other invocation. The script
# returns "cnet" for the interface that is the control net, and the physical
# interface name for all others.
#
mapping eth*
script /usr/local/etc/emulab/findcnet
#
# The control network has been identified and configured indirectly
# via the mapping above. Here we just make sure that if shutdown, we
# remove the indicator file so that we will re-DHCP next time.
#
auto eth0 eth1 eth2 eth3 eth4 eth5 eth6 eth7 eth8 eth9
iface cnet inet manual
up echo "Emulab control net is $IFACE"
down rm -f /var/run/cnet
down ifconfig $IFACE down
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
syslog:x:101:103::/home/syslog:/bin/false
tuser:x:1000:1000:tuser,,,:/home/tuser:/bin/bash
sshd:x:102:65534::/var/run/sshd:/usr/sbin/nologin
statd:x:103:65534::/var/lib/nfs:/bin/false
ntp:x:104:110::/home/ntp:/bin/false
# rc-sysinit - System V initialisation compatibility
#
# This task runs the old System V-style system initialisation scripts,
# and enters the default runlevel when finished.
description "System V initialisation compatibility"
author "Scott James Remnant <scott@netsplit.com>"
start on filesystem and net-device-up IFACE=lo and emulab-findcnet-done
stop on runlevel
# Default runlevel, this may be overriden on the kernel command-line
# or by faking an old /etc/inittab entry
env DEFAULT_RUNLEVEL=2
# There can be no previous runlevel here, but there might be old
# information in /var/run/utmp that we pick up, and we don't want
# that.
#
# These override that
env RUNLEVEL=
env PREVLEVEL=
console output
env INIT_VERBOSE
task
script
# Check for default runlevel in /etc/inittab
if [ -r /etc/inittab ]
then
eval "$(sed -nre 's/^[^#][^:]*:([0-6sS]):initdefault:.*/DEFAULT_RUNLEVEL="\1";/p' /etc/inittab || true)"
fi
# Check kernel command-line for typical arguments
for ARG in $(cat /proc/cmdline)
do
case "${ARG}" in
-b|emergency)
# Emergency shell
[ -n "${FROM_SINGLE_USER_MODE}" ] || sulogin
;;
[0123456sS])
# Override runlevel
DEFAULT_RUNLEVEL="${ARG}"
;;
-s|single)
# Single user mode
[ -n "${FROM_SINGLE_USER_MODE}" ] || DEFAULT_RUNLEVEL=S
;;
esac
done
# Run the system initialisation scripts
[ -n "${FROM_SINGLE_USER_MODE}" ] || /etc/init.d/rcS
# Switch into the default runlevel
telinit "${DEFAULT_RUNLEVEL}"
end script
#!/bin/sh
#
# EMULAB-COPYRIGHT
# Copyright (c) 2004, 2007 University of Utah and the Flux Group.
# All rights reserved.
#
#
# This script will be executed *after* all the other init scripts.
# You can put your own initialization stuff in here if you don't
# want to do the full Sys V style init stuff.
# XXX compat with RedHat feature
if [ ! -d /var/lock/subsys ]; then
mkdir /var/lock/subsys
fi
# XXX serial console seems to be in raw mode, makes our messages ugly :-)
if [ -c /dev/ttyS0 ]; then
stty -F /dev/ttyS0 opost onlcr
fi
#
# Testbed Setup.
#
if [ -f /usr/local/etc/emulab/rc/rc.testbed ] ; then
echo -n 'testbed config: '
/usr/local/etc/emulab/rc/rc.testbed
touch /var/lock/subsys/testbed
fi
echo "Boot Complete"
# Emulab stuff
#
local5.* -/var/log/emulab.log
root:$1$554af391$cIwZvUQr0wCBeS5rZhQ310:14837:0:99999:7:::
daemon:*:14797:0:99999:7:::
bin:*:14797:0:99999:7:::
sys:*:14797:0:99999:7:::
sync:*:14797:0:99999:7:::
games:*:14797:0:99999:7:::
man:*:14797:0:99999:7:::
lp:*:14797:0:99999:7:::
mail:*:14797:0:99999:7:::
news:*:14797:0:99999:7:::
uucp:*:14797:0:99999:7:::
proxy:*:14797:0:99999:7:::
www-data:*:14797:0:99999:7:::
backup:*:14797:0:99999:7:::
list:*:14797:0:99999:7:::
irc:*:14797:0:99999:7:::
gnats:*:14797:0:99999:7:::
nobody:*:14797:0:99999:7:::
libuuid:!:14797:0:99999:7:::
syslog:*:14797:0:99999:7:::
tuser:*:14797:0:99999:7:::
sshd:*:14797:0:99999:7:::
statd:*:14797:0:99999:7:::
ntp:*:14798:0:99999:7:::
......@@ -71,7 +71,7 @@ esac
if [ -z "$tag" ]; then
p1=`echo $dist | tr '[A-Z]' '[a-z]'`
p2=`echo $rel | sed -e 's/^\(.\).*/\1/'`
p2=`echo $rel | sed -e 's/^\([0-9]*\).*/\1/'`
tag="${p1}${p2}"
fi
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment