FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 03-26-2012, 05:43 PM
"Todd A. Jacobs"
 
Default Preseed not pulling in file from network with wget

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;



but I'm having a terrible time with the preseed not actually installing the vagrant.pub key in the .ssh directory. This works when I perform the tasks by hand from within the configured system, but the point of the exercise is to use the preseed file to "just make it happen."


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.

On a hunch, I've checked the installer syslog, but the error makes no sense. The logs are saying that there's no such directory as /home/vagrant/.ssh, but since preseed/late_command should be running after the user has been created (along with their home directory and files from /etc/skel) and just before the installer unmounts /target, what could possibly be causing this?


--
 
Old 03-27-2012, 08:43 PM
Tom H
 
Default Preseed not pulling in file from network with wget

On Mon, Mar 26, 2012 at 1:43 PM, Todd A. Jacobs
<nospam+listmail@codegnome.org> 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;
>
> but I'm having a terrible time with the preseed not actually installing the
> vagrant.pub key in the .ssh directory. This works when I perform the tasks
> by hand from within the configured system, but the point of the exercise is
> to use the preseed file to "just make it happen."
>
> 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.
>
> On a hunch, I've checked the installer syslog, but the error makes no sense.
> The logs are saying that there's no such directory as /home/vagrant/.ssh,
> but since preseed/late_command should be running after the user has been
> created (along with their home directory and files from /etc/skel) and just
> before the installer unmounts /target, what could possibly be causing this?

When you boot into your install, does "vagrant" exist and is its home
directory "/home/vagrant"?

You can add "dbg/flags=all-x" to the kernel boot line.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Archive: CAOdo=Sz0UabxTj+a0zHixHJ6r8JMJ_eo3A2pfWgk2WpR7OTkv w@mail.gmail.com">http://lists.debian.org/CAOdo=Sz0UabxTj+a0zHixHJ6r8JMJ_eo3A2pfWgk2WpR7OTkv w@mail.gmail.com
 
Old 03-30-2012, 02:36 AM
Bob Proulx
 
Default 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
 

Thread Tools




All times are GMT. The time now is 03:14 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org