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

    #31
    Can someone please give me a brief explanation of what is this all about?

    Code:
    linux /vmlinux root=[I]<blah blah>
    [/I]initrd /initrd.img
    these are grub commands, right?

    Comment


      #32
      If you already know what you are doing, this basic intro may be helpful ;-)
      The GRUB 2 Manual
      https://www.gnu.org/software/grub/manual/grub.html
      E.g.,
      16.3.37 linux

      Command: linux file …

      Load a Linux kernel image from file. The rest of the line is passed verbatim as the kernel command-line. Any initrd must be reloaded after using this command (see initrd).

      On x86 systems, the kernel will be booted using the 32-bit boot protocol. Note that this means that the ‘vga=’ boot option will not work; if you want to set a special video mode, you will need to use GRUB commands such as ‘set gfxpayload=1024x768’ or ‘set gfxpayload=keep’ (to keep the same mode as used in GRUB) instead. GRUB can automatically detect some uses of ‘vga=’ and translate them to appropriate settings of ‘gfxpayload’. The linux16 command (see linux16) avoids this restriction.
      And initrd,
      https://www.gnu.org/software/grub/ma...ub.html#initrd
      An intellectual says a simple thing in a hard way. An artist says a hard thing in a simple way. Charles Bukowski

      Comment


        #33
        Originally posted by dazz.. View Post
        Can someone please give me a brief explanation of what is this all about?

        Code:
        linux /vmlinux root=[I]<blah blah>
        [/I]initrd /initrd.img
        these are grub commands, right?
        Part of the grub boot menu stanzas.

        I believe the suggestion is to edit your 40_custom file in /etc/grub.d using the first menuentry from /boot/grub/grub.cfg and edit these two lines:

        Code:
        linux /boot/[B]vmlinuz-4.10.0-22-generic.efi.signed[/B] root=UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ro [B]quiet splash[/B]
        initrd /boot/[B]initrd.img-4.10.0-22-generic[/B]
        to look like this:

        Code:
        linux /boot/[B]vmlinuz[/B] root=UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ro [B]text[/B]
        initrd /boot/[B]initrd.img[/B]
        then you won't have to keep re-editing 40_custom or use any script action at all. This will continue to do what you want without further work.

        The reason this works is Kubuntu (all *buntu's) create a symlinks in the root folder that point to the most current kernel image (vmlinux) and initramfs (initrd.img) and the previous version. If you do this command in a terminal:

        ls -l / |grep lrwx

        you'll see these symlinks:

        Code:
        lrwxrwxrwx   1 root   root     33 Jun  7 09:36 initrd.img -> boot/initrd.img-4.10.0-22-generic
        lrwxrwxrwx   1 root   root     33 May 21 09:10 initrd.img.old -> boot/initrd.img-4.10.0-21-generic
        lrwxrwxrwx   1 root   root     30 Jun  7 09:36 vmlinuz -> boot/vmlinuz-4.10.0-22-generic
        lrwxrwxrwx   1 root   root     30 May 21 09:10 vmlinuz.old -> boot/vmlinuz-4.10.0-21-generic

        Please Read Me

        Comment


          #34
          That makes complete sense. Simple and elegant solution

          Comment


            #35
            For the sake of completion, here's the final solution (content of /etc/grub.d/40_custom)

            Code:
            menuentry '[COLOR=#ff0000][B]Ubuntu (HEADLESS)[/B][/COLOR]' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' {        
                 recordfail
                 load_video
                 gfxmode $linux_gfx_mode
                 insmod gzio
                 if [ x$grub_platform = xxen ]; then insmod xzio; insmod lzopio; fi
                 insmod part_gpt
                 insmod ext2
                 set root='hd0,gpt2'
                 if [ x$feature_platform_search_hint = xy ]; then
                   search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                 else
                   search --no-floppy --fs-uuid --set=root xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
                 fi
            [COLOR=#ff0000][B]        linux /vmlinuz root=UUID=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx ro text systemd.unit=multi-user.target[/B][/COLOR]
            [COLOR=#ff0000][B]        initrd /initrd.img[/B][/COLOR]
            }
            Last edited by dazz..; Jun 20, 2017, 08:01 AM.

            Comment


              #36
              Another interesting command I found:

              Code:
              sudo grub-reboot "Ubuntu (HEADLESS)"
              sudo reboot
              ..to reboot the system and load the newly created stanza labeled as "Ubuntu (HEADLESS)"

              Comment

              Working...
              X