Script to start KDM (in case it doesn't)

debianlight_kdm

Yesterday I reinstalled my Debian Wheezy with my custom repository of KDE 4.10 and I must say that if it worked well before, now it does much better.

The only problem I had was with KDM, which apparently did not install well at all, because it did not want to start automatically, something that catches my attention because I did the same installation, with the same repositories on the other PC and everything was going great .

Looking for the cause of the problem I detected that the file was not created /etc/init.d/kdm which should have this inside:

#! / bin / sh -e ### BEGIN INIT INFO # Provides: kdm # Required-Start: $ local_fs $ remote_fs # Required-Stop: $ local_fs $ remote_fs # Should-Start: console-screen kbd acpid dbus hal krb5- kdc # Should-Stop: console-screen kbd # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: X display manager for KDE # Description: KDM manages a collection of X servers, which may be on the local host or remote machines.
 ### END INIT INFO # /etc/init.d/kdm: start or stop the X display manager # Script originally stolen from the xdm package # # description: K Display Manager # # import the LSB init functions.  / lib / lsb / init-functions # set the locale if [-r / etc / default / locale]; then.  / etc / default / locale export LANG LANGUAGE fi # to start kdm even if it is not the default display manager, change # HEED_DEFAULT_DISPLAY_MANAGER to "false."
 HEED_DEFAULT_DISPLAY_MANAGER = true DEFAULT_DISPLAY_MANAGER_FILE = / etc / X11 / default-display-manager PATH = / bin: / usr / bin: / sbin: / usr / sbin DAEMON = / usr / bin / kdm PIDFILE = / var / run / kdm.pid UPGRADEFILE = / var / run / kdm.upgrade setup_config () {# parameters to support kdm customization KDMRC = / etc / kde4 / kdm / kdmrc BACKGROUNDRC = / etc / kde4 / kdm / backgroundrc # if configuration is changed by kdmtheme or other tools , don't do magick if grep -q "^ [[: space:]] * Theme = @@@ ToBeReplacedByDesktopBase @@@" $ {KDMRC}; then KDMOVERRIDEDIR = / etc / default / kdm.d KDMCFGDIR = / var / run / kdm KDMCFG = $ KDMCFGDIR / kdmrc BACKGROUNDCFG = $ KDMCFGDIR / backgroundrc DEFAULT_KDM_THEME = / kdmx / ariya-test / apps / kdde4 / apps / testiya-themes / kdde0 / themes $ DAEMON || exit 4 # uncomment, if you want auto-logon to be runlevel-dependent #test "$ runlevel" || {runlevel = `runlevel`; runlevel = $ {runlevel # *}; } #test "$ runlevel" = 255 && ARG = -autolog || ARG = -noautolog # uncomment, if you want tons of debug info in your syslog #ARG = "$ ARG -debug 1" # we use an alternative kdm master configuration file ARG = "$ ARG -config $ KDMCFG" # we generate kdm configuration files genkdmconf --in $ KDMCFGDIR XNUMX> / dev / null # we source overrides.  run-parts sorts the list in a predictable order if [-d "$ KDMOVERRIDEDIR"]; then for part in $ (run-parts --list "$ KDMOVERRIDEDIR" 2> / dev / null || true); c.  "$ part" done fi # we update kdm configuration files (only overridden values) [-n "$ USEBACKGROUND"] && sed -i "s | ^ # \? UseBackground =. * | UseBackground = $ USEBACKGROUND |" $ KDMCFG [-n "$ BACKGROUNDCFG"] && sed -i "s | ^ # \? BackgroundCfg =. * | BackgroundCfg = $ BACKGROUNDCFG |" $ KDMCFG [-n "$ USETHEME"] && sed -i "s | ^ # \? UseTheme =. * | UseTheme = $ USETHEME |" $ KDMCFG [-n "$ THEME"] && [-e "$ THEME"] && sed -i "s | ^ # \? Theme =. * | Theme = $ THEME |" $ KDMCFG [-n "$ LANGUAGE"] && sed -i "s | ^ # \? Language =. * | Language = $ LANGUAGE |" $ KDMCFG if grep -q "^ [[: space:]] * Wallpaper = stripes.png" $ {BACKGROUNDRC}; then [-n "$ WALLPAPER"] && [-e "$ WALLPAPER"] && sed -i "s | ^ # \? Wallpaper =. * | Wallpaper =` readlink -f $ WALLPAPER` | " $ BACKGROUNDCFG fi # usetheme is now on "by default" so we need to be sure Theme is not invalid ...
 sed -i "s | @@@ ToBeReplacedByDesktopBase @@@ | $ DEFAULT_KDM_THEME |" $ {KDMCFG} # autologin overrides are useful for live debian environment if [-n "$ AUTOLOGINUSER"]; then sed -i "s | ^ # \? AutoLoginEnable =. * | AutoLoginEnable = true |" $ KDMCFG sed -i "s | ^ # \? AutoLoginUser =. * | AutoLoginUser = $ AUTOLOGINUSER |" $ KDMCFG fi [-n "$ AUTOLOGINDELAY"] && sed -i "s | ^ # \? AutoLoginDelay =. * | AutoLoginDelay = $ AUTOLOGINDELAY |" $ KDMCFG [-n "$ AUTOLOGINAGAIN"] && sed -i "s | ^ # \? AutoLoginAgain =. * | AutoLoginAgain = $ AUTOLOGINAGAIN |" $ KDMCFG [-n "$ AUTOLOGINLOCKED"] && sed -i "s | ^ # \? AutoLoginLocked =. * | AutoLoginLocked = $ AUTOLOGINLOCKED |" $ KDMCFG fi return 0} # If we upgraded the daemon, we can't use the --exec argument to # start-stop-daemon since the inode will have changed. The risk here is that # in a situation where the daemon died, its pidfile was not cleaned up, and # some other process is now running under that pid, start-stop-daemon will send # signals to an innocent process. However, this seems like a corner case.
 # C'est la vie!
 if [-e $ UPGRADEFILE]; then SSD_ARGS = "- pidfile $ PIDFILE --startas $ DAEMON" else SSD_ARGS = "- pidfile $ PIDFILE --exec $ DAEMON" fi still_running () {if expr "$ (cat / proc / $ DAEMONPID / cmdline 2> / dev / null) ":" $ DAEMON "> / dev / null 2> & 1; then true else # if the daemon does not remove its own pidfile, we will rm -f $ PIDFILE $ UPGRADEFILE false fi; } case "$ 1" in start) setup_config if [-e $ DEFAULT_DISPLAY_MANAGER_FILE] && ["$ HEED_DEFAULT_DISPLAY_MANAGER" = "true"] && ["$ (cat $ DEFAULT_DISPLAY_MANAGER_FILE)"! = "$ DAEMON"]; then log_action_msg "Not starting K Display Manager (kdm); it is not the default display manager."
 else log_daemon_msg "Starting K Display Manager" "kdm" if start-stop-daemon --start --quiet $ SSD_ARGS - $ ARG; then log_end_msg 0 else log_action_end_msg 1 "already running" fi fi ;; restart) /etc/init.d/kdm stop if [-f $ PIDFILE]; then if still_running; then exit 1 fi fi /etc/init.d/kdm start ;; reload) log_action_begin_msg "Reloading K Display Manager configuration ..."
 if start-stop-daemon --stop --signal 1 --quiet $ SSD_ARGS; then log_action_end_msg 0 else log_action_end_msg 1 "kdm not running" fi ;; force-reload) /etc/init.d/kdm reload ;; stop) log_action_begin_msg "Stopping K Display Manager: kdm" if [!  -f $ PIDFILE]; then log_action_end_msg 0 "not running ($ PIDFILE not found)" exit 0 else DAEMONPID = $ (cat $ PIDFILE | tr -d '[: blank:]') KILLCOUNT = 1 if [!  -e $ UPGRADEFILE]; then if start-stop-daemon --stop --quiet $ SSD_ARGS; then # give kdm's signal handler a second to catch its breath sleep 1 else log_action_cont_msg "not running" fi fi while [$ KILLCOUNT -le 5]; do if still_running; then kill $ DAEMONPID else break fi sleep 1 KILLCOUNT = $ (($ KILLCOUNT + 1)) done if still_running; then log_action_cont_msg "not responding to TERM signal (pid $ DAEMONPID)" else rm -f $ UPGRADEFILE fi fi log_action_end_msg 0 ;; status) status_of_proc -p "$ PIDFILE" "$ DAEMON" kdm && exit 0 || exit $?
