Re: Solved / new Problem ;-) Was: Re: Sending DHCP requests .... timed out

2006-12-06 Thread Holger Levsen
Hi,

On Wednesday 06 December 2006 17:06, Ingo Wichmann wrote:
> But: seems to be not too hard to get rid of fai-kernels this fai ;-)

fullack. and you're not the first doing it. i have some patches in my mailbox, 
waiting to pull them out. the hardest is really replacing fai-cd but we're 
having good progress there.

"the day etch is released" (ok, probably a bit later, though we could start 
today :) we should start a new branch and kick the need for fai-kernels away 
there.


regards,
Holger


pgpkp5PUumQsl.pgp
Description: PGP signature


Re: Solved / new Problem ;-) Was: Re: Sending DHCP requests .... timed out

2006-12-06 Thread Ingo Wichmann
Of course i'm running the official debian stable version for my
production environment ;-)

Ingo


Thomas Lange schrieb:
>> On Wed, 06 Dec 2006 18:13:52 +0100, Ingo Wichmann <[EMAIL PROTECTED]> 
>> said:
> 
> > I solved this by creating a diretory for the syslog pid-file in the line
> > before syslog is called:
> >   mkdir -p /tmp/var/run
> 
> > And i've put a symlink
> > /var/run -> /tmp/var/run
> > in nfsroot
> Which FAI version are you using? Newer FAI versions mount a tmpfs onto
> /var/run AFAIR, so this is not needed IMO.
> 



Re: Solved / new Problem ;-) Was: Re: Sending DHCP requests .... timed out

2006-12-06 Thread Thomas Lange
> On Wed, 06 Dec 2006 18:13:52 +0100, Ingo Wichmann <[EMAIL PROTECTED]> 
> said:

> I solved this by creating a diretory for the syslog pid-file in the line
> before syslog is called:
>   mkdir -p /tmp/var/run

> And i've put a symlink
> /var/run -> /tmp/var/run
> in nfsroot
Which FAI version are you using? Newer FAI versions mount a tmpfs onto
/var/run AFAIR, so this is not needed IMO.

-- 
regards Thomas


Re: Solved / new Problem ;-) Was: Re: Sending DHCP requests .... timed out

2006-12-06 Thread Ingo Wichmann
Ingo Wichmann schrieb:

> Here task_confdir waits for several minutes, and then continues ...
> task_confdir waits in line:
>   syslogd -m 0 -p /tmp/etc/syslogsocket

I solved this by creating a diretory for the syslog pid-file in the line
before syslog is called:
  mkdir -p /tmp/var/run


And i've put a symlink
/var/run -> /tmp/var/run
in nfsroot

Ingo



Re: Solved / new Problem ;-) Was: Re: Sending DHCP requests .... timed out

2006-12-06 Thread Ingo Wichmann
Ingo Wichmann schrieb:
>> Here task_confdir waits for several minutes, and then continues ...
>> task_confdir waits in line:
>>   syslogd -m 0 -p /tmp/etc/syslogsocket
> 
> I solved this by creating a diretory for the syslog pid-file in the line
> before syslog is called:
>   mkdir -p /tmp/var/run
> 
> 
> And i've put a symlink
> /var/run -> /tmp/var/run
> in nfsroot

And this one:

diff usr/lib/fai/get-boot-info*
127,128c127,128
< dmesg | grep -q "Sending DHCP requests"  || test $ip == dhcp  &&
get_dhcp_info
< dmesg | grep -q "Sending BOOTP requests" || test $ip == bootp &&
get_bootp_info
---
> dmesg | grep -q "Sending DHCP requests"  && get_dhcp_info
> dmesg | grep -q "Sending BOOTP requests" && get_bootp_info

Ingo




Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 17:01 schrieben Sie:
> > Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > > > hi,
> > > >
> > > > as i use softupdate a lot , it would be nice to have a fcopy feature
> > > > which reports if any files or file permissions were changed. Look at
> > > > my script in BASE/50-ntp
> > >
> > > [...]
> > >
> > > I guess postinst is what you really want (and it is already there,
> > > after all). See the man page.
> >
> > you are right, but
> >
> > - postinst is called for every file which is copied
> > -
>
> Which is what you intended, as I understood it - this does _not_ mean that
> postinst is called for every file that fcopy is run on, but only in those
> cases where the file is _really_ copied, i.e., overwritten.

yes but imagine 
fcopy -ir /etc/postfix/
and i need a postinst script with 
   /etc/init.d/postfix reload

i have to place postinst inside
  /etc/postfix/main.cf/BASE/postinst
  /etc/postfix/master.cf/BASE/postinst
right?

and if i did change master.conf and main.conf postinst would be called two 
times. and what if i have 30 files or more in /etc/postfix like virtual 
tables ...

with my approach it would be

`fcopy -irR /etc/postfix/` -gt "0" && /etc/init.d/postfix reload

(maybe this is not correct bash syntax, just example code )

kind regards
Janning


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Michael Tautschnig
> Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > > hi,
> > >
> > > as i use softupdate a lot , it would be nice to have a fcopy feature
> > > which reports if any files or file permissions were changed. Look at my
> > > script in BASE/50-ntp
> >
> > [...]
> >
> > I guess postinst is what you really want (and it is already there, after
> > all). See the man page.
> 
> you are right, but
> 
> - postinst is called for every file which is copied
> - 
> 

Which is what you intended, as I understood it - this does _not_ mean that
postinst is called for every file that fcopy is run on, but only in those cases
where the file is _really_ copied, i.e., overwritten.

Best,
Michael



pgpMQXkhLyFLJ.pgp
Description: PGP signature


another fcopy feature request -k --keep-modes

2006-12-06 Thread Janning Vygen

sometimes i don't care about the owner:group:modes:timestamp
example /etc/ssh/sshd_config. I just want to copy my content 
to /etc/ssh/sshd_config, but owner, group and modes should be kept.

Of course i can add -m but then i need to know the correct permissions and 
ownership of each file i want to change.

I just want to copy a new file and KEEP the original file modes and 
ownerships. with fcopy you have -m -M or modes from source file. 

but It would be nice to have 

  -k  --keep-modes[=owner,group,modes,time]
  to keep all or named file stats from the original file  

i can write a patch if it sounds reasonable.

kind regards
Janning


Solved / new Problem ;-) Was: Re: Sending DHCP requests .... timed out

2006-12-06 Thread Ingo Wichmann
Holger Levsen schrieb:

> On Sunday 03 December 2006 17:50, Thomas Lange wrote:
>> Are you using a Cisco switch? I had similar problems with Cisco
>> switches when not enabling the fastport feature (this disables
>> spanning tree).
> 
> But Ingo wrote, those cards work with the debian-installer (and others)... so 
> I don't think it's the switch.

I don't think also ...

> Ingo, do current debian-installer daily builds (which (should) use 2.6.18) 
> work as well? Debian-installer etch RC1 had 2.6.17, but the dailys should 
> have .18 by now...

I've tested it with kernel
2.6.17 from debian
2.6.17, 2.6.18 and 2.6.19 from kernel.org
and i still got this error.

But i think i found a solution: initrd

i've installed linux-image-2.6.17-2-486 and initramfs-tools from etch in
the nfsroot. I configured mkinitramfs to use nfs:

diff /etc/initramfs-tools/initramfs.conf*
18c18
< MODULES=netboot
---
> MODULES=most
39c39
< BOOT=nfs
---
> BOOT=local

And created a initrd suitable for nfs-boot:
mkinitramfs -o /boot/initrd.img-2.6.17-2-486-nfs 2.6.17-2-486

The file /boot/initrd.img-2.6.17-2-486-nfs i've put into the tftpdir and
i configured pxelinux.cfg/default:
LABEL faisysinfo
  KERNEL fai/vmlinuz
  APPEND initrd=fai/initrd FAI_ACTION=sysinfo ip=dhcp SERVER=faiserver
devfs=nomount root=/dev/nfs nfsroot=/srv/fai/nfsroot
FAI_FLAGS=verbose,sshd,createvt,syslogd --


This seems to work, but there is still an annoying bug probably in
task_confdir:
fai prints:

  Kernel parameters: ( ... stuff deleted ... )
  Kernel parameter ip= does not contain network parameters.
  Reading /tmp/fai/boot.log

Here task_confdir waits for several minutes, and then continues ...
task_confdir waits in line:
  syslogd -m 0 -p /tmp/etc/syslogsocket


But: seems to be not too hard to get rid of fai-kernels this fai ;-)

