diff --git a/host_vars/musicdolphin.yml b/host_vars/musicdolphin.yml index bcf819f..008a9a6 100644 --- a/host_vars/musicdolphin.yml +++ b/host_vars/musicdolphin.yml @@ -17,7 +17,3 @@ mediapi_install_kidsmusic: true mediapi_has_monitor: true musicmouse_version: deploy/musicdolphin -# The attached screen reads back 0 bytes of EDID on both micro-HDMI ports and reports -# "disconnected", so the kernel offers no modes and X dies with "no screens found". -# Force the mode instead. Use the port nearest the USB-C jack (HDMI0 = HDMI-A-1). -pi_kiosk_force_mode: "HDMI-A-1:1920x1080@60e" diff --git a/roles/pi_kiosk/defaults/main.yml b/roles/pi_kiosk/defaults/main.yml index 1fc62bd..750db2b 100644 --- a/roles/pi_kiosk/defaults/main.yml +++ b/roles/pi_kiosk/defaults/main.yml @@ -1,14 +1,3 @@ --- pi_kiosk_user: "kiosk" pi_kiosk_url: "http://localhost:8080" - -# Force a mode on the kiosk output, as a `video=` kernel parameter, e.g. -# "HDMI-A-1:1920x1080@60e" (the trailing `e` forces the output enabled). Empty means -# "let EDID decide", which is what you want whenever EDID can be read. -# -# This is for a display the Pi cannot see: a micro-HDMI cable or adapter whose DDC/HPD -# lines are broken but whose video pairs are fine reads back 0 bytes of EDID and -# reports "disconnected", while displaying perfectly once a mode is forced. Note -# hdmi_force_hotplug=1 does nothing here - it is ignored by the vc4-kms-v3d driver -# these images use. -pi_kiosk_force_mode: "" diff --git a/roles/pi_kiosk/handlers/main.yml b/roles/pi_kiosk/handlers/main.yml index a08305a..6ed99e1 100644 --- a/roles/pi_kiosk/handlers/main.yml +++ b/roles/pi_kiosk/handlers/main.yml @@ -4,9 +4,3 @@ name: "getty@tty1" state: restarted daemon_reload: "yes" - -- name: Warn that a reboot is needed - ansible.builtin.debug: - msg: >- - /boot/firmware/cmdline.txt changed - the forced display mode only takes effect - after a reboot. diff --git a/roles/pi_kiosk/tasks/main.yml b/roles/pi_kiosk/tasks/main.yml index 6e748b2..097c299 100644 --- a/roles/pi_kiosk/tasks/main.yml +++ b/roles/pi_kiosk/tasks/main.yml @@ -16,6 +16,23 @@ shell: /bin/bash create_home: true +- name: Own the directories X and Firefox write into + # Xorg runs as root here (Debian's wrapper, allowed_users=console) with HOME set to + # the kiosk user's, so it creates ~/.cache itself - root-owned and 0700 - the first + # time it writes a mesa shader cache. Firefox then cannot create ~/.cache/mozilla and + # gives up with "Your Firefox profile cannot be loaded. It may be missing or + # inaccessible". Creating these up front, owned by the user, means root only ever + # adds subdirectories to a directory the user already owns. + ansible.builtin.file: + path: "/home/{{ pi_kiosk_user }}/{{ item }}" + state: directory + owner: "{{ pi_kiosk_user }}" + group: "{{ pi_kiosk_user }}" + mode: "0700" + loop: + - .cache + - .mozilla + - name: Autologin the kiosk user on tty1 ansible.builtin.file: path: /etc/systemd/system/getty@tty1.service.d @@ -68,23 +85,3 @@ src: policies.json dest: /etc/firefox-esr/policies.json mode: "0644" - -- name: Read the current kernel command line - ansible.builtin.slurp: - src: /boot/firmware/cmdline.txt - register: pi_kiosk_cmdline - when: pi_kiosk_force_mode | length > 0 - -- name: Force a mode on the kiosk output - # cmdline.txt is a single line of space-separated parameters. Rebuild it by dropping - # any video= we set before and appending the current one, so changing the mode - # replaces it rather than stacking a second one. - ansible.builtin.copy: - dest: /boot/firmware/cmdline.txt - content: >- - {{ ((pi_kiosk_cmdline.content | b64decode).split() - | reject('match', '^video=') | list - + ['video=' ~ pi_kiosk_force_mode]) | join(' ') }} - mode: "0755" - when: pi_kiosk_force_mode | length > 0 - notify: Warn that a reboot is needed