You are not logged in.

#1 2016-05-26 21:03:33

azor7878
Member
Registered: 2016-05-26
Posts: 7

Add grub option to boot in console.

I'm running the newest iso on Lenovo s10-3 and i would like to have a grub option to boot into text only mode, i tried pressing e and changing "quiet splash" to "text" but when i press f10 it still boots me to wm, i'm currently using recovery mode but i'm quite new to linux and i don't really know if i'm supposed to touch that.
Btw. My system doesn't ask for a password in recovery mode and i really don't like that, anybody can just take my laptop and boot in recovery mode so what's the point of even having one, can i force password check to always trigger?

Offline

#2 2016-05-26 21:46:55

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Add grub option to boot in console.

You may need to enable it in systemd.   

sudo systemctl enable multi-user.target 

With that you should be able to boot to the console, methinks... if I'm wrong please someone feel free to correct me as usual.
And use startx   to start up the GUI WM


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#3 2016-05-26 22:21:17

azor7878
Member
Registered: 2016-05-26
Posts: 7

Re: Add grub option to boot in console.

I tried that but i get this error: https://i.imgur.com/lEs2Pm4.png
I also changed GRUB_CMDLINE_LINUX_DEFAULT= in /etc/default/grub from "quiet splash" to "text" and it still boots to wm, i did sudo update-grub.

Offline

#4 2016-05-26 22:59:54

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,143
Website

Re: Add grub option to boot in console.

See if this article is correct, you need to modify both grub and systemd.

http://ask.xmodulo.com/boot-into-comman … ebian.html


I don't care what you do at home. Would you care to explain?

Offline

#5 2016-05-27 01:50:23

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 12,657
Website

Re: Add grub option to boot in console.

off-topic

azor7878 wrote:

My system doesn't ask for a password in recovery mode and i really don't like that, anybody can just take my laptop and boot in recovery mode so what's the point of even having one?

This is a long-running argument. In fact your login password only gives you very low protection. Once someone has physical possession of a laptop, pretty much anything is open to them. The only protection is whole-disk encryption AFAIK.
/off-topic


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), now on Bluesky, there's also some GitStuff )

Introduction to the Bunsenlabs Boron Desktop

Offline

#6 2016-05-27 04:05:38

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,143
Website

Re: Add grub option to boot in console.

johnraff wrote:

off-topic

azor7878 wrote:

My system doesn't ask for a password in recovery mode and i really don't like that, anybody can just take my laptop and boot in recovery mode so what's the point of even having one?

This is a long-running argument. In fact your login password only gives you very low protection. Once someone has physical possession of a laptop, pretty much anything is open to them. The only protection is whole-disk encryption AFAIK.
/off-topic

I have a BunsenLabs-Hydrogen Live USB or CD, I can now reformat your encrypted disks with GParted?


I don't care what you do at home. Would you care to explain?

Offline

#7 2016-05-27 06:08:53

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Add grub option to boot in console.

Horizon_Brave wrote:

You may need to enable it in systemd.   

sudo systemctl enable multi-user.target 

The correct command is:

sudo systemctl set-default multi-user.target

To restore a graphical login, use:

sudo systemctl set-default graphical.target

See systemctl(1)

To boot to a console temporarily, use systemd.unit=multi-user.target as a kernel command line parameter.

See https://wiki.archlinux.org/index.php/Ke … eters#GRUB for more.

EDIT:To generate a custom GRUB menu entry to boot to the console, edit the file at /etc/grub.d/40_custom (as root!) and add this stanza:

#!/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.
menuentry 'BunsenLabs Console' {
        set root=(hdX,Y)
        linux /vmlinuz ro quiet root=/dev/sdXY systemd.unit=multi-user.target
        initrd /initrd.img
}

Replace X & Y with the drive letter and partition number of your root filesystem ("/"), for example /dev/sda1

Then save the file and update your GRUB configuration:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Last edited by Head_on_a_Stick (2016-05-27 06:15:48)

Offline

#8 2016-05-27 07:03:41

