Geoff Thurman wrote:
> Matthias Czapla wrote:
> > I just want to say... ARRRGHHH!
> 
> Yes, this happened to me too; my mouse dropped out.

Put me in that list too.  I took the xserver-xfree86 security update
and sure enough this fluffed the file and the edits in that section
were lost.  But this is only used when X11 starts.  So you won't
notice until you log out.  At that time X11 won't be able to restart.
I did not notice until the next day.

> I thought perhaps I'd made a mistake somewhere.

You did.  I did.  We did.  We all who were caught made the same
mistake.  We have been editing the /etc/X11/XF86Config-4 in the
section marked do not edit.  Look in the file and read carefully this
comment at the top.

# If you want your changes to this file preserved by dexconf, only make changes
# before the "### BEGIN DEBCONF SECTION" line above, and/or after the
# "### END DEBCONF SECTION" line below.

That was our bad.  We should not have been editing that section of the
file.  We need to do this slightly differently.  I had forgotten I was
editing in the debconf section.

Of course I have a backup of the file and I recovered it with no
trouble at all.  But if someone else does this without knowing the  
details this could cause some confusion and they would be offline
until this got fixed.

Here is one solution.  If you have not made any changes to the
/etc/X11/XF86Config-4 then of course you are fine regardless.  If you
have made changes then you need to tell debconf that you are managing
the file instead of it.  Run the following command.  Tell it not to
mange that file any longer.

  dpkg-reconfigure xserver-xfree86
  Manage XFree86 4.x server configuration file with debconf?
  Select "<No>"

That is simple and easily avoids this problem.  After this you can
take updates without any changes happening to your file.

If you are like me and have many machines to do this to you might find
this very tedious and time consuming.  I wrote a script to do this
automatically.  The following is all one one line.

  EDITOR='perl -pi -e "[EMAIL PROTECTED]/[EMAIL 
PROTECTED]/manage_config_with_debconf=\"no\"@"' dpkg-reconfigure --frontend=editor 
xserver-xfree86

Basically I am using the editor frontend to get a script in place to
edit the answer that the xserver-xfree86 postinst is going to ask.  I
used a one line perl script to do the hack.  The above is all one one
line and temporarily sets the EDITOR variable for that single
invokation of dpkg-reconfigure.

I also wanted to be able to run the script repeatedly without changing
anything if the machine were already fixed.  So I wrote the following
script to do the change in an idempotent way.

Perhaps this will be of benefit to someone.

Bob

#!/bin/sh

trap 'rm -f /tmp/*.tmp.$$~' 0

if [ -f /etc/X11/XF86Config-4 -a -f /usr/share/debconf/confmodule ]; then
  # This is crazy but the db_get only works if run in a script.  So
  # create a script on the fly and run it.
  # Load up the debconf routines.  Get the current value.  This will  
  # set the RET variable.  Print that out.
  cat > /tmp/get_db_value.tmp.$$~ <<EOF
#!/bin/sh
. /usr/share/debconf/confmodule
db_get xserver-xfree86/manage_config_with_debconf
echo \$RET
EOF
  chmod a+x /tmp/get_db_value.tmp.$$~

  if [ _"$(/tmp/get_db_value.tmp.$$~ 2>&1)" = _"true" ]; then
    # With the frontend set to editor we get a file and we only need to
    # change the value on the line from yes to no.
    echo Running dpkg-reconfigure xserver-xfree86 to change management setting
    EDITOR='perl -pi -e "[EMAIL PROTECTED]/[EMAIL 
PROTECTED]/manage_config_with_debconf=\"no\"@"' dpkg-reconfigure --frontend=editor 
xserver-xfree86
  fi  
fi

Attachment: pgp00000.pgp
Description: PGP signature

Reply via email to