Sway and WayVNC support

- Added WayVNC configuration options for better security and usability.
- Updated echo statements to reflect the use of Sway instead of Weston.
- Improved kernel parameter check for 'nomodeset' with a warning message.
- Refined package installation steps to include necessary components for Sway.
- Configured Sway and greetd for autologin and session management.
- Added detailed instructions for troubleshooting and final checks.
This commit is contained in:
FallingLights 2025-05-07 19:11:38 +02:00
parent 9e52eaa343
commit 2254b9bd74

View file

@ -10,11 +10,20 @@ KIOSK_URL="https://example.com"
# Set the user account to run the signage under # Set the user account to run the signage under
SIGNAGE_USER="signage" SIGNAGE_USER="signage"
# WayVNC Configuration
# The script will create a ~/.profile for the SIGNAGE_USER
# where this variable can be set.
# For better security, leave it blank here and edit ~/.profile manually after setup.
WAYVNC_PASSWORD_TO_SET="" # Example: "burek123"
WAYVNC_LISTEN_ADDRESS="0.0.0.0" # Listen on all interfaces
WAYVNC_PORT="5900" # Default VNC port
# --- End Configuration --- # --- End Configuration ---
echo "Starting Alpine Linux Signage Setup (Using greetd)..." echo "Starting Alpine Linux Signage Setup (Using Sway, greetd, WayVNC)..."
echo "Target URL: $KIOSK_URL" echo "Target URL: $KIOSK_URL"
echo "Signage User: $SIGNAGE_USER" echo "Signage User: $SIGNAGE_USER"
echo "WayVNC will listen on: $WAYVNC_LISTEN_ADDRESS:$WAYVNC_PORT"
echo "-------------------------------------" echo "-------------------------------------"
# 1. Check if running as root # 1. Check if running as root
@ -23,37 +32,62 @@ if [ "$(id -u)" -ne 0 ]; then
exit 1 exit 1
fi fi
# 2. Update repositories # 2. Check for 'nomodeset' kernel parameter (early check)
echo "[Step 3/11] Updating package repositories..." set +e # Temporarily disable exit-on-error
KERNEL_CMDLINE=$(cat /proc/cmdline)
echo "[Step 1/13] Checking kernel command line for 'nomodeset'..."
echo "Command line: $KERNEL_CMDLINE"
if echo "$KERNEL_CMDLINE" | grep -q -w 'nomodeset'; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!! WARNING: Kernel parameter 'nomodeset' detected in /proc/cmdline!"
echo "!! This PREVENTS Wayland compositors (like Sway) from working correctly with DRM."
echo "!! You MUST remove 'nomodeset' from your bootloader configuration"
echo "!! (e.g., /etc/default/grub or /boot/extlinux.conf) and update/reboot"
echo "!! for the graphical kiosk to function."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
else
echo "'nomodeset' not found. Proceeding..."
fi
set -e # Re-enable exit-on-error
echo "-------------------------------------"
# 3. Update repositories
echo "[Step 2/13] Updating package repositories..."
apk update apk update
echo "-------------------------------------" echo "-------------------------------------"
# 3. Setup base Wayland environment (includes enabling community repo) # 4. Setup base Wayland environment (includes enabling community repo)
echo "[Step 4/11] Setting up base Wayland environment (elogind, eudev)..." echo "[Step 3/13] Setting up base Wayland environment (elogind, eudev)..."
apk add --no-cache alpine-conf apk add --no-cache alpine-conf
setup-wayland-base setup-wayland-base # This enables community repository
echo "-------------------------------------" echo "-------------------------------------"
# 4. Install necessary packages (Add greetd) # 5. Install necessary packages
echo "[Step 5/11] Installing Weston, Chromium, Mesa, D-Bus, Fonts, Firmware, Greetd..." echo "[Step 4/13] Installing Sway, Chromium, Mesa, D-Bus, Fonts, Firmware, Greetd, WayVNC, swaybg, open-vm-tools..."
apk add \ apk add \
weston \ sway \
weston-backend-drm \ swayidle \
weston-shell-desktop \ swaybg \
wl-clipboard \
xwayland \
chromium \ chromium \
mesa-dri-gallium \ mesa-dri-gallium \
mesa-va-gallium \ mesa-va-gallium \
mesa-egl \
dbus \ dbus \
font-dejavu \ font-dejavu \
ttf-freefont \ ttf-freefont \
util-linux \ util-linux \
linux-firmware \ linux-firmware \
greetd \ greetd \
greetd-agreety # Console greeter greetd-agreety \
wayvnc
echo "-------------------------------------" echo "-------------------------------------"
# 5. Enable & Start D-Bus service (elogind/polkit handled by setup-wayland-base) # 6. Enable & Start D-Bus service
echo "[Step 6/11] Enabling and starting D-Bus service..." echo "[Step 5/13] Enabling and starting D-Bus service..."
if ! rc-service dbus status > /dev/null 2>&1; then if ! rc-service dbus status > /dev/null 2>&1; then
rc-update add dbus default rc-update add dbus default
rc-service dbus start rc-service dbus start
@ -62,13 +96,26 @@ else
fi fi
echo "-------------------------------------" echo "-------------------------------------"
# 6. Create the signage user # 7. Enable & Start open-vm-tools service (if installed)
echo "[Step 7/11] Creating signage user '$SIGNAGE_USER'..." echo "[Step 6/13] Enabling and starting open-vm-tools service..."
if rc-service open-vm-tools status > /dev/null 2>&1 || apk info open-vm-tools >/dev/null 2>&1; then
if ! rc-service open-vm-tools status > /dev/null 2>&1; then
rc-update add open-vm-tools default
rc-service open-vm-tools start
else
echo "open-vm-tools service already running or enabled."
fi
else
echo "open-vm-tools not installed, skipping service setup."
fi
echo "-------------------------------------"
# 8. Create the signage user
echo "[Step 7/13] Creating signage user '$SIGNAGE_USER'..."
if ! id -u "$SIGNAGE_USER" >/dev/null 2>&1; then if ! id -u "$SIGNAGE_USER" >/dev/null 2>&1; then
echo "Creating group '$SIGNAGE_USER'..." echo "Creating group '$SIGNAGE_USER'..."
addgroup "$SIGNAGE_USER" addgroup "$SIGNAGE_USER"
echo "Creating user '$SIGNAGE_USER' with shell /bin/sh..." echo "Creating user '$SIGNAGE_USER' with shell /bin/sh..."
# Use /bin/sh shell for better compatibility with login/profile execution
adduser -D -G "$SIGNAGE_USER" -s /bin/sh -h "/home/$SIGNAGE_USER" "$SIGNAGE_USER" adduser -D -G "$SIGNAGE_USER" -s /bin/sh -h "/home/$SIGNAGE_USER" "$SIGNAGE_USER"
echo "User '$SIGNAGE_USER' created." echo "User '$SIGNAGE_USER' created."
else else
@ -86,202 +133,259 @@ if [ ! -d "$SIGNAGE_HOME" ]; then
mkdir -p "$SIGNAGE_HOME" mkdir -p "$SIGNAGE_HOME"
fi fi
chown "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_HOME" chown "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_HOME"
chmod 750 "$SIGNAGE_HOME" # Slightly more secure default chmod 750 "$SIGNAGE_HOME"
# Create user's .local/share directory for logs
SIGNAGE_LOCAL_SHARE="$SIGNAGE_HOME/.local/share"
mkdir -p "$SIGNAGE_LOCAL_SHARE/sway" # For sway logs
chown -R "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_HOME/.local"
chmod 700 "$SIGNAGE_HOME/.local" # Restrict access
chmod 700 "$SIGNAGE_LOCAL_SHARE"
chmod 700 "$SIGNAGE_LOCAL_SHARE/sway"
echo "-------------------------------------" echo "-------------------------------------"
# 7. Configure Weston # 9. Configure user's .profile for WayVNC password and other environment variables
echo "[Step 8/11] Configuring Weston..." echo "[Step 8/13] Configuring $SIGNAGE_HOME/.profile for $SIGNAGE_USER..."
SIGNAGE_CONFIG_DIR="$SIGNAGE_HOME/.config" SIGNAGE_PROFILE="$SIGNAGE_HOME/.profile"
SIGNAGE_WESTON_CONFIG="$SIGNAGE_CONFIG_DIR/weston.ini" cat > "$SIGNAGE_PROFILE" << EOF
WESTON_LOG_DIR="$SIGNAGE_HOME/.local/share/weston" # Profile for $SIGNAGE_USER executed by /bin/sh on login
echo "Creating configuration directories..." # --- WayVNC Configuration ---
mkdir -p "$SIGNAGE_CONFIG_DIR" # IMPORTANT: Set a strong password for WayVNC if it's accessible from untrusted networks.
mkdir -p "$WESTON_LOG_DIR" # Uncomment and set your password:
# Attempt chown, ignore errors if run multiple times # export WAYVNC_PASSWORD="your_very_secure_password_here"
chown -R "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_HOME/.config" || true
chown -R "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_HOME/.local" || true
echo "Creating $SIGNAGE_WESTON_CONFIG..."
cat > "$SIGNAGE_WESTON_CONFIG" << EOF
[core]
# Use drm backend explicitly if needed, usually auto-detected.
# Default backend is drm-backend.so when run outside another compositor
# backend=drm-backend.so
# idle-time=0 prevents screen blanking/DPMS
idle-time=0
[shell]
# locking=false disables the screen lock/shield
locking=false
# Set the background to black (optional)
# background-color=0xff000000
# Start Chromium in kiosk mode as the main client
# Use --no-sandbox as it's often needed in minimal/containerized envs
# Explicitly tell Chromium to use Wayland backend
client=/usr/bin/chromium --enable-features=UseOzonePlatform --ozone-platform=wayland --kiosk --no-first-run --disable-infobars --disable-session-crashed-bubble --disable-component-update --disable-pinch --app=$KIOSK_URL --no-sandbox
# --- Optional Output Configuration ---
# Find your output name (e.g., HDMI-A-1, DP-1) via weston log or 'weston --scan-outputs'
# Then uncomment and configure the [output] section if needed.
#[output]
#name=HDMI-A-1
#mode=1920x1080@60
#transform=rotate-90 # Options: normal, 90, 180, 270, flipped, flipped-90, etc.
EOF EOF
chown "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_WESTON_CONFIG"
chmod 600 "$SIGNAGE_WESTON_CONFIG" if [ -n "$WAYVNC_PASSWORD_TO_SET" ]; then
echo "export WAYVNC_PASSWORD=\"$WAYVNC_PASSWORD_TO_SET\"" >> "$SIGNAGE_PROFILE"
echo "WAYVNC_PASSWORD has been pre-set in $SIGNAGE_PROFILE. Review for security."
else
echo "INFO: WAYVNC_PASSWORD is not set. Edit $SIGNAGE_PROFILE to set it for WayVNC security."
fi
cat >> "$SIGNAGE_PROFILE" << EOF
# --- Other Environment Variables (optional) ---
# export XDG_CURRENT_DESKTOP=sway # Sway usually sets this
# export MOZ_ENABLE_WAYLAND=1 # For Firefox, if used
# export QT_QPA_PLATFORM=wayland # For Qt apps, if used
# export ECORE_EVAS_ENGINE=wayland_shm # For EFL apps
# export ELM_ACCEL=wayland
# export SDL_VIDEODRIVER=wayland
# export _JAVA_AWT_WM_NONREPARENTING=1
EOF
chown "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_PROFILE"
chmod 600 "$SIGNAGE_PROFILE" # User read/write only
echo "-------------------------------------" echo "-------------------------------------"
# 8. Configure greetd for Autologin and Weston Session
echo "[Step 9/11] Configuring greetd..." # 10. Configure Sway
echo "[Step 9/13] Configuring Sway..."
SIGNAGE_CONFIG_DIR="$SIGNAGE_HOME/.config"
SIGNAGE_SWAY_CONFIG_DIR="$SIGNAGE_CONFIG_DIR/sway"
SIGNAGE_SWAY_CONFIG_FILE="$SIGNAGE_SWAY_CONFIG_DIR/config"
echo "Creating Sway configuration directories..."
mkdir -p "$SIGNAGE_SWAY_CONFIG_DIR"
chown -R "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_CONFIG_DIR" || true
chmod 700 "$SIGNAGE_CONFIG_DIR" # Restrict access
chmod 700 "$SIGNAGE_SWAY_CONFIG_DIR"
echo "Creating $SIGNAGE_SWAY_CONFIG_FILE..."
# Note: KIOSK_URL, WAYVNC_LISTEN_ADDRESS, WAYVNC_PORT are expanded when this heredoc is created.
# SIGNAGE_USER is also expanded for the chromium user-data-dir example
cat > "$SIGNAGE_SWAY_CONFIG_FILE" << EOF
# Sway configuration for Alpine Signage Kiosk
# --- Basic Setup ---
set \$mod Mod4 # Super key
font pango:DejaVu Sans Mono 10
# --- Output Configuration ---
output * dpms off # Disable screen blanking / DPMS
# To set a specific mode for an output (name from 'swaymsg -t get_outputs'):
# output Virtual-1 mode 1280x800@60hz
# output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill # Optional: if swaybg is installed
# --- Input Configuration ---
# Hide mouse cursor when typing and after 1 second of inactivity
seat * hide_cursor when-typing
seat * hide_cursor 1000 # You can adjust the timeout (milliseconds)
# --- Autostart Applications ---
# Chromium in Kiosk Mode
# --disable-gpu is added as a safe default, especially for VMs.
# Remove --disable-gpu if you confirm hardware acceleration works correctly.
exec /usr/bin/chromium \\
--enable-features=UseOzonePlatform \\
--ozone-platform=wayland \\
--kiosk \\
--no-first-run \\
--disable-infobars \\
--disable-session-crashed-bubble \\
--disable-component-update \\
--disable-pinch \\
--app=$KIOSK_URL \\
--no-sandbox \\
--password-store=basic \\
--enable-zero-copy \\
--ignore-gpu-blocklist \\
--disable-gpu \\
# --enable-unsafe-webgpu \\
# --disable-gpu-vsync \\
# --user-data-dir=/home/$SIGNAGE_USER/.config/chromium-kiosk
# WayVNC for remote access
# Password should be set via WAYVNC_PASSWORD environment variable (see ~/.profile)
exec wayvnc --render-cursor $WAYVNC_LISTEN_ADDRESS $WAYVNC_PORT
# --- Keybindings (Minimal, mostly for debugging) ---
bindsym \$mod+Shift+q kill
bindsym \$mod+Shift+c reload
bindsym \$mod+Shift+e exec swaynag -t warning -m 'You pressed the exit shortcut. Do you really want to exit sway? This will end the kiosk session.' -B 'Yes, exit sway' 'swaymsg exit'
# --- General Settings ---
focus_follows_mouse no
mouse_warping output
EOF
chown "$SIGNAGE_USER:$SIGNAGE_USER" "$SIGNAGE_SWAY_CONFIG_FILE"
chmod 600 "$SIGNAGE_SWAY_CONFIG_FILE" # User read/write only
echo "-------------------------------------"
# 11. Configure greetd for Autologin and Sway Session
echo "[Step 10/13] Configuring greetd..."
GREETD_CONFIG_DIR="/etc/greetd" GREETD_CONFIG_DIR="/etc/greetd"
GREETD_CONFIG_FILE="$GREETD_CONFIG_DIR/config.toml" GREETD_CONFIG_FILE="$GREETD_CONFIG_DIR/config.toml"
mkdir -p "$GREETD_CONFIG_DIR" mkdir -p "$GREETD_CONFIG_DIR"
# Create greetd config for autologin with agreety launching weston SWAY_LOG_PATH_IN_GREETD="$SIGNAGE_LOCAL_SHARE/sway/sway-greetd.log"
cat > "$GREETD_CONFIG_FILE" << EOF cat > "$GREETD_CONFIG_FILE" << EOF
# Greetd configuration for signage kiosk # Greetd configuration for signage kiosk with Sway
[terminal] [terminal]
# Use agreety on the specified TTY. Switch VT if desired.
vt = 1 vt = 1
# command line REMOVED from here - specified in default_session
[default_session] [default_session]
# Automatically log in the specified user.
user = "$SIGNAGE_USER" user = "$SIGNAGE_USER"
# Launch sway via dbus-run-session. User's .profile will be sourced.
# The command to run for the default session user. # Sway debug logs (-d) are redirected. -V (version) is also included.
# Launch weston directly. elogind grants permissions via PAM integration with greetd. command = "/usr/bin/dbus-run-session /usr/bin/sway -V -d 2> $SWAY_LOG_PATH_IN_GREETD"
command = "/usr/bin/weston --log=/home/$SIGNAGE_USER/.local/share/weston/weston.log" # Simpler alternative if log redirection is problematic (logs go to greetd's output):
# command = "/usr/bin/dbus-run-session /usr/bin/sway"
EOF EOF
chmod 644 "$GREETD_CONFIG_FILE" chmod 644 "$GREETD_CONFIG_FILE"
echo "greetd config written to $GREETD_CONFIG_FILE" echo "greetd config written to $GREETD_CONFIG_FILE"
echo "Ensure $SIGNAGE_USER can write to $SWAY_LOG_PATH_IN_GREETD."
echo "-------------------------------------" echo "-------------------------------------"
# 9. Configure inittab to start greetd # 12. Configure inittab to start greetd
echo "[Step 10/11] Configuring autologin via greetd in /etc/inittab..." echo "[Step 11/13] Configuring autologin via greetd in /etc/inittab..."
if [ -f "/etc/inittab" ]; then if [ -f "/etc/inittab" ]; then
# Backup original inittab first only if it exists if [ ! -f "/etc/inittab.bak.signage" ]; then # Create backup only once
cp /etc/inittab /etc/inittab.bak.$(date +%s) cp /etc/inittab /etc/inittab.bak.signage
echo "Backed up /etc/inittab to /etc/inittab.bak.signage"
fi
# Disable getty on other TTYs (optional, saves resources)
echo "Commenting out ttys 2-6 in /etc/inittab..." echo "Commenting out ttys 2-6 in /etc/inittab..."
sed -i -e '/^tty[2-6]:/s/^/#/' /etc/inittab sed -i -e '/^tty[2-6]:/s/^/#/' /etc/inittab
# Configure tty1 to start greetd
echo "Modifying tty1 entry in /etc/inittab to start greetd..." echo "Modifying tty1 entry in /etc/inittab to start greetd..."
GREETD_INITTAB_LINE="tty1::respawn:/usr/sbin/greetd" GREETD_INITTAB_LINE="tty1::respawn:/usr/sbin/greetd"
# Check if the line already exists to prevent duplicates if grep -q "^tty1::respawn:" /etc/inittab && ! grep -Fxq "$GREETD_INITTAB_LINE" /etc/inittab; then
if ! grep -Fxq "$GREETD_INITTAB_LINE" /etc/inittab; then
# Replace the default getty/agetty/login line with the greetd line
sed -i "s|^tty1::respawn:.*|$GREETD_INITTAB_LINE|" /etc/inittab sed -i "s|^tty1::respawn:.*|$GREETD_INITTAB_LINE|" /etc/inittab
elif ! grep -Fxq "$GREETD_INITTAB_LINE" /etc/inittab; then
echo "$GREETD_INITTAB_LINE" >> /etc/inittab
echo "Added greetd line to /etc/inittab (fallback)."
else else
echo "greetd line already seems to be present in /etc/inittab." echo "greetd line already seems to be present in /etc/inittab."
fi fi
else else
echo "Warning: /etc/inittab not found. Cannot configure greetd startup." echo "Warning: /etc/inittab not found. Cannot configure greetd startup for sysvinit."
fi fi
echo "-------------------------------------" echo "-------------------------------------"
# 10. Attempt to Enable elogind PAM module for session management # 13. Attempt to Enable elogind PAM module for session management
echo "[Step 11/11] Attempting to configure PAM for elogind session..." echo "[Step 12/13] Attempting to configure PAM for elogind session..."
PAM_GREETD_FILE="/etc/pam.d/greetd" PAM_GREETD_FILE="/etc/pam.d/greetd"
PAM_SYSTEM_LOGIN="/etc/pam.d/system-login"
PAM_SYSTEM_AUTH="/etc/pam.d/system-auth" PAM_SYSTEM_AUTH="/etc/pam.d/system-auth"
PAM_TARGET_FILE="" PAM_TARGET_FILE=""
PAM_MODULE="pam_elogind.so" PAM_MODULE="pam_elogind.so"
# Prefer greetd's specific PAM file if it exists
if [ -f "$PAM_GREETD_FILE" ]; then if [ -f "$PAM_GREETD_FILE" ]; then
PAM_TARGET_FILE="$PAM_GREETD_FILE" PAM_TARGET_FILE="$PAM_GREETD_FILE"
echo "Using $PAM_TARGET_FILE for PAM configuration." elif [ -f "$PAM_SYSTEM_LOGIN" ]; then
PAM_TARGET_FILE="$PAM_SYSTEM_LOGIN"
elif [ -f "$PAM_SYSTEM_AUTH" ]; then elif [ -f "$PAM_SYSTEM_AUTH" ]; then
PAM_TARGET_FILE="$PAM_SYSTEM_AUTH" PAM_TARGET_FILE="$PAM_SYSTEM_AUTH"
echo "Using $PAM_SYSTEM_AUTH for PAM configuration (greetd PAM file not found)."
else
echo "Warning: Neither $PAM_GREETD_FILE nor $PAM_SYSTEM_AUTH found!"
fi fi
if [ -n "$PAM_TARGET_FILE" ]; then if [ -n "$PAM_TARGET_FILE" ]; then
# Check if the module is already present echo "Using $PAM_TARGET_FILE for PAM configuration."
if ! grep -q "$PAM_MODULE" "$PAM_TARGET_FILE"; then if ! grep -q "$PAM_MODULE" "$PAM_TARGET_FILE"; then
echo "Adding '$PAM_MODULE' to $PAM_TARGET_FILE..." echo "Adding '$PAM_MODULE' to $PAM_TARGET_FILE..."
# Use awk to insert after the first line starting with 'session' if [ ! -f "$PAM_TARGET_FILE.bak.signage" ]; then
# Create backup before modifying cp "$PAM_TARGET_FILE" "$PAM_TARGET_FILE.bak.signage"
cp "$PAM_TARGET_FILE" "$PAM_TARGET_FILE.bak.$(date +%s)" echo "Backed up $PAM_TARGET_FILE to $PAM_TARGET_FILE.bak.signage"
fi
awk '/^session/{if(!p++) print; print "session optional pam_elogind.so"; next} 1' "$PAM_TARGET_FILE" > "$PAM_TARGET_FILE.tmp" && mv "$PAM_TARGET_FILE.tmp" "$PAM_TARGET_FILE" awk '/^session/{if(!p++) print; print "session optional pam_elogind.so"; next} 1' "$PAM_TARGET_FILE" > "$PAM_TARGET_FILE.tmp" && mv "$PAM_TARGET_FILE.tmp" "$PAM_TARGET_FILE"
echo "PAM module added." echo "PAM module added."
else else
echo "'$PAM_MODULE' already present in $PAM_TARGET_FILE." echo "'$PAM_MODULE' already present in $PAM_TARGET_FILE."
fi fi
else else
echo "Warning: Could not find suitable PAM file to modify." echo "Warning: Could not find suitable PAM file (greetd, system-login, system-auth) to modify."
echo " System relies on default PAM includes for elogind session setup." echo " System relies on default PAM includes for elogind session setup."
echo " XDG_RUNTIME_DIR creation might fail if not handled by defaults."
fi fi
echo "-------------------------------------" echo "-------------------------------------"
# 11. Check for 'nomodeset' kernel parameter echo "[Step 13/13] Final checks and information."
# Temporarily disable exit-on-error ('+e') for the check
set +e
KERNEL_CMDLINE=$(cat /proc/cmdline)
echo "[Step 2/11] Checking kernel command line for 'nomodeset'..."
echo "Command line: $KERNEL_CMDLINE"
if echo "$KERNEL_CMDLINE" | grep -q -w 'nomodeset'; then
echo ""
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "!! WARNING: Kernel parameter 'nomodeset' detected in /proc/cmdline!"
echo "!! This PREVENTS Weston's DRM backend from working correctly."
echo "!! You MUST remove 'nomodeset' from your bootloader configuration"
echo "!! (e.g., /etc/default/grub or /boot/extlinux.conf) and update/reboot"
echo "!! for the graphical kiosk to function."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo ""
# Allow script to continue, but it will fail graphically later
else
echo "'nomodeset' not found. Proceeding..."
fi
# Re-enable exit-on-error
set -e
echo "-------------------------------------"
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
echo " Alpine Linux Signage Setup Script Finished!" echo " Alpine Linux Signage Setup Script Finished!"
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
echo " SUMMARY:" echo " SUMMARY:"
echo " * Packages installed (Weston, Chromium, elogind, greetd, etc.)." echo " * Packages installed (Sway, Chromium, Greetd, WayVNC, open-vm-tools etc.)."
echo " * User '$SIGNAGE_USER' created/configured with shell /bin/sh." echo " * User '$SIGNAGE_USER' created/configured with shell /bin/sh."
echo " * Weston configured in $SIGNAGE_WESTON_CONFIG." echo " * Sway configured in $SIGNAGE_SWAY_CONFIG_FILE."
echo " -> Chromium will start with --disable-gpu. Edit this file to change."
echo " -> Mouse cursor configured to hide when typing and after 1s inactivity."
echo " * WayVNC configured to launch via Sway, listening on $WAYVNC_LISTEN_ADDRESS:$WAYVNC_PORT."
echo " * IMPORTANT: WayVNC password MUST be set in $SIGNAGE_PROFILE for security."
echo " * Autologin configured via greetd ($GREETD_CONFIG_FILE)." echo " * Autologin configured via greetd ($GREETD_CONFIG_FILE)."
echo " * /etc/inittab modified to launch greetd on tty1." echo " * /etc/inittab modified to launch greetd on tty1."
echo " * Attempted to configure PAM for elogind." echo " * Attempted to configure PAM for elogind."
echo " * open-vm-tools service enabled (if applicable)."
echo "" echo ""
echo " !!! IMPORTANT !!!" echo " !!! IMPORTANT !!!"
echo " If you saw a WARNING about 'nomodeset' earlier, the graphical kiosk" echo " * If you saw a WARNING about 'nomodeset' earlier, the graphical kiosk"
echo " WILL NOT WORK until you remove 'nomodeset' from your bootloader config" echo " WILL NOT WORK until you remove 'nomodeset' from your bootloader config and reboot."
echo " (e.g., /etc/default/grub or /boot/extlinux.conf) and reboot." echo " * For WayVNC to be secure, you MUST set a strong WAYVNC_PASSWORD"
echo " in $SIGNAGE_HOME/.profile for the user $SIGNAGE_USER."
echo " Example: echo 'export WAYVNC_PASSWORD=\"your_secure_password\"' >> $SIGNAGE_HOME/.profile"
echo " * Chromium is launched with --disable-gpu. If you have working 3D acceleration"
echo " (especially on bare metal or with robust VM drivers), you can try removing"
echo " this flag from $SIGNAGE_SWAY_CONFIG_FILE for better performance."
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
echo "" echo ""
echo " Please REBOOT the system for changes to take effect." echo " Please REBOOT the system for changes to take effect."
echo " Command: reboot" echo " Command: reboot"
echo "" echo ""
echo " TROUBLESHOOTING AFTER REBOOT (if it doesn't work):" echo " TROUBLESHOOTING AFTER REBOOT (if it doesn't work):"
echo " 1. Log in as root on another TTY (Alt+F2) or via SSH." echo " 1. Log in as root on TTY2 (Alt+F2) or SSH."
echo " 2. Check greetd status/logs:" echo " 2. Check greetd logs: grep greetd /var/log/messages | tail -n 20"
echo " * cat /var/log/messages | grep greetd" echo " 3. Check Sway log: cat $SWAY_LOG_PATH_IN_GREETD"
echo " * Check greetd config: cat $GREETD_CONFIG_FILE" echo " 4. Check Sway config syntax (as root, or as user if paths adjusted):"
echo " 3. Check the Weston log: cat $WESTON_LOG_DIR/weston.log" echo " sway -C -c $SIGNAGE_SWAY_CONFIG_FILE"
echo " 4. Check XDG_RUNTIME_DIR: ls -ld /run/user/\$(id -u $SIGNAGE_USER)" echo " 5. Check XDG_RUNTIME_DIR: ls -ld /run/user/\$(id -u $SIGNAGE_USER)"
echo " (Should be created by elogind via PAM)." echo " 6. Check services: rc-service elogind status && rc-service dbus status && rc-service open-vm-tools status"
echo " 5. Check service status: rc-service elogind status && rc-service dbus status" echo " 7. Check inittab: grep ^tty1 /etc/inittab"
echo " 6. Check /etc/inittab for the tty1 line: grep ^tty1 /etc/inittab (should show greetd)" echo " 8. Check dmesg: dmesg | tail -n 50"
echo " 7. Check system messages for graphics/DRM errors: dmesg | tail -n 50" echo " 9. Verify Chromium flags in: cat $SIGNAGE_SWAY_CONFIG_FILE"
echo " 8. Verify Chromium Wayland flags in: cat $SIGNAGE_WESTON_CONFIG" echo "10. Check WayVNC: ps aux | grep wayvnc ; netstat -tulnp | grep :$WAYVNC_PORT"
echo " Ensure WAYVNC_PASSWORD is set in $SIGNAGE_PROFILE"
echo "11. Manually test Sway as $SIGNAGE_USER on TTY2 (stop greetd first: rc-service greetd stop):"
echo " su - $SIGNAGE_USER -c \"dbus-run-session sway -d\""
echo "-----------------------------------------------------" echo "-----------------------------------------------------"
exit 0 exit 0