Tuesday, December 22, 2020

Beware ! Minecraft Windows 10 Edition from Microsoft store

 To my knowledge there is no satisfactory solution to share a Minecraft Win 10 licence from MS Store on a Win10 Computer among different users with differen MS Store accounts.

No App Sharing as known from Apple or Google possible. 

The MS Solution is to buy the licence X-Times!

Not Cool!

Monday, October 19, 2020

Granting Access for non Root to GPIOs

https://stackoverflow.com/questions/30938991/access-gpio-sys-class-gpio-as-non-root



Anleitung dafür Rechte auf GPIOs zu setzen aus:
http://www.netzmafia.de/skripten/hardware/RasPi/RasPi_GPIO_Shell.html

Datei:
# /etc/udev/rules.d/80-gpio-noroot.rules
# Zugriff auf GPIO ohne root-Rechte ermoeglichen
#
# Gruppe aendern
SUBSYSTEM=="gpio", RUN+="/bin/chown -R root.gpio /sys/class/gpio"
SUBSYSTEM=="gpio", RUN+="/bin/chown -R root.gpio /sys/devices/virtual/gpio"
# Sticky-Bit setzen
SUBSYSTEM=="gpio", RUN+="/bin/chmod g+s /sys/class/gpio"
SUBSYSTEM=="gpio", RUN+="/bin/chmod g+s /sys/devices/virtual/gpio"
# Zugriffsrechte setzen
SUBSYSTEM=="gpio", RUN+="/bin/chmod -R ug+rw /sys/class/gpio"
SUBSYSTEM=="gpio", RUN+="/bin/chmod -R ug+rw /sys/devices/virtual/gpio"


#Jetzt müssen Sie nur noch den udev-Daemon von den Änderungen wissen lassen (beim nächsten Reboot passiert das dann automatisch):
sudo service udev restart
sudo udevadm trigger --subsystem-match=gpio

Iobroker zur Gruppe gpios hinzufügen:
sudo usermod -aG gpio iobroker



Nun ist folgendes passiert: 
Die Rechte auf die GPios wurden auf die Gruppe GPIO erweitert.
Dies wird bei jedem Boot wiederholt.
Der Nutzer Iobroker wurde dieser Gruppe hinzugefügt und kann nach einem Neustart nun die GPios schalten.


Saturday, September 26, 2020

Ubuntu Blocking Packages from update

 https://askubuntu.com/questions/18654/how-to-prevent-updating-of-a-specific-package

dpkg

Put a package on hold:

echo "<package-name> hold" | sudo dpkg --set-selections

Remove the hold:

echo "<package-name> install" | sudo dpkg --set-selections

Display the status of your packages:

dpkg --get-selections

apt

Hold a package:

sudo apt-mark hold <package-name>

Remove the hold:

sudo apt-mark unhold <package-name>

Show all packages on hold:

sudo apt-mark showhold

Saturday, August 15, 2020

postfix for raspi info

 I just installed Postfix on multiple raspis to be informed about updates, problems etc.

Any suggestions on how this could be done easier by e.g. collecting would be very much appreciated.


I started of with:

sudo apt install postfix:

  • Setup as satellite machine
  • Hostname unchanged
  • Relay or smarthost: put in your smtp
  • Everythin else default.

After that I've updated my /etc/aliases to reroute everything towards root and then towards my external mail adress:

postmaster:    root
nagios: root
root: admin@yourdomain.com


in the postfix Config file: /etc/postfix/main.cf I added:



smtp_sasl_auth_enable = yes
smtp_sasl_security_options = noanonymous
smtp_sasl_password_maps = hash:/etc/postfix/sasl_password
sender_canonical_maps = hash:/etc/postfix/sender_canonical
smtp_tls_security_level = encrypt


The  meaning of sender_canonical  is not clear as it seems redundant to the aliases:
www-data admin@yourdomain.com
root admin@yourdomain.com


the sasl_password file needs the input of your external relay or smarthost:

smtpserver:25  user:password


Be sure, the file ist only readable by its owner.


now:

sudo newalias    --> gets the aliases updated
 sudo postmap hash:/etc/postfix/sasl_password  && sudo postmap /etc/postfix/sender_canonical --> gets the files merged into postfix
