[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: install logging

> I've got an idea -- I think it'd be nice if base-config runs all or part
> of itself under script, with output going to /var/log/something. The
> idea being this will produce very handy typescripts for testing now, and
> later on will be useful too. (No more incoherent whining "something
> broke"? Probably too much to hope for.)

Nice idea. I proposed the same two years ago and implemented it in my slink
automatic installer.

Another thing I did in my installer was to copy the logs produced by the
bootfloppy installer during the first phase into the final logfile in the
target partition.

> Running a process that includes setting the root password under script
> and saving the output might be ill-advised though, even though debconf
> is not about to output anything while you're typing in root's password,
> so the only way any info about it could leak out is if you mistakenly
> typed it in at the wrong time or something. But I may just run the
> apt-get run under script, not the whole thing. And the log file should
> probably come out mode 600 root.root out of general paranoia. TBD.

The script command doesn't log passwords since they are not echoed (if the
program asking password id well written).

> Question is: What should I call the log? IIRC dbootstrap copys over an
> install log now. Would it make sense to append to it? What filename?
> Does anything ever result in this log being deleted after, say a week of
> uptime, when the events of the install are probably no longer a concern, 
> and a huge typescript of a base-config run should not be cluttering up
> the disk?

/var/log/install.log seems a good choice.

There is no reason to schedule a deletion of the file to save space since
the log of a medium installation is usually less than 1MB. I suggest that
we send a message or email to the administrator informing of the existance
of the file and suggesting to delete or gzip it manually after inspection. 

Regarding the implementation of the whole thing, you can't do it with the
normal `script' command because it has no options for executing a specific
command instead of an interactive shell. The solution is to add such option
to the script command or to hack root's .bashrc in order to execute a command
instead of a shell. I used the following code in my .bashrc:

  # In /root/.bashrc
  if [ "$SCRIPT_CMD" ]; then
    SCRIPT_CMD="" /bin/bash -c "$SCRIPT_CMD"
    exit $?

and the following code in the install script to run under script:

  # In install.sh script
  export SCRIPT_CMD="exec $0 $*"
  exec script -a "$CONFIG_SCRIPT_LOG"

BTW, the install.sh is not started by hacking /etc/inittab or root's rcfiles
and then restoring them, but simply invoked by an ad-hoc /etc/initscript
which works only for tty1 and is deleted or renamed after the installation.
Much simpler and cleaner than the automagically disappearing /root/.profile.

Massimo Dal Zotto

|  Massimo Dal Zotto               email: dz@cs.unitn.it               |
|  Via Marconi, 141                phone: ++39-0461534251              |
|  38057 Pergine Valsugana (TN)      www: http://www.cs.unitn.it/~dz/  |
|  Italy                             pgp: see my www home page         |

Reply to: