LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Hardware (https://www.linuxquestions.org/questions/linux-hardware-18/)
-   -   My xorg.conf is replaced with a default xorg.conf after reboot (https://www.linuxquestions.org/questions/linux-hardware-18/my-xorg-conf-is-replaced-with-a-default-xorg-conf-after-reboot-801101/)

rrrssssss 04-09-2010 02:31 PM

My xorg.conf is replaced with a default xorg.conf after reboot
 
Hello forum,

I have installed Kubuntu 8.04.2 on a USB stick with persistence to keep any changes I make after a reboot and it works fine. I then installed the 185 Nvidia driver to give me higher resolutions and it works fine. But each time I reboot, my updated xorg.conf is replaced with the default xorg.conf that ships with that version of Kubuntu and a backup is made of my updated xorg.conf (the correct one) which looks like xorg.conf.20100409135913. I have to put the backup xorg.conf back in place to get my Nvidia driver to work with the correct screen resolutions again. Otherwise my screen resolution is too low.

What could be causing this behavor? I'm sure it not the persistence feature of the USB stick failing since a backup is made of my original xorg.conf.

Any pointers or suggestions?

Regards,
Roy

I might add more information. The xorg.conf that gets changed after a reboot says "This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database."
#

smoker 04-09-2010 07:50 PM

dexconf seems to be running at startup. Stop it from doing so. Or find a way to make it read your current file.

rrrssssss 04-10-2010 04:24 AM

Can't Solve Yet
 
Hello again,

I still can not solve it.

I commented out the debconf.conf file in the /etc directory but debconf still overwrote my xorg.conf on the next reboot. I also noticed there is not a startup script in the /etc/init.d directory that I could keep from starting.

I can not find much help from Googling either. Or from the debconf man pages.

I use nvidia-xconfig to create the correct xorg.conf and it works when I log out and log back in but it fails when I reboot because debconf overwrites the xorg.conf once again.

How can I let debconf know that I already have a display driver properly configured and I do not need it to give me a generic display driver?

Can anybody help me?

Thanks much,
Roy

smoker 04-10-2010 08:25 AM

Apparently you can edit the /usr/bin/dexconf script.
This script generates xorg.conf automatically in liveCD session according to the booted machine.
I suggest you make a backup before you change anything.


https://help.ubuntu.com/community/LiveCDCustomization

rrrssssss 04-11-2010 02:14 PM

Hello again,


I am a newbee when it comes to certain things in Linux and I do not know how to edit scripts such as the script in /usr/bin/dexconf. Instead, I just renamed it in order to disable it and now my problem is solved. My xorg.conf is not overwritten on reboot so I can boot up to proper screen resolutions.

If anybody can think of a better way to accomplish this I will be very greatful.

Cheers,
Roy

smoker 04-11-2010 03:02 PM

If you have renamed it then you will find errors showing up in your logs. If you don't know how to edit it properly, you may be causing other problems. (edit - I've found what looks like a copy and the script only deals with the xorg config so renaming it won't break anything but may cause error messages - see below on how to deal with that)

You could add the word exit on a new line just after the beginning of the script to avoid "script not found" errors
Code:

#!/bin/sh
exit 0
# dexconf: Debian X server configuration file writer for failsafe mode

#

# This tool is a backend which uses debconf database values.  It writes an

# XFree86 X server configuration file based on the information in the database.

#

then the script will run but not do anything, and you won't get script not found errors.
Obviously you would have to rename it back to the original name.
If you don't care about the errors, then don't worry about editing the file.
If you want to post it here, we can work through it properly.

rrrssssss 04-11-2010 03:38 PM

Thank you smoker. I prefer to do it the right way.

Below is the dexconf script.

Code:

#!/bin/sh

# dexconf: Debian X server configuration file writer
#
# This tool is a backend which uses debconf database values.  It writes an
# XFree86 X server configuration file based on the information in the database.
#
# Author: Branden Robinson

# Copyright 2000--2004 Progeny Linux Systems, Inc.
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2,
# or (at your option) any later version.
#
# This is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License with
# the Debian operating system, in /usr/share/common-licenses/GPL;  if
# not, write to the Free Software Foundation, Inc., 59 Temple Place,
# Suite 330, Boston, MA 02111-1307 USA

set -e

# source debconf library
. /usr/share/debconf/confmodule

# display a usage message
usage () {
  cat <<EOF
Usage: $PROGNAME [OPTION ...]
  write an Xorg X server configuration file based on debconf database values
Options:
  -h, --help                                display this usage message and exit
  -o FILE, --output=FILE                        write configuration file to FILE
This help message is intended only as a quick reference.  For a description of
the usage of $PROGNAME, see the $PROGNAME(1) manual page.
EOF
}

# the error-out function
bomb () {
  echo "$PROGNAME: error: $*" | fold -s -w "${COLUMNS:-80}" >&2
  exit 1
}

# wrapper around db_get to ensure that the info we try to retrieve exists; it
# is (almost) always a fatal error for the values to be null
fetch () {
  db_get "$1" || true
  if [ -z "$RET" ]; then
    ERRMSG="cannot generate configuration file; $1 not set.  Aborting."
    ERRMSG="$ERRMSG  Reconfigure the X server with \"dpkg-reconfigure"
    ERRMSG="$ERRMSG xserver-xorg\" to correct this problem."
    bomb "$ERRMSG"
  fi
}

# convert a debconf comma-delimited list to a shell whitespace-delimited list
list_convert () {
  echo $(IFS=", "; set -- $RET; while [ $# -gt 0 ]; do echo \"$1\"; shift; done)
}

SERVER="xorg"
XF86CONFIG=/etc/X11/xorg.conf
PROGNAME=${0##*/}
SHOWHELP=
EARLYEXIT=

GETOPT_OUTPUT=$(getopt --options ho: \
                      --longoptions help,output: \
                      -n "$PROGNAME" -- "$@")

if [ $? -ne 0 ]; then
    bomb "error while getting options; use \"$PROGNAME --help\" for help"
fi

eval set -- "$GETOPT_OUTPUT"

while :; do
    case "$1" in
        -f|--format)
          bomb "This option, and XFree86 3.x output, are no longer supported."
          ;;
        -h|--help) SHOWHELP=yes EARLYEXIT=yes ;;
        -o|--output) XF86CONFIG="$2"; shift ;;
        --) shift; break ;;
        *)
          bomb "unrecognized option \"$1\"; use \"$PROGNAME --help\" for help"
          ;;
    esac
    shift
