Friday, March 11, 2022

Debian Bullseyes: installing & configure brightness control on Xfce4

 

You need to install:

  1. brightnessctl
  2. grub-customizer
  3. xfce4-power-manager   

# apt-get install brightnessctl grub-customizer xfce4-power-manager   

From Applications -> Settings -> Grub Customizer

  1. Open General settings
  2. At kernel parameters append acpi_backlight=video
    for example "quiet acpi_backlight=video"
  3. Save and restart.

You can choose only one from these options:

  • acpi_backlight=vendor
  • acpi_backlight=video
  • acpi_backlight=native
  • acpi_backlight=none

You can change your brightness from Power Manager Plugin in Xfce4.

Note: after make any change, restart your Debian

Tested on

  • Asus K45DR AMD A8 Series
  • Debian 11.2
  • linux-image 5.15.0-0.bpo.3-amd64

Tuesday, November 9, 2021

Debian Bullseyes: installing zoneminder (1.34.23-1)

 

Requirements:

  • MariaDB
  • Apache2

Installing packages

# apt-get install zoneminder apache2 mariadb-server-10.5 mariadb-client-10.5 php php7.4 libapache2-mod-php7.4 php7.4-mysql

# chown www-data:www-data /usr/share/zoneminder/ -R

# chown root:www-data /etc/zm/ -R

# a2enmod cgi

# a2enmod rewrite

# a2enconf zoneminder

Set root password (optional). For the first time after installation, password for mariadb root is blank.

# mysqladmin -u root -p password yournewpass

Create DB, User and Password. Omit option -p for mariadb root if you do not set password.

# mysql –u root –p

MariaDB [(none)]> CREATE USER 'zmuser' IDENTIFIED BY 'zmpass';

MariaDB [(none)]> CREATE DATABASE zm;

MariaDB [(none)]> GRANT ALL PRIVILEGES ON zm.* TO 'zmuser'@'localhost';

Creating DB

# mysql -u zmuser -p < /usr/share/zoneminder/db/zm_create.sql

NOTE: if change user, password or database, you need to change file in /etc/zm/zm.conf

# ZoneMinder database name

ZM_DB_NAME=zm

# ZoneMinder database user

ZM_DB_USER=zmuser

# ZoneMinder database password

ZM_DB_PASS=zmpass

Restarting services

# systemctl restart apache2

# systemctl restart zoneminder

From browser open URL http://localhost/zm

References:

  • https://forums.zoneminder.com/viewtopic.php?t=29355
  • https://wiki.zoneminder.com/Debian_11_Bullseye_with_Zoneminder_1.36.x

Thursday, October 14, 2021

Raspberry Pi Model B: Setup Raspbian Wheezy SD Card using Debian Bullseye PC

 

Raspberry Pi (c)2011.12 is very old and slow machine. I decided to reinstall the OS using legacy one, i.e. Wheezy version (End of Support).

On Debian Bullseye PC

Download Raspbian Wheey image from http://downloads.raspberrypi.org/raspbian/images/raspbian-2015-05-07/
and extract it

$ unzip 2015-05-05-raspbian-wheezy.zip

Insert SD Card and check SD Card

# dmesg
...
[ 2554.400733] usb 2-2: Product: Mass Storage Device
[ 2554.400740] usb 2-2: Manufacturer: Generic
[ 2554.400746] usb 2-2: SerialNumber: 058F63666433
[ 2554.402183] usb-storage 2-2:1.0: USB Mass Storage device detected
[ 2554.402877] scsi host1: usb-storage 2-2:1.0
[ 2555.552033] scsi 1:0:0:0: Direct-Access     Multiple Card  Reader     1.00 PQ: 0 ANSI: 0
[ 2555.553827] scsi 1:0:0:0: Attached scsi generic sg1 type 0
[ 2556.192885] sd 1:0:0:0: [sdb] 15523840 512-byte logical blocks: (7.95 GB/7.40 GiB)
[ 2556.197840] sd 1:0:0:0: [sdb] Write Protect is off
[ 2556.197858] sd 1:0:0:0: [sdb] Mode Sense: 03 00 00 00

The SD Card is at sdb

Warning: Careful to select disk, this command will erase all of your data in sdb.

# umount /dev/sdb
umount: /dev/sdb: not mounted.
# dd bs=4M if=/home/dedetok/master/raspbian/2015-05-05-raspbian-wheezy.img of=/dev/sdb status=progress

On Raspberry Pi Model B

Insert your SD Card into Raspberry Pi Model B, mouse, keyboard, HDMI/TV and Power your Raspberry. Running and configuring Raspbery Pi 2 Model B for the first time will show these menu

1. Expand File System
2. Change User Password
3. Enable Boot to Desktop/Scratch
4. International Options
5. ....

You need to:

  1. Expand File System option 1
  2. Change user (default user is pi) password option 2
  3. Change boot to desktop if you wish option 3

You can alter this configuring later by running

$ sudo raspi-config

Raspbian Wheezy support has been terminated and repository was moved to legacy http://legacy.raspbian.org/. To update your Raspbian Wheezy you need to:

  1. edit /etc/apt/sources.list
    deb http://legacy.raspbian.org/raspbian wheezy main contrib non-free rpi
    #deb http://mirrordirector.raspbian.org/raspbian/ wheezy main contrib non-free rpi
    # Uncomment line below then 'apt-get update' to enable 'apt-get source'
    #deb-src http://archive.raspbian.org/raspbian/ wheezy main contrib non-free rpi
  2. edit /etc/apt/sources.list.d/raspi.list
    #deb http://archive.raspberrypi.org/debian/ wheezy main
    # Uncomment line below then 'apt-get update' to enable 'apt-get source'
    #deb-src http://archive.raspberrypi.org/debian/ wheezy main
  3. edit /etc/apt/sources.list.d/collabora.list
    #deb http://raspberrypi.collabora.com wheezy rpi

You need to download and install legacy repository public key for raspbian wheezy

$ wget http://legacy.raspbian.org/raspbian.public.key
$ sudo apt-key add ./raspbian.public.key
OK

To update your system run:

$ sudo apt-get update
$ sudo apt-get upgrade -y

By default, root user is disable. To enable root and login as root

$ sudo passwd root
Enter new UNIX password:
Retype new UNIX password:
passwd: password updated successfully
$ su -
Password:
#

You do not need to type sudo for manage your system. After that you don't need monitor, keyboard and mouse, you can ssh your Raspberry Pi.

Note: By Default SSH Server is enable and running after boot

Running on:

  • Raspberry Pi (c)2011.12 Model B+ Revision 1.0
  • SD Card 8Gb

Monday, August 23, 2021

Debian Bullseye: upgrade from Debian Buster XFCE

 

Edit /etc/apt/sources.list

# main security
deb https://security.debian.org/debian-security bullseye-security/updates main
#deb-src https://security.debian.org/debian-security bullseye-security/updates main

# main mirror Indonesia
deb http://kebo.pens.ac.id/debian bullseye main
deb http://kebo.pens.ac.id/debian bullseye-updates main

# NON FREE
deb https://deb.debian.org/debian bullseye main contrib non-free

# BACKPORTS
deb https://deb.debian.org/debian bullseye-backports main

Update without new packages

# apt upgrade --without-new-pkgs

During upgrade, you need to restart some services.

Restart, open root terminal and make full upgrade (required more than 800MB)

# apt full-upgrade

Restart your PC.

Clean up unused installer

# apt-get autoclean && apt-get autoremove -y

If you get trouble connecting to internet (can not resolve servername) after upgrading edit /etc/resolv.conf

search 8.8.8.8 1.1.1.1
nameserver 127.0.0.1
nameserver 8.8.8.8
nameserver 1.1.1.1

Restart your networking

# systemctl restart networking

If you install dnsmasq and get trouble connecting to internet (can not resolve servername) after upgrading, edit /etc/dnsmasq.conf

#no-resolv
# dedetok 2021-08-18
no-resolv
server=8.8.8.8
server=1.1.1.1

Reboot

Wednesday, August 4, 2021

jdk11: Eclipse MariaDB Connector/J

 

Minimum Java Project JavaSe-1.8.

Adding MariaDB Connector/J 2.7.3 to Eclipse 2021-06:

  1. Download MariaDB Connector/J 2.7.3 (stable) from https://downloads.mariadb.org/connector-java/2.7.3/
  2. Put JAR file in [Workspace] -> [project_name] -> lib (create folder lib)
  3. Right click on Package Explorer -> [project_name] -> Properties
  4. Java Build Path -> Library -> Add External JARs, point it to [Workspace]/[project_name]/lib/mariadb-java-client-2.7.3.jar
  5. Click Apply and Close

Example code to access MariaDB database

package com.dedetok;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class TesCon {
    public static void main(String[] args) throws ClassNotFoundException, SQLException {
        String muser = "my_user";
        String mpass = "my_password";
        String murl = "jdbc:mariadb://localhost:3306/my_database_name";
        Class.forName("org.mariadb.jdbc.Driver");
        Connection connection = DriverManager.getConnection(murl, muser, mpass);
        System.out.println("ok");
    }
}