What does “doesn’t allow sudo” mean? Did you get an error that provided a reason? What exactly did you do?
What does “doesn’t allow sudo” mean? Did you get an error that provided a reason? What exactly did you do?
Don’t.
They know, the wanted to run xscreensaver though.
It’s really quite simple - but works pretty well. There are 3 components:
A simple systemd service that starts a kiosk script.
[Unit]
Description=Kiosk
Wants=graphical.target
After=graphical.target
[Service]
Environment=DISPLAY=:0.0
Environment=XAUTHORITY=/home/pi/.Xauthority
Type=simple
ExecStart=/bin/bash /home/pi/kiosk.sh
Restart=on-abort
User=pi
Group=pi
[Install]
WantedBy=graphical.target
The script in /home/pi/kiosk.sh just starts a web browser in full-screen mode pointed at my home assistant instance:
#!/bin/bash
xset s noblank
xset s off
xset -dpms
export DISPLAY=:0.0
echo 0 > /sys/class/backlight/rpi_backlight/bl_power
LANDING_PAGE="https://homeassistant.example.com/"
unclutter -idle 0.5 -root &
/usr/bin/chromium-browser --noerrdialogs --disable-infobars --kiosk $LANDING_PAGE
I have a very simple python/flask service that runs and exposes an endpoint that lets you turn on/off the display. It’s called by a homeassistant automation for when the motion detector senses or hasn’t sensed movement.
Here’s the python - I have this started from another “kiosk.service” systemd service as well.
#!/usr/bin/env python3
import subprocess
from flask import Flask
from flask_restful import Api, Resource
def turn_off_display():
with(open(backlight_dev, 'w')) as dev:
dev.write("1")
def turn_on_display():
with(open(backlight_dev, 'w')) as dev:
dev.write("0")
class DisplayController(Resource):
def get(self, state):
if state == 'off':
turn_off_display()
elif state == 'on':
turn_on_display()
else:
return {'message': f'Unknown state {state} - should be off/on'}, 500
return {"message": "Success"}
def init():
turn_on_display()
if __name__ == "__main__":
init()
app = Flask(__name__)
api = Api(app)
api.add_resource(DisplayController, '/display/<string:state>')
app.run(debug=False, host='0.0.0.0', port=3000)
You can then have the HA rest action call this with “http://pidisplay:3000/display/on” or off.
You don’t normally “listen” on an IP address
You can bind to an IP when you open a port, it lets you limit your listening to a particular device if there are more than one interfaces. 0.0.0.0 means to listen on “all available” devices.
For apt to install a local file I think you need either a fully qualified path or to use “./” at the start for a relative path.
So “./$1/opensnitch_${1}_amd64.deb”
apt install 1.6.5/opensnitch_1.6.5_amd64.deb 1.6.5/python3-opensnitch-ui_1.6.5_all.deb
Edit: Here’s a better example of what I think you would want:
#!/bin/bash
# Often good to assign a numbered parameter to a variable
VER="${1}"
apt install "./${VER}/opensnitch_${VER}_amd64.deb" "./${VER}/python3-opensnitch-ui_${VER}_all.deb"
Also - when debugging bash scripts it’s often helpful to just put “echo” before the line you’re questioning to see what exactly is being run. e.g.:
#!/bin/bash
VER="${1}"
echo apt install "./${VER}/opensnitch_${VER}_amd64.deb" "./${VER}/python3-opensnitch-ui_${VER}_all.deb"
That will show the the command that would have run rather than running it, then you can inspect it for errors and even copy/paste it to run it by hand.
In VisualBasic “true” would be represented as -1 when converted to an int because it’s all 1’s in twos complement.
It’s one of these. I don’t know the chip but I haven’t had any issues with false positives. If anything they’re slightly under sensitive, but not enough to be a deal breaker for my purposes.
I used to do this frequently “back in the day”…
dd will create a complete bit-for-bit copy of the drive and put its contents into a file. All the way down to the boot sector, partitions, etc. Filesystem doesn’t even matter a little.
I used to do something like “dd /dev/sda bs=1M | nc remote.server 1234” and then on the remote server “nc -l 1234 -p > file.img </dev/null”. I was swapping back and forth between Linux and Windows on a work laptop that I was using for non-work related things on the weekend, at conferences, etc.
Wasn’t perhaps my most intelligent moment, but it worked!
Much simpler than that - The motion sensors are zigbee and integrated with HomeAssistant. I have a HA automation that sends a REST call to a webservice I wrote on the PI that then just needs to write 1 or 0 to /sys/class/backlight/rpi_backlight/bl_power.
I’ve got a RPI running a full-screen ‘kiosk’ view from homeassitant that turns an external display on/off based on a motion sensor.
So basically it’s showing current temperatures, thermostat control, etc. but I have the display turn off after X minutes of no movement and turn on when there has been movement so it’s only on when you’re in the room.
I have an alias set up and SDKs enabled. The experience is indistinguishable from a regular install.
That’s not indistinguishable - that’s you working around the problem of running flatpak run some.domain.IForget
(which - BONUS is case sensitive which is awesome) to run neovim.
Snaps install a binary you can run. Flatpaks make you remember the 3 part domain to run things. So you setup aliases after installing things to run them, and if you uninstall them you need to remove your aliases. It’s a complete own-goal by the flatpak developers that this mess exists and is completely unnecessary. Simply providing an option to create and manage a script in .local/bin or something would be all it takes to make flatpaks usable from the CLI in a way that isn’t obnoxious.
Running cli apps like neo vim from a flatpak is frustrating… “flatpak run com.something.neovim” is just the worst way to handle things. Complete deal breaker.
I don’t want an OS designed for idiots - that’s what IOS is and it’s a shitty walled-garden because it has to be.
I mean - IOS exists for you friend. It’s not a superiority thing, it’s that you’re trying to use the wrong OS. Back to the walled garden. It’s safe there.
And if you want to whine about needing to type and use a CLI then you can fuck right off back to IOS.
It’s not though. I’m not saying they can’t try to use it, but they’re looking for “free Windows” not “Linux”.
I’ve heard this complaint since the '90s. Linux has continued to grow and thrive as a “real usable option” in that time.
If you want stupid-user friendly Linux experience get a tablet with Android on it.
Yes you should. It’s part of what makes Linux Linux.
But what does. Be specific. Are you prompted on the CLI or is there a pop-up window that you’re entering credentials into?