fri-alpine-signage/README.md

74 lines
No EOL
5.3 KiB
Markdown

# Alpine Linux Weston/Chromium Kiosk Setup
This script automates the setup of a minimal Alpine Linux system to function as a digital signage kiosk. It installs and configures Weston (a Wayland compositor), Chromium (web browser), and necessary supporting services to automatically display a specific webpage in fullscreen kiosk mode upon system boot.
## Features
* Automated installation and configuration on a base Alpine Linux system.
* Uses the modern Wayland display protocol via the Weston compositor.
* Employs `elogind` for session and seat management.
* Uses `greetd` with `agreety` for lightweight, automatic user login.
* Configurable target URL displayed in Chromium's kiosk mode.
* Includes basic Mesa graphics drivers and essential firmware.
* Checks for the problematic `nomodeset` kernel parameter.
## How to Use
1. **Download/Save Script:** Obtain the `setup_signage.sh` script and place it on your target Alpine machine (e.g., using `wget`, `scp`, or copy-paste via SSH).
2. **Configure:**
* Edit the script using a text editor (like `nano`): `nano setup_signage.sh`
* Modify the following variables near the top of the script:
* `KIOSK_URL`: Set this to the full URL of the webpage you want to display (e.g., `"https://your-status-board.com"`).
* `SIGNAGE_USER`: You can change the username if desired, but `"signage"` is standard for this setup.
* Save the changes (`Ctrl+O`, `Enter` in nano) and exit (`Ctrl+X`).
3. **Make Executable:** `chmod +x setup_signage.sh`
4. **Run as Root:** `./setup_signage.sh`
5. **Review Output:** Watch the script output for any errors. Pay attention to any warnings, especially regarding `nomodeset`.
6. **Reboot:** If the script completes successfully, reboot the system: `reboot`
Upon rebooting, the system should automatically log in as the `signage` user and launch Weston with Chromium displaying the configured `KIOSK_URL`.
## How It Works (Technical Details)
The script performs the following main steps:
1. Checks for root privileges.
2. Checks `/proc/cmdline` for the `nomodeset` kernel parameter and issues a warning if found (as this prevents Weston's DRM backend from working).
3. Updates Alpine package repositories (`apk update`).
4. Runs `setup-wayland-base` to install and configure `elogind`, `eudev`, enable the community repository, and set up related services.
5. Installs core packages: `weston`, `weston-backend-drm`, `weston-shell-desktop`, `chromium`, `mesa-dri-gallium`, `mesa-va-gallium`, `dbus`, fonts, `util-linux` (for dependencies), `linux-firmware`, `greetd`, `greetd-agreety`.
6. Ensures the `dbus` service is enabled and started.
7. Creates the non-root user (`signage` by default) with `/bin/sh` as the shell.
8. Creates Weston configuration (`~/.config/weston.ini`) setting `idle-time=0` (no screen blanking) and specifying Chromium as the client, ensuring the `--ozone-platform=wayland` flag is used.
9. Creates `greetd` configuration (`/etc/greetd/config.toml`) to use `agreety` on VT1, perform autologin for the `signage` user, and set the session command to `/usr/bin/weston`.
10. Modifies `/etc/inittab` to start `/usr/sbin/greetd` on tty1 instead of the default getty/login prompt.
11. Attempts to add `pam_elogind.so` to the PAM configuration (`/etc/pam.d/greetd` or `/etc/pam.d/system-auth`) to ensure `elogind` handles session setup correctly (including `$XDG_RUNTIME_DIR`).
## IMPORTANT: `nomodeset` Boot Parameter
Weston requires Kernel Mode Setting (KMS) graphics drivers to function with its primary (`drm`) backend. The kernel parameter `nomodeset` **disables** KMS drivers.
**If the setup script warned you about `nomodeset` being present, the graphical kiosk WILL NOT WORK.**
You **MUST** remove `nomodeset` from your kernel boot arguments. Edit your bootloader configuration file:
* **Syslinux/Extlinux:** Edit `/boot/extlinux.conf`. Find the line(s) starting with `APPEND` and delete the word `nomodeset`.
* **GRUB:** Edit `/etc/default/grub`. Find the line(s) starting with `GRUB_CMDLINE_LINUX_DEFAULT=` and `GRUB_CMDLINE_LINUX=` and delete the word `nomodeset` from within the quotes. After saving, run `update-grub`.
Reboot after modifying the bootloader configuration.
## Troubleshooting
If the kiosk doesn't start correctly after rebooting:
1. **Switch TTY:** Press `Alt+F2` (or `F3`, `F4`, etc.) to get to another virtual console login prompt.
2. **Login as Root:** Use the root username and password.
3. **Check Logs & Status:**
* **Greetd:** `cat /var/log/messages | grep greetd` (Look for errors starting or running greetd)
* **Weston:** `cat /home/signage/.local/share/weston/weston.log` (Look for DRM errors, GL errors, client launch errors)
* **XDG Runtime Dir:** `ls -ld /run/user/$(id -u signage)` (Should exist, owned by `signage`, permissions `drwx------`)
* **Services:** `rc-service elogind status && rc-service dbus status` (Both should be started)
* **inittab:** `grep ^tty1 /etc/inittab` (Should show `/usr/sbin/greetd`)
* **Kernel Messages:** `dmesg | tail -n 50` (Look for graphics/DRM driver errors, especially if you suspect `nomodeset` issues)
* **Greetd Config:** `cat /etc/greetd/config.toml` (Verify syntax, command path, user)
* **Weston Config:** `cat /home/signage/.config/weston.ini` (Verify syntax, client path, Chromium flags)