This is what said file has on the other PC, but I couldn't see it last night, I show you my other alternative

The solution I found then was to create my own startup script, which is used for KDM or any other application that we want to start, which contains this:

#! / bin / sh PATH = / sbin: / bin. /lib/init/vars.sh. / lib / lsb / init-functions case "$ 1" in start | "") / usr / bin / kdm ;; stop) # No-op ;; *) echo "Usage: kdm [start | stop | restart]"> & 2 exit 3 ;; that C

Now, in order for KDM to start automatically, it is necessary to activate said script, so I use RCConf for it. And ready. However, I recommend using the original 😛


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

11 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   vicky said

    I am using an alternative to kdm called sddm.

    1.    elav said

      Hmm. I didn't know her .. I'm going to look.

    2.    elav said

      Crap !!! It needs GLIBC 2.14 and in Debian I have 2.13 ¬_¬

  2.   st0rmt4il said

    Ummm, it seems good: D .. elav, to include other environments and make valid use of said script, we just have to change the name of the window manager we want to use right?

    Regards!

  3.   erdosain9 said

    Hey.
    Although it has nothing to do with the article itself, I wanted to ask you: could you do a "what to do after installing Wheezy"?
    Because I ran into some problems installing it. For example:
    1-Although it takes the Wi-Fi network to install itself, when it finishes installing there is no Wi-Fi connection and not even a program to manage the networks. (I connected it at the end manually from direct console ... but I found anyone who connects to the wifi while it installs and then doesn't even install a network-manager ... or something ...)
    2-although the installation is in the language you choose, then the system is installed in English? No idea how to correct that ...

    And well, niente piu ... if you can expand this with your experience and make a post it would serve me well hehe ... (I imagine others too).
    Regards!!!

    1.    elav said

      Hmm, what desktop environment do you use? I guess KDE ..

      1.    erdosain9 said

        You guess very well. Yes, I use KDE but in reality I am falling into the Debian world ... what environment do you recommend?
        Before I was in Crunchbang for a while ... and I was attracted by how stable it was, I assumed that because it was based on Debian and that's why I threw myself into debian ... I chose KDE to choose ... which one would you recommend?
        And what I mention happens only in KDE?

        Saludos y gracias

  4.   Jairo said

    Hello,
    I read your article and I want to comment that I have a problem in Debian wheezy with KDE and I don't know if it is the same. I have searched like crazy for a solution and asked in forums but no one can tell me why. the error is that after passing the Grub, sometimes debian does not start because it stays on the black screen after this line of text appears (it is the third):

    Waiting For / dev To Be Fully Populated

    My computer is an ASUS K93SV Notebook
    Intel Core i7 2670QM
    the error does not always happen. when it happens i have to force shutdown and restart.

    1.    elav said

      A quick Google search has returned this to me:

      http://www.esdebian.org/foro/28882/waiting-for-dev-to-be-fully-populated

      Tell me if it solves you.

      1.    Jairo said

        I read the whole post, but I don't dare to do it because I checked my menu.list and it is completely different from what appears in that conversation.

  5.   cooper15 said

    This Elav always publishing interesting sticks, I have that problem and therefore I am using LightDM which by the way works quite well, but let's see if this script (strange KDM) works for me, I appreciate the contribution 😉