Showing posts with label UBUNTU. Show all posts
Showing posts with label UBUNTU. Show all posts

Tuesday, December 13, 2022

Easy mount dd *.iso Image in ubuntu

 https://superuser.com/questions/117136/how-can-i-mount-a-partition-from-dd-created-image-of-a-block-device-e-g-hdd-u


losetup --partscan --find --show disk.img

mount /dev/loop0p1 /mnt

to free up loop0, use after umount:

losetup -d /dev/loop0

Saturday, April 2, 2022

Sunday, October 17, 2021

Ubuntu 20.04 sd card to usb drive complete move Raspi4

 So far the only suitable guide for moving an existing ubuntu 20.04. installation completely to USB boot:

https://www.instructables.com/Raspberry-Pi-4-USB-Boot-No-SD-Card/

Tuesday, January 19, 2021

Information on Linux systems live

 Process overview: top, htop, nmon

Disk/read/write: iotop -o -b -d 10

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

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.

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

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.



Sunday, December 8, 2019

IObroker in Homematic

Finally, after one year with Homematic IP and Homematic running via a Raspi and the ELV expansion module, I'll try to include more Raspis via iobroker into my automation.

Right now, the role or structure for accessing other Raspis GPios through Homematic IP is not clear to me. However I have the following idea:
Setup will be as follows:
- Rasberrymatic with ELV expansion and iobroker addin --> multihost slave
- Raspberry with some kind of ubuntu and iobroker installed --> multihost master



After some thinking I will got with an Iobroker installation on another PI only to test ioBroker.
Simulatneously I installed debmatic:
https://github.com/alexreinert/debmatic
on that pi and will try to link it to the first homematic as well as iobroker.


Next step with IOBroker on second PI was to install RPI extension as well as Vis.
RPI needs config in Instance Menu. If error with writing to certain block occurs,e.g.:
18309) Cannot evaluate: Filesystem 1K-blocks Used Available Use% Mounted on /dev/mmcblk0p2 7318052 4276676 2701448 62% / /1024


Then you probably need to uncheck the Raspberry Checkbox in RPI Config on IoBroker


Iobroker auf raspi 4 installieren
https://technikkram.net/2019/07/funktioniert-iobroker-auf-neuem-raspberry-pi-4-installieren



Io Broker move to new host:
https://forum.iobroker.net/topic/12365/raspberrypi-defekt-daten-retten/6


Break.
Iobroker went to new Raspi4 because of Memory consumption.
Debmatic ist out of discussion as well as running iobroker on the homematic pi.
Now I'm gonna link Iobroker on PI 1 to homematic on Pi 2 via Network.



Problems with radar2.plugin on Raspi3 Ubuntu:
 After reboot i get:
host.RelayPi12020-06-09 21:10:54.654errorCaught by controller[0]: at process._tickCallback (internal/process/next_tick.js:61:11) errno: 19, code: 'ENODEV', syscall: 'bind' }
host.RelayPi12020-06-09 21:10:54.653errorCaught by controller[0]: at process.nextTick (/opt/iobroker/node_modules/@abandonware/noble/lib/noble.js:60:24)
host.RelayPi12020-06-09 21:10:54.653errorCaught by controller[0]: at NobleBindings.init (/opt/iobroker/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:78:13)
host.RelayPi12020-06-09 21:10:54.652errorCaught by controller[0]: at Hci.init (/opt/iobroker/node_modules/@abandonware/noble/lib/hci-socket/hci.js:100:35)
host.RelayPi12020-06-09 21:10:54.652errorCaught by controller[0]: { Error: ENODEV, No such device


Issuing the following command:
sudo hciattach /dev/ttyAMA0 bcm43xx 921600

solves the error till next reboot.



Friday, March 23, 2012

KILE: Workaround for forward search in Windows

The KILE builtin functionality currently adds as space and "./" to the source file when clicking ForwardDVI under windows with the current KDE Windows release. I do not have this behavior in Linux Ubuntu 10.04 with latest patches installed.
Still, this annoys  me and I came up with a workaround for Windows:

You need:

  • Cygwin with sed installed
  • Okular (any other dvi viewer should do fine)


Generate a build command in Kile-> Settings -> Configure Kile --> Build which is exactly the same as ForwardDVI.
Than change this new command to the following:

Command: cmd
Options: /c open_okular.bat '%target'

This should call the batch file open_okular.bat within the DOS CMD shell and pass along the string containing everything you need for doing forward search.

Now place the following DOS CMD script in your TEX Project Root folder:
FILE open_okular.bat


echo "Start"
set PATH=%PATH%;c:\programdata\kde\bin\;c:\cygwin\bin\;c:\Users\<username>\kderoot\bin\
echo  %INPUT%
for /f %%a in ('echo %1 ^| sed.exe -e"s/ \.\///"') do set OUTPUT=%%a
@echo %OUTPUT%
okular.exe %OUTPUT% --unique
echo "End"

What the script does:
Line 2 updates your path so that okular.exe and sed.exe are known. Adjust paths appropriatley
Line 4 removes the " ./" in words: space dot slash; from the string and stores it in OUTPUT
Line 6 calls okular with the new string.


This should give you the forward search for Kile and Okular in Windows.
Adoptions to any other DVI viewer should be straight forward.
Adoptions to Linux should be easy as string manipulation is usually a lot easier.






KILE: Document Variables or Build wildcards

Document variables or Build wildcards of kile are not documented anywhere to my knowledge and I just found this POST which basically says the same!

So here is a quick overview copied from the site above:



The variables have the following meanings:
%source -> filename with suffix but without path <-> myBestBook.tex
%S -> filename without suffix but without path <-> myBestBook
%dir_base -> path of the source file without filename <-> /home/user/latex
%dir_target -> path of the target file without filename, same as %dir_base if 
no relative path has been set <-> /home/user/latex
%target -> target filename without path <-> without filename 


And these are special variables
%res <-> resolution of the quickpreview action set in configure 
kile->tools->preview


%AFL <-> List of all files in a project marked for archiving. You can set the 
archive flag in the "Files and projects" sidebar using the context menu.



Currently, my KILE setup is not using the correct way to call okular to jump to the correct line viewed as tex source. The wildcard %target produces the following output:

Target.dvi#source:120 Source.tex


However, there should not be a space between 120 and Source. Without this space it is working well from command line.
However I lack the variables for linenumber and source document and so I stuck. Any Ideas for solving this particular problem?