Announcement

Collapse
No announcement yet.

Add GRUB entry for extra option to boot in text mode?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Add GRUB entry for extra option to boot in text mode?

    Hi again guys.

    I have my little el-cheapo laptop server running like a champ, but I've been trying to get it to boot in text only mode to no avail.

    I can boot without a desktop running this command I found in the interwebz
    Code:
    systemctl set-default multi-user.target
    and back to desktop mode by running...

    Code:
    systemctl set-default graphical.target
    Problem is I get no terminal to work with, I've tried the usual Alt+T shortcut and a bunch of others too. The screen stays black with a flashing cursor.
    I can access it via SSH, but I fear someday the LAN connection might fail and I'd be unable to recover it

    Here's my /etc/default/grub

    Code:
    root@dazz-Lenovo-V110-15IAP:~# more /etc/default/grub# If you change this file, run 'update-grub' afterwards to update
    # /boot/grub/grub.cfg.
    # For full documentation of the options in this file, see:
    #   info -f grub -n 'Simple configuration'
    
    GRUB_DEFAULT=0
    #GRUB_HIDDEN_TIMEOUT=1
    GRUB_HIDDEN_TIMEOUT_QUIET=true
    GRUB_TIMEOUT=2
    GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
    #GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    GRUB_CMDLINE_LINUX_DEFAULT="text"
    GRUB_CMDLINE_LINUX=""
    
    # Uncomment to enable BadRAM filtering, modify to suit your needs
    # This works with Linux (no patch required) and with any kernel that obtains
    # the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
    #GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
    
    # Uncomment to disable graphical terminal (grub-pc only)
    GRUB_TERMINAL=console
    
    # The resolution used on graphical terminal
    # note that you can use only modes which your graphic card supports via VBE
    # you can see them in real GRUB with the command `vbeinfo'
    #GRUB_GFXMODE=640x480
    
    # Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
    #GRUB_DISABLE_LINUX_UUID=true
    
    # Uncomment to disable generation of recovery mode menu entries
    #GRUB_DISABLE_RECOVERY="true"
    
    # Uncomment to get a beep at grub start
    #GRUB_INIT_TUNE="480 440 1"
    
    GRUB_FORCE_HIDDEN_MENU="true"
    export GRUB_FORCE_HIDDEN_MENU
    Also ideally I'd like to have an extra option in the GRUB menu to choose from text mode or graphical mode. Can it be done?

    Thanks

    #2
    OK, so I learned how to add this kernel parameter to the GRUB script to force boot in graphical mode

    Code:
    systemd.unit=graphical.target
    So now I know I can recover it if I can't connect remotely, but it would still be cool to have that shell and grub menu option

    Comment


      #3
      Update, I managed to add the grub menu entry for a "headless" boot following this tuto

      https://www.youtube.com/watch?v=TDf_fRAophc

      Works flawlessly! All i needed to do is to change the kernel boot params from

      Code:
      linux /boot/vmlinuz-4.10.0-22-generic.efi.signed root=UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ro quiet splash $vt_handoff
      to

      Code:
      linux /boot/vmlinuz-4.10.0-22-generic.efi.signed root=UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ro quiet splash [COLOR=#ff0000][B]systemd.unit=multi-user.target[/B][/COLOR] $vt_handoff
      adding the systemd.unit=multi-user.target param.

      Did I happen to mention I love linux?

      So all is left to do is to get that pesky shell/text mode working, although at this point I pretty much know it's impossible to get stuck there and unable to boot to KDE/Plasma, it'd still be nice to be able to type commands directly in the laptop without a desktop environment

      Comment


        #4
        This is linux so there's several ways to make this happen.

        Have you tried replacing "quiet splash" with "text" ? I believe that used to work. Easy enough to test - boot up, when presented with the grub menu, hit "E" on the keyboard to edit the line, look for "quiet splash" and delete them and add "text", then F10 to boot.

        Have you tried disabling the display manager? Presuming you're using a standard Kubuntu install, you could disable sddm at boot;

        sudo systemctl disable sddm

        should do it.

        Finally, IMO, if this is a server why have a desktop installed at all? Especially if it's an older slowish computer. I access my server via the text console using ssh or graphically using Webmin. Both ways can do everything I need.

        Please Read Me

        Comment


          #5
          Oops, I see you posted a few times while I was away from the keyboard!

          See? I told you there were several ways to make this happen
          Last edited by oshunluvr; Jun 17, 2017, 06:58 AM.

          Please Read Me

          Comment


            #6
            So all is left to do is to get that pesky shell/text mode working, although at this point I pretty much know it's impossible to get stuck there and unable to boot to KDE/Plasma, it'd still be nice to be able to type commands directly in the laptop without a desktop environment
            This is exactly what I do. Unless there's some issue you haven't explained, you need only to install and enable ssh on the server and log into it from a konsole on your desktop PC. I configure my ssh install to use a non-standard port and use secure keys like this explains. Finally, I have a "config" file in ~/.ssh that holds all my PC's ssh port settings, host names (or IP addresses), and my user name. That in combination with the secure key access means I need only type "ssh server" in the konsole and I'm on my server, or I can send a single command with "rsh server <COMMAND>"

            Works great

            Please Read Me

            Comment


              #7
              Originally posted by oshunluvr View Post
              This is linux so there's several ways to make this happen.

              Have you tried replacing "quiet splash" with "text" ? I believe that used to work. Easy enough to test - boot up, when presented with the grub menu, hit "E" on the keyboard to edit the line, look for "quiet splash" and delete them and add "text", then F10 to boot.

              Have you tried disabling the display manager? Presuming you're using a standard Kubuntu install, you could disable sddm at boot;

              sudo systemctl disable sddm

              should do it.

              Finally, IMO, if this is a server why have a desktop installed at all? Especially if it's an older slowish computer. I access my server via the text console using ssh or graphically using Webmin. Both ways can do everything I need.
              Thanks oshunluvr!, I'll try those suggestions right now

              Well, it's a new but cheap laptop I just got me. It's not really a server, I mostly use it for regular web browsing, watching movies and all that stuff, but I also have a crypto-coin pool server running there. It's not even accessible from outside my LAN.
              It's all more of an exercise and an opportunity to learn than a real necessity

              Comment


                #8
                Originally posted by dazz.. View Post
                Thanks oshunluvr!, I'll try those suggestions right now

                Well, it's a new but cheap laptop I just got me. It's not really a server, I mostly use it for regular web browsing, watching movies and all that stuff, but I also have a crypto-coin pool server running there. It's not even accessible from outside my LAN.
                It's all more of an exercise and an opportunity to learn than a real necessity
                Awesome. Linux is actually fun to work with vs. Windows which I just find to be annoying. Always good to learn new things.

                BTW, Welcome to the forum!

                Please Read Me

                Comment


                  #9
                  Originally posted by oshunluvr View Post
                  This is exactly what I do. Unless there's some issue you haven't explained, you need only to install and enable ssh on the server and log into it from a konsole on your desktop PC. I configure my ssh install to use a non-standard port and use secure keys like this explains. Finally, I have a "config" file in ~/.ssh that holds all my PC's ssh port settings, host names (or IP addresses), and my user name. That in combination with the secure key access means I need only type "ssh server" in the konsole and I'm on my server, or I can send a single command with "rsh server <COMMAND>"

                  Works great
                  Already using ssh, so I'll do that, thanks a lot. great opportunity to learn some good practices on security

                  BTW, sudo systemctl disable sddm works exactly as I want it to! it boots straight to the command line. Just perfect.
                  Now I need to put that in the my added grub entry to replace the systemd.unit=multi-user.target

                  Originally posted by oshunluvr View Post
                  BTW, Welcome to the forum!
                  Thank you!

                  Comment


                    #10
                    I'm not a systemd expert, but I think if you disable a service it stays disabled. You shouldn't need to also have it in grub. Just stopping a service wouldn't prevent it from running again, but disable removes the symlinks that allows systemd to launch it.

                    Please Read Me

                    Comment


                      #11
                      Originally posted by oshunluvr View Post
                      I'm not a systemd expert, but I think if you disable a service it stays disabled. You shouldn't need to also have it in grub. Just stopping a service wouldn't prevent it from running again, but disable removes the symlinks that allows systemd to launch it.
                      OK, that's a problem though.

                      What I have in mind is to have a "regular" default boot option in GRUB to KDE/Plasma desktop, and another boot option to "text-only" mode
                      Actually now I can't enable sddm back again, hehehe.

                      ETA: the sddm service was stopped, fixed now

                      Comment


                        #12
                        I can't get sddm starting on boot.
                        I tried locating the service and adding the symlink...

                        Code:
                        ln -s /lib/systemd/system/sddm.service/sddm.service /etc/systemd/system/
                        also tried

                        Code:
                        sudo update-rc.d sddm defaults
                        ETA: wait! just noticed I screwed up the symlink
                        Last edited by dazz..; Jun 17, 2017, 08:35 AM.

                        Comment


                          #13
                          Nope, still doesn't start on boot. The symlink looks good to me now

                          Code:
                          ls -la  /etc/systemd/system/
                          lrwxrwxrwx  1 root root   32 jun 17 16:36 sddm.service -> /lib/systemd/system/sddm.service
                          ETA: OK,
                          Code:
                          [COLOR=#111111][FONT=Consolas]sudo dpkg-reconfigure sddm[/FONT][/COLOR]
                          did the trick
                          Last edited by dazz..; Jun 17, 2017, 08:49 AM.

                          Comment


                            #14
                            If you do sudo systemctl enable sddm.service it will be enabled next boot and for there on.

                            I pictured you'd boot to text mode and log in. Then if you want graphic mode, launch sddm and log into the GUI - no need to reboot at all. When you're done with graphical mode, simply kill sddm and you're back to text only mode.

                            I rarely boot my systems so that's how I would do it. Honestly, it's fine to boot to the GUI mode and just hit ALT-F1 to get the console mode.

                            However, to have a text only and a graphical boot option is a bit more complex. You'd have to have a custom stanza in grub or something like that. That would be difficult to manage IMO -too much manual work required. Theoretically, you could write a script that would automagically create a custom boot stanza from your grub.cfg and have it execute when you ran "update-grub" - that would work but it will take some creative thinking and good bash scripting foo.

                            What about a boot script that queries GUI or Text? I don't even know if that possible.

                            Please Read Me

                            Comment


                              #15
                              Originally posted by oshunluvr View Post
                              If you do sudo systemctl enable sddm.service it will be enabled next boot and for there on.

                              I pictured you'd boot to text mode and log in. Then if you want graphic mode, launch sddm and log into the GUI - no need to reboot at all. When you're done with graphical mode, simply kill sddm and you're back to text only mode.

                              I rarely boot my systems so that's how I would do it. Honestly, it's fine to boot to the GUI mode and just hit ALT-F1 to get the console mode.

                              However, to have a text only and a graphical boot option is a bit more complex. You'd have to have a custom stanza in grub or something like that. That would be difficult to manage IMO -too much manual work required. Theoretically, you could write a script that would automagically create a custom boot stanza from your grub.cfg and have it execute when you ran "update-grub" - that would work but it will take some creative thinking and good bash scripting foo.

                              What about a boot script that queries GUI or Text? I don't even know if that possible.
                              You're absolutely right. I have this weird tendency for X,Y problems
                              I can use the default boot option both with and without sddm by firing a single command. I never needed any of the above to begin with, LOL
                              I now have a boot option to boot in "headless" mode, that I will probably never use. But once again, was totally worth it since now I'm a bit more at home with Grub

                              Once again, thank you

                              Comment

                              Working...
                              X