Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Possible to get a variable from Grub2?

  1. #11
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Possible to get a variable from Grub2?

    Quote Originally Posted by Jose Catre-Vandis View Post

    ( no, the "text" kernel option doesn't work with SLiM)
    Edit the /etc/init.d/slim file to look like this:
    Code:
    ...
    
    case $1 in
      start)
    
        for ARG in $(cat /proc/cmdline)
        do
          case "${ARG}" in
            text|-s|s|S|single)
              plymouth quit || :  # We have the ball here
              exit 0
              ;;
          esac
        done
    
        if [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
           [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
           [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then
          echo "Not starting X display manager (slim); it is not the default display manager."
        else
          echo -n "Starting X display manager: slim"
          start-stop-daemon --start --quiet $SSD_START_ARGS || echo -n " already running"
          echo "."
        fi
      ;;
    ...
    Quote Originally Posted by Jose Catre-Vandis View Post
    ( I can't find a way to start up with runlevel 1 without invoking recovery mode or dropping to a root shell)
    then create a text mode boot option:
    http://ubuntuforums.org/showpost.php...18&postcount=3

  2. #12
    Join Date
    Mar 2006
    Beans
    Hidden!

    Unhappy Re: Possible to get a variable from Grub2?

    Quote Originally Posted by sisco311 View Post
    Edit the /etc/init.d/slim file to look like this:
    Code:
    ...
    
    case $1 in
      start)
    
        for ARG in $(cat /proc/cmdline)
        do
          case "${ARG}" in
            text|-s|s|S|single)
              plymouth quit || :  # We have the ball here
              exit 0
              ;;
          esac
        done
    
        if [ "$HEED_DEFAULT_DISPLAY_MANAGER" = "true" ] &&
           [ -e $DEFAULT_DISPLAY_MANAGER_FILE ] &&
           [ "$(cat $DEFAULT_DISPLAY_MANAGER_FILE)" != "$DAEMON" ]; then
          echo "Not starting X display manager (slim); it is not the default display manager."
        else
          echo -n "Starting X display manager: slim"
          start-stop-daemon --start --quiet $SSD_START_ARGS || echo -n " already running"
          echo "."
        fi
      ;;
    ...


    then create a text mode boot option:
    http://ubuntuforums.org/showpost.php...18&postcount=3
    Looks good sisco311 (I like your work all over the forum ),

    but no /etc/init.d/slim file on my setup
    No longer participating......

  3. #13
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Possible to get a variable from Grub2?

    How did you install slim? An Ubuntu deb package should provide an init script. Either a Sys-V style one in /etc/init.d or an Upstart job in /etc/init.

  4. #14
    Join Date
    Jun 2007
    Location
    Maryland, US
    Beans
    6,264
    Distro
    Kubuntu

    Re: Possible to get a variable from Grub2?

    Quote Originally Posted by ajgreeny View Post
    No it is runlevel 2! Try the
    Code:
    who -r
    command.
    You're right! I ran both the command you indicated above (and runlevel as suggested by amauk).

    To have some "fun", I edited the /etc/init/rc-sysinit.conf file so that the default setting on my system is level 5... just like Red Hat and Fedora.

    Btw, so far I cannot see any discernible difference between levels 2 and 5, and from looking at the respective /etc/rc<N>.d directories, there probably isn't.

  5. #15
    Join Date
    Mar 2006
    Beans
    Hidden!

    Re: Possible to get a variable from Grub2?

    Quote Originally Posted by sisco311 View Post
    How did you install slim? An Ubuntu deb package should provide an init script. Either a Sys-V style one in /etc/init.d or an Upstart job in /etc/init.
    from source

    Code:
    wget http://download.berlios.de/slim/slim-1.3.2.tar.gz
    I didn't realise it was back in the repos, it disappeared a while back
    No longer participating......

  6. #16
    Join Date
    Feb 2007
    Location
    Romania
    Beans
    Hidden!

    Re: Possible to get a variable from Grub2?

    Quote Originally Posted by Jose Catre-Vandis View Post
    from source

    Code:
    wget http://download.berlios.de/slim/slim-1.3.2.tar.gz
    I didn't realise it was back in the repos, it disappeared a while back
    You could create your own Upstart job or Sys-V style init script.

    Or install it from the repositories.

    Here is an Upstart job which should work in Maverick and Natty:

    /etc/init/slim.conf:
    Code:
    # SLIM - Simple Login Manager
    #
    # A Desktop-independent graphical login manager for X11, 
    # derived from Login.app.
    #
    # based on gdm.conf by William Jon McCann <mccann@jhu.edu>
    
    description     "Simple Login Manager"
    author          "sisco311"  
    
    start on (filesystem
              and started dbus
              and (drm-device-added card0 PRIMARY_DEVICE_FOR_DISPLAY=1
                   or stopped udevtrigger))
    stop on runlevel [016]
    
    emits starting-dm
    
    env XORGCONFIG=/etc/X11/xorg.conf
    
    script
        if [ -n "$UPSTART_EVENTS" ]
        then
    	[ ! -f /etc/X11/default-display-manager -o "$(cat /etc/X11/default-display-manager 2>/dev/null)" = "/usr/bin/slim" ] || { stop; exit 0; }
    
    	# Check kernel command-line for inhibitors
    	for ARG in $(cat /proc/cmdline)
    	do
    	    case "${ARG}" in
    		text|-s|s|S|single)
                        plymouth quit || :  # We have the ball here
    		    exit 0
    		    ;;
    	    esac
    	done
        fi
    
        if [ -r /etc/default/locale ]; then
    	. /etc/default/locale
    	export LANG LANGUAGE
        elif [ -r /etc/environment ]; then
    	. /etc/environment
    	export LANG LANGUAGE
        fi
        export XORGCONFIG
    
        exec slim
    end script
    Last edited by sisco311; April 8th, 2011 at 12:16 AM.

  7. #17
    Join Date
    Mar 2006
    Beans
    Hidden!

    Re: Possible to get a variable from Grub2?

    Thanks again cisco311 - I'll have a bash at this tomorrow and report back.
    No longer participating......

  8. #18
    Join Date
    Mar 2006
    Beans
    Hidden!

    Re: Possible to get a variable from Grub2?

    I installed from the repos and edited the /etc/init.d/slim file as above.

    On reboot I manually edited the recovery mode option from the grub menu, replacing "single" with text, and got my cli prompt

    I haven't tried out creating the grub menu entry as the install I am working on is a second install, being picked up by the primary installs grub2, and I am not chainloading the second install. I have another setup running in a VM so will test there.

    Will this all persist if I do a remastersys dist on it and create an installation CD, or does this have to be done after installation?

    I am going to mark as solved Thanks to all
    No longer participating......

  9. #19
    Join Date
    Mar 2006
    Beans
    Hidden!

    Re: Possible to get a variable from Grub2?

    Follow up.

    On my standalone setup, I edited the /etc/init.d/slim file as above, then followed the howto to to edit /etc/grub.d/10_linux.

    This all works nicely, apart from the fact that the "text mode" entry, whilst avoiding plymouth, still ends up with slim presenting itself for a login. As previously, slim ignores the "text" kernel option, so it behaves differently to gdm (et al).

    Anyway to fix this?

    I have discovered that if I change "text" to "3" in this line in 10_linux,
    Code:
    "text ${GRUB_CMDLINE_LINUX}" > "3 ${GRUB_CMDLINE_LINUX}"
    that 3 shows up in the menu entry, so could use the script as above? But that doesn't work, because now slim is installed from a deb (repos) there is an init script firing it up, as opposed that having to be manually called.

    If I remove the executable bit from /etc/init.d/slim, and put the runlevel finding script back into rc.local it all works as I want although I do see a small complaint coming through about init scripts (S & K) not running, but I would expect that.
    Last edited by Jose Catre-Vandis; April 11th, 2011 at 09:09 AM.
    No longer participating......

  10. #20
    Join Date
    Aug 2007
    Location
    Belgium
    Beans
    176
    Distro
    Ubuntu 10.04 Lucid Lynx

    Re: Possible to get a variable from Grub2?

    Quote Originally Posted by sisco311 View Post
    <snip>
    Code:
    ...
        for ARG in $(cat /proc/cmdline)
        do
          case "${ARG}" in
            text|-s|s|S|single)
              plymouth quit || :  # We have the ball here
              exit 0
              ;;
          esac
        done
    
    ...
    <snip>
    Voilà, integrated in my /etc/init.d/slim, and assuming it's SLiM that isn't working properly, your little piece of code allows me to do some testing with it.

    Thank you for that.

    I'll post my problem in a new thread in a moment...

    EDIT: The problem
    Last edited by El_Belgicano; April 12th, 2011 at 12:13 AM.
    El Belgicano
    -----------------
    Laptop: 5 years old Asus M6N (ATI9600/9700 graphics, 512Mb RAM, Intel Mobile 1.66GHz, 60Gb HDD) running 10.04-Lucid Lynx pretty nicely.

Page 2 of 2 FirstFirst 12

Tags for this Thread

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
  •