sudo systemctl restart postfix -->  start with new config

If everything works you should be able to do this:
echo Hello!  Test! | mail -s Testmail admin@yourdomain.com



If it does not work due to the encryption or auth because missing Mech:
https://serverfault.com/questions/1008119/postfix-error-sasl-authentication-failed-cannot-authenticate-to-server-no-mec
try to install:
apt install libsasl2-modules


Friday, August 14, 2020

Nagios

Nagios installed following ....




Systems under surveillance need:

 sudo apt-get install nagios-nrpe-server nagios-plugins

 


nagios extension:

https://community.spiceworks.com/topic/275519-how-do-i-install-a-perl-script-into-nagios


Sunday, July 5, 2020

Raspi Temperaturmessung DS18B20 mit OWFS und Iobroker

I've looked through some tutorials. 
My Goal was to directly attach Ds18b20 Sensors to GPIO4 and to read via a mount Point into IOBroker.

First of all, do the Setup were you enable correct Interpretation on Raspi:
modprobe w1-gpio pullup=1
modprobe w1-therm

if all works well you make these Settings permanent by putting it into 
(old kernel versions)
# /etc/modules
w1-gpio pullup=1
w1-therm 
The same functionality should be achievable by putting the following in /boot/config.txt or better (ubuntu) /boot/Firmware/usercfg.txt dtoverlay=w1-gpio,gpioin=4,pullup=on
I suggest doing this in the end, if eventually everythin works

Install owfs and owserver:
sudo apt install owfs owserver

You should see the page on <Ip>:2121
If you enable the line with Server: fake in the /etc/owfs.conf file you should see fake sensors  on the webpage

Next Thing is wiring of the sensors. I'm not an expert. The following works for me:
Wire 4,7kOhm Resistor between 3,3 V VCC of Pi an GPIO4 Data Port
Wire VCC or + or red to 3,3V of the pi
Wire Gnd or - to Gnd on Pi
Wire Data to Pin 4 of Pi 

If you query dmesg you should see something like:
[  +0.024838] w1_master_driver w1_bus_master1: Attaching one wire slave 28.01193a3da276 crc e5
[  +0.007224] w1_master_driver w1_bus_master1: Family 28 for 28.01193a3da276.e5 is not registered.


install Iobroker Adapter owfs






Debugging:

High Speed USB @ Raspi4

https://www.youtube.com/watch?v=t0kYcM1E5fY&feature=youtu.be

Never heard of USAP but it seems interesting as ist faster an saves power from the first impression

Friday, June 26, 2020

Openhab and iobroker on same Linux Problem

Just saw, that frontail service for openhab serves on port 9001 which ist same as Iobroker internal imem Socket!

After disabling frontail iobroker was reachable again.

Sunday, June 7, 2020

USV / UPS an Raspi

Raspberrymatic: 
https://github.com/wolwin/WW-mySHT/blob/master/SHT_RM_Nut/RM-NUT_Client.md


Ich habe mich für die Vorgehensweise mit Nut entschlossen:




Nagios check_raid Bug for non Dm users:

since an update, the query for DM causes an error. Workaround for md Raid users is:
-p mdstat:

define command {
 command_name    check_raid
 command_line    /usr/lib/nagios/plugins/check_raid $ARG1$
}


define service{
    use                  generic-service
    host_name            localhost
    service_description  Linux RAID
    check_command        check_raid!-p mdstat!
    normal_check_interval  120
    retry_check_interval 5
}


Script extension:
https://unix.stackexchange.com/questions/164788/run-various-shell-commands-when-nut-reports-a-low-ups-battery

Friday, May 1, 2020

Swap File on an off Ubuntu

https://linuxize.com/post/how-to-add-swap-space-on-ubuntu-18-04/

Raspi 4 eeprom update

https://www.geeks3d.com/20191101/raspberry-pi-4-new-firmware-reduces-power-consumption-and-boards-temperatures/


vcgencmd measure_temp

Raspi Backup Ubuntu

straightforward approach with:
 dd if=/dev/mmcblk0 |gzip > /media/backup/2020_02_16_gzip_backup.gz



https://hobbyblogging.de/raspberry-pi-vollautomatisch-sichern



