Ubuntu Linux: How to reconfigure X windows system (X.org server)

Q. I had messed up my Ubuntu Linux X windows configuration by editing files. Now all I want is my default settings back to previous state. How do I reconfigure X.org windows system?

ADVERTISEMENTS

A. You need to use dpkg-reconfigure command which reconfigures packages after they have already been installed. Pass it the names of a package or packages to reconfigure. It will ask configuration questions, much like when the package was first installed.

Ubuntu reconfigure xorg

Type any one of the following command to reconfigure X.org windows system:
As the root user:
# dpkg-reconfigure xserver-xorg
OR as a normal user:
$ sudo dpkg-reconfigure xserver-xorg
Just follow on screen questions and you should able to restore or reconfigure to previous state.

See also:

🐧 If you liked this page, please support my work on Patreon or with a donation.
🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
11 comments… add one
  • Borys Marcelo Jan 4, 2008 @ 14:27

    Thanks!

    I put this also in my blog so that more users can find a solution faster.

    • Darkxnes Apr 26, 2011 @ 22:53

      Delete /etc/X11/xorg and done

  • Olivia Cond Jan 5, 2008 @ 5:16

    sudo dpkg-reconfigure -phigh xserver-xorg
    for automatic configuration

    • Hamed Feb 4, 2011 @ 11:56

      I have a problem with the w window, when I power on my PC, and after progressing ubuntu logo, there will appear a blue screen with the gray screen in it(SYSTEM CONFIGURATION,select language).
      I lost my X window. I use the sudo dpkg-reconfigure -phigh xserver-xorg but it did not work and got me this
      debconf: DbDriver “config”: /var/cache/debconf/config.dat is locked by another process: Resource temporarily unavailable

      what should I do?
      Hamed

  • Matthew Lye Mar 24, 2009 @ 23:44

    I would avoid using the -phigh setting as it can cause problems. The autodetect is no good if you originally did anything other than click next next next on the configuration part of the Ubuntu install (other than the partitioning).

  • Héctor Mamani Mar 29, 2009 @ 16:08

    Hi, in my case sudo dpkg-reconfigure -phigh xserver-xorg was sucessfull I have puppy linux runnig as frugal, My sin was to try to set the audio controls from Puppy…

  • Nima Dec 22, 2010 @ 19:13

    Just wanted to say thanks for this great share… It really saved my day, i was about to renistall my OS because of xorg problem.

  • Ejendra kumar Feb 27, 2012 @ 11:00

    Hi, in my case with BOSS Linux ver. 3 sudo dpkg-reconfigure xserver-xorg then sudo startx was sucessfull I have BOSS linux running smoothly but I have to do it on every startup, how can I set it permanently anyone plz help, My sin was to set the Display card setting which I have to do by above sudo in command line mode. now plzzzzzzzzzz help to do it fix permanently to avoid again and again.

  • Surajit Bhakta Apr 24, 2012 @ 14:02

    I can not login into my graphical interface. Whenever I hit login after giving password, it goes blank for a few second and returns me the same screen again with no error. I’m using ubuntu 11.04 64bit. My system is running fine on tele-terminal, but can not get into the graphical terminal.
    I don’t know what I did to my system. I have a ATI HD 6770 gpu in my desktop and perhaps I tried to use xbmc from their repository. I have now uninstalled xbmc from my system fully, but it didn’t solve my problem. I tried to reconfigure the xserver, gdm; but nothing works.
    Please help me, otherwise I have to make a fresh install of my system.

  • Matias Colli Jan 31, 2014 @ 17:48

    Another solution is:
    # X -configure
    and then copy the new configuration into /etc/X11/xorg.conf (replacing this file)
    __
    Matias Colli
    Perito Informático Forense
    M.N A-128 COPITEC

  • L Pingel Apr 22, 2014 @ 3:06

    Thankyou for this solution. I have a laptop that has bios administrator password set. The prevents booting from flash or DVD for traditional install. I cloned a hard drive on another Ubuntu system then used dpkg-reconfigure to get it to work properly.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.