azor7878
Member
Registered: 2016-05-26
Posts: 7

Re: Add grub option to boot in console.

Horizon_Brave wrote:

To generate a custom GRUB menu entry to boot to the console, edit the file at /etc/grub.d/40_custom (as root!) and add this stanza:

#!/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.
menuentry 'BunsenLabs Console' {
        set root=(hdX,Y)
        linux /vmlinuz ro quiet root=/dev/sdXY systemd.unit=multi-user.target
        initrd /initrd.img
}

Replace X & Y with the drive letter and partition number of your root filesystem ("/"), for example /dev/sda1

Then save the file and update your GRUB configuration:

sudo grub-mkconfig -o /boot/grub/grub.cfg

I don't really know what you mean by drive letter, i replaced X with /dev/sda becouse my drive was marked as that in gparted and Y with /dev/sda1, my / partition was marked like that in gparted.
I added the grub entry but when i choose it i get this error:
error: disk `hd/dev/sda,/dev/sda1' not found.
error: you need to load the kernel first.

@edit:
I tried changing hdX,Y and XY to /dev/sda1 but it gives me the same error, only diference is that in quotes it says `/dev/sda1'.

Last edited by azor7878 (2016-05-27 07:04:12)

Offline

#9 2016-05-27 07:15:08

damo
....moderator....
Registered: 2015-08-20
Posts: 6,734

Re: Add grub option to boot in console.

azor7878 wrote:

...
I don't really know what you mean by drive letter, i replaced X with /dev/sda becouse my drive was marked as that in gparted and Y with /dev/sda1, my / partition was marked like that in gparted.
I added the grub entry but when i choose it i get this error:
error: disk `hd/dev/sda,/dev/sda1' not found.
error: you need to load the kernel first.

@edit:
I tried changing hdX,Y and XY to /dev/sda1 but it gives me the same error, only diference is that in quotes it says `/dev/sda1'.

The "hdX" (drive)  numbering starts from zero, so the first drive (the one with grub)  would be "hd0";
The first partition could be "sda1", the second "sda2" etc, so if your "/" (root) is on the first partition then use Y = "1"


Be Excellent to Each Other...
The Bunsenlabs Lithium Desktop » Here
FORUM RULES and posting guidelines «» Help page for forum post formatting
Artwork on DeviantArt  «» BunsenLabs on DeviantArt

Offline

#10 2016-05-27 07:51:53

azor7878
Member
Registered: 2016-05-26
Posts: 7

Re: Add grub option to boot in console.

damo wrote:
azor7878 wrote:

...
I don't really know what you mean by drive letter, i replaced X with /dev/sda becouse my drive was marked as that in gparted and Y with /dev/sda1, my / partition was marked like that in gparted.
I added the grub entry but when i choose it i get this error:
error: disk `hd/dev/sda,/dev/sda1' not found.
error: you need to load the kernel first.

@edit:
I tried changing hdX,Y and XY to /dev/sda1 but it gives me the same error, only diference is that in quotes it says `/dev/sda1'.

The "hdX" (drive)  numbering starts from zero, so the first drive (the one with grub)  would be "hd0";
The first partition could be "sda1", the second "sda2" etc, so if your "/" (root) is on the first partition then use Y = "1"

Thanks man, i replaced the first part with hd0,1 and the second one with 01 and that worked!
...well, kinda, it boots to console but it gets stuck at this error:

Loading, please wait...
Scanning for Btrfs filesystems

then after ~30 seconds it displays this message:

modprobe: module unknown not found in modules.dep
mount: mounting /dev/root on /root failed: No such device or adress
Target filesystem doesn't have requested /sbin/int.
mount: mounting /dev on /root/dev failed: No such file or directory
No int found. Try passing int= dootarg.


BusyBox v1.22.1 (Debian 1:1.22.0-9+deb8u1) built-in shell (ash)
Enter 'help' for a list of built-in commands.

/bin/sh: cannot access tty; job control turned off
(initramfs)_

I don't know if that's important but when i update grub at the end i get this error:

