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");
    }
}

Sunday, July 18, 2021

Android Studio: moving project from windows to Debian 10

Backup:

  1. all files in
    [Workspace] -> [app_name]
    backup jks and iml file
  2. Folder
    [Workspace] -> [app_name] -> [app]
    Exclude folder release and build

DO NOT BACKUP: Hiden folder (.gradle, .idea), gradle

Restore all folder structure into your new Workspace folder in new OS

Before you open your project in new OS, adjust your files depend on your your SDK, SDK version and Buildtool version, edit file

[workspace] -> [app_name]
local.properties
    sdk.dir=/home/[username]/Android/Sdk

[workspace] -> [app_name] -> [app]
build.gradle
    compileSdkVersion 31
    buildToolsVersion "31.0.0"
    ...
        targetSdkVersion 31

You can safely open your project, Android Studio will make same adjustment, download some necessary library and reconfigure your project.

Tested on

  • Debian Buster
  • Android Studio 4.2.x
  • moving project from windows to Debian

Thursday, July 15, 2021

Debian Buster (Debian 10): install mysql workbench

 

Download mysql workbench from https://downloads.mysql.com/archives/workbench/

I use mysql-workbench-community version 8.0.19 for ubuntu 18.04 i.e. mysql-workbench-community_8.0.19-1ubuntu18.04_amd64

Install libtinfo5

# apt-get install  libtinfo5

Install mysql workbench using dpkg

# dpkg -i mysql-workbench-community_8.0.19-1ubuntu18.04_amd64

NOTE:

  • only mysql workbench community for Ubuntu 18.04 will work on Debian Buster (10)