done

if [ -n "$SHOWHELP" ]; then
    usage
fi

if [ -n "$EARLYEXIT" ]; then
    exit 0
fi

if which laptop-detect >/dev/null 2>&1; then
  if laptop-detect > /dev/null ; then
    LAPTOP=true
  fi
fi

DEXCONFTMPDIR=

trap 'if [ -e "$DEXCONFTMPDIR/backup" ] && [ -n "$XF86CONFIG" ]; then \
        cat "$DEXCONFTMPDIR/backup" >"$XF86CONFIG"; \
      fi; \
      exec 4<&-; \
      rm -rf "$DEXCONFTMPDIR"; \
      bomb "received signal; aborting"' HUP INT QUIT TERM


# Set up a temporary directory for the files we'll be writing.
TDIR_PARENT="${TMPDIR:-/tmp}"
TDIR="${TMPDIR:-/tmp}/dexconf-tmp-$$"

if [ ! -d "$TDIR_PARENT" ]; then
  bomb "cannot create temporary work directory; \"$TDIR_PARENT\" does not" \
    "exist or is not a directory"
fi

if [ ! -w "$TDIR_PARENT" ]; then
  bomb "cannot create temporary work directory in \"$TDIR_PARENT\"; directory" \
    "not writable"
fi

rm -rf "$TDIR"

if mkdir -m 0700 "$TDIR"; then
  DEXCONFTMPDIR="$TDIR"
else
  bomb "creation of temporary work directory \"$TDIR\" failed"
fi

# xorg.conf sections:
#  Files          File pathnames
#  ServerFlags    Server flags                      NOT USED BY DEXCONF
#  Module        Dynamic module loading            NOT USED BY DEXCONF
#  InputDevice    Input device description
#  Device        Graphics device description
#  VideoAdaptor  Xv video adaptor description      NOT USED BY DEXCONF
#  Monitor        Monitor description
#  Modes          Video modes descriptions          NOT USED BY DEXCONF
#  Screen        Screen configuration
#  ServerLayout  Overall layout                    NOT USED BY DEXCONF
#  DRI            DRI-specific configuration        NOT USED BY DEXCONF
#  Vendor        Vendor-specific configuration    NOT USED BY DEXCONF

### HEADER

# Because debconf hijacks standard output and its confmodule uses file
# descriptor 3 for its own purposes, we will write our output to file descriptor
# 4 instead of standard output.

