[25871] in Source-Commits
Re: /svn/athena r25272 -
daemon@ATHENA.MIT.EDU (Geoffrey Thomas)
Tue Jul 26 09:20:41 2011
Date: Tue, 26 Jul 2011 09:20:33 -0400 (EDT)
From: Geoffrey Thomas <geofft@MIT.EDU>
To: Jonathan D Reed <jdreed@mit.edu>
cc: source-commits@mit.edu
In-Reply-To: <201107261156.p6QBubjE008729@drugstore.mit.edu>
Message-ID: <alpine.DEB.2.00.1107260904210.17504@tyger.mit.edu>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed
Bah.
1. It might make a lot more sense to use the installer's existing
syslogging support instead of writing our own log. (As a side benefit,
syslogs are timestamped.) You can use what appears to be a reasonably
standard logger(1) to send messages. They end up in /var/log/syslog.
2. I'm skeptical that your netcat MTA works. The client not waiting for
server responses is one of the biggest giveaways that a message is spam
before it's even read; I suspect this will be highly unreliable. The
installer has a built-in httpd for getting debug logs off -- you can just
run "httpd", which will spawn a daemon serving /var/log over port 80, or
you can do something involving `udpkg --configure --force-configure
save-logs`, which also symlinks a few useful things into /var/log. (The
latter is what the installer main menu's "Save debug logs" option runs.
3. If networking doesn't work, how is sending mail supposed to work?
--
Geoffrey Thomas
geofft@mit.edu
On Tue, 26 Jul 2011, Jonathan D Reed wrote:
> Author: jdreed
> Date: 2011-07-26 07:56:37 -0400 (Tue, 26 Jul 2011)
> New Revision: 25272
>
> Added:
> trunk/debathena/scripts/installer/pxe/stage1/debathena/sendlog
> Modified:
> trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
> Log:
> Support some more logging in the installer
>
> Modified: trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh
> ===================================================================
> --- trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh 2011-07-20 22:08:01 UTC (rev 25271)
> +++ trunk/debathena/scripts/installer/pxe/stage1/debathena/installer.sh 2011-07-26 11:56:37 UTC (rev 25272)
> @@ -12,6 +12,14 @@
> cd /debathena
> fi
>
> +debug () {
> + if [ "$test" != "test" ]; then
> + echo "$@" > /debathena/debug.log
> + else
> + echo "DEBUG: $@"
> + fi
> +}
> +
> pxetype=""
>
> netconfig () {
> @@ -34,6 +42,7 @@
> HOSTNAME=
> echo -n "$ipprompt "
> read IPADDR
> + debug "In netconfig, user entered '$IPADDR'"
> # RFC1123 does permit hostnames to start with digits, moira doesn't
> # If you do that, suck it up and type the IP
> if echo "$IPADDR" | grep -q '[a-zA-Z]'; then
> @@ -84,6 +93,8 @@
> echo " Broadcast: $bc"
> echo " Gateway: $GATEWAY"
>
> + debug "Calculated values: $HOSTNAME $NETMASK $GATEWAY $bc"
> +
> if [ "$pxetype" != cluster ] ; then
> echo -n "Are these OK? [Y/n]: "; read response
> case $response in
> @@ -135,10 +146,18 @@
> arch="amd64"
> fi
>
> +# Of course the installer doesn't have `date`
> +# time.mit.edu/kerberos.mit.edu is 18.7.21.144
> +# This will probably break eventually
> +debug "** Install begins at $(nc -w1 18.7.21.144 13)"
> +
> if [ -f "/debathena/version" ]; then
> echo -n "SVN version: " && cat /debathena/version
> + debug "SVN: " "$(cat /debathena/version)"
> fi
>
> +debug "Mirror $mirrorsite Type $installertype Arch $arch"
> +
> echo "Welcome to Athena, Stage 1 Installer"
> echo
>
> @@ -231,6 +250,16 @@
> esac
> done
>
> +debug "*** Main menu complete"
> +debug "Mirror: $mirrorsite Type $installertype "
> +debug "Arch $arch Distro $distro Pxetype $pxetype"
> +debug "eth0:"
> +debug "$(ip address show eth0)"
> +debug "routing:"
> +debug "$(route)"
> +debug "resolv.conf:"
> +debug "$(cat /etc/resolv.conf)"
> +
> ##############################################################################
>
>
> @@ -335,10 +364,12 @@
> echo "$dkargs $kargs"
> exit 0
> fi
> +debug "About to run kexec with these args: $dkargs $kargs"
> ./kexec -l linux --append="$dkargs $kargs" --initrd=initrd.gz \
> && sleep 3 && chvt 1 && sleep 2 && ./kexec -e
> echo "Secondary installed failed; please contact release-team@mit.edu"
> echo "with the circumstances of your install attempt. Here's a shell for debugging:"
> +echo "(You might try running this command: /debathena/sendlog )"
> # We don't want to let this fall through to an actual install of whatever
> # kernel we're using.
> while : ; do /bin/sh ; done
>
> Added: trunk/debathena/scripts/installer/pxe/stage1/debathena/sendlog
> ===================================================================
> --- trunk/debathena/scripts/installer/pxe/stage1/debathena/sendlog (rev 0)
> +++ trunk/debathena/scripts/installer/pxe/stage1/debathena/sendlog 2011-07-26 11:56:37 UTC (rev 25272)
> @@ -0,0 +1,39 @@
> +#!/bin/sh
> +#
> +# This is undoubtedly a bad idea
> +
> +if ! [ -r /debathena/debug.log ]; then
> + echo "I can't read /debathena/debug.log and therefore can't send mail."
> + exit 0
> +fi
> +
> +outgoing=18.7.22.104
> +
> +echo -n "Enter your full name: "
> +read NAME
> +echo -n "Enter your MIT e-mail address: "
> +read ADDR
> +
> +echo "Sending mail..."
> +msg="HELO mit.edu
> +MAIL FROM: <errors@mit.edu>
> +RCPT TO: <release-team@mit.edu>
> +DATA
> +To: release-team@mit.edu
> +From: errors@mit.edu
> +Subject: Stage 1 install failure log from $ADDR
> +
> +Contact name: $NAME
> +Contact addr: $ADDR
> +
> +Debug log:
> +$(cat /debathena/debug.log)
> +.
> +QUIT"
> +
> +if echo "$msg" | nc -w 5 $outgoing 25; then
> + echo "Mail sent."
> +else
> + echo "Couldn't send mail for some reason."
> +fi
> +
>
>
> Property changes on: trunk/debathena/scripts/installer/pxe/stage1/debathena/sendlog
> ___________________________________________________________________
> Added: svn:executable
> + *
>
>