blog.lobraun.de Lothar Braun

Grub on MSI GS43VR (UEFI)

UEFI laptops sometimes want some massaging before they are willing to boot up the GRUB boot manager. Many postings show different ways to setup the boot manager.

Several UEFI-capable devices can be configured using efivars, to store which Boot Manager should be used by default (e.g. the Windows Boot Manager, Grub, ...). They then offer an option during startup to pick the appropriate boot manager. The MSI GS43VR does not support efivars. So in order to make sure that grub is used as your default boot manager, you have to do the following:

First follow the instructions of your distro to setup the boot manager. Afterwards, identify the UEFI boot partition, and mount it to your system:

# mount /dev/<your_uefi_partition> /boot/efi/

Then identify the location that your distro used to store the file grubx64.efi:

# find /boot/efi/ -name grubx64.efi
/boot/efi/EFI/debian/grubx64.efi

Make a copy of your old Boot loader from MSI:

# cp /bin/efi/EFI/Boot/bootx64.efi /bin/efi/EFI/Boot/bootx64_msi_orig.efi

Copy your distros grubx64.efi over the bootx64.efi loader:

# cp /boot/efi/EFI/<distro_folder>/grubx64.efi /boot/efi/EFI/Boot/bootx64.efi

The reason for this is simple: The MSI will boot the image EFI/Boot/bootx64.efi as the default image. By copying the grub loader to this location, the MSI loader will automatically load the grub loader as its only loader.

You have redo this step every time grub updates its grubx64.efi file. You also have to redo this step if you decide to change your preferred distro. The grubx64.efi of one distro is unlikely to be able to load the further stages that are provided by another distro and you will be put into a grub rescue prompt.

Xorg -configure: Number of created screens does not match number of detected devices. Configuration failed.

Configuring an Xserver used to be a task that required fiddling with the X server configuration files, and you needed to perform this every time you set up a new system. Today, the X server will often automagically detect all available hardware and come up with some reasonable settings without any configuration file at all.

You only need to create an xorg.conf if you want to modify some of the defaults. Most of the time, this just means running

Xorg -configure 

And to copy the configuration file to your /etc/X11 directory. If you system has two graphic cards, then the configuration might abort with the following error message:

Number of created screens does not match number of detected devices. Configuration failed.

Xorg -configure does create a xorg.conf, which contains a two Monitor sections, two Screen sections, and two Device sections. An example output might look like this:

Section "ServerLayout"
    Identifier     "X.org Configured"
    Screen      0  "Screen0" 0 0
    Screen      1  "Screen1" RightOf "Screen0"
    InputDevice    "Mouse0" "CorePointer"
    InputDevice    "Keyboard0" "CoreKeyboard"
EndSection

Section "Files"
    ModulePath   "/usr/lib/xorg/modules"
    FontPath     "/usr/share/fonts/X11/misc"
    FontPath     "/usr/share/fonts/X11/cyrillic"
    FontPath     "/usr/share/fonts/X11/100dpi/:unscaled"
    FontPath     "/usr/share/fonts/X11/75dpi/:unscaled"
    FontPath     "/usr/share/fonts/X11/Type1"
    FontPath     "/usr/share/fonts/X11/100dpi"
    FontPath     "/usr/share/fonts/X11/75dpi"
    FontPath     "built-ins"
EndSection

Section "Module"
	Load  "glx" 
EndSection

Section "InputDevice"
	Identifier  "Keyboard0"
	Driver      "kbd"
EndSection

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option	    "Protocol" "auto"
    Option	    "Device" "/dev/input/mice"
    Option	    "ZAxisMapping" "4 5 6 7"
EndSection

Section "Monitor"
	Identifier   "Monitor0"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Monitor"
	Identifier   "Monitor1"
	VendorName   "Monitor Vendor"
	ModelName    "Monitor Model"
EndSection

Section "Device"
    ### Available Driver options are:-
    ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
    ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
    ### <percent>: "<f>%"
    ### [arg]: arg optional
    #Option     "SWcursor"           	# [<bool>]
    #Option     "HWcursor"           	# [<bool>]
    #Option     "NoAccel"            	# [<bool>]
    #Option     "ShadowFB"           	# [<bool>]
    #Option     "VideoKey"           	# <i>
    #Option     "WrappedFB"          	# [<bool>]
    #Option     "GLXVBlank"          	# [<bool>]
    #Option     "ZaphodHeads"        	# <str>
    #Option     "PageFlip"           	# [<bool>]
    #Option     "SwapLimit"          	# <i>
    #Option     "AsyncUTSDFS"        	# [<bool>]
    #Option     "AccelMethod"        	# <str>
    #Option     "DRI"                	# <i>
	Identifier  "Card0"
	Driver      "nouveau"
	BusID       "PCI:1:0:0"
