Results 1 to 10 of 10

Thread: Disabling Auto-Start Of X In Ubuntu/Mint258 days old

  1. #1
    The Stealth Mod
    ZemaTalon's Avatar
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    4,530
    Threads
    786

    Awards Showcase

    Real Name
    Steve
    Blog Entries
    1
    Local Date
    05-22-2013
    Local Time
    11:56 PM

    Cool Disabling Auto-Start Of X In Ubuntu/Mint

    I've been trying to figure out how to do this, I knew there had to be a way, but all the how-to instructions resulted in either a black screen, or a blank purple Ubuntu screen in the case of one sacrificial Ubuntu VM I tried it on. But then I came across instructions for setting up a temp X install on a server, where X would be run only on occasion.

    Whether it’s because you’re not fully versed in the power of the command line, or you just want to use a tool that will speed things along like gparted, the command-line isn’t always the best tool for the job. Sometimes you just need a GUI, even if it’s just for a few minutes. I’m going to walk through how to do the installation on Ubuntu 11.10 with the assumption that you only want the GUI occasionally, and don’t want it consuming server resources all the time.

    The first step is to get the GUI tools installed. sudo apt-get update
    sudo apt-get upgrade
    sudo apt-get install xubuntu-desktop


    That was the simple part. At this point you now have the GUI installed, but it will start the GUI every time the system boots, loading all of that extra cruft into memory. The next steps that I followed from a post on Techinote shows the steps to disable the automatic startup of the GUI environment.

    sudo apt-get install lightdm
    sudo nano /etc/default/grub


    find the line
    GRUB_CMDLINE_LINUX_DEFAULT

    and set it to

    GRUB_CMDLINE_LINUX_DEFAULT="text"

    sudo update-grub
    sudo update-rc.d -f lightdm remove
    sudo shutdown -r now

    Done!

    Your system will now be at the text-based login screen (as it was before this all started). When you need to use the graphical environment, simply type startx and it will move you into an already authenticated GUI desktop environment. This will allow you to setup and configure tools with a GUI (like CrashPlan) without having to rely the UI being constantly loaded and running in the background.
    From here.

    I tested this on a cloned Mint 13 XFCE VM. Since it already had X, I skipped down to the editing of grub. I followed the instructions exactly, except that I substituted "mdm" for "lightdm" as the display manager to remove, since that's the one XFCE uses. After rebooting I came up into a nice traditional command line login. I logged in, and did startx, and immediately the XFCE desktop came up! I love being able to get things to "just work", after the powers that be decided to make them just not work

  2. #2
    Hell's Very Own Grogan's Avatar
    Join Date
    Sep 2002
    Location
    Ontario, Canada
    Posts
    23,100
    Threads
    2409

    Awards Showcase

    Real Name
    Hugh Jorgen
    Local Date
    05-23-2013
    Local Time
    02:56 AM
    So you basically have to pass that parameter with the boot loader and disable the display manager from starting. All I got was a black screen when I tried those steps (I didn't use update-rc.d to do that, but same effect). Hmm maybe it's because I built Vesafb into my kernel and now there's nothing to specify mode and it's defaulting to something stupid. I guess I'll try a kernel without framebuffer support.

    (It's not so simple anymore... Grub 2 no longer takes a vga= parameter. I really hate that boot loader. I don't know what goes through these jackasses heads. Ease of use at the cost of complexity is not worth it. They aren't doing anyone any favours by forcing automation on people that's difficult to override. They swear up and down you're not supposed to edit grub.cfg directly, but it's the only bloody choice when all the stupid scripts get something wrong! It gets overwritten every time you have to run update-grub and you have to redo it every time you upgrade your kernel or other aspect of grub configuration)

    See, these distros now use this "Plymouth" shit in the initrd along with kernel modesetting to set your resolution and stuff even before X starts. Eliminate the kernel hooks and initrd and that's probably why I'm getting the black screen.

    I'll stick with Slackware, one of the last sane distros for an old school user like me (or go back to Linux From Scratch if even Slackware gets corrupted by foolishness). I was just screwing around with Mint 13 in VirtualBox, since that's the distro I'm using for any customers I install Linux for. I won't be doing stuff like this for them, but I still need to know.

  3. #3
    The Stealth Mod
    ZemaTalon's Avatar
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    4,530
    Threads
    786

    Awards Showcase

    Real Name
    Steve
    Blog Entries
    1
    Local Date
    05-22-2013
    Local Time
    11:56 PM

    I need to setup Slackware in VB so that I can become proficient enough in it that I'll have somewhere to easily go when things become even more Ubuntulated and Unityized

  4. #4
    Wizard of Lore Mod Alakazam's Avatar
    Join Date
    Aug 2001
    Location
    In the Keep
    Posts
    14,761
    Threads
    6157

    Awards Showcase

    Real Name
    Zammy
    Local Date
    05-23-2013
    Local Time
    02:56 AM
    Slackware is currently at 14 RC4 so it shouldn't be long before it's all finalized.

  5. #5
    The Stealth Mod
    ZemaTalon's Avatar
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    4,530
    Threads
    786

    Awards Showcase

    Real Name
    Steve
    Blog Entries
    1
    Local Date
    05-22-2013
    Local Time
    11:56 PM

    For anyone with a Ubuntu or Debian based distro they want to boot to the command line I think this is a much better solution than the one I posted above. I was curious as to whether Debian used the same system as Ubuntu in so far as auto-starting X goes. Debian seems slightly more traditional than Ubuntu so I thought maybe they were more sensible when it came to that, and other attributes. I had a Debian VM up this evening to play around, and I ran a Google search on a related topic, and up pops something that caught my eye: sysv-rc-conf.

    Code:
    SysV init runlevel configuration tool for the terminal
     
    sysv-rc-conf provides a terminal GUI for managing "/etc/rc{runlevel}.d/"
    symlinks.  The interface comes in two different flavors, one that simply
    allows turning services on or off and another that allows for more fine tuned
    management of the symlinks.  Unlike most runlevel config programs, you can
    edit startup scripts for any runlevel, not just your current one.
    I tested it out on Debian and it worked perfectly. All you do after launching sysv-rc-conf is move the cursor down to the line where your login manager is, and remove the checkmark(s) for it under the runlevels. Debian had it checked for runlevels 2-5. Unchecking it only under runlevel 3 didn't work, so I just unchecked all four of them and then it worked. Then I tested it in a Mint13 VM and there too it worked instantly on rebooting. And if you later decide to re-enable the original behavior just rerun the conf utility. So no need for all those other hoops and gyrations


  6. #6
    Hell's Very Own Grogan's Avatar
    Join Date
    Sep 2002
    Location
    Ontario, Canada
    Posts
    23,100
    Threads
    2409

    Awards Showcase

    Real Name
    Hugh Jorgen
    Local Date
    05-23-2013
    Local Time
    02:56 AM
    I would be careful with that old utility. Ubuntu doesn't really use SysVinit style runlevels anymore, they are just there for compatibility.

    It uses something called "Upstart" now that replaces the old fashioned "init" program and the real configuration is in .conf files in /etc/init. (I hate that shit, by the way. WHY change that? Just because they can? It used to be that you could go to any Linux distro and know how it works but now these people have to pretend they are too clever to stick with traditional methods) To make it worse, not all services are converted to use the Upstart method and the links in /etc/rc?.d are used. The emulation still allows you to set a default runlevel, but you must create your OWN /etc/inittab file.

    It obviously still worked for you to disable the graphical session manager, but look at those silly checkboxes. They don't actually make sense and you can see that they are started by other means. For example, lm-sensors only in runlevel "S" (which is supposed to be a special, single user mode that is similar to runlevel 1, but possibly having different scripts) Networking scripts run only in shutdown and restart runlevels?

  7. #7
    The Stealth Mod
    ZemaTalon's Avatar
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    4,530
    Threads
    786

    Awards Showcase

    Real Name
    Steve
    Blog Entries
    1
    Local Date
    05-22-2013
    Local Time
    11:56 PM

    Looks like Ubuntu created Upstart. Debian apparently doesn't use it, but a number of other distros have adopted it. From Wikipedia:

    As Upstart matures, it is intended that its role will expand to the duties
    currently handled by cron, anacron, the at command's daemon (atd), and
    possibly (but much less likely) inetd.

    Distributions in which Upstart is enabled by default:
    Upstart was first included in Ubuntu in the 6.10 (Edgy Eft) release in late 2006,
    replacing sysvinit. Ubuntu 9.10 (Karmic Koala) introduced native Upstart
    bootup as of Alpha 6.
    NixOS has been using Upstart as default from the beginning.
    Upstart replaced the sysvinit in the Maemo 5 operating system for
    Nokia Internet tablets.
    Upstart is used in HP's webOS for the Palm Pre, Palm Pixi
    (both before Palm was bought out by HP), HP Veer, and
    HP Pre 3 smart phones, along with the HP TouchPad tablet.
    Upstart is used in Google's Chrome OS.
    Red Hat includes Upstart in their Red Hat Enterprise Linux 6 release.
    As a result, it is also used by RHEL 6 variants such as Centos,
    Scientific Linux, and Oracle Linux.
    Upstart replaced sysvinit in Fedora 9, and functioned in the same manner
    as it did in Ubuntu, i.e. it replaces sysvinit, while retaining the existing
    scripts. However, Upstart has been replaced by
    systemd in Fedora 15 release.
    Debian considered switching for the Squeeze release.
    openSUSE included upstart in version 11.3 Milestone 4,
    but not as default. systemd replaced Upstart, as the
    default init system in openSUSE 12.1.
    And systemd:

    Compared to System V init, which is used by most distributions,
    systemd can take advantage of several new techniques:

    Socket-activated and bus-activated services, which sometimes leads
    to better parallelization of interdependent services. cgroups are used to
    track service processes, instead of PIDs. This means that daemons cannot
    "escape" systemd even by double-forking.

    In April 2012, udev's source tree was merged into systemd.
    systemd is Linux-only by design, as it relies upon features such as
    cgroups and fanotify. Debian is avoiding the adoption of systemd
    due to this issue.

    systemd has been proposed as an external dependency of GNOME 3.2
    by the project's author. This would essentially require all distributions that
    use GNOME to use systemd, or at least include it as a configurable option.

    Distributions in which systemd is enabled by default include:
    Fedora 15 and later,
    Frugalware 1.5 and later,
    Mageia 2,
    Mandriva 2011,
    openSUSE 12.1 and later and
    Arch Linux 2012.10.06 and later.
    It sounds like most distros will eventually end up using one or the other of those. It's interesting that Fedora used Upstart for awhile, then switched to systemd.

  8. #8
    Hell's Very Own Grogan's Avatar
    Join Date
    Sep 2002
    Location
    Ontario, Canada
    Posts
    23,100
    Threads
    2409

    Awards Showcase

    Real Name
    Hugh Jorgen
    Local Date
    05-23-2013
    Local Time
    02:56 AM
    I'll stick with Slackware, or Linux From Scratch, because I'm going to use the simple, traditional methods. When you keep things simple, they have no choice but to work. You know the reason for most of that bullshit? Faster startup, with parallel execution of loading daemons and shit. With complexity comes fragility, and difficulty in troubleshooting.

    I much prefer the sequential boot scripts that Slackware uses. They are easy to follow, easy to configure and you can eliminate a lot of the condition checking to see if services are to start to make it even faster, by commenting out sections that load the things you don't want or need.

  9. #9
    The Stealth Mod
    ZemaTalon's Avatar
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    4,530
    Threads
    786

    Awards Showcase

    Real Name
    Steve
    Blog Entries
    1
    Local Date
    05-22-2013
    Local Time
    11:56 PM

    A little update - my previous experiments with this were on systems with only XFCE, so the login manager was mdm. I just went to do this on a system which started out with KDE, to which I installed XFCE, so it was using kdm, On running sysv-rc-conf I discovered that kdm had no x's in any of the run levels, meaning this utility was useless for disabling it. The XFCE login manager appearantly does things differently. So I did some more research, and found this:

    Disabling it should be as simple as:

    sudo mv /etc/init/kdm.conf{,disabled}

    The same should be the true for gdm (which also uses a upstart script in /etc/init/).

    If you want to fine-tune it, edit /etc/init/kdm.conf and change its start on declarations. Just comment that entire section out and you'll still be able to run sudo start kdm when you want a graphical display.
    It does indeed work.

  10. #10
    The Stealth Mod
    ZemaTalon's Avatar
    Join Date
    Aug 2002
    Location
    Southern California
    Posts
    4,530
    Threads
    786

    Awards Showcase

    Real Name
    Steve
    Blog Entries
    1
    Local Date
    05-22-2013
    Local Time
    11:56 PM

    I thought I'd include this information specific to Fedora in case anyone might have a need for it in the future. Fedora now uses a system like Ubuntu's Upstart, called Systemd, but it works differently than Upstart.
    How do I change the default runlevel?

    systemd uses symlinks to point to the default runlevel. You have to delete the existing symlink first before creating a new one

    Code:
     rm /etc/systemd/system/default.target
    Switch to runlevel 3 by default

    Code:
    ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target
    Switch to runlevel 5 by default

    Code:
     ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target
    systemd does not use /etc/inittab file.
    I switched it to runlevel 3 and it then booted to the command line. I combined this with disabling the hiding of the startup text, which I posted about here. The end result of both of these modifications is a nice traditional command line startup and login. But there's one minor issue - after the boot messages finish, it appears to hang without going to the login prompt. But if you press a key, you'll suddenly find yourself at the login prompt, with your random key press having been interpreted as a user name entry, and it will now be waiting for the associated password. So it's better to press a non-text entry key, like the caps lock etc.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •