Turn Off LED on msi Motherboard


Table of Contents

  1. Quick Guide
  2. Install msi-rgb
  3. Turn Off Immediatedly
  4. Turn Off on Start
  5. Turn Off After Resume
  6. Reference

Quick Guide

  1. Get and install nagisa’s msi-rgb utlity for msi motherboards.
  2. OpenRGB is an alternative solution and supports more motherboards.
  3. Turn off by running ‘sudo /home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000‘.
  4. Use crontab to turn off after boot.
  5. Create a shell script in /lib/systemd/system-sleep/ to turn off after resume.

Install msi-rgb

nagisa has written a small utility to control the rgb on msi motherboard. For others, use Adam Honse’s OpenRGB instead.

Use git to download from GitHub: ‘git clone https://github.com/nagisa/msi-rgb

It’s written in rust. Beforce build, setup the development environment by running ‘curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh‘. The Getting started page explains a small sample project and the build process.

To uninstall, run ‘rustup self uninstall‘.

Change to the msi-rgb directory and run ‘cargo build --release‘ to build th project.

The executible file is /home/amigo/msi-rgb/target/release/msi-rgb.

Turn Off Immediatedly

It can change the color with assigned delay time. I just want to turn them off forever:

sudo /home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000

The flag ‘-x‘ is to turn off. Because it cannot run without the three red-green-blue hex values, any would be fine.

msi-rgb -h‘ shows more control options.

Turn Off on Start

Edit the root’s crontab file to run at start:

$sudo crontab -e

Add a task to run msi-rgb after each reboot:

@reboot sudo /home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000

The led will be turned off before login.

Turn Off After Resume

Create a script in /lib/systemd/system-sleep/ on Ubuntu 20.04 LTS to be executed after resume. The location might be different on different version and distribution.

$sudo vi /lib/systemd/system-sleep/turn-off-rgb-after-resume.sh
...
#!/bin/bash 
#
# located in /lib/systemd/system-sleep/
# Created 2021/5/6
# pre - before resume
# post - after resume

case "${1}" in
    post)
        su root -c "/home/amigo/msi-rgb/target/release/msi-rgb -x 00000000 00000000 00000000"
        break
        ;;
esac
...
$sudo chmod 744 turn-off-rgb-after-resume.sh

Reference

  1. reddit: How to disable MSI RGB LED without Mystic Light
  2. GitHub: nagisa / msi-rgb
  3. GitLab: Adam Honse / OpenRGB
  4. Rust: Getting started
  5. Rust: Install Rust
  6. Chron: How to Run a Command on Startup in Linux
  7. Computer Hope: Linux crontab command
  8. ask ubuntu: how to execute a command after resume from suspend?
  9. Shell Scripting Tutorial: Case
  10. Style Guide

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.