exec 4>"$DEXCONFTMPDIR/Header"
cat >&4 <<SECTION
# xorg.conf (X.Org X Window System server configuration file)
#
# This file was generated by dexconf, the Debian X Configuration tool, using
# values from the debconf database.
#
# Edit this file with caution, and see the xorg.conf manual page.
# (Type "man xorg.conf" at the shell prompt.)
#
# This file is automatically updated on xserver-xorg package upgrades *only*
# if it has not been modified since the last upgrade of the xserver-xorg
# package.
#
# If you have edited this file but would like it to be automatically updated
# again, run the following command:
#  sudo dpkg-reconfigure -phigh xserver-xorg
SECTION

### KEYBOARD / INPUTDEVICE

fetch xserver-$SERVER/config/inputdevice/keyboard/rules
XKB_RULES="$RET"
fetch xserver-$SERVER/config/inputdevice/keyboard/model
XKB_MODEL="$RET"
fetch xserver-$SERVER/config/inputdevice/keyboard/layout
XKB_LAYOUT="$RET"
# XkbVariant and XkbOptions are permitted to be null.
db_get xserver-$SERVER/config/inputdevice/keyboard/variant
XKB_VARIANT="$RET"
db_get xserver-$SERVER/config/inputdevice/keyboard/options
XKB_OPTIONS="$RET"

exec 4>"$DEXCONFTMPDIR/InputDeviceKeyboard"
cat >&4 <<SECTION
Section "InputDevice"
        Identifier        "Generic Keyboard"
        Driver                "kbd"
        Option                "XkbRules"        "$XKB_RULES"
        Option                "XkbModel"        "$XKB_MODEL"
        Option                "XkbLayout"        "$XKB_LAYOUT"
SECTION
if [ -n "$XKB_VARIANT" ]; then
  printf "\tOption\t\t\"XkbVariant\"\t\"$XKB_VARIANT\"\n" >&4
fi
if [ -n "$XKB_OPTIONS" ]; then
  printf "\tOption\t\t\"XkbOptions\"\t\"$XKB_OPTIONS\"\n" >&4
fi
printf "EndSection\n" >&4

### MOUSE / INPUTDEVICE

DO_EMULATE3BUTTONS=

fetch xserver-$SERVER/config/inputdevice/mouse/emulate3buttons
if [ "$RET" = "true" ]; then
  DO_EMULATE3BUTTONS=true
fi

MOUSE_DRIVER=mouse
IS_VIRT=
if which vmmouse_detect >/dev/null 2>&1; then
  if vmmouse_detect > /dev/null ; then
    MOUSE_DRIVER=vmmouse
    IS_VIRT=true
  fi
fi

exec 4>"$DEXCONFTMPDIR/InputDeviceMouse"
cat >&4 <<SECTION
Section "InputDevice"
        Identifier        "Configured Mouse"
        Driver                "$MOUSE_DRIVER"
        Option                "CorePointer"
SECTION
if [ -n "$DO_EMULATE3BUTTONS" ]; then
  printf "\tOption\t\t\"Emulate3Buttons\"\t\"true\"\n" >&4
fi
if [ -n "$IS_VIRT" ]; then
  printf "\tOption\t\t\"Device\"\t\"/dev/input/mice\"\n" >&4
fi
printf "EndSection\n" >&4

if [ -n "$LAPTOP" ]; then
  cat >&4 <<SECTION

Section "InputDevice"
        Identifier        "Synaptics Touchpad"
        Driver                "synaptics"
        Option                "SendCoreEvents"        "true"
        Option                "Device"                "/dev/psaux"
        Option                "Protocol"                "auto-dev"
        Option                "HorizEdgeScroll"        "0"
EndSection
SECTION
fi

### DEVICE

db_get xserver-$SERVER/config/device/driver
DEVICE_DRIVER="$RET"
db_get xserver-$SERVER/config/device/bus_id
DEVICE_BUSID="$RET"
db_get xserver-$SERVER/config/device/use_fbdev
DEVICE_USE_FBDEV="$RET"

QEMU_KVM=$(grep "QEMU Virtual CPU" /proc/cpuinfo || true)
if [ -n "$QEMU_KVM" ]; then
    DEVICE_DRIVER="cirrus"
fi

exec 4>"$DEXCONFTMPDIR/Device"
cat >&4 <<SECTION
Section "Device"
        Identifier        "Configured Video Device"
SECTION
if [ -n "$DEVICE_DRIVER" ]; then
  printf "\tDriver\t\t\"$DEVICE_DRIVER\"\n" >&4
fi
PS3_FB=$(grep -i PS3 /proc/fb 2>/dev/null || true)
if [ -n "$PS3_FB" ]; then
  printf "\tOption\t\t\"ShadowFB\"\t\t\"false\"\n" >&4
fi
if [ -n "$DEVICE_BUSID" ]; then
  printf "\tBusID\t\t\"$DEVICE_BUSID\"\n" >&4
