Skip to content

System Settings Configuration for Raspberry Pi

This guide provides comprehensive information about configuring and customizing your Raspberry Pi's system settings. Whether you're optimizing performance, enabling interfaces, or setting up remote access, these instructions will help you tailor your Raspberry Pi to your specific needs.

Configuration Tools Overview

Raspberry Pi OS provides several methods to adjust system settings:

Command-Line Configuration

  • raspi-config: Text-based interface for system-wide settings
  • Configuration files: Direct editing of system files in /boot and /etc
  • Command-line utilities: Specialized tools for specific settings

Graphical Configuration (for Desktop installations)

  • Raspberry Pi Configuration: GUI tool in Preferences menu
  • Desktop settings panels: Display, network, and appearance settings
  • Third-party configuration utilities: Additional tools available in repositories

Using raspi-config - The Primary Configuration Tool

The raspi-config utility is the central configuration tool for Raspberry Pi systems. It provides a text-based interface to manage most system settings.

sudo raspi-config

Key raspi-config Sections

  1. System Options

    • Password: Change user password
    • Hostname: Set the network name for your Raspberry Pi
    • Boot / Auto Login: Configure automatic login and boot to CLI or desktop
    • Network at Boot: Wait for network connection during boot
    • Splash Screen: Enable/disable boot splash screen
  2. Display Options

    • Resolution: Set screen resolution
    • Screen Blanking: Enable/disable screen blanking (power saving)
    • Pixel Doubling: Scale display for high-resolution screens
  3. Interface Options

    • SSH: Enable/disable Secure Shell server
    • VNC: Enable/disable Virtual Network Computing server
    • SPI: Enable/disable Serial Peripheral Interface
    • I2C: Enable/disable Inter-Integrated Circuit interface
    • Serial Port: Configure UART serial port
    • 1-Wire: Enable/disable 1-Wire interface
    • Remote GPIO: Enable/disable remote GPIO access
  4. Performance Options

    • Overclock: Adjust CPU clock speed (model-dependent)
    • GPU Memory: Allocate memory between CPU and GPU
    • Overlay File System: Configure read-only file system
  5. Localization Options

    • Locale: Set language and regional standards
    • Timezone: Set system time zone
    • Keyboard Layout: Configure keyboard layout
    • WLAN Country: Set WiFi regulatory domain
  6. Advanced Options

    • Expand Filesystem: Ensure SD card storage is fully utilized
    • GL Driver: Select OpenGL driver options
    • Audio: Configure audio output device

Using raspi-config Non-interactively

You can also use raspi-config in non-interactive mode for scripting:

1
2
3
4
5
# Example: Enable SSH without interactive prompt
sudo raspi-config nonint do_ssh 0  # 0 for enable, 1 for disable

# Example: Set GPU memory to 128MB
sudo raspi-config nonint do_memory_split 128

Common Configuration Tasks in Detail

Network Configuration

Hostname Configuration

# Check current hostname
hostname

# Change hostname
sudo hostnamectl set-hostname new-hostname

# Edit hosts file to match
sudo nano /etc/hosts
# Add/update the line with your new hostname:
# 127.0.1.1   new-hostname

Static IP Configuration

Edit /etc/dhcpcd.conf:

sudo nano /etc/dhcpcd.conf

Add the following (adjust values for your network):

interface eth0
static ip_address=192.168.1.100/24
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 8.8.8.8

# For WiFi configuration (if needed)
interface wlan0
static ip_address=192.168.1.101/24
static routers=192.168.1.1
static domain_name_servers=1.1.1.1 8.8.8.8

WiFi Configuration

Edit /etc/wpa_supplicant/wpa_supplicant.conf:

sudo nano /etc/wpa_supplicant/wpa_supplicant.conf

Add your WiFi network:

country=US  # Replace with your country code
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
    ssid="YourNetworkName"
    psk="YourPassword"
    key_mgmt=WPA-PSK
    priority=1
}

# Add additional networks with different priorities if needed
network={
    ssid="SecondNetwork"
    psk="OtherPassword"
    key_mgmt=WPA-PSK
    priority=2  # Higher number = higher priority
}

Display and Audio Settings

Display Resolution and Monitor Configuration

Edit /boot/firmware/config.txt:

sudo nano /boot/firmware/config.txt

Common display settings:

# Force specific HDMI mode (see https://www.raspberrypi.org/documentation/configuration/config-txt/video.md)
hdmi_group=1  # CEA (TVs) = 1, DMT (monitors) = 2
hdmi_mode=16  # Mode 16 = 1080p at 60Hz

# Force HDMI output even if no HDMI display detected
hdmi_force_hotplug=1

# Adjust overscan if you see black borders
disable_overscan=1
# Or set custom overscan values:
#overscan_left=24
#overscan_right=24
#overscan_top=24
#overscan_bottom=24

To identify available modes:

1
2
3
4
5
6
7
8
# List available CEA modes (TVs)
tvservice -m CEA

# List available DMT modes (monitors)
tvservice -m DMT

# Show current state
tvservice -s

Audio Configuration

1
2
3
4
5
6
# List available audio devices
aplay -l

# Set default audio output
# 0 = auto, 1 = 3.5mm jack, 2 = HDMI
sudo amixer cset numid=3 2

For advanced audio routing, consider using:

1
2
3
4
5
# Install PulseAudio volume control
sudo apt install pavucontrol

# Run the graphical audio control panel
pavucontrol

Time and Locale Settings

Setting Timezone

1
2
3
4
5
6
7
8
# Check current timezone
timedatectl

# List available timezones
timedatectl list-timezones | grep -i asia  # Example: filter for Asia

# Set timezone
sudo timedatectl set-timezone Asia/Tokyo

Locale Settings

1
2
3
4
5
# View current locale settings
locale

# Reconfigure locales through the configuration utility
sudo dpkg-reconfigure locales

To set locales directly:

1
2
3
4
5
6
7
# Example: Enable English (US) and Japanese locales
sudo sed -i 's/^# *\(en_US.UTF-8\)/\1/' /etc/locale.gen
sudo sed -i 's/^# *\(ja_JP.UTF-8\)/\1/' /etc/locale.gen
sudo locale-gen

# Set default locale
sudo update-locale LANG=en_US.UTF-8

Performance Optimization

Memory Split

Adjust GPU memory allocation in /boot/firmware/config.txt:

1
2
3
4
5
# Values typically between 16-512
# For headless servers: 16
# For desktop use: 128
# For gaming/video: 256+
gpu_mem=128

Overclocking

Warning: Overclocking may reduce system stability and lifespan. Always ensure adequate cooling.

Edit /boot/firmware/config.txt (values depend on Pi model):

1
2
3
4
5
6
7
8
9
# For Raspberry Pi 4:
over_voltage=6
arm_freq=2000
gpu_freq=600

# For Raspberry Pi 3:
over_voltage=4
arm_freq=1350
gpu_freq=500

Monitor temperature after overclocking:

# Watch temperature in real-time
watch -n 1 vcgencmd measure_temp

Swap Configuration

Adjust swap size in /etc/dphys-swapfile:

sudo nano /etc/dphys-swapfile

Modify the configuration:

1
2
3
4
5
# Set swap size in MB
CONF_SWAPSIZE=1024

# To disable swap altogether:
#CONF_SWAPSIZE=0

Apply changes:

sudo systemctl restart dphys-swapfile

Consider optimizing swap with ZRAM for better performance.

Managing System Services

# List all active services
systemctl list-units --type=service

# List all services (including inactive)
systemctl list-units --type=service --all

# Check service status
systemctl status service_name

# Start/stop a service
sudo systemctl start service_name
sudo systemctl stop service_name

# Enable/disable service at boot
sudo systemctl enable service_name
sudo systemctl disable service_name

# Restart a service
sudo systemctl restart service_name

# Reload configuration without restarting
sudo systemctl reload service_name

Common services to manage:

  • ssh: Secure Shell server
  • bluetooth: Bluetooth functionality
  • dhcpcd: DHCP client daemon
  • networking: Networking services
  • lightdm: Display manager (for desktop environments)

Remote Access Configuration

SSH Server Configuration

Advanced SSH configuration in /etc/ssh/sshd_config:

sudo nano /etc/ssh/sshd_config

Recommended security settings:

# Disable root login
PermitRootLogin no

# Use SSH protocol 2 only
Protocol 2

# Limit authentication attempts
MaxAuthTries 3

# Disable password authentication (use keys only)
PasswordAuthentication no

# Allow only specific users
AllowUsers username1 username2

# Change default port (adds security by obscurity)
Port 2222

After changes:

sudo systemctl restart ssh

Setting Up SSH Keys

On your local machine:

1
2
3
4
5
6
7
# Generate key pair
ssh-keygen -t ed25519 -C "your_email@example.com"

# Copy public key to Raspberry Pi
ssh-copy-id username@raspberrypi.local
# Or for custom port:
ssh-copy-id -p 2222 username@raspberrypi.local

VNC Server Configuration

1
2
3
4
5
6
# Install if not already present
sudo apt install realvnc-vnc-server

# Enable service
sudo systemctl enable vncserver-x11-serviced
sudo systemctl start vncserver-x11-serviced

Configure VNC through raspi-config:

sudo raspi-config
# Navigate to Interface Options > VNC > Enable

Advanced VNC settings:

1
2
3
4
5
# Set VNC password
vncpasswd

# Configure VNC settings
nano ~/.vnc/config

Boot Configuration in Detail

The /boot/firmware/config.txt file is the primary configuration file for hardware settings. It's similar to BIOS on traditional computers.

Common Boot Configuration Options

# --- System Performance ---
# CPU overclocking
arm_freq=1800
over_voltage=5

# --- Interfaces ---
# Enable/disable Bluetooth
dtoverlay=disable-bt

# Enable/disable WiFi
dtoverlay=disable-wifi

# Enable/disable onboard audio
dtparam=audio=on

# Enable/disable interfaces
dtparam=i2c_arm=on
dtparam=spi=on
dtparam=i2s=on

# --- Display ---
# Set specific display rotation (0, 90, 180, 270)
display_rotate=0

# Force display resolution
hdmi_group=2
hdmi_mode=82  # 1080p at 60Hz

# --- USB and Power ---
# Increase USB current availability
max_usb_current=1

# --- Memory ---
# GPU memory allocation
gpu_mem=128

# --- Custom Overlays ---
# Example: Add GPIO fan control
dtoverlay=gpio-fan,gpiopin=14,temp=60000

Managing cmdline.txt

The /boot/firmware/cmdline.txt file contains kernel boot parameters:

sudo nano /boot/firmware/cmdline.txt

Common modifications:

# Default parameters - DO NOT add line breaks to this file
console=tty1 root=PARTUUID=738a4d67-02 rootfstype=ext4 fsck.repair=yes rootwait quiet splash

# Add these parameters as needed:
# Disable IPv6
ipv6.disable=1

# Boot with fixed console size
fbcon=map:10 fbcon=font:ProFont6x11

# Enable serial console
console=serial0,115200

# Add kernel parameter for specific hardware
sdhci.debug_quirks2=4

Security Hardening

Firewall Configuration

# Install UFW (Uncomplicated Firewall)
sudo apt install ufw

# Set default policies
sudo ufw default deny incoming
sudo ufw default allow outgoing

# Allow SSH
sudo ufw allow ssh
# Or if using custom SSH port:
sudo ufw allow 2222/tcp

# Allow other services as needed
sudo ufw allow http  # Port 80
sudo ufw allow 8080/tcp  # Custom web port
sudo ufw allow 1883  # MQTT
sudo ufw allow 5900  # VNC

# Enable the firewall
sudo ufw enable

# Check status
sudo ufw status verbose

Create a Limited User Account

1
2
3
4
5
6
7
8
# Add a new user
sudo adduser username

# Add to sudo group (if needed)
sudo usermod -aG sudo username

# Switch to new user
su - username

Password Policies

1
2
3
4
5
# Install password quality checking library
sudo apt install libpam-pwquality

# Edit password policy
sudo nano /etc/security/pwquality.conf

Add these settings:

# Minimum password length
minlen = 10

# Require at least one uppercase letter
ucredit = -1

# Require at least one lowercase letter
lcredit = -1

# Require at least one digit
dcredit = -1

# Require at least one special character
ocredit = -1

# Remember previous passwords
remember = 5

Disable Unused Services

1
2
3
4
5
6
7
# List enabled services
systemctl list-unit-files --state=enabled

# Disable unused services
sudo systemctl disable bluetooth  # If not using Bluetooth
sudo systemctl disable avahi-daemon  # If not using mDNS/Zeroconf
sudo systemctl disable triggerhappy  # If not using hotkey daemon

Desktop Environment Configuration (GUI)

If you're using the desktop environment, you can configure many settings graphically:

Raspberry Pi Configuration Tool

Access via: Menu > Preferences > Raspberry Pi Configuration

This graphical tool provides similar options to raspi-config, including: - System settings (hostname, auto-login) - Interface enablement (SSH, VNC, etc.) - Performance settings (overclock) - Localization

Appearance Settings

Access via: Menu > Preferences > Appearance Settings

Configure: - Desktop theme - Desktop background - Font sizes - Menu bar appearance

Network Configuration

Access via: Right-click on network icon in taskbar > Wireless & Wired Network Settings

Configure: - WiFi networks - Proxy settings - Network adapter settings

System Monitoring and Maintenance

System Monitoring Tools

# Install monitoring tools
sudo apt install htop iotop nmon

# Monitor system resources
htop

# Monitor disk I/O
sudo iotop

# Full system monitoring
nmon

Log Monitoring

# View system logs
sudo journalctl -xe

# Follow system logs in real-time
sudo journalctl -f

# View specific service logs
sudo journalctl -u ssh

# View boot logs
sudo journalctl -b

# Manage log size
sudo journalctl --vacuum-time=1week

Scheduled Tasks with cron

1
2
3
4
5
# Edit user crontab
crontab -e

# Edit system crontab
sudo crontab -e

Example crontab entries:

# Format: minute hour day_of_month month day_of_week command

# Run a script daily at 3:00 AM
0 3 * * * /home/pi/scripts/daily_backup.sh

# Reboot every Sunday at 2:00 AM
0 2 * * 0 /sbin/reboot

# Check temperature every 5 minutes and record if high
*/5 * * * * /usr/bin/vcgencmd measure_temp | grep -q "temp=8" && echo "High temp at $(date)" >> /home/pi/high_temps.log

Troubleshooting Configuration Issues

Common Issues and Solutions

Boot Problems After Configuration Changes

If your Pi won't boot after configuration changes:

  1. Mount the SD card on another computer
  2. Navigate to the boot partition
  3. Revert changes in config.txt or cmdline.txt
  4. For drastic cases, add recovery to end of cmdline.txt

Display Issues

# Force safe video settings by adding to /boot/firmware/config.txt:
hdmi_safe=1

Networking Issues After Static IP Configuration

If you lose network connectivity after setting static IP:

  1. Check your network settings match your router's subnet
  2. Ensure gateway and DNS settings are correct
  3. Try:
    sudo systemctl restart dhcpcd
    

Permission Issues

If you encounter permission denied errors after configuration:

1
2
3
4
5
6
7
8
9
# Check file ownership
ls -l /path/to/file

# Correct ownership
sudo chown user:group /path/to/file

# Correct permissions
sudo chmod 644 /path/to/file  # For config files
sudo chmod 755 /path/to/directory  # For directories

Advanced Configuration Techniques

Creating Custom Boot Configurations

You can create configuration sets for different scenarios:

1
2
3
4
5
6
7
# Create a backup of working configurations
sudo cp /boot/firmware/config.txt /boot/firmware/config.txt.backup
sudo cp /boot/firmware/cmdline.txt /boot/firmware/cmdline.txt.backup

# Create scenario-specific configurations
sudo cp /boot/firmware/config.txt /boot/config.overclock.txt
sudo cp /boot/firmware/config.txt /boot/config.media-center.txt

Edit the NOOBS recovery.cmdline file to select configurations during boot:

# Add to recovery.cmdline for selectable config
os_config=config.txt os_config2=config.overclock.txt os_config3=config.media-center.txt

User-Level Configuration

Create user-level configuration for applications:

1
2
3
4
5
# Create config directory if it doesn't exist
mkdir -p ~/.config/app_name

# Create default configuration
nano ~/.config/app_name/settings.conf

Best Practices

  1. Always backup configurations before making changes:

    sudo cp /boot/firmware/config.txt /boot/firmware/config.txt.$(date +%Y%m%d)
    
  2. Make one change at a time and test before proceeding

  3. Document your configurations for future reference

  4. Use version control for tracking configuration changes:

    1
    2
    3
    4
    5
    # Initialize git repository for configs
    cd /etc
    sudo git init
    sudo git add *.conf
    sudo git commit -m "Initial configuration"
    
  5. Test critical services after configuration changes:

    # Example: Test SSH configuration without disconnecting
    sudo sshd -t
    

By following these guidelines and utilizing the configuration options described in this guide, you can fully customize your Raspberry Pi to suit your specific needs and use cases.