EndSection

Section "Device"
    ### Available Driver options are:-
    ### Values: <i>: integer, <f>: float, <bool>: "True"/"False",
    ### <string>: "String", <freq>: "<f> Hz/kHz/MHz",
    ### <percent>: "<f>%"
    ### [arg]: arg optional
    #Option     "ShadowFB"           	# [<bool>]
    #Option     "DefaultRefresh"     	# [<bool>]
    #Option     "ModeSetClearScreen" 	# [<bool>]
    Identifier  "Card1"
    Driver      "vesa"
    BusID       "PCI:0:2:0"
EndSection

Section "Screen"
	Identifier "Screen0"
	Device     "Card0"
	Monitor    "Monitor0"
	SubSection "Display"
		Viewport   0 0
		Depth     1
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

Section "Screen"
	Identifier "Screen1"
	Device     "Card1"
	Monitor    "Monitor1"
	SubSection "Display"
		Viewport   0 0
 		Depth     1
    EndSubSection
    SubSection "Display"
    	Viewport   0 0
    	Depth     4
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     8
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     15
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     16
	EndSubSection
	SubSection "Display"
		Viewport   0 0
		Depth     24
	EndSubSection
EndSection

If you can decide which graphic card should be used in the configuration, you can simply delete the other irrelevant sections from you configuration file. If I only want to have the nouveau driver running, then I remove all references to Monitor1, Screen1, and Card1 from the configuration. Make sure to adopt the ServerLayout section as well.

GitLab: The project you were looking for could not be found.

After setting up my first repository on my GitLab instance, I received the following error message when pushing to my first repo:

remote: GitLab: The project you were looking for could not be found.

Turned out that I had a symlink in the path of to my data repository:

/var/opt/gitlab/git-data --> /data/gitlib

GitLab cannot deal with this and will then show this error message. The correct way to change the data directory is to change the config in /etc/gitlab/gitlab.rb to

git_data_dirs({ "default" => { "path" => "<YOUR_DATA_PATH>", 'gitaly_address' => 'unix:/var/opt/gitlab/gitaly/gitaly.socket' } })

Afterwards, you should be able to push / pull to your repositories.

Enabling Serial Console

Serial console output can be generated for grub messsages, for the kernel boot process, and the access to the system. Different configuration changes need to be done in order to do that.

Grub boot messages

If you want to see boot messages through the console, you need to pass additional arguments to the kernel through kernel arguments. This can be done via the grub config. Simply add the following to your default arguments:

GRUB_TERMINAL=serial
GRUB_SERIAL_COMMAND="serial --speed=38400 --unit=0 --word=8 --parity=no --stop=1"

into your grub config (e.g. /etc/conf.d/grub on gentoo or /etc/default/grub on Debian)

Then regenerate your grub.cfg by running your update grub:

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

or

update-grub

or

update-grub2

depending on the distro.

Kernel Boot Messages

If you want to see boot messages through the console, you need to pass additional arguments to the kernel through kernel arguments. This can be done via the grub config. Simply add the following to your default arguments:

  GRUB_CMDLINE_LINUX_DEFAULT="console=tty0 console=ttyS0,38400n8"

System

Without systemd

For systems without systemd, you simply edit the /etc/inittab by adding a new getty process to the serial terminal:

s0:12345:respawn:/sbin/agetty -L 115200 ttyS0 vt100

If the file /etc/securetty exists, then add the following to the end of it

S0

This allows root to login through the serial console.

With systemd

While old Linux systems were configured using /etc/inittab most new systems now use systemd as their init system. Systemd does not use the old inittab, but uses systemctl to start a getty process on a the serial port. In order to start a getty only ones, you need to run

systemctl start serial-getty@ttyS0.service

In order to run it at boot time, you need enable by running:

systemctl enable serial-getty@ttyS0.service

CIFS

Most Linux distributions provide their pre-compiled kernels with most options enabled as kernel modules. When self-compiling the kernel, you sometimes miss modules because you did not care to enable all available modules. That can sometimes lead to problems, such as when mounting SMB shares:

# mount -t cifs //<myhost>/<myshare> /mnt/myshare
mount error: cifs filesystem not supported by the system
mount error(19): No such device
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

These problems can be overcome by providing and loading the CIFS kernel module under:

File Systems ---> 
    Network File Systems --->
       <M> CIFS support (advanced network filesystems, SMBFS successor)

Compile and install your kernel and kernel modules. The kernel module should be loaded when trying to mount a share. If it is not loaded automatically on mount, then load the module manually:

# modprobe cifs
Older Posts