fi
if [ "$DEVICE_USE_FBDEV" = "true" ]; then
  printf "\tOption\t\t\"UseFBDev\"\t\t\"$DEVICE_USE_FBDEV\"\n" >&4
fi
printf "EndSection\n" >&4

### MONITOR

exec 4>"$DEXCONFTMPDIR/Monitor"
cat >&4 <<SECTION
Section "Monitor"
        Identifier        "Configured Monitor"
SECTION

if [ -n "$QEMU_KVM" ]; then
  printf "\tHorizSync\t30-70\n" >&4
  printf "\tVertRefresh\t50-160\n" >&4
fi
cat >&4 <<SECTION
EndSection
SECTION

### SCREEN

exec 4>"$DEXCONFTMPDIR/Screen"
cat >&4 <<SECTION
Section "Screen"
        Identifier        "Default Screen"
        Monitor                "Configured Monitor"
        Device                "Configured Video Device"
SECTION
if [ -n "$PS3_FB" ]; then
  printf "\tDefaultFbBpp 32\n" >&4
fi
if [ -n "$QEMU_KVM" ]; then
cat >&4 <<SUBSECTION
        Device                "Configured Video Device"
        DefaultDepth        24
        SubSection "Display"
                Depth        24
                Modes        "1280x800" "1152x768" "1024x768" "800x600" "640x480"
        EndSubSection
SUBSECTION
fi
printf "EndSection\n" >&4

### SERVERLAYOUT

exec 4>"$DEXCONFTMPDIR/ServerLayout"
cat >&4 <<SECTION
Section "ServerLayout"
        Identifier        "Default Layout"
        Screen                "Default Screen"
SECTION
if [ -n "$LAPTOP" ]; then
  printf "\tInputDevice\t\"Synaptics Touchpad\"\n" >&4
fi
printf "EndSection\n" >&4

# Close file descriptor 4 before we delete temporary files
exec 4<&-

# Tell debconf to stop listening to us.
db_stop

# Write the configuration file.  Put a blank line before every section we write
# except the first.

OUTFILE="$DEXCONFTMPDIR/dexconf-out"
umask 022
: >"$OUTFILE"

SPACER=
for SECTION in Header Files InputDeviceKeyboard InputDeviceMouse \
              Device Monitor Screen ServerLayout; do
  if [ -e "$DEXCONFTMPDIR/$SECTION" ]; then
    eval $SPACER
    cat "$DEXCONFTMPDIR/$SECTION" >>"$OUTFILE"
    SPACER='echo "" >>"$OUTFILE"'
  fi
done

# Ensure we can write to our destination if it already exits.
if [ -e "$XF86CONFIG" ]; then
  if [ ! -w "$XF86CONFIG" ]; then
    bomb "unable to write to \"$XF86CONFIG\""
  fi
fi

BACKUP=
# Create a backup of the existing configuration file if it already exists.
if [ -e "$XF86CONFIG" ]; then
  cat "$XF86CONFIG" >"$DEXCONFTMPDIR/backup"
  BACKUP=true
fi

# Move the new file into place.
if ! cat "$OUTFILE" >"$XF86CONFIG"; then
  # Failed; try to restore the backup.
  if [ -n "$BACKUP" ]; then
    cat "$DEXCONFTMPDIR/backup" >"$XF86CONFIG"
  fi
fi

rm -rf "$DEXCONFTMPDIR"

exit 0

# vim:set ai et sts=2 sw=2 tw=80:


smoker 04-11-2010 03:43 PM

Heh, my edited post actually deals with it, but anyway,

edit the script and make the first two lines look like the following :
Code:

#!/bin/sh
exit 0 # this disables the script - remove to re-enable auto config
# dexconf: Debian X server configuration file writer

Don't change anything else.
You will probably have to be root to edit this file.
Rename it back to its original name.

rrrssssss 04-11-2010 04:31 PM

Thanks
 
Thanks smoker. That did the trick.

I ordered a USB stick from On.disk.com with the latest version of Kubuntu pre-installed on it and it will not overwrite the xorg.conf on each reboot, thus allowing me to keep my display driver intact with high resolutions. I guess somebody re-wrote the dexconf script just for that purpose.

Thanks again,
Roy

PS - I am really a Gentoo fan. I'm just using Kubuntu since a Debian based OS is the most popular for booting from a USB stick.

smoker 04-11-2010 04:45 PM

No problem.
We could probably also have disabled it by finding where it gets called and disabling that, but this was the most straight forward way IMHO. Easy to change, and easy to change back.

I've never used Gentoo, but I guess we can't all be perfect !
Cheers


All times are GMT -5. The time now is 05:48 AM.