Ingo





Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 16:46 schrieb Janning Vygen:
> Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > > hi,
> > >
> > > as i use softupdate a lot , it would be nice to have a fcopy feature
> > > which reports if any files or file permissions were changed. Look at my
> > > script in BASE/50-ntp
> >
> > [...]
> >
> > I guess postinst is what you really want (and it is already there, after
> > all). See the man page.
>
> you are right, but
>
> - postinst is called for every file which is copied

sorry, i clicked return-enter to early. my second reason why i don't like 
postinst:

- its more transparent to have it inside the script which fcopies the files.

kind regards
janning


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 16:13 schrieb Michael Tautschnig:
> > hi,
> >
> > as i use softupdate a lot , it would be nice to have a fcopy feature
> > which reports if any files or file permissions were changed. Look at my
> > script in BASE/50-ntp
>
> [...]
>
> I guess postinst is what you really want (and it is already there, after
> all). See the man page.

you are right, but

- postinst is called for every file which is copied
- 

> However, the permission thing is obviously not captured (yet).
>
> Best,
> Michael

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/



Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Michael Tautschnig
> hi,
> 
> as i use softupdate a lot , it would be nice to have a fcopy feature which 
> reports if any files or file permissions were changed. Look at my script in 
> BASE/50-ntp
>
[...]

I guess postinst is what you really want (and it is already there, after all).
See the man page. 

However, the permission thing is obviously not captured (yet).

Best,
Michael



pgp5yRmGlAlET.pgp
Description: PGP signature


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 15:35 schrieb Thomas Lange:
> > On Wed, 6 Dec 2006 15:23:58 +0100, Janning Vygen <[EMAIL PROTECTED]>
> > said:
> >
> > if [ `fcopy -iM /etc/ntp.conf` -gt "0" ]
> >
> > it would be nice to have an option like
> >  -n --number  report number of files changed
> > and let fcopy report the number of files changed
>
> Good idea. 

thanks.

> But then fcopy must not write any error or verbose messages 
> when using -n. Or should -n report the number of files changes using
> the exit/return code?

we have two options:

- using error code:
i thought about using return code first, but isn't it a little bit 
non-unix-stlye to use exit code for reporting?

- using stdout:
we could print verbose messages to stderr with "warn" and use stdout only for 
reporting number of files. 

i think using stdout is best, just reporting a number.
The script could even build a nice report with "-R full" to send to 
administrator showing diffs and chmod/chown/utime

if you get output with -R something was changed, so you can always reload the 
daemon.

so my proposal would be:

1. send all verbose output to stderr 
2. create a new option

  --report [number|filenames|full|mail]
"number" (default if -R is given): reports number of file
 changes to stdout
"filenames" list all files which has changed one per line
"full" list all files and their differences of content or modes
"mail" sends full report to stdout and [EMAIL PROTECTED]

But i am unsure how to name the option as "-r" is already used, as -l --list 
and -c --count are used, too.

kind regards
Janning



Re: Fcopy patch regarding debian bug report #360184

2006-12-06 Thread Henning Glawe
On Wed, Dec 06, 2006 at 12:01:03PM +0100, Janning Vygen wrote:
> +  return 1 if ( $suid != $duid or $sgid != $dgid or $smode != $dmode or 
> $stime != $dtime );

thinking about (pre/post)inst scripts, comparing the time will lead to
problems... (as destfile may have a different mtime because it has been
modified by one of these scripts).

-- 
c u
henning


Re: fcopy feature request: report if a file was copied

2006-12-06 Thread Thomas Lange
> On Wed, 6 Dec 2006 15:23:58 +0100, Janning Vygen <[EMAIL PROTECTED]> said:

> if [ `fcopy -iM /etc/ntp.conf` -gt "0" ]

> it would be nice to have an option like 
>  -n --number  report number of files changed
> and let fcopy report the number of files changed 
Good idea. But then fcopy must not write any error or verbose messages
when using -n. Or should -n report the number of files changes using
the exit/return code?

-- 
regards Thomas


Re: Fcopy patch regarding debian bug report #360184

2006-12-06 Thread Janning Vygen
Am Mittwoch, 6. Dezember 2006 15:24 schrieb Henning Glawe:
> On Wed, Dec 06, 2006 at 12:01:03PM +0100, Janning Vygen wrote:
> > +  return 1 if ( $suid != $duid or $sgid != $dgid or $smode != $dmode or
> > $stime != $dtime );
>
> thinking about (pre/post)inst scripts, comparing the time will lead to
> problems... (as destfile may have a different mtime because it has been
> modified by one of these scripts).

