late_command is in never-never-land?

View: New views
4 Messages — Rating Filter:   Alert me  

late_command is in never-never-land?

by Shachar Or :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello!

I am using the d-i preseed late_command option to launch a script that
installs a set of packages and makes some configurations.

The script seems to work fine. I am testing it the following way:
1. Boot d-i with 'auto url=myserver'. This has a preseed file that does
everything and does not run my late_command and does not answer the
final 'installation complete, now reboot' note; so it doesn't yet reboot.
2. Now I press <Alt>+<F2>, press enter, and run 'chroot /target /bin/bash'
3. I wget my late_command, chmod it and run it.

This way it works fine and completely non-interactively, as expected.

The problem is when I try to run this script via the preseed option like so:

d-i preseed/late_command string chroot /target /bin/bash -c 'cd /root/ &&
wget -q http://ahava/d-i/etch/late_command.sh && chmod 755 late_command.sh
&& ./late_command.sh' >> /var/log/syslog

The syslog bit is an easy way to watch the output, on tty4. Is there a better
way?

It runs it, of course, but it soon stops and the processes that are running,
that seem interesting, are:
/usr/bin/perl -w /usr/sbin/dpkg-reconfigure -phigh debconf
/bin/sh /var/lib/dpkg/info/debconf.config reconfigure (can't read the rest)

The last interesting messages that are displayed are:
(date) log-output: debconf: unable to initialize frontend: Newt
(date) log-output: debconf: (Can't locate Debconf/FrontEnd/Newt.pm in @INC
(@INC
contains: /usr/share/perl5 /usr/local/lib/perl/5.8.8 /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr
share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .)
at (eval 19) line 2.)
(date) log-output: debconf: falling back to frontend: Noninteractive

And that is it. It doesn't go further.

I think that the line in my script that causes this
is 'dpkg-reconfigure -phigh debconf'.

So, can anyone explain to me what is the difference between:
running my script (debconf is the problematic process, AFAICT) in tty2 in
chroot
and:
running my script from the preseed late_command option
???

Thanks for reading! Happy living!

--
Shachar Or | שחר אור
http://ox.freeallweb.org/


--
To UNSUBSCRIBE, email to debian-boot-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: late_command is in never-never-land?

by Shachar Or :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wednesday 23 July 2008 01:37, Shachar Or wrote:

> Hello!
>
> I am using the d-i preseed late_command option to launch a script that
> installs a set of packages and makes some configurations.
>
> The script seems to work fine. I am testing it the following way:
> 1. Boot d-i with 'auto url=myserver'. This has a preseed file that does
> everything and does not run my late_command and does not answer the
> final 'installation complete, now reboot' note; so it doesn't yet reboot.
> 2. Now I press <Alt>+<F2>, press enter, and run 'chroot /target /bin/bash'
> 3. I wget my late_command, chmod it and run it.
>
> This way it works fine and completely non-interactively, as expected.
>
> The problem is when I try to run this script via the preseed option like
> so:
>
> d-i preseed/late_command string chroot /target /bin/bash -c 'cd /root/ &&
> wget -q http://ahava/d-i/etch/late_command.sh && chmod 755 late_command.sh
> && ./late_command.sh' >> /var/log/syslog
>
> The syslog bit is an easy way to watch the output, on tty4. Is there a
> better way?
>
> It runs it, of course, but it soon stops and the processes that are
> running, that seem interesting, are:
> /usr/bin/perl -w /usr/sbin/dpkg-reconfigure -phigh debconf
> /bin/sh /var/lib/dpkg/info/debconf.config reconfigure (can't read the rest)
>
> The last interesting messages that are displayed are:
> (date) log-output: debconf: unable to initialize frontend: Newt
> (date) log-output: debconf: (Can't locate Debconf/FrontEnd/Newt.pm in @INC
> (@INC
> contains: /usr/share/perl5 /usr/local/lib/perl/5.8.8
> /usr/local/share/perl/5.8.8 /usr/lib/perl5 /usr share/perl5
> /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at (eval
> 19) line 2.)
> (date) log-output: debconf: falling back to frontend: Noninteractive
>
> And that is it. It doesn't go further.
>
> I think that the line in my script that causes this
> is 'dpkg-reconfigure -phigh debconf'.
>
> So, can anyone explain to me what is the difference between:
> running my script (debconf is the problematic process, AFAICT) in tty2 in
> chroot
> and:
> running my script from the preseed late_command option
> ???
>
> Thanks for reading! Happy living!

I was given advice in #debian-boot to use in-target for this purpose, so I've
solved it like this:

d-i preseed/late_command string wget -q -O -
http://ahava/d-i/etch/late_command.sh > /target/root/late_command.sh && chmod
u+x /target/root/late_command.sh && in-target '/root/late_command.sh'
>> /var/log/syslog

Thanks to the kind developer at #debian-boot today!
>
> --
> Shachar Or | שחר אור
> http://ox.freeallweb.org/

--
Shachar Or | שחר אור
http://ox.freeallweb.org/


--
To UNSUBSCRIBE, email to debian-boot-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


AW: late_command is in never-never-land?

by Lenz, Mario (LDS) :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi!

Just to show a (sligthly) different way :-)

>d-i preseed/late_command string wget -q -O -
>http://ahava/d-i/etch/late_command.sh >
>/target/root/late_command.sh && chmod
>u+x /target/root/late_command.sh && in-target '/root/late_command.sh'

wget -q -O - http://ahava/d-i/etch/late_command.sh | sh

You can do this chrooted, in-target or do the chroot in
late_command.sh:

chroot /target <<EOF
cmd1
cmd2
...
EOF

It's not better, but I find it a bit more elegant to pipe it directly
into a shell. *Might* lead to some problems you don't have with your
solution, though.

greez

   Mario


--
To UNSUBSCRIBE, email to debian-boot-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...


Re: late_command is in never-never-land?

by Philip Hands :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Wed, Jul 23, 2008 at 09:26:50PM +0300, Shachar Or wrote:
> On Wednesday 23 July 2008 01:37, Shachar Or wrote:
...
> I was given advice in #debian-boot to use in-target for this purpose, so I've
> solved it like this:
>
> d-i preseed/late_command string wget -q -O -
> http://ahava/d-i/etch/late_command.sh > /target/root/late_command.sh && chmod
> u+x /target/root/late_command.sh && in-target '/root/late_command.sh'
> >> /var/log/syslog

You might want to try this:

  d-i preseed/late_command string preseed-fetch late_command.sh /target/root/late_command.sh && in-target 'sh /root/late_command.sh'

preseed-fetch has the advantage that it gets stuff from wherever you
got the preseed files, so you can write scripts that are portable from
a preseed setup on your web server, to a copy of the same on an USB
stick, say.

The use of sh id just to make it more concise than doing the chmod,
but that's just a personal preference.

Have a look at http://hands.com/d-i/ for more examples of preseed-fetch,
and lots of scripting stuff.

Cheers, Phil.
--
|)|  Philip Hands [+44 (0)20 8530 9560]    http://www.hands.com/
|-|  HANDS.COM Ltd.                    http://www.uk.debian.org/
|(|  10 Onslow Gardens, South Woodford, London  E18 1NE  ENGLAND


--
To UNSUBSCRIBE, email to debian-boot-REQUEST@...
with a subject of "unsubscribe". Trouble? Contact listmaster@...

LightInTheBox - Buy quality products at wholesale price