From f8ca4480569e60ec114dd1ee8400f8bd4e54d0a4 Mon Sep 17 00:00:00 2001 From: ABelliqueux Date: Tue, 9 Apr 2024 14:07:25 +0200 Subject: [PATCH] Fix apt command --- diagramme.svg | 12 +- linux_server_deploy.sh | 4 +- prepa_rpios.md | 313 ++++++++++++++++++++++++++++++++++++++++- 3 files changed, 318 insertions(+), 11 deletions(-) diff --git a/diagramme.svg b/diagramme.svg index c3827b4..eb2c1e4 100644 --- a/diagramme.svg +++ b/diagramme.svg @@ -7,7 +7,7 @@ viewBox="0 0 297 210" version="1.1" id="svg5" - inkscape:version="1.2.1 (9c6d41e410, 2022-07-14)" + inkscape:version="1.2.1 (9c6d41e410, 2022-07-14, custom)" xml:space="preserve" sodipodi:docname="diagramme.svg" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" @@ -28,8 +28,8 @@ shape-rendering="auto" showguides="true" inkscape:zoom="1.1011145" - inkscape:cx="560.79545" - inkscape:cy="475.4274" + inkscape:cx="561.70362" + inkscape:cy="476.33557" inkscape:window-width="1920" inkscape:window-height="1043" inkscape:window-x="0" @@ -294,12 +294,12 @@ style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:4.23333px;font-family:Sans;-inkscape-font-specification:'Sans, Normal';font-variant-ligatures:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-east-asian:normal;fill:#000000;stroke:none;stroke-width:1.05833px" x="182.77737" y="170.53987" - id="tspan6454">- commandes systèmes (reboot, extinctions, clign.)- commandes systèmes (reboot, extinction, clign.)- synchro fichiers config, medias- synchro fichiers config, medias via http_upload(rsync ?) : rsync, scp : = 248 (2021-03)](https://github.com/systemd/systemd/blob/28795f2c138203fb700fc394f0937708af886116/NEWS#L2809), you can [start a user unit as root](https://www.freedesktop.org/software/systemd/man/systemctl.html#-M), i.e ; +using `sudo systemctl` or in a root shell, with e.g: + +`sudo systemctl --user --machine USERNAME@ start foo.service` + +On prior versions, you have to use either +`su - USERNAME -c 'systemctl --user start foo.service'` or +`runuser -l USERNAME -c 'systemctl --user start foo.service'` instead. + +## 3. inotifywait : watch for a file's creation/deletion + +### Install the tool : + +`sudo apt-get install inotify-tools` + +### Create the script : + +In '~/vlc_gui.sh' : + +```bash +#!/usr/bin/env bash + +inotifywait -m /tmp -e create -e delete | +while read directory action file; do + if [[ "$file" == ".vlc_gui" ]]; then + if [[ "$action" == "CREATE" ]]; then + echo "Starting VLC GUI." + # Start X environment on tty7 + DISPLAY=:0 startx -- vt7 & + elif [[ "$action" == "DELETE" ]]; then + echo "Killing VLC GUI" + pkill vlc + fi + fi +done +``` + +Don't forget to set execution bit : `sudo chmod +x ~/vlc_gui.sh` + +## 4. Minimal X environment & Launching VLC + +Install the following packages : + +`sudo apt-get install -y --no-install-recommends --no-install-suggests xinit xserver-xorg xserver-xorg-core xserver-xorg-input-evdev xserver-xorg-input-kbd openbox feh` + +### Xinit config + +We start the X environment with `startx`, which sources "~/.xinitrc". +Let's start openbox session there. + +`cp /etc/X11/xinit/xinitrc ~/.xinitrc` + +Then in "~/.xinitrc" : +```bash +#!/bin/sh + +# /etc/X11/xinit/xinitrc +# +# global xinitrc file, used by all X sessions started by xinit (startx) + +# invoke global X session script +. /etc/X11/Xsession +exec openbox-session +``` + +Set execution bit : + +`sudo chmod +x ~/.xinitrc` + +### Openbox configuration + +Now Openbox config files are in '~/.config/openbox' and there are two of them : + +#### autostart.sh + +In '~/.config/openbox/autostart.sh' : +```bash +#!/bin/bash + +# Exit openbox when VLC is closed +vlc --vout=gles2 && openbox --exit +# on rpi with 3d kms driver, can be --vout=drm_vout +``` + +Set execution bit : + +`sudo chmod +x ~/.config/openbox/autostart.sh` + +#### rc.xml + +`cp /etc/xdg/openbox/rc.xml ~/.config/openbox/` + +We want the VLC gui launching fullscreen, with no window decoration. +In openbox's [](http://openbox.org/wiki/Help:Applications) section of '~/.config/openbox/rc.xml', l.656, add: + +```markup + + no + yes + +``` + +## Troubleshooting + +### Udev rules + +You can increase udev's log verbosity with `sudo udevadm control --log-priority=debug` +then run `journalctl -f` to see if an error message comes up when plugging/unplugging the USB HID. + +### Xserver + +You can see what's going on by launching `journalctl -f` in a SSH session, then plug/unplug the USB HID. +If you encounter an error with the X server complaining about permission to tty7 like this + +``` +(EE) xf86OpenConsole: Cannot open virtual console 7 (Permission denied) +``` + +try rebooting. + +### Slow mouse cursor + +If you experience laggy mouse cursor movements, you can try adding `usbhid.mousepoll=0` to '/boot/cmdline.txt'. + +Other values you might want to try are : + + | value | speed | + | :-: | :-: | + | 0 | device request | + | X | 1000/X Hz | + + source: [https://peppe8o.com/fixing-slow-mouse-with-raspberry-pi-os/](https://peppe8o.com/fixing-slow-mouse-with-raspberry-pi-os/) + + +## Systemd unit : run unit every X seconds with timer + +/etc/systemd/system/nvlc.service +/etc/systemd/system/nvlc.timer + +In '.config/systemd/user/nvlc.service' : +``` +[Unit] +Description=VLC Ncurse UI service + +[Service] +Type=oneshot +#User=pil +WorkingDirectory=/home/pil/ +ExecStart=/home/pil/vlc_gui.sh +#ExecStart=/usr/bin/nvlc -I ncurses --no-osd --file-caching=5000 + +[Install] +WantedBy=default.target +``` + +In '.config/systemd/user/nvlc.timer' : +```[Unit] +Description=NVLC test + +[Timer] +OnUnitActiveSec=10s +OnBootSec=10s + +[Install] +WantedBy=timers.target +``` + +then to start timer : + +``` +systemctl --user start nvlc.timer +``` + +list timers : + +``` +systemctl --user list-timers --all +``` + +## Timedate + +To sync time/date , add dns to '/etc/resolv.conf', then +``` +sudo timedatectl +``` + +systemd unit : + +``` +systemctl status systemd-timesyncd +```