User Tools

Site Tools


raspberry_magic_mirror

This is an old revision of the document!


Raspberry as Magic Mirror

Prerequisites

Use the Kiosk howto to install a R/O Kiosk. Magic Mirror software runs from the home directory of the user and can only be R/W. I used a USB SSD connected to the USB3 port of the Raspberry Pie 4.

Fstab changes

Make a partition on the USB disk and format it as EXT4. Then use blkid to see PARTUID:

blkid
/dev/mmcblk0p1: LABEL_FATBOOT="boot" LABEL="boot" UUID="5203-DB74" TYPE="vfat" PARTUUID="6c586e13-01"
/dev/mmcblk0p2: LABEL="rootfs" UUID="2ab3f8e1-7dc6-43f5-b0db-dd5759d51d4e" TYPE="ext4" PARTUUID="6c586e13-02"
/dev/sda1: UUID="2f7dbca4-e910-4517-b70a-efad86e0b8d3" TYPE="ext4" PARTUUID="b3a803bf-01"

In this case the PARTUUID of /dev/sda1 is b3a803bf-01. Change /etc/fstab to look something like this:

/etc/fstab
proc                  /proc              proc    defaults                                    0 0
PARTUUID=6c586e13-01  /boot              vfat    defaults,ro                                 0 2
PARTUUID=6c586e13-02  /                  ext4    defaults,noatime,ro                         0 1
PARTUUID=b3a803bf-01  /home              ext4    defaults,noatime                            0 0
tmpfs                 /tmp               tmpfs   defaults,noatime,nosuid,mode=1777,size=100m 0 0
tmpfs                 /var/tmp           tmpfs   defaults,noatime,nosuid,size=30m            0 0
tmpfs                 /var/log           tmpfs   defaults,noatime,nosuid,mode=0755,size=100m 0 0
tmpfs                 /var/run           tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0
tmpfs                 /etc/console-setup tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0
tmpfs                 /var/lib/chrony    tmpfs   defaults,noatime,nosuid,mode=0755,size=2m   0 0
tmpfs                 /var/lib/lightdm  tmpfs   defaults,noatime,nosuid,size=30m            0 0

Reboot and see if /home is mounted. Create a directory for the user pi

mkdir /home/pi
chmod 700 /home/pi
chown pi. /home/pi

X-server settings

Now we are going to undo the changes of the system wide autostart and put them in the homedir of the pi user. Make it look like it was:

/etc/xdg/openbox/autostart
#
# These things are run when an Openbox X Session is started.
# You may place a similar script in $HOME/.config/openbox/autostart
# to run user-specific things.
#

# If you want to use GNOME config tools...
#
#if test -x /usr/lib/arm-linux-gnueabihf/gnome-settings-daemon >/dev/null; then
#  /usr/lib/arm-linux-gnueabihf/gnome-settings-daemon &
#elif which gnome-settings-daemon >/dev/null 2>&1; then
#  gnome-settings-daemon &
#fi

# If you want to use XFCE config tools...
#
#xfce-mcs-manager &

Now create the autostart file for the pi user as the pi user

cd ~
mkdir -p .config/openbox
/home/pi/.config/openbox/autopstart
xset -dpms
xset s off
xset s noblank
unclutter -idle 0 &
cd ~/MagicMirror
xrandr --output HDMI-1 --rotate left &
npm start &

Rotate the graphical interface does not seem to work on a Pi 4. As you can see we are using xrandr to rotate. Rotation of the console must be disabled and the GL driver must be enabled. Use raspi-config to change to GL driver: 7 Advanced Options → A8 GL driver → G2 GL (Fake KMS) Then change /boot/config.txt to remove rotate screen

/boot/config.txt
.
.
.
[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2

[all]
dtoverlay=vc4-fkms-v3d

#display_rotate=3
disable_splash=1
raspberry_magic_mirror.1579983087.txt.gz · Last modified: by herwarth