Announcement

Collapse
No announcement yet.

question about grub2

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

    question about grub2

    Looking to modify grub2 to add a boot option
    I think I need to copy the existing ubuntu boot and change the run level to 3. So, I can pick at boot which runlevel to log in to. I know I can ctrl-alt-f1 and stop the dm, but would like an quicker option

    #2
    I think everything you would need to do is listed on this wiki https://help.ubuntu.com/community/Gr...m_Menu_Entries

    Basically you will want to copy over your default menu item to the 40_custom file but append "init 3" to the end of the linux line and then rebuild grub2.

    Comment


      #3
      Add "3" to the end of the boot options in /etc/default/grub if you want to boot to 3 every time.

      Standard:
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

      Yours:
      GRUB_CMDLINE_LINUX_DEFAULT="quiet splash 3"

      Don't forget yo run update-grub after the edit.

      Please Read Me

      Comment


        #4
        Originally posted by oshunluvr View Post
        Add "3" to the end of the boot options in /etc/default/grub if you want to boot to 3 every time.

        Standard:
        GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"

        Yours:
        GRUB_CMDLINE_LINUX_DEFAULT="quiet splash 3"

        Don't forget yo run update-grub after the edit.

        I tried doing this in grub-customizer. /etc/default/grub had the following in it

        GRUB_DEFAULT="0"
        #GRUB_HIDDEN_TIMEOUT="0"
        GRUB_HIDDEN_TIMEOUT_QUIET="true"
        GRUB_TIMEOUT="2"
        GRUB_DISTRIBUTOR="`lsb_release -i -s 2> /dev/null || echo Debian`"
        GRUB_CMDLINE_LINUX_DEFAULT=""
        GRUB_CMDLINE_LINUX=""
        Since I wasn't sure what to add, I installed grub-customizer. Copied the ubuntu entry and named it ubuntu cli

        recordfail
        load_video
        gfxmode $linux_gfx_mode
        insmod gzio
        insmod part_msdos
        insmod ext2
        set root='hd0,msdos1'
        if [ x$feature_platform_search_hint = xy ]; then
        search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 1d4545f9-935e-43c4-8ffd-fc298c2dd764
        else
        search --no-floppy --fs-uuid --set=root 1d4545f9-935e-43c4-8ffd-fc298c2dd764
        fi
        linux /boot/vmlinuz-3.13.0-36-generic root=UUID=1d4545f9-935e-43c4-8ffd-fc298c2dd764 ro 3 <- added this 3
        initrd /boot/initrd.img-3.13.0-36-generic

        It still boots straight to GUI. Any ideas what I did wrong?

        Comment


          #5
          Append "init 3" without the quotes to your linux line, I feel like I might have said that already. Also you said you wanted to choose at boot time which run level so you will need to use the 40_custom file and not just modify your main grub lines. Did grub-customizer rebuild the menu? Check out the wiki, there are easy clear instructions there.
          Last edited by anika200; Sep 29, 2014, 05:18 AM.

          Comment


            #6
            Ok, this should be working. <insert upset mumbling>. Followed instructions in site mentioned by anika 2000

            I put the following into 40_custom
            menuentry "Command Line" {
            recordfail
            gfxmode $linux_gfx_mode
            insmod gzio
            insmod part_msdos
            insmod ext2
            set root='hd0,msdos1'
            if [ x$feature_platform_search_hint = xy ]; then
            search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 1d4545f9-935e-43c4-8ffd-fc298c2dd764
            else
            search --no-floppy --fs-uuid --set=root 1d4545f9-935e-43c4-8ffd-fc298c2dd764
            fi
            linux /boot/vmlinuz-3.13.0-36-generic root=UUID=1d4545f9-935e-43c4-8ffd-fc298c2dd764 ro init 3
            initrd /boot/initrd.img-3.13.0-36-generic

            When I run sudo upfate-grub (tried in a konsole window and using ctrl-alt-f1, stopping lightdm, update, then restart.
            In either case I get the following:

            Generating grub configuration file ...
            using custom appearance settings
            Found background image: /home/virgil/Pictures/wallpapers/boomerang nebula.jpg
            /etc/grub.d/40_custom: 1: /etc/grub.d/40_custom: menuentry: not found
            /etc/grub.d/40_custom: 2: /etc/grub.d/40_custom: recordfail: not found
            /etc/grub.d/40_custom: 3: /etc/grub.d/40_custom: gfxmode: not found
            insmod: ERROR: could not load module gzio: No such file or directory
            insmod: ERROR: could not load module part_msdos: No such file or directory
            insmod: ERROR: could not load module ext2: No such file or directory
            /etc/grub.d/40_custom: 11: /etc/grub.d/40_custom: search: not found
            /etc/grub.d/40_custom: 13: /etc/grub.d/40_custom: linux: not found
            /etc/grub.d/40_custom: 14: /etc/grub.d/40_custom: initrd: not found
            /etc/grub.d/40_custom: 15: /etc/grub.d/40_custom: Syntax error: "}" unexpected


            I also tried removing things, but got the same error, so went back. it also blows up grub-customizer with a grub-mkconfig error. ctrl-alt-f1 is easy enough, but I hate backing down from a problem.

            Comment


              #7
              Yes that should be working, must be some pasting error. For instance I do not see a closing }.
              Can you post the exact paste from your 40_custom file within the code tags please (# icon). You should be able to do all the work from within Konsole with the sudo command. If you get an error as you did above paste it with code tags too.

              Comment


                #8
                I didn't have a 40_custom so I had to create it... Here it is. I think the last paste just chopped off the closing } I used sudo vim /etc/grub.d/40_custom, the just copied with the mouse and pasted here

                Code:
                menuentry "Command Line" {
                recordfail
                gfxmode $linux_gfx_mode
                insmod gzio
                insmod part_msdos
                insmod ext2
                set root='hd0,msdos1'
                if [ x$feature_platform_search_hint = xy ]; then
                  search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1  1d4545f9-935e-43c4-8ffd-fc298c2dd764
                else
                  search --no-floppy --fs-uuid --set=root 1d4545f9-935e-43c4-8ffd-fc298c2dd764
                fi
                linux   /boot/vmlinuz-3.13.0-36-generic root=UUID=1d4545f9-935e-43c4-8ffd-fc298c2dd764 ro init 3
                initrd  /boot/initrd.img-3.13.0-36-generic
                }

                Comment


                  #9
                  Originally posted by vsreeser View Post
                  I didn't have a 40_custom so I had to create it...
                  That is strange, what version Kubuntu are you using?

                  There is an important comment in the original file here it is: and of course you need the bash shebang too.
                  Code:
                  #!/bin/sh
                  exec tail -n +3 $0
                  # This file provides an easy way to add custom menu entries.  Simply type the
                  # menu entries you want to add after this comment.  Be careful not to change
                  # the 'exec tail' line above.

                  Comment


                    #10
                    Installed ubuntu 14.04 server, then added kde, lxde, and xfce

                    Added the code and update-grub ran with no errors. . Thanks for the help. It still boots to gui though
                    Tried by hitting e then adding 3 and init 3 to the end of the linux line and it still boots gui. The problem must be somewhere else. Maybe a wipe and reinstall is in order. Should I dl a new copy of kubuntu 14.04 first? Or would another version be advisable? This is not a production machine, so I can do anything with it. This shouldn't make a difference, but I use the 64 bit version since the machine in question has 6Gb ram and is m\ulti-core
                    Last edited by vsreeser; Sep 29, 2014, 12:17 PM.

                    Comment


                      #11
                      Do you get a new menu item in grub named Command Line? This should be working, hmmmm. Even if you re-install you will still want to figure this out anyway so you might as well keep working on it.

                      Comment


                        #12
                        There is a new menu item. I tried hitting e in grub and adding a 3 and an init 3 to then end of the linux line and that didn't work either. Starting to think this is not a grub problem, but a problem somewhere else. Everything is entered the way it should be but its no co-operating. Strange

                        Comment


                          #13
                          look hear http://askubuntu.com/questions/22840...-to-runlevel-3

                          VINNY
                          i7 4core HT 8MB L3 2.9GHz
                          16GB RAM
                          Nvidia GTX 860M 4GB RAM 1152 cuda cores

                          Comment


                            #14
                            From what I read on that site you have to change the display manager settings as well, never heard of that before or tested the method.

                            Unfortunately, Ubuntu has ignored the standard and that's why you'll need to change /etc/init/lightdm.conf or /etc/init/gdm.conf (or whatever DM you use) as well. This is how mine "on start" condition looks like:
                            start on ((filesystem
                            and runlevel [!06]
                            and runlevel [!03]
                            and started dbus
                            and plymouth-ready)
                            or runlevel PREVLEVEL=S)
                            Actually I have no idea what we are using for a dm. I am new to this distro, only couple months. Ahh, it looks like it is Lightdm.
                            Last edited by anika200; Sep 29, 2014, 05:15 PM. Reason: added personal note

                            Comment


                              #15
                              yes the default is lightdm ,,,,you can use kdm .

                              but lightdm is default

                              VINNY
                              Last edited by vinnywright; Sep 29, 2014, 05:51 PM.
                              i7 4core HT 8MB L3 2.9GHz
                              16GB RAM
                              Nvidia GTX 860M 4GB RAM 1152 cuda cores

                              Comment

                              Working...
                              X