[ 32.085916] You didn't specify the type of your ufs filesystem
[ 32.085916] 
[ 32.085916] mount -t ufs -o ufstype=sun|sunx85|44bsd|lufs2|5xbsd|old|hp|nextstep|neststep-cd|openstep ...
[ 32.085916] 
[ 32.085916] >>>WARNING<<< Wrong ufstype may corrupt your filesystem, default is ufstype=old
[ 32.119940] hfs. can't find a HFS filesystem on dev sda2

There could be typos in codes, i wrote it from the screen of my laptop, sorry.

Offline

#11 2016-05-27 08:11:20

xaos52
The Good Doctor
From: Planet of the @pes
Registered: 2015-09-30
Posts: 695

Re: Add grub option to boot in console.

Warning only!
update-grub is scanning your hard drive for bootable partitions, finds sda2, tries to mount it,but fails - because it contains an BSD filesystem.
You should be able to boot to any discovered linux partitions though.

Offline

#12 2016-05-27 18:31:20

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Add grub option to boot in console.

Terribly sorry about this, I posted my EDIT just before rushing out to $DAY_JOB, so I made a mistake with the (hd0,1) bit  :8

If your root filesystem is on /dev/sda1 then the file should look like this:

#!/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.
menuentry 'BunsenLabs Console' {
        set root=(hd0,1)
        linux /vmlinuz ro quiet root=/dev/sda1 systemd.unit=multi-user.target
        initrd /initrd.img
}

If that still throws up an error, boot your normal system and post the output of:

cat /proc/cmdline

Also check for /vmlinuz and /initrd.img -- these should be symlinks to the current kernel image & initramfs.

Offline

#13 2016-05-27 19:21:22

azor7878
Member
Registered: 2016-05-26
Posts: 7

Re: Add grub option to boot in console.

Head_on_a_Stick wrote:

Terribly sorry about this, I posted my EDIT just before rushing out to $DAY_JOB, so I made a mistake with the (hd0,1) bit  :8

If your root filesystem is on /dev/sda1 then the file should look like this:

#!/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.
menuentry 'BunsenLabs Console' {
        set root=(hd0,1)
        linux /vmlinuz ro quiet root=/dev/sda1 systemd.unit=multi-user.target
        initrd /initrd.img
}

If that still throws up an error, boot your normal system and post the output of:

cat /proc/cmdline

Also check for /vmlinuz and /initrd.img -- these should be symlinks to the current kernel image & initramfs.

Hell yeah man! That worked perfectly, thanks!

I have two more questions tho:
1. Can i change the resolution in text mode?
2. How can i force password check in recovery mode or if that's impossible disable it?
I know that if somebody has the physical access to my laptop they can force their way through any password check but still, using live usb or evading the password in any other way requires thought and skills, i don't like that there is just an option to bypass the password check right there on the boot menu.

Offline

#14 2016-05-27 19:39:48

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Add grub option to boot in console.

azor7878 wrote:

Can i change the resolution in text mode?

Depending on your graphics hardware, kernel modesetting (KMS) may allow native screen resolution at the console.

See https://wiki.archlinux.org/index.php/Ke … de_setting

There are also options to set the resolution at the GRUB screen and then keep that at the console but I think these are hardware-dependent and I've never tried them.
https://www.gnu.org/software/grub/manual/grub.html

azor7878 wrote:

How can i force password check in recovery mode

I don't understand what you mean, sorry hmm

multi-user.target should still boot to a console log in and a password should still be required.

Offline

#15 2016-05-27 19:54:28

azor7878
Member
Registered: 2016-05-26
Posts: 7

Re: Add grub option to boot in console.

Head_on_a_Stick wrote:
azor7878 wrote:

Can i change the resolution in text mode?

Depending on your graphics hardware, kernel modesetting (KMS) may allow native screen resolution at the console.

See https://wiki.archlinux.org/index.php/Ke … de_setting

There are also options to set the resolution at the GRUB screen and then keep that at the console but I think these are hardware-dependent and I've never tried them.
https://www.gnu.org/software/grub/manual/grub.html

