Skip to content

DietPi

DietPi is used on my Raspberry Pi 1 and Raspberry Pi Zero W

🛠 Installation

  1. Download the image from DietPi website.
  2. Identify the SD card device using lsblk.

    lsblk
    
  3. Write the image to the SD card. Replace image.img.xz with the path to your downloaded image and /dev/sdX with the device identifier of your SD card.

xzcat image.img.xz | dd of=/dev/sdX status=progress
xzcat image.img.xz | sudo dd of=/dev/sdX status=progress
  1. Mount the boot partition (e.g., /dev/sdX1) and edit the configuration files.

/boot/dietpi.txt

AUTO_SETUP_NET_WIFI_ENABLED=1

/boot/dietpi-wifi.txt

aWIFI_SSID[0]='MyWifiName'
aWIFI_KEY[0]='MySecretPassword'

⚙ Config

Add user
adduser nicholas
usermod -aG sudo nicholas
su nicholas

Enable Secure Copy Protocol (SCP)

These packages are installed to enable Secure Copy Protocol (SCP), allowing secure file transfers to and from the device. This is useful for managing files remotely.

Enable SCP
sudo apt install openssh-client openssh-sftp-server

Disable DietPi Banner

The DietPi banner displays system information upon login. To disable it and show only a standard login prompt, create a .hushlogin file in the user's home directory.

Disable Banner
touch ~/.hushlogin
Configure Banner
dietpi-banner
Config DietPi
dietpi-config

Change Hostname

To change the hostname of your DietPi device, run dietpi-config, navigate to '2 Network Options' -> 'Hostname', and enter your desired hostname.

Change Hostname
dietpi-config
Resize
dietpi-drive_manager

⚡ Overclocking

Risk of Hardware Damage

Overclocking may void your warranty and can shorten the life of your device. Ensure you have adequate cooling.

Add the following to /boot/config.txt:

# already runs at 1000 by default when busy, this locks it high
force_turbo=1
over_voltage=2

Add the following to /boot/config.txt:

arm_freq=900
core_freq=400
sdram_freq=450
over_voltage=6

🚀 Kernel Tuning

Optimize the kernel for low-memory devices (Raspberry Pi 1, Zero, 2).

/etc/sysctl.d/99-rpi-tuning.conf

vm.swappiness=100
vm.vfs_cache_pressure=500
vm.dirty_background_ratio=1
vm.dirty_ratio=50

Apply the changes:

sudo sysctl --system

📦 ZRAM Swap

Install zram-swap to improve performance on low-memory devices.

git clone https://github.com/foundObjects/zram-swap.git
cd zram-swap
sudo ./install.sh

📝 Usage

🚀 Upgrade

dietpi-update

🔗 References