Support #980
Install MagicMirror on Debian
Start date:
06/21/2025
Due date:
% Done:
100%
Estimated time:
1.00 h
Description
This is a guide for installing MagicMirror with Debian Bookworm on a Raspberry Pi 2
Prepare the Environment¶
- Make sure everything is up to date:
sudo apt update && sudo apt upgrade
- Install nodejs repo:
curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh sudo bash nodesource_setup.sh
- Install required dependencies:
sudo apt install wayfire seatd xdg-user-dirs git nano openssl ca-certificates wget gnupg libgtk-3-0 libx11-xcb-dev libnss3-dev libxss1 libxtst6 libasound2 libdrm2 libgbm1 fonts-arphic-uming procps arp-scan libatk1.0-0 libraspberrypi-bin libllvm14 libgl1-mesa-dri libglapi-mesa libsensors5 libdrm-radeon1 libelf1 libdrm-amdgpu1 libdrm-nouveau2 libgpiod-dev nodejs
- Edit
cmdline.txt
:sudo nano /boot/firmware/cmdline.txt
- Add wayland=on to the command line options:
console=serial0,115200 console=tty1 root=PARTUUID=ef31a647-01 rootfstype=ext4 fsck.repair=yes wayland=on rootwait cfg80211.ieee80211_regdom=US
- Create the magicmirror user and add it to the video group:
sudo adduser --uid 1001 -ingroup users --shell /bin/bash --comment "magicmirror" mm sudo usermod -aG video mm
- Create a wayfire service file:
sudo nano /etc/systemd/system/wayfire.service
- And add the following:
[Unit] Description=Wayfire Wayland Compositor After=rc-local.service [Service] User=mm Type=simple ExecStart=/usr/bin/wayfire Restart=on-failure Environment=XDG_RUNTIME_DIR=/var/run/user/1001 [Install] WantedBy=multi-user.target
- And add the following:
- Reload systemd and enable the service at boot:
sudo systemctl daemon-reload sudo systemctl enable wayfire
Install MagicMirror¶
- Switch to the magicmirror user:
sudo su - mm
- Add XDG_RUNTIME_DIR to
.bashrc
:echo "export XDG_RUNTIME_DIR=/run/user/1001" >> ~/.bashrc
- Clone the MagicMirror repository:
git clone https://github.com/MagicMirrorOrg/MagicMirror
- Install the application:
cd MagicMirror npm run install-mm
- Create the config file:
cp config/config.js.sample config/config.js
Autostart MagicMirror¶
- Create a launch script:
nano /home/mm/launch-mm.sh
- And add the following:
#!/bin/bash cd /home/mm/MagicMirror npm run start:wayland
- Don't forget to make it executable:
chmod +x /home/mm/launch-mm.sh
- And add the following:
- Create a wayfire config
nano /home/mm/.config/wayfire.ini
- And add the following:
[core] plugins = autostart [autostart] boot = /home/mm/launch-mm.sh
- And add the following:
Resources¶
- https://docs.magicmirror.builders/getting-started/installation.html
- https://github.com/sdetweil/MagicMirror_scripts/blob/master/raspberry.sh
- https://gitlab.com/khassel/magicmirror/-/raw/master/build/Dockerfile-debian?ref_type=heads
- https://gist.github.com/seffs/2395ca640d6d8d8228a19a9995418211
- https://www.raspberrypi.com/documentation/computers/configuration.html#wayland
- https://utdream.org/xdg_runtime_dir-is-invalid-or-not-set-on-raspberry-pi-5/
- https://forums.raspberrypi.com/viewtopic.php?t=376273