incremental file copy:
sudo rsync -avu --progress /media/BilderArchiv/ /media/Raid1_2/BilderArchiv/



Raspi3 change to usb boot

If the device fails to respond after this maximum timeout, it is possible to increase the timeout to five seconds using program_usb_boot_timeout=1 in config.txt



enable usb:

insert in cmdline.txt und boot up twice:
#enable usb boot

program_usb_boot_mode=1


Check for correct setting:

$ vcgencmd otp_dump | grep 17:
17:3020000a

Raspi3 Ubuntu vcgencmd missing

Following guide here:
https://wiki.ubuntu.com/ARM/RaspberryPi

Optional PPAs
While the official image includes compatible firmware, bootloader and kernel, there are a few packages available in an unofficial PPA (ppa:ubuntu-raspi2/ppa) which are useful on the Raspberry Pi, including:

libraspberrypi-bin - VideoCore utilities from https://github.com/raspberrypi/userland such as vcgencmd, raspistill, etc.

libraspberrypi-bin-nonfree - Binary VideoCore utilities not provided in the open source userland repository, currently vcdbg and edidparser.

xserver-xorg-video-fbturbo - An accelerated x.org video driver, though this is limited to hardware accelerated window moving/scrolling on the Raspberry Pi.

hello-dkms - Not strictly to do with the Raspberry Pi, but a small example DKMS project to test building kernel DKMS modules.

To install:


sudo add-apt-repository ppa:ubuntu-raspi2/ppa
sudo apt-get update
sudo apt install libraspberrypi-bin
Further/updated Raspberry Pi packages can be found in the Ubuntu Pi Flavour Maker PPA. Many of these packages rely on the user being a member of groups:




sudo groupadd -f --system gpio
sudo groupadd -f --system i2c
sudo groupadd -f --system input
sudo groupadd -f --system spi

Raspi Ubuntu Debugging

Let dmesg -w run
Let run top to see heavy loads
Let vgencmd
https://medium.com/@kevalpatel2106/monitor-the-core-temperature-of-your-raspberry-pi-3ddfdf82989f

nano monitor-temp.py

import os

import time

def measure_temp():

temp = os.popen("vcgencmd measure_temp").readline()

return (temp.replace("temp=",""))

while True:

print(measure_temp())

time.sleep(1)



python monitor-temp.py

Raspi3 B+ external SSD USB freezes and hangs

For some time I've tried to get my Raspi3+ext SSD Setup working. Currently I do a complete Backup via dd towards a NAS drive. The Image sizes are rougly about 100 GB.
between 2GB und 100 GB the Backup always crashes.
The SSD ist connected directly to the USB Port without additional Powersupply.

So far I've had the following errors:
<pre class="brush: csharp">// Comment
watchdog: BUG: soft lockup - CPU#2 stuck fpr 23s: [kworker/2:0:3391]
....
watchdog: BUG: soft lockup - CPU#2 stuck fpr 23s: [ksoftirqd/1:18]
...
watchdog: BUG: soft lockup - CPU#2 stuck fpr 23s: [swapper/2:0]
....
rcu: $1-...0: (2ticks this >GP) idle=......02 softirq=12313/123123 fqs=18361
...
cpufrq: __target_index: failed to change cpu frequency: -22
....
watchdog: BUG: soft lockup - CPU#2 stuck for 22s! [(d-logind):5635]
....
rcu sched kthread starved for 1233 jiffies
RCU grace period k-thread stack dump
</pre>


So far I've tested the following:

External Power Supply for ssd
Differen connector for SSD
USB Stick instead SSD
Backup from SSD to USB Stick
Backup from SSD to SD Card
Backup from USB Stick to SD Card

Everytime I get some kind of Kernel error, cpufreq error aso.

Next Step ist to test Raspbian instead of ubuntu.
Till now, raspbian was able to do a successfull backup to sd card in the same pi.
Next Step ist Backup to Network NAS.
If that works as well I'll try my ssd with Raspbian an Backup to NAS.

Actually, the only solution was a Raspbian native install on SSD. Everything works as perfect since then. qed.

Friday, April 3, 2020

Saturday, March 21, 2020

Raspi Ubuntu Raid 1

