Skip to content

Instantly share code, notes, and snippets.

@gryan11
Last active March 1, 2024 18:36
Show Gist options
  • Save gryan11/4256178ec2148accc458d0b822a9e379 to your computer and use it in GitHub Desktop.
Save gryan11/4256178ec2148accc458d0b822a9e379 to your computer and use it in GitHub Desktop.
Notes on setting up MSI GS65 Stealth as dual boot Linux Laptop

Linux Setup on MSI GS65 Laptop

Preliminary Setup

Make the following usb sticks and drives on windows:

  1. Ubuntu install usb stick
  2. System recovery usb stick
  3. System backup image on usb hard drive

windows setup

  1. Optional: Run the msi dragon software first time setup and configure for quiet operation and battery life, this will reduce fan noise
  2. Partition drive. Goto disk management, right click on drive you want to partition for linux, and click "shrink volume"
  • should have at least 100gb, ideally more depending on intended usage
  1. Disable fast startup (in control panel)

ubuntu install

  1. hold alt when booting with ubuntu usb inserted
  2. do 'other' when given options to install
  3. On the open space on the disk:
  4. make a partition for swap that is same size as your memory, set to use as swap (16gb is reasonable if you're not sure)
  5. make remaining space into partitiion with ext4
  6. leave bootloader installed onto base disk
  7. after install, may need to boot into bios (alt) and set boot order to use grub bootloader instead of windows
  • for me this option was on the bottom of the boot order bios options page

ubuntu setup

  1. make sure to install nvidia drivers through software center (need to reboot with safeboot)
  2. install gnome tweak tool
  3. Optional: swap left ctrl and left alt
  • tweaks -> mouse and keyboard -> additional layout options -> ctrl position
  1. install fonts from google fonts
  • Update: Now prefer cascadia mono font
  • noto sans medium for window titles and interface
  • noto sans regular or garuda regular for documents
  • noto sans mono medium for shell (if you like 'crisp' fonts, use regular instead)
  1. set fonts in tweak tool
  2. set scaling factor under fonts to 0.85
  3. install gnome shell extensions
  4. install ocs-url
  5. install appimage installer
  6. install shell theme/icons (I used adapta bluegrey for applications, flat remix blue dark icons, and flat remix dark full panel shell theme
  7. Optional: install login theme
  • (I used gdm3 theme blur)
  • alternately install lightdm sudo apt install lightdm if you want to use hdmi
  • I couldn't get hdmi port to work reliably and switched to thunderbolt port for external display instead
  1. fix airplane mode button (use to turn wifi card back on after suspend)
  • sudo nano /etc/default/grub
  • add line GRUB_CMDLINE_LINUX_DEFAULT="acpi_osi=! acpi_osi='Windows 2009' quiet splash"
  • sudo update-grub
  • reboot
  • note: switching to use hibernate is another recommended solution but pm-hibernate command didn't do anything when I tried it after installing pm-tools

Copy/Paste:

  1. For gnome-terminal in preferences set the copy shortcut to ctrl-c and paste shortcut to ctrl-v. Then set stty intr ^x to set a new interrupt shortcut (that does ctrl-x)
  2. (Optional) In tweak-tool->Keyboard & Mouse -> Additional Layout Options under 'Ctrl position' I swapped left ctrl and left alt. This makes the behavior similar to mac where the alt key next to spacebar controls most shortcuts and is easier to reach.

Open command:

Add the following to ~/.bashrc or ~/.zshrc

alias open="xdg-open &>/dev/null"

Nvidia drivers:

  1. you can switch between nvidia and intel graphics with sudo prime-select nvidia|intel, then reboot
  • intel uses less power, but you need nvidia to connect to external monitors with hdmi

Mtrack Touchpad config:

(alternative to synaptics but has weird mouse jumping issue)

  1. install mtrack:
mkdir -p repos/packages/
cd repos/packages
git clone https://github.com/p2rkw/xf86-input-mtrack.git
cd xf86-input-mtrack
./configure --with-xorg-module-dir=/usr/lib/xorg/modules
make
sudo make install
  1. copy the 50-mtrack.conf file at bottom of this guide into /usr/share/X11/xorg.conf.d/50-mtrack.conf
  2. Settings you may want to change:
  • Sensitivity: sets mouse speed
  • EdgeRightSize: how much of right side of trackpad to ignore (I set high for large trackpad on GS Stealth)
  • EdgeTopSize: ignore part of top of touchpad
  • ClickFinger0 and EdgeBottomSize are set to click integrated touchpad button with thumb while ignoring tracking for thumb, you can disable this behavior by removing these options
  • TapButton1-4 currently 0, set to nonzero to enable tap to click
  • ScrollDistance lower = faster scrolling
  1. (Optional) Configure adaptive mouse acceleration (I found unnecessary with polynomial acceleration profile):
  • good guide to mouse config: http://510x.se/notes/posts/Changing_mouse_acceleration_in_Debian_and_Linux_in_general/
  • edit ~/.xprofile:
# xset m 6/2 8
# xinput --set-prop 'SynPS/2 Synaptics TouchPad' 'Device Accel Constant Deceleration' 1.03
# xinput --set-prop 'SynPS/2 Synaptics TouchPad' 'Device Accel Adaptive Deceleration' 1.5
  • these settings adjust mouse acceleration, you can try different settings using the xinput and xset commands
  • use xset q and xinput list, xinput --list-props with id of touchpad from xinput list to see what the current settings are
  • Adaptive Decel is applied on small mouse movements to make precise pointing possible
  • xset sets acceleration as fraction, so 4/1 is 4.0, 1/4 is .25. Third value is distance before accel applied

screen scaling:

Gives nice subpixel rendering that makes fonts look smooth. Add startup command:

/bin/bash -c "sleep 3 && xrandr --output eDP-1-1 --scale 1.1x1.1"

The sleep ensures it waits for xorg startup to finish before rescaling

background and login images:

  1. First pick background image and put in ~/Pictures/mybackground.jpg

  2. Goto background in settings and select, it should show up under pictures

  3. copy into backgrounds: sudo cp ~/Pictures/mybackground.jpg /usr/share/backgrounds/mybackground.jpg

  4. Install the slick greeter (you'll need to build from source for ubuntu)

git clone https://github.com/linuxmint/slick-greeter.git
cd slick-greeter
sudo apt install gtk-3.0
sudo apt install libcanberra-gtk3-dev
sudo apt install liblightdm-gobject-1-dev
sudo apt install valac
./autogen.sh
./configure
make
sudo make install
  1. Edit lightdm config sudo vim /usr/share/lightdm/lightdm.conf.d/50-unity-greeter.conf and set to following:
[Seat:*]
greeter-session=slick-greeter
  1. Then sudo vim /etc/lightdm/slick-greeter.conf to be following:
[Greeter]
background=/usr/share/backgrounds/purplemountains.jpg

undervolting:

I used the following project for undervolting: https://github.com/georgewhewell/undervolt

Set -50mV for GPU and -100mV for all other options

cpu control:

middle click scrolling:

fan configuration:

Use isw for fan settings, regular linux fan drivers won't work for MSI laptops.

git clone https://github.com/YoyPa/isw
cd isw

sudo cp etc/isw.conf /etc/isw.conf
sudo cp etc/modprobe.d/isw-ec_sys.conf /etc/modprobe.d/isw-ec_sys.conf
sudo cp etc/modules-load.d/isw-ec_sys.conf /etc/modules-load.d/isw-ec_sys.conf
sudo cp usr/lib/systemd/system/isw@.service /etc/systemd/system/isw.service
sudo cp isw /usr/bin/isw

sudo chmod 644 /etc/modprobe.d/isw-ec_sys.conf
sudo chmod 644 /etc/modules-load.d/isw-ec_sys.conf
sudo chmod 644 /etc/systemd/system/isw.service
sudo chmod 755 /usr/bin/isw

sudo modprobe ec_sys write_support=1

Edit /etc/systemd/system/isw.service:

  • set sleep path to /bin/sleep
  • set isw cmd to /usr/bin/isw -w 16Q4EMS1
  • can double check id number is correct in isw.conf file under laptop version Start isw service:
sudo systemctl enable isw
sudo systemctl start isw

Edit /etc/isw.conf. Under the [16Q4EMS1] heading set the following:

# CPU
cpu_temp_0 = 47
cpu_temp_1 = 50
cpu_temp_2 = 58
cpu_temp_3 = 67
cpu_temp_4 = 76
cpu_temp_5 = 82
cpu_fan_speed_0 = 0
cpu_fan_speed_1 = 0
cpu_fan_speed_2 = 25
cpu_fan_speed_3 = 45
cpu_fan_speed_4 = 50
cpu_fan_speed_5 = 75
cpu_fan_speed_6 = 80
# GPU
gpu_temp_0 = 50
gpu_temp_1 = 55
gpu_temp_2 = 61
gpu_temp_3 = 65
gpu_temp_4 = 71
gpu_temp_5 = 77
gpu_fan_speed_0 = 0
gpu_fan_speed_1 = 20
gpu_fan_speed_2 = 50
gpu_fan_speed_3 = 60
gpu_fan_speed_4 = 70
gpu_fan_speed_5 = 80
gpu_fan_speed_6 = 90

Can edit these to customize fan settings. Note for different MSI laptops heading may be different.

apps:

  1. install mail client (I used mailspring)
  2. set up onedrive client repo (I use onedrive)
  • install as user level service
  • add the following aliases:
alias onedrivestart="systemctl --user start onedrive && systemctl --user status onedrive"
alias onedrivestop="systemctl --user stop onedrive&& systemctl --user status onedrive"
  1. monitor temperature with psensor: https://itsfoss.com/check-laptop-cpu-temperature-ubuntu/
  2. trash bin to sidebar: link

pdf signing:

  • install gimp and xournal (xournal++ did not work for me but its also an option)
  • take a picture of your signature with only white paper in background, ideally even lighting conditions
  • use gimp wand selection to select background of signature (hold shift to multiselect and increase wand threshold to 90-100)
  • hit delete to make transparent (you may need to do Layer->Transparency->Add Alpha Layer first)
  • export to png
  • use xournal image annotation to annotate and sign pdfs

todo:

to explore:

Mouse Config file:

This should go in /usr/share/X11/xorg.conf.d.50-mtrack.conf

Section "InputClass"
        MatchIsTouchpad "on"
        Identifier      "Touchpads"
        Driver          "mtrack"
        Option          "Sensitivity" "0.25"
        Option          "AccelerationProfile" "2"
        Option          "FingerHigh" "5"
        Option          "FingerLow" "1"
        Option          "DisableOnPalm" "true"
        Option          "IgnoreThumb" "true"
        Option          "ThumbRatio" "70"
        Option          "ThumbSize" "5"
        Option          "IgnorePalm" "true"
        Option          "TapButton1" "0"
        Option          "TapButton2" "0"
        Option          "TapButton3" "0"
        Option          "TapButton4" "0"
        Option          "ClickFinger0" "1"
        Option          "ClickFinger1" "1"
        Option          "ClickFinger2" "3"
        Option          "ClickFinger3" "2"
        Option          "ButtonMoveEmulate" "false"
        Option          "ButtonIntegrated" "true"
        Option          "ClickTime" "25"
        Option          "EdgeTopSize" "15"
        Option          "EdgeBottomSize" "40"
        Option          "EdgeRightSize" "40"
        Option          "EdgeScrollSensitivity" "0"
        Option          "EdgeScrollDist" "0"
        Option          "EdgeScrollUpButton" "0"
        Option          "EdgeScrollDownButton" "0"
        Option          "EdgeScrollLeftButton" "0"
        Option          "EdgeScrollRightButton" "0"
        Option          "SwipeLeftButton" "0"
        Option          "SwipeRightButton" "0"
        Option          "SwipeUpButton" "8"
        Option          "SwipeDownButton" "0"
        Option          "SwipeDistance" "700"
        Option          "ScrollCoastDuration" "300"
        Option          "ScrollCoastEnableSpeed" ".2"
        Option          "ScrollUpButton" "5"
        Option          "ScrollDownButton" "4"
        Option          "ScrollLeftButton" "7"
        Option          "ScrollRightButton" "6"
        Option          "ScrollDistance" "100"
EndSection
@ReubenMech
Copy link

ReubenMech commented Aug 28, 2022

Great Job, Really Helpful.

@noceir
Copy link

noceir commented Feb 22, 2024

life saver, thank you very much sir.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment