Skip to content

Instantly share code, notes, and snippets.

@JJTech0130
Last active January 15, 2025 20:09
Show Gist options
  • Save JJTech0130/70fcfcb2a3bf7777847be8516578cdf5 to your computer and use it in GitHub Desktop.
Save JJTech0130/70fcfcb2a3bf7777847be8516578cdf5 to your computer and use it in GitHub Desktop.
Unlocks Turbo Boost when it has been locked due to an unsupported power supply (Dell Optiplex BD PROCHOT issue)
#!/bin/bash
# Check if the script is being run as root
if [[ $(id -u) -ne 0 ]]; then
echo "This script must be run as root. Exiting."
exit 1
fi
# Install necessary tools (msr-tools)
echo "Installing msr-tools..."
apt update && apt install -y msr-tools
# Check if msr-tools installed successfully
if ! command -v wrmsr &> /dev/null; then
echo "Error: msr-tools installation failed."
exit 1
fi
# Create systemd service file
echo "Creating systemd service..."
cat <<EOF > /etc/systemd/system/unlock-turbo-boost.service
[Unit]
Description=Unlock Turbo Boost on Dell Machine due to unsupported power supply
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/usr/local/bin/unlock-turbo-boost.sh
RemainAfterExit=true
StandardOutput=journal
StandardError=journal
[Install]
WantedBy=multi-user.target
EOF
# Create the script to unlock turbo boost and load msr module
echo "Creating unlock-turbo-boost.sh script..."
cat <<'EOF' > /usr/local/bin/unlock-turbo-boost.sh
#!/bin/bash
# Load msr module
echo "Loading msr module..."
modprobe msr
# Unlock Turbo Boost by writing to MSR register
echo "Unlocking Turbo Boost..."
wrmsr -a 0x1A0 0x850089
# Disable no_turbo to allow turbo boost
echo "Disabling no_turbo to enable turbo boost..."
echo 0 | tee /sys/devices/system/cpu/intel_pstate/no_turbo
# Confirm changes
if [ $? -eq 0 ]; then
echo "Turbo Boost unlocked successfully!"
else
echo "Error: Failed to unlock Turbo Boost."
fi
EOF
# Make the script executable
chmod +x /usr/local/bin/unlock-turbo-boost.sh
# Enable systemd service to run on boot
echo "Enabling systemd service..."
systemctl daemon-reload
systemctl enable unlock-turbo-boost.service
echo "Setup complete. The system will now automatically unlock Turbo Boost on boot."
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment