Support #980
Updated by Daniel Curtis 26 days ago
This is a guide for installing MagicMirror with Debian Bookworm on a Raspberry Pi 2 h2. Prepare the Environment * Make sure everything is up to date: <pre> sudo apt update && sudo apt upgrade </pre> * Install nodejs repo: <pre> curl -fsSL https://deb.nodesource.com/setup_22.x -o nodesource_setup.sh sudo bash nodesource_setup.sh </pre> * Install required dependencies: <pre> 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 </pre> * Edit @cmdline.txt@ : <pre> sudo nano /boot/firmware/cmdline.txt </pre> * Add *wayland=on* to the command line options: <pre> console=serial0,115200 console=tty1 root=PARTUUID=ef31a647-01 rootfstype=ext4 fsck.repair=yes wayland=on rootwait cfg80211.ieee80211_regdom=US </pre> * Create the magicmirror user and add it to the video group: <pre> sudo adduser --uid 1001 -ingroup users --shell /bin/bash --comment "magicmirror" mm sudo usermod -aG video mm </pre> * Create a oneshot service to create the XDG_RUNTIME_DIR path: <pre> sudo nano /etc/systemd/system/create-xdg-runtime-dir.service </pre> #* And add the following: <pre> [Unit] Description=Create XDG_RUNTIME_DIR for magicmirror After=local-fs.target [Service] Type=oneshot ExecStart=/bin/mkdir -p /run/user/1001 ExecStart=/bin/chown 1001:1001 /run/user/1001 ExecStart=/bin/chmod 700 /run/user/1001 [Install] WantedBy=multi-user.target </pre> * Create a wayfire service file: <pre> sudo nano /etc/systemd/system/wayfire.service </pre> #* And add the following: <pre> [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 </pre> * Reload systemd and enable the two services service at boot: <pre> sudo systemctl daemon-reload sudo systemctl enable wayfire sudo systemctl enable create-xdg-runtime-dir </pre> h2. Install MagicMirror * Switch to the magicmirror user: <pre> sudo su - mm </pre> * Add *XDG_RUNTIME_DIR* to @.bashrc@: <pre> echo "export XDG_RUNTIME_DIR=/run/user/1001" >> ~/.bashrc </pre> * Clone the MagicMirror repository: <pre> git clone https://github.com/MagicMirrorOrg/MagicMirror </pre> * Install the application: <pre> cd MagicMirror npm run install-mm </pre> * Create the config file: <pre> cp config/config.js.sample config/config.js </pre> h2. Autostart MagicMirror * Create a launch script: <pre> nano /home/mm/launch-mm.sh </pre> #* And add the following: <pre> #!/bin/bash cd /home/mm/MagicMirror npm run start:wayland </pre> #* Don't forget to make it executable: <pre> chmod +x /home/mm/launch-mm.sh </pre> * Create a wayfire config <pre> nano /home/mm/.config/wayfire.ini </pre> #* And add the following: <pre> [core] plugins = autostart [autostart] boot = /home/mm/launch-mm.sh </pre> h2. Run MagicMirror * Exit out of the magicmirror user: <pre> exit </pre> * Start the create-xdg-runtime-dir and wayfire services: <pre> sudo systemctl start create-xdg-runtime-dir sudo systemctl start wayfire </pre> h2. 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