Raid 1 on ubuntu setup
https://ourcodeworld.com/articles/read/736/how-to-implement-a-software-raid-1-array-mirror-in-ubuntu-16-04


:/home/shares$ sudo mdadm --detail --scan

ARRAY /dev/md0 metadata=1.2 name=iOBroker1:0 UUID=ae338e6c:87421f87:56adea0f:e4e066c0

:/home/shares$ sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

ARRAY /dev/md0 metadata=1.2 name=iOBroker1:0 UUID=ae338e6c:87421f87:56adea0f:e4e066c0







debugging and getting info:

~$ sudo mdadm  -E /dev/sdc

/dev/sdc:

   MBR Magic : aa55

Partition[0] :   4294967295 sectors at            1 (type ee)

:~$ cat /proc/mdstat

Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]

md0 : active raid1 sdb[1] sda[0]

      244066432 blocks super 1.2 [2/2] [UU]

      bitmap: 0/2 pages [0KB], 65536KB chunk



Statusanzeige des Software-RAIDs
~# mdadm -D /dev/mdN


sudo mdadm -D /dev/md0

 sudo cat /etc/mdadm/mdadm.conf


regular error with mount.cifs -2 can relate to version being

Try options vers=1.0  or vers=2.0


Diagnose: 
cat /proc/mdstat


https://www.thomas-krenn.com/de/wiki/Mdadm_checkarray

Monday, March 9, 2020

Raspi 4GB problem Ubuntu

https://askubuntu.com/questions/94542/how-can-i-repair-my-installation



In the meantime, developers can use a temporary workaround to enable USB on the 4GB RAM version. The temporary solution will consist in editing the file /boot/firmware/usercfg.txt to limit RAM to 3GB, as follows:
https://ubuntu.com/blog/roadmap-for-official-support-for-the-raspberry-pi-4

total_mem=3072

Saturday, March 7, 2020

Samba CIFS Share ubuntu raspi

https://www.elektronik-kompendium.de/sites/raspberry-pi/2007071.htm


Setup like there:


Error:
Systemfehler 67 aufgetreten.

Der Netzwerkname wurde nicht gefunden.

came from the wrong path in /etc/samba\smb.conf



Check Status of Samba Access:
sudo smbstatus

Usage: [OPTION...]
  -p, --processes                    Show processes only
  -v, --verbose                      Be verbose
  -L, --locks                        Show locks only
  -S, --shares                       Show shares only
  -N, --notify                       Show notifies
  -u, --user=STRING                  Switch to user
  -b, --brief                        Be brief
  -P, --profile                      Do profiling
  -R, --profile-rates                Show call rates
  -B, --byterange                    Include byte range locks
  -n, --numeric                      Numeric uid/gid
  -f, --fast                         Skip checks if processes still exist

Help options:
  -?, --help                         Show this help message
      --usage                        Display brief usage message

Common samba options:
  -d, --debuglevel=DEBUGLEVEL        Set debug level
  -s, --configfile=CONFIGFILE        Use alternate configuration file
  -l, --log-basename=LOGFILEBASE     Base name for log files
  -V, --version                      Print version
      --option=name=value            Set smb.conf option from command line



Restart:
 testparm && sudo systemctl restart smbd & sudo systemctl restart nmdb



https://superuser.com/questions/740375/how-to-login-to-network-share-when-microsoft-account-is-tied-to-windows-login


5.12.2021:
Move to Docker:
https://alexlubbock.com/convert-samba-docker

Friday, February 21, 2020

hdparm

Drives are not suspended correctly
Removed -S in /lib/udev/hdparm in Line 44 in front of -B

Thursday, February 20, 2020

Linux Console automount

Found here: https://askubuntu.com/questions/342188/how-to-auto-mount-from-command-line udisksctl Listing available devices: udisksctl status Mounting is done via: udisksctl mount -b /dev/sdf or udisksctl mount -p block_devices/sdf Unmounting is done via: udisksctl unmount -b /dev/sdf or udisksctl unmount -p block_devices/sdf The object-path can be found out by doing: udisksctl dump Object of type org.freedesktop.UDisks2.Block seem to be valid as object-patch, the /org/freedesktop/UDisks2/ prefix has to be cut from the path for udisksctl to accept them.