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

Bug#193278: libc6: When restarting, if one fails, rest isn't done



At Wed, 14 May 2003 10:27:30 +0200,
Paul Slootman wrote:
> 
> Package: libc6
> Version: 2.3.1-16
> Severity: important
> 
> When upgrading to this version, when restarting services, it failed when
> doing apache (which always seems to happen BTW; I always have to start
> apache afterwards, and see also #169424 which also mentions this).

Did you upgrade from woody to sarge or sid?

> Later I discovered that it had apparently not restarted any of the
> services in its list after apache: samba logins stopped working for
> instance, and the samba daemons were clearly still running from before
> the upgrade. A quick check shows that also proftpd, cupsys, mysql-server
> were not restarted (i.e. all installed packages from the list after
> apache). It only showed apache as having failed.
> 
> This is a Bad Thing...

Well, it's bad.

> From a quick look in the libc6 postinst I don't see why this is
> happening; however, I wonder why not the init.d script "restart" option
> isn't used; presumably that's more robust in restarting a service than
> "stop; sleep 1; start" i.e. perhaps taking into account that a daemon
> might not immediately terminate hence keeping the TCP port in use for a
> few seconds longer than expected...

That's right.  However, is "restart" option really guaranteed to exist
in all scripts?

> Hmm, looking further, I see that there's some flawed logic apparently
> where it determines what services to restart:
> 
>     # dpkg -s proftpd 2> /dev/null | awk 'BEGIN{RS="\n\n";FS="\n"}{if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' '
>     proftpd
> 
>     # dpkg -s apache proftpd 2> /dev/null | awk 'BEGIN{RS="\n\n";FS="\n"}{if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' '
>     apache
>     proftpd
> 
>     # dpkg -s apache apache2-common proftpd 2> /dev/null | awk 'BEGIN{RS="\n\n";FS="\n"}{if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' '
>     apache
> 
> Note the conspicuous absence of proftpd from the last example...
> This may be the reason why not all services are restarted.
> 
> BTW: Why not use dpkg -l ? Seems a lot less complicated.

Which awk version do you use?

    $ dpkg -s apache apache2-common proftpd 2> /dev/null | gawk 'BEGIN{RS="\n\n";FS="\n"}{if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' '
    apache
    apache2-common
    proftpd
    $

    $ dpkg -s apache apache2-common proftpd 2> /dev/null | mawk 'BEGIN{RS="\n\n";FS="\n"}{if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' '
    apache
    apache2-common
    proftpd
    $

    $ dpkg -s apache apache2-common proftpd 2> /dev/null | original-awk 'BEGIN{RS="\n\n";FS="\n"}{if ( $2 ~ /Status: .* installed$/ ) { print $1 } }' | cut -f 2 -d ' '
    $

It seems original-awk does not work well.  We should change to "mawk"?

At Wed, 14 May 2003 11:32:08 +0200,
Paul Slootman wrote:
> Additional info:
> dpkg gives an extra empty line if a not-installed package name is given,
> which is probably what is confusing the awk script.

Could you provide us your "dpkg -s apache apache2-common proftpd"?

Regards,
-- gotom



Reply to: