Disable USB power in ubuntu

  • find list of usb
lsusb

ls /sys/bus/usb/devices
  • disable USB on startup
echo disabled | sudo tee /sys/bus/usb/devices/usb2/power/wakeup
  • Remove power from port
echo suspend | sudo tee /sys/bus/usb/devices/usb2/power/level
  • add power to port again
echo auto | sudo tee /sys/bus/usb/devices/usb2/power/level

https://askubuntu.com/questions/1338682/is-it-possible-to-disable-usb-port-with-known-physical-location

Let me recap for Linux >= 2.6.38: The file power/level is deprecated now; use power/control instead. (power/wakeup is ok.)

https://stackoverflow.com/questions/4702216/controlling-a-usb-power-supply-on-off-with-linux

apt install powertop
powertop

OpenMediaVault rsync – ubuntu

  • Edit the file /etc/default/rsync
RSYNC_ENABLE=inetd

#install
apt-get -y install xinetd
  • create /etc/xinetd.d/rsync
service rsync
{
    disable = no
    socket_type = stream
    wait = no
    user = root
    server = /usr/bin/rsync
    server_args = --daemon
    log_on_failure += USERID
    flags = IPv4
}
  • Create /etc/rsyncd.conf
max connections = 2
log file = /var/log/rsync.log
timeout = 300

[share]
comment = Public Share
path = /home/share
read only = no
list = yes
uid = 0
gid = 0
auth users = user
secrets file = /etc/rsyncd.secrets
cat /etc/rsyncd.secrets 

user1:user1

chmod 600 /etc/rsyncd.secrets
  • Restart
/etc/init.d/xinetd restart
  • Verify
home@home:~$ rsync user1@192.168.29.142::share
Password: 
drwxr-xr-x          4,096 2025/03/21 11:21:47 .
-rw-r--r--              0 2025/03/21 11:21:47 1.txt

bluetooth – bluetoothctl service on ubuntu

  • Check service status
systemctl status bluetooth.service


● bluetooth.service - Bluetooth service
     Loaded: loaded (/usr/lib/systemd/system/bluetooth.service; enabled; preset: enabled)
     Active: active (running) since Fri 2025-03-21 07:57:38 IST; 1min 18s ago
       Docs: man:bluetoothd(8)
   Main PID: 21633 (bluetoothd)
     Status: "Running"
      Tasks: 1 (limit: 76673)
     Memory: 1.1M (peak: 1.6M)
        CPU: 55ms
     CGroup: /system.slice/bluetooth.service
             └─21633 /usr/libexec/bluetooth/bluetoothd
  • Auto connect script for device when it’s on(add it to cronjob or create service)
#!/bin/bash

if [[ $(hcitool con | grep '00:1B:66:0F:XX:XX' | wc -l) != 1 ]]
then
    echo "connect 00:1B:66:0F:XX:XX" | bluetoothctl

else
    echo "Already connected to 00:1B:66:0F:XX:XX"
fi
  • For monitoring events on Bluetooth
root@home:~# bluetoothctl
bluetooth]# [NEW] Device F4:C8:8A:7F:xx:xx CP250003
[bluetooth]# hci0 type 7 discovering off
[bluetooth]# hci0 type 7 discovering on
[bluetooth]# hci0 type 7 discovering off
[bluetooth]# hci0 type 7 discovering on
[bluetooth]# [DEL] Device F4:C8:8A:7F:xx:xx CP250003
[bluetooth]# [NEW] Device F4:C8:8A:7F:xx:xx CP250003
[bluetooth]# hci0 type 7 discovering off
[bluetooth]# hci0 type 7 discovering on
[bluetooth]# [CHG] Device D0:49:7C:8F:xx:xx RSSI: 0xffffffab (-85)



list                                              List available controllers
show [ctrl]                                       Controller information
select <ctrl>                                     Select default controller
devices [Paired/Bonded/Trusted/Connected]         List available devices, with an optional property as the filter
system-alias <name>                               Set controller alias
reset-alias                                       Reset controller alias
power <on/off>                                    Set controller power
pairable <on/off>                                 Set controller pairable mode
discoverable <on/off>                             Set controller discoverable mode
discoverable-timeout [value]                      Set discoverable timeout
agent <on/off/auto/capability>                    Enable/disable agent with given capability
default-agent                                     Set agent as the default one
advertise <on/off/type>                           Enable/disable advertising with given type
set-alias <alias>                                 Set device alias
scan <on/off/bredr/le>                            Scan for devices
info [dev/set]                                    Device/Set information
pair [dev]                                        Pair with device
cancel-pairing [dev]                              Cancel pairing with device
trust [dev]                                       Trust device
untrust [dev]                                     Untrust device
block [dev]                                       Block device
unblock [dev]                                     Unblock device
remove <dev>                                      Remove device
connect <dev>                                     Connect device
disconnect [dev]                                  Disconnect device
menu <name>                                       Select submenu
version                                           Display version
quit                                              Quit program
exit                                              Quit program
help                                              Display help about this program
export                                            Print environment variables

Raspberry pi disk read/write speed test result – dd

https://pibenchmarks.com/

sudo curl https://raw.githubusercontent.com/TheRemote/PiBenchmarks/master/Storage.sh | sudo bash
root@lp-arm-1:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'Unlisted' 'SC'
product: 'EC1S5' 3.0

root@lp-arm-1:~# 

     Category                  Test                      Result     
HDParm                    Disk Read                 41.53 MB/sec             
HDParm                    Cached Disk Read          41.88 MB/sec             
DD                        Disk Write                11.3 MB/s                
FIO                       4k random read            3646 IOPS (14586 KB/s)   
FIO                       4k random write           620 IOPS (2481 KB/s)     
IOZone                    4k read                   8160 KB/s                
IOZone                    4k write                  1897 KB/s                
IOZone                    4k random read            6715 KB/s                
IOZone                    4k random write           2006 KB/s                

                          Score: 893                                         


==========================================================
root@lp-arm-2:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'SanDisk' 'SD'
product: 'SD32G' 8.5

root@lp-arm-2:~# 
     Category                  Test                      Result     
HDParm                    Disk Read                 38.89 MB/sec             
HDParm                    Cached Disk Read          37.33 MB/sec             
DD                        Disk Write                18.3 MB/s                
FIO                       4k random read            2692 IOPS (10771 KB/s)   
FIO                       4k random write           926 IOPS (3706 KB/s)     
IOZone                    4k read                   7577 KB/s                
IOZone                    4k write                  1803 KB/s                
IOZone                    4k random read            6164 KB/s                
IOZone                    4k random write           3204 KB/s                

                          Score: 1048                                        
                    

==========================================================
root@lp-arm-3:~# lshw -class disk  
  *-disk                    
       description: SCSI Disk
       product: Storage Device
       vendor: Mass
       physical id: 0.0.0
       bus info: scsi@0:0.0.0
       logical name: /dev/sda
       size: 447GiB (480GB)

root@lp-arm-3:~# 

     Category                  Test                      Result     
HDParm                    Disk Read                 31.01 MB/sec             
HDParm                    Cached Disk Read          29.69 MB/sec             
DD                        Disk Write                27.4 MB/s                
FIO                       4k random read            512 IOPS (2048 KB/s)     
FIO                       4k random write           2871 IOPS (11484 KB/s)   
IOZone                    4k read                   12668 KB/s               
IOZone                    4k write                  10282 KB/s               
IOZone                    4k random read            10202 KB/s               
IOZone                    4k random write           11744 KB/s               

                          Score: 2400                                        

=================================================
root@lp-arm-4:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'SanDisk' 'SD'
product: 'SD32G' 8.5

root@lp-arm-4:~#
     Category                  Test                      Result     
HDParm                    Disk Read                 39.28 MB/sec             
HDParm                    Cached Disk Read          35.07 MB/sec             
DD                        Disk Write                17.4 MB/s                
FIO                       4k random read            2967 IOPS (11869 KB/s)   
FIO                       4k random write           876 IOPS (3506 KB/s)     
IOZone                    4k read                   7180 KB/s                
IOZone                    4k write                  1844 KB/s                
IOZone                    4k random read            5824 KB/s                
IOZone                    4k random write           2350 KB/s                

                          Score: 942                                         
==================================================
root@pi5:~# mmc cid read /sys/block/mmcblk0/device
type: 'SD'
manufacturer: 'Transcend/Samsung' 'SM'
product: 'ED2S5' 3.0

root@pi5:~# 

     Category                  Test                      Result     
HDParm                    Disk Read                 42.00 MB/sec             
HDParm                    Cached Disk Read          80.31 MB/sec             
DD                        Disk Write                54.6 MB/s                
FIO                       4k random read            4227 IOPS (16911 KB/s)   
FIO                       4k random write           833 IOPS (3333 KB/s)     
IOZone                    4k read                   21831 KB/s               
IOZone                    4k write                  3226 KB/s                
IOZone                    4k random read            16273 KB/s               
IOZone                    4k random write           3229 KB/s                

                          Score: 2035  



  • DD command with 1GB
root@pi5:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 20.0689 s, 53.5 MB/s


root@lp-arm-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 117.843 s, 9.1 MB/s

root@lp-arm-2:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 72.3963 s, 14.8 MB/s

###########pi4 with old USB-to-SATA cable###########

root@lp-arm-3:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 39.0338 s, 27.5 MB/s

###########pi4 with new USB-to-SATA cable###########

pi@lp-arm-3:~ $ dd if=/dev/zero of=/tmp/test2.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 5.6486 s, 190 MB/s
#######################################################

root@lp-arm-4:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 183.551 s, 5.8 MB/s


[root@lp-k8control-1 ~]# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.1345 s, 96.4 MB/s

[root@lp-knode-1 ~]# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 9.51946 s, 113 MB/s


root@lp-proxmox-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 8.93593 s, 120 MB/s

home@home:~$ dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 1.69814 s, 632 MB/s

========Crucial 1000GB SSD with SATA USB 3.0 with laptop=====

home@home:~$ dd if=/dev/zero of=/media/home/backup-ssd1/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 3.08829 s, 348 MB/s

========Crucial 1000GB SSD with SATA USB 3.0 with pi5 ntfs=====


root@pi5:~# dd if=/dev/zero of=/media/home/backup-ssd1/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 4.16956 s, 258 MB/s

===========pi5===Sandisk-extreme=======================

root@pi5-sandisk:/home/pi# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 15.1769 s, 70.7 MB/s

===========pi5===Samsung evo plus=======================
root@lp-arm-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 20.0689 s, 53.5 MB/s

===========pi4===Sandisk-extreme=======================
root@lp-arm-4:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 28.8803 s, 37.2 MB/s

===========pi4===Samsung evo plus=======================
root@lp-arm-1:~# dd if=/dev/zero of=/tmp/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 30.305 s, 35.4 MB/s

============on pi4 NFS server 188============================

root@lp-knode-2:~# dd if=/dev/zero of=/mnt/nfs188/test1.img bs=1G count=1 oflag=dsync
1+0 records in
1+0 records out
1073741824 bytes (1.1 GB, 1.0 GiB) copied, 11.2499 s, 95.4 MB/s



More test ref:

rocky linux enable time sync – ntp timedatectl

[root@lp-knode-1 ~]# date
Tue Mar  4 19:32:46 IST 2025

[root@lp-knode-1 ~]# timedatectl
               Local time: Tue 2025-03-04 19:33:01 IST
           Universal time: Tue 2025-03-04 14:03:01 UTC
                 RTC time: Tue 2025-03-04 14:27:56
                Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: no
              NTP service: inactive
          RTC in local TZ: no


[root@lp-knode-1 ~]# timedatectl set-ntp on
[root@lp-knode-1 ~]# timedatectl status
               Local time: Tue 2025-03-04 20:00:13 IST
           Universal time: Tue 2025-03-04 14:30:13 UTC
                 RTC time: Tue 2025-03-04 14:30:13
                Time zone: Asia/Kolkata (IST, +0530)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

[root@lp-knode-1 ~]# date
Tue Mar  4 20:00:17 IST 2025

Crack zip lock password and passwd in linux

@home:~/Downloads$ zip-password-finder -i mahuli6.zip --minPasswordLen=6 --maxPasswordLen=6 --fileNumber=1 -c=d -w=12
Targeting file 'mahuli/mahuli-bg.jpg' within the archive
Archive encrypted with AES256 - expect a long wait time
Starting 12 workers to test passwords
Generating passwords with length from 6 to 6 for charset with length 10
0123456789
Starting search space for password length 6 (1000000 possibilities) 
Time elapsed: 2m 51s 256ms 948us 212ns
Password found:666666
unshadow /etc/passwd  /etc/shadow > pass.txt
user@home:~$ john pass.txt
user@home:~$ john pass.txt --show
abc1:11111111:1000:1000:abc1:/home/abc1:/bin/bash
abc2:22222222:1002:1002:,,,:/home/abc2:/bin/bash


user@home:~$ ls .john/
john.log  john.pot

Note: Don’t use simple password.

firefly-iii finance setup – home automation – Opensource

  • Docker compose setup

CSP error fix:

TRUSTED_PROXIES=**
services:
  app:
    image: fireflyiii/core:latest
    hostname: app
    container_name: firefly_iii_core
    restart: always
    volumes:
      - firefly_iii_upload:/var/www/html/storage/upload
    env_file: .env
    networks:
      - firefly_iii
    ports:
      - 80:8080
    depends_on:
      - db
  db:
    image: mariadb:lts
    hostname: db
    container_name: firefly_iii_db
    restart: always
    env_file: .db.env
    networks:
      - firefly_iii
    volumes:
      - firefly_iii_db:/var/lib/mysql
  cron:
    #
    # To make this work, set STATIC_CRON_TOKEN in your .env file or as an environment variable and replace REPLACEME below
    # The STATIC_CRON_TOKEN must be *exactly* 32 characters long
    #
    image: alpine
    restart: always
    container_name: firefly_iii_cron
    env_file: .env
    command: sh -c "
      apk add tzdata
      && ln -s /usr/share/zoneinfo/${TZ} /etc/localtime
      | echo \"0 3 * * * wget -qO- http://app:8080/api/v1/cron/REPLACEME;echo\" 
      | crontab - 
      && crond -f -L /dev/stdout"
    networks:
      - firefly_iii

volumes:
   firefly_iii_upload:
   firefly_iii_db:

networks:
  firefly_iii:
    driver: bridge

camera raspberry pi

raspistill -o image_$(date +%s).jpg -w 480 -h 360
root@lp-arm-4:~# raspistill -o image_$(date +%s).jpg -w 480 -h 360
mmal: Cannot read camera info, keeping the defaults for OV5647
mmal: mmal_vc_component_create: failed to create component 'vc.ril.camera' (1:ENOMEM)
mmal: mmal_component_create_core: could not create component 'vc.ril.camera' (1)
mmal: Failed to create camera component
mmal: main: Failed to create camera component
mmal: Only 76M of gpu_mem is configured. Try running "sudo raspi-config" and ensure that "memory_split" has a value of 128 or greater

/boot/firmware/config.txt add gpu_mem=128