LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Debian wheezy(amd64): fail to configure tzdata -> everything got stuck. (http://www.linuxquestions.org/questions/debian-26/debian-wheezy-amd64-fail-to-configure-tzdata-everything-got-stuck-4175412151/)

kaz2100 06-18-2012 09:20 PM

Debian wheezy(amd64): fail to configure tzdata -> everything got stuck.
 
Hya,

situation
This week, after dist-upgrade,
Code:

Setting up tzdata (2012c-1) ...         
dpkg: error processing tzdata (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 tzdata
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:
Setting up tzdata (2012c-1) ...
dpkg: error processing tzdata (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 tzdata

and many other things got stuck.

This happened with 2 penguins (amd64 wheezy).

I have checked 1. bug report for tzdata, dpkg, 2. changelog for tzdata (2012c-1), 3. aptitude with -v option. So far, no solution.

These two penguins have different apt source files.

The file (tzdata) is a kind of essential and I have not tried to remove (purge) and install.

Question
How can I get out of this situation?

Closing remark
Thanks in advance.

evo2 06-19-2012 12:55 AM

Hi,

you should try to debug the post-installation script and work out why it is returning with non-zero status. You can find it at:

/var/lib/dpkg/info/tzdata.postinst

Try putting 'set -x' on the second line of the script, then run 'dpkg --configure tzdata'.

Cheers,

Evo2.

kaz2100 06-19-2012 02:28 AM

Hya

After setting "set -x" on the second line, "dpkg --configure tzdata" runs without error, (exit status is 0). I am not sure what went on, however, no error.

Then, things look well.

Hopefully, no hidden trouble in future.

Thanks.

Have a nice Penguin!

evo2 06-19-2012 03:02 AM

Hi,

hmm maybe I know. Did you delete a line with "set -e"? A "set -e" would have caused the script to exit if any of the commands it runs run turn non-zero. If this is the case something may have failed to be setup correctly. If you did delete it please add "set -x" and "set -e" and rerun the configuration.

Evo2.

kaz2100 06-19-2012 07:50 PM

Auch,

You are a star! How did you know that I deleted the line "set -e"?
With "set -x" on line 2, it goes like
Code:

.
.
+ mv -f /etc/localtime.dpkg-new /etc/localtime
+ which restorecon
+ restorecon /etc/localtime
dpkg: error processing tzdata (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 tzdata
#

and I guess "which restorecon >/dev/null 2>&1 && restorecon /etc/localtime" is where the Penguin chokes. However
Code:

# which restorecon
/sbin/restorecon
# echo $?
0
# restorecon /etc/localtime
# echo $?
0
#

The content of '/etc/localtime' looks correct.

Apology for my poor experience with sh script.

Thanks for your assistance.

kaz2100 06-19-2012 07:58 PM

And entire tzdata.postinst looks like
Code:

# cat tzdata.postinst
#! /bin/sh
set -x
set -e

LC_ALL=C
LANG=C
unset TZ
umask 022

. /usr/share/debconf/confmodule
db_version 2.0

if [ "$1" = configure ]; then
    # If the user prefers to manage the time zone by itself, let him doing that.

    if ! [ -e /etc/timezone ] && [ -z "$DEBCONF_RECONFIGURE" ] ; then
        db_stop
        echo
        echo "User defined time zone, leaving /etc/localtime unchanged."
    else
   
        # Get the values from debconf
        AREA=Etc
        ZONE=UTC
        db_get tzdata/Areas && AREA="$RET"
        db_get tzdata/Zones/$AREA && ZONE="$RET"
        db_stop
   
        # Update the time zone
        echo $AREA/$ZONE > /etc/timezone
        cp -f /usr/share/zoneinfo/$AREA/$ZONE /etc/localtime.dpkg-new && \
            mv -f /etc/localtime.dpkg-new /etc/localtime
        which restorecon >/dev/null 2>&1 && restorecon /etc/localtime
   
        echo
        echo "Current default time zone: '$AREA/$ZONE'"
    fi

    # Show the new setting to the user
    TZBase=$(LC_ALL=C TZ=UTC0 date)
    UTdate=$(LC_ALL=C TZ=UTC0 date -d "$TZBase")
    TZdate=$(unset TZ ; LANG=C date -d "$TZBase")
    echo "Local time is now:      $TZdate."
    echo "Universal Time is now:  $UTdate."
    if [ -z "$DEBCONF_RECONFIGURE" ] ; then
        echo "Run 'dpkg-reconfigure tzdata' if you wish to change it."
    fi
    echo
fi



exit 0


evo2 06-20-2012 02:01 AM

Hi,

this is a little strange I wonder if it is shell related. If /bin/sh is not linked to your login shell, can you please try changing the "#! /bin/sh" to "#! /bin/bash" and try again?

Another thing is that restorecon seems to be SELinux related (from the policycoreutils package): are you actually using SELinux? If not, you should probably remove policycoreutils. I guess simply commenting out that line in the postinst script will work for you (if you don't use selinux), but it doesn't answer the underlying question.

Looking like it could be time to think about filing a but report.

Evo2.

kaz2100 06-22-2012 06:19 AM

Hya,

Sorry for delay, I was off several days.

1. /bin/sh to /bin/bash does not change anything.

2. neither removing policycoreutils.

It may be a good idea to file bug report, I agree. However, I am not sure which one of tzdata or selinux (policycoreutils) is to blame. I will try to pinpoint a little further.

cheers

kaz2100 06-28-2012 09:08 PM

Hya,

Self reply:

Two other amd64 Penguins and two ia32 Penguins (all Debian wheezy) went update without choking.

Installed packages are not identical, tho....

Have a nice Penguin!

kaz2100 07-03-2012 10:01 PM

Hya

Self reply.

The preblematic two penguins (see post #1) went update. This time, policycoreutils choked.
Code:

# dpkg --configure policycoreutils
Setting up policycoreutils (2.1.10-9) ...
+ [ ! -e /etc/selinux/config ]
+ [ -x /etc/init.d/mcstrans ]
+ update-rc.d mcstrans defaults
+ invoke-rc.d mcstrans start
Starting mcstransd:
invoke-rc.d: initscript mcstrans, action "start" failed.
+ exit 1
dpkg: error processing policycoreutils (--configure):
 subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
 policycoreutils
#

then it looks like that mcstrans start chokes. /etc/init.d/mcstrans reads:
Code:

start(){
        test -x /sbin/mcstransd  || exit 5
        echo -n $"Starting $prog: "
        if ! [ -d /var/run/setrans ]; then
                rm -rf /var/run/setrans
                install -d -o root -g root /var/run/setrans
                [ -x /sbin/restorecon ] && /sbin/restorecon /var/run/setrans
        fi

        unset HOME MAIL USER USERNAME
        start-stop-daemon --start --quiet --exec /sbin/mcstransd -- "$EXTRAOPTIONS"
        RETVAL=$?
        echo
        if test $RETVAL = 0 ; then
                touch $lockfile
        fi
        return $RETVAL
}

Now, it looks like that /sbin/mcstransd returns 1. man page of mcstransd does not say much about return value. I am not sure where to go next.

My next guess is whether or not kernel is related. For some reason, one of kernel parameters, "CONFIG_SECURITY_SELINUX_DISABLE" is "Y".

For several reasons, I cannot recompile kernel now. I will update in near future.

Currently, these penguins live without policycoreutils package.

cheers

evo2 07-03-2012 10:41 PM

Hi,

oh, the joy of selinux.

If you are not using it you should probably uninstall all the selinux realated pacakges. It seems to be the cause of all your problems.

Evo2.

kaz2100 07-04-2012 06:26 PM

Hya,

self reply.

I checked another penguin, which does not choke, and found that "CONFIG_SECURITY_SELINUX_DISABLE" was "Y". I reinstalled policicoreutils, and see what happens. No problem!

Troubleshoot is not complete, however, practically it is solved.

Following what I did to get out of trouble.
1. tzdata package failed to configure.
2. tweak tzdata.postinst file, suggested by post #7. So other files upgraded.
3. policycoreutil package failed to configure.
4. purge policycoreutil package.
5. reinstall policycoreutil package.

Thanks for your help.

Have a Happy Penguin!


All times are GMT -5. The time now is 06:26 PM.