that's not a problem in my patch as set_mode is called anyway and only once 
here regardless of the result of compare_modes:

original code in LATEST
set_mode($ps,$destfile,$class);
runscript("postinst",$ps,$destfile,$class);

original code in DEBIAN STABLE is 
postinst($ps,$destfile,$class);
set_mode($ps,$destfile,$class);

so set_mode is called anyway after or before postinst. I dont know why the 
utime is called at all. Is it importand to have the time set to the time of 
the configuration file?

in my opinion all modtime code could be removed, but i kept it as i didn't 
understand it and just wanted to fix the bug.

kind regards,
janning

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/



fcopy feature request: report if a file was copied

2006-12-06 Thread Janning Vygen
hi,

as i use softupdate a lot , it would be nice to have a fcopy feature which 
reports if any files or file permissions were changed. Look at my script in 
BASE/50-ntp

  #!/bin/sh
  fcopy -iM /etc/ntp.conf
  /etc/init.d/ntp-server stop
  ntpd -q -g
  hwclock --systohc
  /etc/init.d/ntp-server start

I dont want to start and stop my ntp server on each softupdate, only on my 
first install or when /etc/ntp.conf changes

it would be nice to have something like this:

if [ `fcopy -iM /etc/ntp.conf` -gt "0" ]
then
   /etc/init.d/ntp-server stop
   ntpd -q -g
   hwclock --systohc
   /etc/init.d/ntp-server start
fi

it would be nice to have an option like 
 -n --number  report number of files changed
and let fcopy report the number of files changed 

i would like to write a patch for fcopy implementing this if it does make 
sense and would become part of fai.

kind regards 
Janning

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/



Fcopy patch regarding debian bug report #360184

2006-12-06 Thread Janning Vygen
Hi fai,

attached there are two patch files for fcopy, one for debian stable version 
and one for the latest from fai (which send Thomas Lange to me yesterday)

These Patch files should fix the bug 

http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=360184

"In case only the modes are changed, but the actual file stays the same,   
 these changes are not propagated; a possible workaround is IMHO 
 to call set_mode even if a file is preserved."

It just fixes the part of code where $opt_update is not set as i do not 
understood what -p really does.

the main difference is in this line

   if ( compare($tmpfile,$destfile) or compare_mode($ps,$destfile,$class)) {

instead of 

   if ( compare($tmpfile,$destfile) ){

There are a few new subroutines:
   sub get_sourcefile_mode
   sub get_destfile_mode
   sub compare_mode

and some minor modifications to 
  sub set_mode 
to use these new subroutines and avoid repeated code.

It was tested a few times in my environment and it works for me, but maybe 
won't work for you. 

i hope it works and will help anybody. Feel free to use/modify/discard but 
don't claim me for any bugs.

Can anybody review this patch and maybe upload it to http://bugs.debian.org/ 
as i am not used to handle bug reporting databases.

kind regards
Janning

PS: i hope its allowed to send attachments to the list. netiquette is still a 
TODO on 
http://faiwiki.informatik.uni-koeln.de/index.php/Linux-fai_mailing_list_infos

--- fcopy	2006-12-06 11:49:47.306784009 +0100
+++ fcopy.deb31.fixed	2006-12-06 11:47:56.833502527 +0100
@@ -123,8 +123,7 @@
 }
   } else {
 # compare literally
-
-if ( compare($sourcefile,$destfile)) {
+if ( compare($sourcefile,$destfile) or compare_mode($ps,$destfile,$class)) {
   $logcomment="\t# new (literal)";
 } else {
   $logcomment="\t# preserved (literal)" if $logfile;
@@ -187,26 +186,55 @@
 sub set_mode {
 
   # set target file's owner, group, mode and time
-  # use owner,group,mode from -m or from the file file-modes or
-  # use the values from the source file
   my ($sourcefile,$destfile,$class) = @_;
+  my ($uid,$gid,$mode,$stime) = get_sourcefile_mode($sourcefile,$class);
+  warn "chown/chmod u:$uid g:$gid m:$mode $destfile\n" if $debug;
+  chown ($uid,$gid, $destfile) || ewarn("chown $uid, $gid $destfile failed. $!");
+  chmod ($mode, $destfile) || ewarn("chmod $mode $destfile failed. $!");
+  utime ($stime,$stime, $destfile) || ewarn("utime for $destfile failed. $!");
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_sourcefile_mode {
+
+  # owner,group,mode from -m or from the file file-modes or
+  # the values from the source file
+  my ($sourcefile,$class) = @_;
   my ($uid,$gid,$owner,$group,$mode);
   # get mtime,uid,gid,mode from source file
   my ($stime,@defmodes) = (stat("$sourcefile/$class"))[9,4,5,2];
-
   if ($modeset) { # use -m values
 ($owner,$group,$mode) = @opt_modes;
   } elsif (-f "$sourcefile/file-modes"){
 ($owner,$group,$mode) = read_file_mode("$sourcefile/file-modes",$class);
   } else { # use values from source file
 ($owner,$group,$mode) = @defmodes;
+# see perldoc -f stat
+$mode = $mode & 0;
   }
-
   ($uid,$gid) = name2num($owner,$group);
-  warn "chown/chmod u:$uid g:$gid m:$mode $destfile\n" if $debug; 
-  chown ($uid,$gid, $destfile) || ewarn("chown $owner $group $destfile failed. $!");
-  chmod ($mode, $destfile) || ewarn("chmod $mode $destfile failed. $!");
-  utime ($stime,$stime, $destfile) || ewarn("utime for $destfile failed. $!");
+  return ($uid,$gid,$mode,$stime);
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub get_destfile_mode {
+
+  my $destfile = shift;
+  my ($owner,$group,$mode,$time) = (stat($destfile))[4,5,2,9];
+  my ($uid,$gid) = name2num($owner,$group);
+  # see perldoc -f stat
+  $mode = $mode & 0;
+  return ($uid,$gid,$mode,$time);
+}
+# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
+sub compare_mode {
+
+  # compare destination file's mode with source
+  # return 1 if differs / 0 if equals
+  my ($sourcefile,$destfile,$class) = @_;
+  my ($suid,$sgid,$smode,$stime) = get_sourcefile_mode($sourcefile,$class);
+  my ($duid,$dgid,$dmode,$dtime) = get_destfile_mode($destfile);
+
+  return 1 if ( $suid != $duid or $sgid != $dgid or $smode != $dmode or $stime != $dtime );
+  return 0;
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 sub check_mopt {
--- fcopy	2006-12-06 11:19:47.0 +0100
+++ fcopy.fixed	2006-12-06 11:19:47.0 +0100
@@ -145,7 +145,7 @@
   runscript("preinst",$ps,$tmpfile,$class);
 };
 
-if ( compare($tmpfile,$destfile)) {
+if ( compare($tmpfile,$destfile) or compare_mode($ps,$destfile,$class)) {
   $logcomment="\t# new (literal)";
 } else {
   $logcomment="\t# preserved (literal)" if $logfile;
@@ -246,27 +246,56 @@
 sub set_mode {
 
   # set target file's owner, group, mode and tim

Re: fcopy

2006-12-06 Thread Janning Vygen
Am Dienstag, 5. Dezember 2006 21:04 schrieb Michael Tautschnig:
> > > On Tue, 5 Dec 2006 15:46:35 +0100, Janning Vygen
> > > <[EMAIL PROTECTED]> said:
> > >
> > > If i fcopy a file which is alread there with same content, but the
> > > file in SOURCE has other file access permissions, why it is not
> > > copied?
> >
> > I should be copied, but the permissions should be changed.
> > Which fcopy are you using?
> > Maybe try fcopy -vD to get debuggin and verbose output.
> >
> > > Why does fcopy compares files only literally?
> >
> > Maybe a small bug. But first try -D for debugging output.
> >
> > If you join the IRC channel #fai on oftc.net and paste your output to
> > paste.debian.net we may help you very quickly.
>
> Did you solve this issue already? Otherwise this is probably just what
> #360184 is about:
>
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=360184

Yes, it seams to be the same bug. And it's still there in the newest version. 
IMHO this is a bug to worry about if you use softupdate, which can result in 
a security hole: 

i chmod a script executable in /etc/network/if-pre-up.d/ which contains 
iptables statements. Tthe executable flag was NOT copied and so my firewall 
is not in the state it should be. chmod a script can be an easy way to 
enable/disable a part of a firewall. 

This bug might be only a problem with softupdate of course.

I am debugging fcopy at the moment and will send my patch today.

kind regards,
janning

-- 
PLANWERK 6 websolutions
Venloer Straße 8, 40477 Düsseldorf
Tel: (0211) 302666-0
Fax: (0211) 302666-10 
http://www.planwerk6.de/