I'll try those, thanks.

Head_on_a_Stick wrote:
azor7878 wrote:

How can i force password check in recovery mode

I don't understand what you mean, sorry hmm

multi-user.target should still boot to a console log in and a password should still be required.

Well when i boot in recovery mode it doesn't ask for password, just logs me in as root, i want to have to input my password no matter what mode i'm booting in.

Offline

#16 2016-05-27 20:01:00

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Add grub option to boot in console.

You can disable the "Recovery" entries by uncommenting (remove the # symbol) this line in /etc/default/grub:

GRUB_DISABLE_RECOVERY=true

Then save the file and update your configuration:

sudo grub-mkconfig -o /boot/grub/grub.cfg

Offline

#17 2016-05-27 21:05:04

hhh
Gaucho
From: High in the Custerdome
Registered: 2015-09-17
Posts: 16,143
Website

Re: Add grub option to boot in console.

azor7878 wrote:

1. Can i change the resolution in text mode?

From https://wiki.debian.org/GrubTransition

To set a screen resolution for your console you can do the following... as root

edit /etc/default/grub uncomment the GRUB_GFXMODE=640x480 and change the resolution to something you can use e.g. 1024x768
Add the line
GRUB_GFXPAYLOAD_LINUX=keep
to the file to have the same resolution at the Linux console. You do not edit the 00_header file as some suggest you need to do.

run update-grub

run reboot to confirm that your changes worked!


I don't care what you do at home. Would you care to explain?

Offline

#18 2016-05-27 21:17:46

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Add grub option to boot in console.

Good to know... I didn't know you could pass the

linux /vmlinuz ro quiet root=/dev/sda1 systemd.unit=multi-user.target

command into the grub bootloader as a param....Surprised grub knows how to "use" this..

One question guys. Is doing this method that HoaS provided, the same as running with multi-user.target as the default target? LIke with the command 

sudo systemctl set-default multi-user.target

It seems that the "pointing to" the console is done at different spots, but effectively it does the same thing?


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

#19 2016-05-27 21:52:19

Head_on_a_Stick
Member
From: London
Registered: 2015-09-29
Posts: 9,093
Website

Re: Add grub option to boot in console.

Horizon_Brave wrote:

I didn't know you could pass the

linux /vmlinuz ro quiet root=/dev/sda1 systemd.unit=multi-user.target

command into the grub bootloader as a param....Surprised grub knows how to "use" this..

It doesn't, everything after "/vmlinuz" (the location of the kernel image) is passed straight to the kernel as a command line parameter.

Horizon_Brave wrote:

Is doing this [...] the same as running with multi-user.target as the default target?

No, `systemctl set-default` would permanently set the default .target whereas the GRUB kernel command line option is temporary.

Offline

#20 2016-05-28 02:40:21

Horizon_Brave
Operating System: Linux-Nettrix
Registered: 2015-10-18
Posts: 1,473

Re: Add grub option to boot in console.

Head_on_a_Stick wrote:
Horizon_Brave wrote:

I didn't know you could pass the

linux /vmlinuz ro quiet root=/dev/sda1 systemd.unit=multi-user.target

command into the grub bootloader as a param....Surprised grub knows how to "use" this..

It doesn't, everything after "/vmlinuz" (the location of the kernel image) is passed straight to the kernel as a command line parameter.

Horizon_Brave wrote:

Is doing this [...] the same as running with multi-user.target as the default target?

No, `systemctl set-default` would permanently set the default .target whereas the GRUB kernel command line option is temporary.

Edit:  That was odd.. I got the secure connection failed message (not the first time) So I went back and resubmitted, but didn't even notice that it didn't actually save the text...

Anyway all I said was basically concurring with you about the temporary and permanent change, but made the comment that it seems like more work to edit grub to boot temporarily into console mode, and it seems seems easier to just switch to console mode  with the hot keys.

Last edited by Horizon_Brave (2016-05-28 12:16:58)


"I have not failed, I have found 10,000 ways that will not work" -Edison

Offline

Board footer

Powered by FluxBB