You are not logged in.

#1 2013-01-24 03:48:06

phonky
Member
Registered: 2008-12-19
Posts: 78

[SOLVED] grub2 menuentry (or what?) to boot into runlevel 3

I have searched an hour now on the web and can't believe I haven't been able to find a solution.

I want, at startup, to have an option in the grub2 selection list for selecting an entry to boot into runlevel 3 directly - no X, because I just plainly want a command line.

I know I can go 'e', go to the 'linux' line and add a 3 at the end.
But I don't want to do that all the time - that's what the grub2 menu is supposed to do imho, to allow to boot your preferred options.

I wanted to put something into /etc/grub.d/40_custom, but I lack the info to actually put  it there - because the arch default menu entries are generated from 10_linux which looks completely different...

Anyone can help please? I can't understand why grub2 needs to have this so complicated really...
thanks

Last edited by phonky (2013-01-24 05:02:31)

Offline

#2 2013-01-24 03:57:14

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED] grub2 menuentry (or what?) to boot into runlevel 3

You could just edit /boot/grub/grub.cfg manually.  Copy and paste the relevant entry and then change the title (like maybe append "TTY" or something) and then add the 3 you desire to that entry.  Though you should probably know that with systemd, there is a different format for what you are trying to accomplish.  Runlevels are a function of SysV, systemd uses targets.  So I think the correct format would be systemd.unit=multi-user.target... though I haven't used this is a while.

Keep in mind that, yes these entries will be erased everytime you run that grub configuration generator.  Honestly, this is one of the many reasons I was eventually enticed to move to syslinux.  Multi-booting more than once Linux in syslinux is a touch more complex, but the overall simplicity if booting just one Linux (or one Linux and one windows) is freakin' amazing.


Edit: Fixed "systemd.unit=multi-user.target" to avoid any potential confusion for future readers.

Last edited by WonderWoofy (2013-01-24 04:16:12)

Offline

#3 2013-01-24 04:14:20

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 7,198

Re: [SOLVED] grub2 menuentry (or what?) to boot into runlevel 3

Adjust as required:

menuentry "Arch Linux Kernel with systemd (no X11)" --class arch --class gnu-linux --class gnu --class os {
        set gfxpayload="keep"
        set root="${_arch64_boot}"
        echo 'Llwytho Linux vmlinuz ar FyNghyfriadur ...'
        linux /vmlinuz-linux root=${_root_lvol} ro rootfstype=${_rootfstype} ${_kernel_params} systemd.unit=multi-user.target
        echo 'Llwytho initial ramdisk ...'
        initrd /initramfs-linux.img
}

Note that I don't auto-generate grub.cfg. However, I think it should work to just include the entry in 40_custom or whatever.

Last edited by cfr (2013-01-24 04:15:31)


CLI Paste | How To Ask Questions

Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L

Offline

#4 2013-01-24 05:02:05

phonky
Member
Registered: 2008-12-19
Posts: 78

Re: [SOLVED] grub2 menuentry (or what?) to boot into runlevel 3

Aaaaah it works - thanks cfr, I followed your proposal and adjusted as needed (e.g. /boot/vmlinuz-linux and /boot/initramfs-linux.img, etc.).
I did generate with grub-mkconfig.

Thanks!

Offline

Board footer

Powered by FluxBB