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

Re: Preseed not pulling in file from network with wget



Todd A. Jacobs wrote:
> I've got the following snippet in a Debian preseed.cfg file:
> 
> d-i preseed/late_command string \
> in-target mkdir --mode=700 /home/vagrant/.ssh; \
> in-target chown vagrant:vagrant /home/vagrant/.ssh; \
> in-target wget --no-check-certificate
> --output-document=/home/vagrant/.ssh/authorized_keys
> https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub; \
> in-target chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys; \
> in-target chmod 0600 /home/vagrant/.ssh/authorized_keys; \

With that many commands it is probably better to put all of those into
a script and then run the script.  Something like this which is an
edit of what I do here.

  d-i preseed/late_command string wget -O/target/var/tmp/bootstrap http://example.com/bootstrap; in-target sh /var/tmp/bootstrap

> but I'm having a terrible time with the preseed not actually installing the
> vagrant.pub key in the .ssh directory.

There is almost certainly some small detail error.  If you use the
script method I suggest above then redirect all output to a file in
/var/tmp or /root or some other reboot persistent location and see
what output is emitted there.  Something like this:

  #!/bin/sh
  exec >>/root/bootstrap.out 2>&1
  set -x
  mkdir --mode=700 /home/vagrant/.ssh
  chown vagrant:vagrant /home/vagrant/.ssh
  wget --no-check-certificate --output-document=/home/vagrant/.ssh/authorized_keys https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub
  chown vagrant:vagrant /home/vagrant/.ssh/authorized_keys
  chmod 0600 /home/vagrant/.ssh/authorized_keys
  exit 0

> Any idea what could be wrong? I find the preseed/late_commands very
> difficult to debug, especially when they aren't throwing any obvious errors.

I always redirect the output as shown above and then look at the
resulting output.

Bob

Attachment: signature.asc
Description: Digital signature


Reply to: