[GH-ISSUE #52] Wayfire Replaced - Do we know how the new environment works with the script now? #50

Closed
opened 2026-03-03 11:13:42 +03:00 by kerem · 14 comments
Owner

Originally created by @andiohn on GitHub (Oct 29, 2024).
Original GitHub issue: https://github.com/debloper/xiosk/issues/52

I'm going to test it, but I was curious if we have some changes to make.

Originally created by @andiohn on GitHub (Oct 29, 2024). Original GitHub issue: https://github.com/debloper/xiosk/issues/52 I'm going to test it, but I was curious if we have some changes to make.
kerem 2026-03-03 11:13:42 +03:00
Author
Owner

@gjobin commented on GitHub (Oct 29, 2024):

Of course they will replace it just in time for my first setup! First time messing with a RPi and been struggling to understand why it was not working. Now I know. Watching this issue. TY.

<!-- gh-comment-id:2445208743 --> @gjobin commented on GitHub (Oct 29, 2024): Of course they will replace it just in time for my first setup! First time messing with a RPi and been struggling to understand why it was not working. Now I know. Watching this issue. TY.
Author
Owner

@gjobin commented on GitHub (Oct 29, 2024):

I was able to make it launch at startup with this :
sudo echo "~/piosk/scripts/browser.sh" > ~/.config/labwc/autostart

<!-- gh-comment-id:2445275732 --> @gjobin commented on GitHub (Oct 29, 2024): I was able to make it launch at startup with this : `sudo echo "~/piosk/scripts/browser.sh" > ~/.config/labwc/autostart`
Author
Owner

@debloper commented on GitHub (Oct 30, 2024):

No changes would be needed if you stick with wayfire. But, that's swimming against the tide, and not a long term strategy.

We're better off changing the approach of how the browser & keyboard toggle is autostarted. Here's my proposal (feel free to share alternative ideas): #53

<!-- gh-comment-id:2446515097 --> @debloper commented on GitHub (Oct 30, 2024): No changes would be needed if you stick with wayfire. But, that's swimming against the tide, and not a long term strategy. We're better off changing the approach of how the browser & keyboard toggle is autostarted. Here's my proposal (feel free to share alternative ideas): #53
Author
Owner

@kwetiaw-goreng commented on GitHub (Nov 20, 2024):

the above command didnt work for me. what worked for me though,
sudo raspi-config > select option 6 > A6 > W2 Wayfire > Ok and reboot
After reboot, it launched great!
However, the webui to change the URL is not working, not sure what i can do to fix that though. For now I can manually update the config file.
Hope that helps anyone

<!-- gh-comment-id:2487909893 --> @kwetiaw-goreng commented on GitHub (Nov 20, 2024): the above command didnt work for me. what worked for me though, sudo raspi-config > select option 6 > A6 > W2 Wayfire > Ok and reboot After reboot, it launched great! However, the webui to change the URL is not working, not sure what i can do to fix that though. For now I can manually update the config file. Hope that helps anyone
Author
Owner

@tismofied commented on GitHub (Nov 28, 2024):

the above command didnt work for me. what worked for me though, sudo raspi-config > select option 6 > A6 > W2 Wayfire > Ok and reboot After reboot, it launched great! However, the webui to change the URL is not working, not sure what i can do to fix that though. For now I can manually update the config file. Hope that helps anyone

same exact issue here. the gui worked first boot then broke after reboot.

what's the location of the config file to add sites manually?

<!-- gh-comment-id:2506577153 --> @tismofied commented on GitHub (Nov 28, 2024): > the above command didnt work for me. what worked for me though, sudo raspi-config > select option 6 > A6 > W2 Wayfire > Ok and reboot After reboot, it launched great! However, the webui to change the URL is not working, not sure what i can do to fix that though. For now I can manually update the config file. Hope that helps anyone same exact issue here. the gui worked first boot then broke after reboot. what's the location of the config file to add sites manually?
Author
Owner

@debloper commented on GitHub (Nov 28, 2024):

what's the location of the config file to add sites manually?

~/piosk/config.json

Seems like instead of starting nodejs with rc.local script, we should use systemd service unit. That's what breaking nodejs apparently. A lot of people complained about rc.local breaking after updates.

<!-- gh-comment-id:2506641338 --> @debloper commented on GitHub (Nov 28, 2024): > what's the location of the config file to add sites manually? `~/piosk/config.json` Seems like instead of starting `nodejs` with `rc.local` script, we should use systemd service unit. That's what breaking nodejs apparently. A lot of people complained about `rc.local` breaking after updates.
Author
Owner

@timb33 commented on GitHub (Dec 2, 2024):

what's the last known working rpi OS, that will work as described on the main page? latest 24-11-19 32/64 bit versions don't work. thanks

<!-- gh-comment-id:2512980105 --> @timb33 commented on GitHub (Dec 2, 2024): what's the last known working rpi OS, that will work as described on the main page? latest 24-11-19 32/64 bit versions don't work. thanks
Author
Owner

@timb33 commented on GitHub (Dec 3, 2024):

kwetiaw-goreng
sudo raspi-config > select option 6 > A6 > W2 Wayfire > Ok and reboot

this worked for me too (thanks). To get the portal working again, I reran the curl script, which starts the portal. I have to do that every time I change config, but this is workable for me.

actually, every time the script is run, a new entry is added to the startup file. So, the script's not idempotent, and you end up with multiple instances started?

<!-- gh-comment-id:2514175335 --> @timb33 commented on GitHub (Dec 3, 2024): > [kwetiaw-goreng](/kwetiaw-goreng) _sudo raspi-config > select option 6 > A6 > W2 Wayfire > Ok and reboot_ this worked for me too (thanks). To get the portal working again, I reran the curl script, which starts the portal. I have to do that every time I change config, but this is workable for me. actually, every time the script is run, a new entry is added to the startup file. So, the script's not idempotent, and you end up with multiple instances started?
Author
Owner

@SpiraMirabilis commented on GitHub (Dec 15, 2024):

The piosk needs to use systemd to manage its three scripts that are running.
I'm not really interested in actually submitting a PR but this is how you would do it:

Here is an example of a systemd service that should be used instead of the way piosk currently sets itself up to be autorun:

install in /etc/systemd/system/ and then run sudo systemctl daemon-reload, sudo systemctl enable piosk-browser and sudo systemctl start piosk-browser (repeat for other two)

piosk-browser.service

[Unit]
Description=Run piosk 'browser.sh' to launch chromium
After=default.target

[Service]
Type=simple
ExecStartPre=/usr/bin/sleep 5
ExecStart=/bin/bash /home/pi/piosk/scripts/browser.sh
WorkingDirectory=/home/pi
User=pi
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
Environment=XDG_RUNTIME_DIR=/run/user/1000
Restart=on-failure

[Install]
WantedBy=graphical.target


Note that it has a small sleep delay before the service fires, and it depends on graphical.target so it will launch (with a delay) after the GUI comes up, and it hijacks the pi user's environmental variables for the X display adapter. Note that this will only work if the user is named "pi".

If you configured the raspberry pi user with a different username then you'd have to adjust this. The savvy developer could include these three files as a template in the install script and then use sed to add in the actual user name so that it would always work.

You'd need a seperate version of this for the switcher.sh and also one to run the index.js if you wanted it to switch tabs and have the webserver running, here are the ones I used:

piosk-switcher.service

[Unit]
Description=Run piosk 'switcher.sh' to switch tabs
#After=piosk-browser.service
#Requires=piosk-browser.service

[Service]
Type=simple
ExecStartPre=/usr/bin/sleep 30
ExecStart=/bin/bash /home/pi/piosk/scripts/switcher.sh
WorkingDirectory=/home/pi
User=pi
Environment=DISPLAY=:0
Environment=XAUTHORITY=/home/pi/.Xauthority
Environment=XDG_RUNTIME_DIR=/run/user/1000
Restart=on-failure
RestartSec=5

[Install]
WantedBy=graphical.target


piosk-webserver.service

[Unit]
Description=Run piosk webserver

[Service]
Type=simple
ExecStartPre=/usr/bin/sleep 5
ExecStart=/usr/bin/node /home/pi/piosk/index.js
WorkingDirectory=/home/pi/piosk
User=root
Restart=on-failure

[Install]
WantedBy=graphical.target


Ideally you should have three of these, including one to run your index.js. Putting things in rc.local is ugly, there is no functionality to restart it if it fails and a bunch of other things.

This will solve the "after X hours the piosk stops switching tabs" issue which is undoubtedly the switcher.sh script failing for some random reason or another, but systemd will automatically restart it as long as "browser.sh" is running.

Edit: I removed the After/Requires section in piosk-switcher.service as this seems to get hung up on boot often and just replaced it with a 30 second delay and hoping for the best, which seems to work well!

<!-- gh-comment-id:2544210145 --> @SpiraMirabilis commented on GitHub (Dec 15, 2024): The piosk needs to use systemd to manage its three scripts that are running. I'm not really interested in actually submitting a PR but this is how you would do it: Here is an example of a systemd service that should be used instead of the way piosk currently sets itself up to be autorun: install in /etc/systemd/system/ and then run sudo systemctl daemon-reload, sudo systemctl enable piosk-browser and sudo systemctl start piosk-browser (repeat for other two) piosk-browser.service --- [Unit] Description=Run piosk 'browser.sh' to launch chromium After=default.target [Service] Type=simple ExecStartPre=/usr/bin/sleep 5 ExecStart=/bin/bash /home/pi/piosk/scripts/browser.sh WorkingDirectory=/home/pi User=pi Environment=DISPLAY=:0 Environment=XAUTHORITY=/home/pi/.Xauthority Environment=XDG_RUNTIME_DIR=/run/user/1000 Restart=on-failure [Install] WantedBy=graphical.target --- Note that it has a small sleep delay before the service fires, and it depends on graphical.target so it will launch (with a delay) after the GUI comes up, and it hijacks the pi user's environmental variables for the X display adapter. Note that this will only work if the user is named "pi". If you configured the raspberry pi user with a different username then you'd have to adjust this. The savvy developer could include these three files as a template in the install script and then use sed to add in the actual user name so that it would always work. You'd need a seperate version of this for the switcher.sh and also one to run the index.js if you wanted it to switch tabs and have the webserver running, here are the ones I used: piosk-switcher.service --- [Unit] Description=Run piosk 'switcher.sh' to switch tabs #After=piosk-browser.service #Requires=piosk-browser.service [Service] Type=simple ExecStartPre=/usr/bin/sleep 30 ExecStart=/bin/bash /home/pi/piosk/scripts/switcher.sh WorkingDirectory=/home/pi User=pi Environment=DISPLAY=:0 Environment=XAUTHORITY=/home/pi/.Xauthority Environment=XDG_RUNTIME_DIR=/run/user/1000 Restart=on-failure RestartSec=5 [Install] WantedBy=graphical.target --- piosk-webserver.service --- [Unit] Description=Run piosk webserver [Service] Type=simple ExecStartPre=/usr/bin/sleep 5 ExecStart=/usr/bin/node /home/pi/piosk/index.js WorkingDirectory=/home/pi/piosk User=root Restart=on-failure [Install] WantedBy=graphical.target --- Ideally you should have three of these, including one to run your index.js. Putting things in rc.local is ugly, there is no functionality to restart it if it fails and a bunch of other things. This will solve the "after X hours the piosk stops switching tabs" issue which is undoubtedly the switcher.sh script failing for some random reason or another, but systemd will automatically restart it as long as "browser.sh" is running. Edit: I removed the After/Requires section in piosk-switcher.service as this seems to get hung up on boot often and just replaced it with a 30 second delay and hoping for the best, which seems to work well!
Author
Owner

@debloper commented on GitHub (Dec 18, 2024):

@SpiraMirabilis you've already done the hard work, just go ahead and send a PR... That'd be great!

As I've said in some other issue... I will only get time by the last week of December (or early January), to clear my GitHub backlogs, depending on how many issues has Santa piled up for me.

<!-- gh-comment-id:2552249182 --> @debloper commented on GitHub (Dec 18, 2024): @SpiraMirabilis you've already done the hard work, just go ahead and send a PR... That'd be great! As I've said in some other issue... I will only get time by the last week of December (or early January), to clear my GitHub backlogs, depending on how many issues has Santa piled up for me.
Author
Owner

@SpiraMirabilis commented on GitHub (Dec 19, 2024):

@debloper I went ahead and did so. I had to re-write the setup.sh and cleanup.sh completely. In this new version the piosk package installs itself in and runs from /opt/piosk rather than ~/piosk. if you want to change that, feel free.

<!-- gh-comment-id:2555701138 --> @SpiraMirabilis commented on GitHub (Dec 19, 2024): @debloper I went ahead and did so. I had to re-write the setup.sh and cleanup.sh completely. In this new version the piosk package installs itself in and runs from /opt/piosk rather than ~/piosk. if you want to change that, feel free.
Author
Owner

@alexjv89 commented on GitHub (Dec 31, 2024):

Just a thought: these scripts can also be run via pm2. I feel this is simpler, as nodejs is already installed.

as part of setup:

# install pm2 globally
sudo npm install pm2 -g 

# Start the browser service and switcher service
pm2 start /home/cf_pi5/piosk/scripts/browser.sh --name "browser" --interpreter bash
pm2 start /home/cf_pi5/piosk/scripts/switcher.sh --name "switcher" --interpreter bash

# Save this processes to startup
pm2 save
# will save in /home/cf_pi5/.pm2/dump.pm2

# To make it start on system boot
pm2 startup

running pm2 startup will give you instructions to setup pm2 on boot specific to your system.

[PM2] Init System found: systemd
[PM2] To setup the Startup Script, copy/paste the following command:
sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u cf_pi5 --hp /home/cf_pi5

copy paste execute that and you are good to go.

pm2 unstartup systemd - use this to cancel pm2 from running on boot.

<!-- gh-comment-id:2566297815 --> @alexjv89 commented on GitHub (Dec 31, 2024): Just a thought: these scripts can also be run via [pm2](https://pm2.keymetrics.io/). I feel this is simpler, as nodejs is already installed. as part of setup: ```shell # install pm2 globally sudo npm install pm2 -g # Start the browser service and switcher service pm2 start /home/cf_pi5/piosk/scripts/browser.sh --name "browser" --interpreter bash pm2 start /home/cf_pi5/piosk/scripts/switcher.sh --name "switcher" --interpreter bash # Save this processes to startup pm2 save # will save in /home/cf_pi5/.pm2/dump.pm2 # To make it start on system boot pm2 startup ``` running `pm2 startup` will give you instructions to setup pm2 on boot specific to your system. ``` [PM2] Init System found: systemd [PM2] To setup the Startup Script, copy/paste the following command: sudo env PATH=$PATH:/usr/bin /usr/lib/node_modules/pm2/bin/pm2 startup systemd -u cf_pi5 --hp /home/cf_pi5 ``` copy paste execute that and you are good to go. `pm2 unstartup systemd` - use this to cancel pm2 from running on boot.
Author
Owner

@SpiraMirabilis commented on GitHub (Dec 31, 2024):

Since pm2 uses systemd itself, this is just using systemd with extra steps and extra points of failure, though?

<!-- gh-comment-id:2566317109 --> @SpiraMirabilis commented on GitHub (Dec 31, 2024): Since pm2 uses systemd itself, this is just using systemd with extra steps and extra points of failure, though?
Author
Owner

@alexjv89 commented on GitHub (Dec 31, 2024):

hmmm, I guess it's a familiarity thing then - "What library are you more familiar with?". I am sure there are equivalents to pm2 logs switcher & pm2 monit via systemd. I dont have strong opinions about this.

<!-- gh-comment-id:2566324153 --> @alexjv89 commented on GitHub (Dec 31, 2024): hmmm, I guess it's a familiarity thing then - "What library are you more familiar with?". I am sure there are equivalents to `pm2 logs switcher` & `pm2 monit` via systemd. I dont have strong opinions about this.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/xiosk#50
No description provided.