레이블이 linux인 게시물을 표시합니다. 모든 게시물 표시
레이블이 linux인 게시물을 표시합니다. 모든 게시물 표시

2026년 1월 16일 금요일

쿠리어(Courier) 폰트.

 모든 글자가 동일한 폭을 갖고 있는 고정폭(Monospace) 폰트의 대표격이다. 모든 글자라곤 하지만 대부분 영어에만 해당된다. 그래서 어디에 사용되냐면, 프로그래밍/코딩에 주로 사용된다. 이건 내 영역이라 먼저 썼지만, 역사적으로 페이당 분량을 산정해서 먹고사는 영역에서(소설, 영화 작가들) 원고료 산정 방식때문에 많이 사용되었던 듯 싶다. 

 그래서 내 경우 리눅스 터미널, 코드 에디터(EMACS, Visual Studio Code, PyCharm 등)의 기본 폰트로 적극 사용해라라는 메시지를 기억이 가물가물해지는 나에게 남겨두기 위해 여기에 써둔다. 

2026년 1월 14일 수요일

써 봄직한 auto-cpufreq

 사과무니가 그려져 있는 랩탑 컴퓨터가 갖고 싶어 하진 않았지만, 그 혜자로운 배터리 지속 기간은 너무나도 부러웠다. 내가 랩탑을 쓰는 건지 랩탑 밥 챙겨주려고 쓰는 건지 도통 편리하지가 않다. 

Debian 패키지 안에 cpufrequtils라는 패키지가 기본 설치되어 관리해 주지만 앞서 이야기 한 것 같이 많이 아쉽다.

그런데 그 대체제가 있었던 것 같다. 심지어 3.0 버전대가 버젓이 존재하고 있었다. auto-cpufreq라고 하지만, debain 패키지 관리자에서는 관리되지 않고 있는 것 같다. 

소스코드 도적대인 github에서 내려받아 컴파일 하고 설치하는 방법밖에 없는 것 같다. 다른 방법이 있긴 한데 이거 하나 설치하자고 snap 패키지 관리자를 설치하기는 마음에 들지 않는다.

$ git clone https://github.com/AdnanHodzic/auto-cpufreq.git

설치하기

$ cd auto-cpufreq

$ sudo ./auto-cpufreq-installer

설치된 후 버전확인과 시스템에 등록된 상태 확인하기

$ auto-cpufreq --version

$ sudo systemctl status auto-cpufreq

재부팅 전까지만 사용해 보기

$ sudo auto-cpufreq --live

영구히 서비스로 등록

$ sudo auto-cpufreq --install


이 골방에 와서 auto-cpufreq 설치를 혹여나 시도할 수 있으니 주의사항도 남겨둔다. 

debian에 이미 설치된 cpufrequtils와 서로 충돌한다. 다음과 같이 cpufrequtils를 시스템에서 내려야 한다.

$ sudo systemctl stop power-profiles-daemon.service

$ sudo systemctl mask power-profiles-daemon.service

$ sudo systemctl stop tlp.service # if TLP is installed

$ sudo systemctl mask tlp.service # if TLP is installed

# Similarly for any other cpufreq-related service (e.g., cpufrequtils)

재부팅에도 더이상 자동 실행되지 않도록 해주어야 한다. 

$ sudo update-rc.d -f cpufrequtils remove # To remove startup links

$ sudo systemctl stop cpufrequtils.service

# or simply uninstall the package

$ sudo apt remove cpufrequtils


2026년 1월 7일 수요일

Windows + WSL + TensorFlow + CUDA 설치하기

 아쉽게도 tensorflow가 native로 윈도우를 더 이상 지원하지 않기로 한 것 같다. 여기 저기 검색해 본 결과 JAX랑 PyTorch 쓰라고 하네. 당장 짜놓은 Tensorflow+keras 조합을 바꾸진 못할 것 같다.

당분간은 본업용 윈도우 시스템과 실험용 리눅스 시스템을 동시에 굴려서 실험을 해야 잘못된 실험(결과값을 reverse scaling하지 못해서 ....)을 다시 할 수 있을 것 같다. 

그럼 본업은 유지해야 하기 때문에 윈도우를 갈아 업을 순 없고 가능한 조합은 Windows + WSL + CUDA + Tensorflow + Keras 인것 같다.

그래서 먼저 WSL 설치하고 CUDA 설치하고 tensorflow를 설치해야 겠다.

1. WSL 설치

1.1. linux용 windows 하위 시스템 설치

PS C:\Windows\system32> wsl --install

재부팅하라니 재부팅을 해주어야 겠다.

1.2. 사용가능한 linux 배포판 확인하기

PS C:\Windows\system32> wsl --list --online

1.3. linux 배포판 설치

나는 자주 갈아 업는 배포판은 귀찮기 때문에 Ubuntu 24.04 LTS 버전을 설치하도록 하겠다.

PS C:\Windows\system32> wsl --install Ubuntu-24.04

1.4. Ubuntu 환경 업데이트

PS C:\Windows\system32> wsl 

user@DESKTOP:/mnt/c/Users/user$ sudo apt update

user@DESKTOP:/mnt/c/Users/user$ sudo apt upgrade


2. CUDA 환경 설치

Nvidia의 드라이버 구조와 cuda 는 다소 난잡하다. 

2.1. Nvidia 드라이버 설치

윈도우 시스템에 nvidia 드라이버가 설치된 상태로 wsl을 설치해서 그런지, 이미 설치되어 있는 듯 싶다. 확인만 하고 넘어 가자.

...$ nvidia-smi

드라이버 버전 확인 요망(내껀 드라이버 버전 576.88이다. CUDA도 설치 되어 있네 12.9)

2.2. CUDA Toolkit 설치

앞서 이야기 했듯이 난잡하다. nvidia 드라이버 버전을 기준으로 다른 패키지들 tensorflow와 cuda-toolkit의 매칭되는 버전을 찾아 보도록 해야 겠다. 다시 설치하고 그러기 싫다.

우선 시스템이 제공해 줄 수 있는 버전을 확인해 본다.

...$ sudo apt search nvidia-cuda-tool

nvidia-cuda-toolkit이 설치할 수 있게 검색되며 버전은 12.0.140 이다.

그럼 설치한다.

...$ sudo apt install nvidia-cuda-toolkit

오래 걸린다. 잠깐 정리하고 넘어가자.

nvidia 드라이버 버전(576.88), CUDA 버전(12.9), nvidia-cuda-toolkit 버전(12.0.140)

설치된 nvidia관련 패키지들 리스트들이다.

...$ apt list --installed | grep nvidia

libnvidia-compute-535/noble-updates,noble-security,now 535.274.02-0ubuntu0.24.04.2 amd64 [installed,automatic]

libnvidia-ml-dev/noble,now 12.0.140~12.0.1-4build4 amd64 [installed,automatic]

nvidia-cuda-dev/noble,now 12.0.146~12.0.1-4build4 amd64 [installed,automatic]

nvidia-cuda-gdb/noble,now 12.0.140~12.0.1-4build4 amd64 [installed,automatic]

nvidia-cuda-toolkit-doc/noble,now 12.0.1-4build4 all [installed,automatic]

nvidia-cuda-toolkit/noble,now 12.0.140~12.0.1-4build4 amd64 [installed]

nvidia-opencl-dev/noble,now 12.0.140~12.0.1-4build4 amd64 [installed,automatic]

nvidia-profiler/noble,now 12.0.146~12.0.1-4build4 amd64 [installed,automatic]

nvidia-visual-profiler/noble,now 12.0.146~12.0.1-4build4 amd64 [installed,automatic]

어 근데 cudnn은 없네 이것도 필요한 것으로 기억하는데 이것도 설치해야 겠다.

...$ sudo apt install nvidia-cudnn

현재 설치버전은 8.9.2.26이다. 버전이 무슨 암호 같다. 그 전에 너무 길다.

이젠 python 설치와 관련 패키지 설치인것 같다.


3. python 설치

다행이도 이미 설치된 버전은 3.12.3이다.

...$ python3

Python 3.12.3 (main, Nov  6 ...)

>>> quit()

그럼 관련 조합을 정리해 보자.

tensorflow-2.15 + cuda-12.2 + cudnn-8.9 -> corresponding NVIDIA Driver 535

약간 다르긴 하지만 이 조합 밖에 없다. 이걸로 밀어 부치자.

3.1. 가상 환경 설치하기

개발환경의 패키지 버전과 시스템이 관리하는 버전의 충돌을 경험해 보고 싶지 않으면 python 가상환경을 설치하자. 

...$ sudo apt install python3-venv

3.2. tensorflow를 위한 가상환경 생성

그럼 하얀 도화지를 준비하자.

...$ python3 -m venv tf-env

3.3. 생성된 가상 환경 활성화 하기

...$ source ./tf-env/bin/activate

(tf-env) ...$ 

가상환경 종료는 맨 마지막에 해주어야 하지만, 참고로 다음과 같이

(tf-env) ...$ deactivate

아무튼 가상환경 하에서 필요한 tensorflow-2.15버전을 설치한다.

3.4. tensorflow 2.15 설치

(tf-env) ...$ pip install tensorflow[and-cuda]==2.15

에휴 없다. 다시 호환표를 보자.

https://www.tensorflow.org/install/source?hl=ko#gpu

....

텐서플로우-2.17.0 3.9-3.12 클랭 17.0.6 바젤 6.5.0 8.9 12.3

텐서플로우-2.16.1 3.9-3.12 클랭 17.0.6 바젤 6.5.0 8.9 12.3

텐서플로우-2.15.0 3.9-3.11 클랭 16.0.0 바젤 6.1.0 8.9 12.2

...

맞는 조합이 없다. python 3.12이고 cuDNN 8.9고 CUDA는 12.9다.

모른겠다. 2.17버전 설치한다.

(tf-env) ...$ pip install tensorflow[and-cuda]==2.17

엉망 진창이지만 설치가 된다. 근데 오래 걸린다.

3.6. 설치 확인

(tf-env) ...$ python3 -c "import tensorflow as tf; print(tf.config.list_physical_devices('GPU'))"

너무 오래 걸린다. 윈도우 환경으로 넘어가서 visual studio code 환경 설정해야 겠다.

4. visual studio code 환경 설정

visual studio code는 윈도우에 설치하고 python과 tensorflow는 윈도우 안에 있는 리눅스 시스템에 설치되어 있다. 이 둘 간의 OS를 넘나드는 다리를 만들어 주어야 한다.

visual studio code를 실행하고 좌측 탭의 extensions를 선택하고 "Remote - WSL"을 검색한다.

근데 WSL 밖에 없다. 설명을 보아 하니 WSL에 있는 폴더를 열 수 있다고 한다. 이것 설치한다.

그리고 좌측 하단의 원격 연결 버튼 ( >< 모양 아이콘)을 클릭하고 "Connect to WSL"을 선택한다.

뭔가 설치한 Ubuntu-24.04와 연결하는 것 같다.

File -> Open Folder 하고  WSL 디렉토리 선택하고 test.py 파일을 하나 만들면 필요한 extensions들을 추천해 주는데 다 설치하자. 그럼 또 가상 환경 만들라고 한다. 이미 만들어 놓은 건 어쩌고 만들라고 하는지 기존것 로딩하는 것은 없나 보다. 

아 귀찬다. /mnt/c/Users/usr/tf-env를 /home/user로 복사해 오자. 나머지는 내일 하는 것으로.



2024년 7월 22일 월요일

freecad의 충돌 그리고 실행을 위한 python3.11의 libshiboken2, libpyside2 링크 만들기

 잘쓰던 freecad가 python3의 버전이 오롯이 3.12로 재편 되면서 기존의 3.11이 있음에도 불구하고 3.11이 제대로 돌아가지 못하게 되었다. 

 그래서 덩달아 freecad도 실행이 불가능한 상태가 되어 버렸다. 해결해 볼라구 찾아 보았다 크게 2개의 문제가 되더라 libpyside2와 libshiboken2, 이 둘이 freecad의 GUI를 담당하는데 찾고 있던 경로(/usr/lib/python3/dist-packages/)에 없었던 듯 하다.

 데비안 패키지 저장소를 뒤졌으나 libshiboken2-py3-5.15_5.15.10-4_amd64.deb 밖에 없었다. 범위를 넓혀서 rpm도 찾아 보았다. 그래서 데비안 libpyside2 패키지를 대체할 수 있는 pyside2-core-5.15.12-2-omv2490.x86_64.rpm를 다운로드 받았다. 

 데비안 현시점(2024-07-22)의 testing 배포판의 python3의 주력이 3.12으로 넘어가 버려서 /usr/lib/python3/dist-packages에 3.11 버전의 패키지를 덮어 씌우는 것은 시스템을 망가트릴 수 있어 아래의 경로에 해당 라이브러리들(libpyside2*, libshiboken2*)을 복사해 두었다.

 $ mv /home/daysleep/Downloads/libpyside2.cpython-311-x86_64-linux-gnu.so.5.15* /usr/lib/x86_64-linux-gnu/
$ mv /home/daysleep/Downloads/libshiboken2/libshiboken2-py3-5.15_5.15.10-4_amd64/usr/lib/x86_64-linux-gnu/libshiboken2.cpython-311-x86_64-linux-gnu.so.5.15* /usr/lib/x86_64-linux-gnu/
$ cp -r /home/daysleep/Downloads/libshiboken2/libshiboken2-py3-5.15_5.15.10-4_amd64/data/usr/lib/python3/dist-packages/shiboken2 /usr/local/lib/python3.11/dist-packages/

뭐 그래도 여전히 유독 /usr/lib/python3/dist-packages에서만 찾는 plugin 자원들은 문제가 생기더라 뭐 찝찝하지만 실행은 되니 우선 임시적으로 이렇게 써야 겠다.

* 주의 사항: symbolic link 생성시 반드시 작업 디레토리를 생성 경로로 설정해야 생성이 되더라 한참 애먹었다. 

$ ln -s libpyside2.cpython-311-x86_64-linux-gnu.so.5.15.12 libpyside2.cpython-311-x86_64-linux-gnu.so.5.15

2023년 6월 6일 화요일

데비안 리눅스 시스템은 python 최신버전으로 유지 될때 과거의 python 설치하는 법

 [원본 : https://unix.stackexchange.com/questions/188741/install-newer-older-versions-of-python-on-debian]

대부분 우분투의 deadsnakes PPA를 이용하여 설치하는 방법을 설명하지만 아쉽게도 Debian에 이와 같이 설정하면 어디에선가 문제를 야기시킬수 있는 위험을 가지고 있다. 위의 원본 게시물에서도 알려주다시피 메뉴얼로다가 해당 버전을 다운로드 해서 수작업으로 설치하는 것을 추천한다.

현시점에서 python 3.11 버전으로 업데이트 되어 더이상 tensorflow를 설치할 수 없다. tensorflow가 지원하는 최신버전의 python이 3.10이다. 먼저 python 3.10 설치하고 그리고 Teledyne의 Spinnaker SDK의 python 버전이 python 3.8만 지원한다. 이것도 나중에 설치해야 겠다.

우선 급한데로 python 3.10 버전을 수작업으로 설치하는 방법을 기록해 둔다.

# 사전 준비물

```bash

$ apt install libssl-dev openssl libffi-dev

```

# python 3.10.11 버전 수동 설치

```bash

$ wget https://www.python.org/ftp/python/3.10.11/Python-3.10.11.tgz

$ tar zxf Python-3.10.11.tgz

$ cd Python-3.10.11/
$ ./configure --prefix=/usr/local
$ make
$ make install

```

여기서, 시스템에서 관리되는 /usr/local에 설치하면 시스템 관리에 혼동을 초래할 수 있기 때문에 가능하면 /opt/python-3.10.11로 설정해서 컴파일하고 설치하도록 하자.

 그리고, 시스템에서 접근할 수 있게 PATH에 추가하거나 /usr/local에 symbolic link를 만들어 두자.

```bash

$ ln -s /opt/python-3.10.11/bin/python3.10 /usr/local/bin/python3.10
$ ln -s /opt/python-3.10.11/bin/pip3.10 /usr/local/bin/pip3.10

```


2022년 7월 10일 일요일

FreeCad, Debian Test에서 사라지다.

 어느날 부터인가 libboost가 업그레이드가 안되더니 수작업으로 업그래드 한 후 갑자기 freecad가 자동으로 사라져 버렸다. test 리포지터리에서 사라진것 같다. 

 freecad 홈페이지에 가 보았더니 처음에 experimental로 올리고 나중에 testing으로 전환된다고 한다. 아마도 지금은 experimental에서 testing으로 전화되기 중간과정에서 기존 버전을 내리는 과정에 있는 것 같다. 언제 올라올지 몰라서 현재 패키지 리포지터리에 unstable 을 추가하고, freecad만 설치한후 다시 unstable 소스 리포지터리를 주석처리해서 다른 패키지에 영향을 안주도록 만들었다.


deb http://ftp.us.debian.org/debian/ testing main contrib non-free
# deb-src http://ftp.us.debian.org/debian/ testing main contrib non-free

deb http://security.debian.org/debian-security testing/updates main contrib non-free
# deb-src http://security.debian.org/debian-security testing/updates main contrib non-free

deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
# deb-src http://ftp.us.debian.org/debian/ unstable main contrib non-free

2022년 2월 2일 수요일

Linux System Management

 # Avoid clicking sound from hdd
$ hdparm -B 254 -S 241 /dev/sda
## /etc/hdparm.conf
/dev/sda {
    apm = 254
    apm_battery = 254
    spindown_time = 241
}

# Grub screen resolution
## /etc/default/grub
uncomment as GRUB_GFXMODE=800x600
$ update-grub

# Keyboard remapping; capslock into ctrl, and swap Left Window with Left Alt
## Check available options
$ grep alt /usr/share/X11/xkb/rules/evdev.lst | grep win
## /etc/default/keyboard
XKBOPTIONS="ctrl:nocaps, altwin:swap_lalt_lwin"

# Install vscode
$ curl -sSL https://packages.microsoft.com/keys/microsoft.asc | sudo apt-key add -
$ sudo add-apt-repository "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main"
$ sudo apt install code

# Install emacs
$ sudo apt install emacs-nox
## emacs goodies
$ apt install elpa-irony elpa-flycheck elpa-ggtags

# Install KeePassXC, Gaculator, Visual Studio Code, LimeSuite GUI, Meld, QtCreator, Sublime Text, Spinnaker, FreeCad, GIMP, ImageJ, LibreCad, Shotwell, Meshlab, Chromeium, Firefox, ThunderBird, Skype, Remote Viewer, Telegram, Kicad, Fish, Disk Usage Analyzer, GParted, CuteCom, libvirt, Vitual Machine Viewer, Barrier,

# Install LibreOffice
Prof-XFCE-theme-1.2, Papirus-Light,

pycharm,


# Delete APT cache
$ apt autoclean

# Delete unneccessary APT packages
$ apt autoremove

# Delete systemd journal logs
$ journalctl --disk-usage
$ journalctl --vacuum-time=3d

# Delete log files
$ rm -v /var/log/*log*

# Analyze booting process in terms of time cosuming
$ systemd-analyze blame
## In case of too long consuming service
$ systemctrl disable $(service_name)

# Disabling tracker for your user only
Enter the directory ~/.config/autostart, create it if it does not exist
Create a file named tracker-miner-fs-3.desktop
Paste the following into the file, save and exit:
[Desktop Entry]
Encoding=UTF-8
Name=Tracker
Hidden=true

or

$ systemctl --user unmask tracker-store.service tracker-miner-fs-3.service tracker-miner-rss.service tracker-extract-3.service tracker-miner-apps.service tracker-writeback.service


# Error starting domain: Requested operation is not valid: network 'default' is not active
Type help for instructions on how to use fish
$ virsh net-list --all
 Name      State      Autostart   Persistent
----------------------------------------------
 default   inactive   no          yes

$ virsh net-start default
Network default started

$ virsh net-autostart --network default
Network default marked as autostarted

# find the UUID of disk
$ blkid | grep UUID

# Clone disk
$ dd if=/dev/sda of=/dev/sdb bs=4096 conv=noerror,sync

# Firmware update
$ fwupdmgr get-devices
$ fwupdmgr refresh
$ fwupdmgr update

2021년 8월 1일 일요일

Line Scan Imaging을 위한 buffer 다루기와 Thread의 설계

# Memory 설계

기본적으로 메모리 사용량의 효율성 보다 서로 다른 Thread가 하나의 메모리 공간을 가지고 경쟁하는 상황을 피하기 위해서,

라인 스캔된 영상들은 하나의 영역을 구성하는 기본 영상을 저장하는데 필요한 크기보다 큰 circular buffer(boost::circular_buffer)에 차곡차곡 쌓아 놓아야 한다. 이를 통해서 영상을 획득하는 Thread(Acquisition Processing)는 circular buffer에 적재만 하고 ciruclar buffer가 어떻게 사용되는지는 고려하지 않아도 된다. 그리고 영상이 완성된 이후의 영상처리 기능을 분산하기 위해서 라인 스캔된 영상단위로 처리할 수 있는 영상처리를 수행하고 처리된 결과를 저장할 추가적인 circular buffer를 마련해서 computing cost를 분산시킨다.

# Thread 설계 

라인 스캔 영상을 처리학 위해서 최소한 3개의 Thread가 필요하다. 첫째는 라인 스캔된 영상을 획득하고 circular buffer에 적재하는 Thread(+가능하다면 라인스캔 단위로 처리할 영상처리를 수행), 둘째는 하나의 기본단위 영상 크기에 대한 영상처리 thread, 그리고 마지막 셋째는 영상 처리 결과를 30혹은 60hz 주기로 GUI에 뿌려주는 Thread로 구성하면된다.

이와 같은 Thread가 순차적으로 동작하도록 하기 위해선 QThreadPool과 QRunnable이라는 Qt 인스턴스를 활용해야한다.

# 최적화

속도의 문제가 발생할 수 있는 우려되는 영역은 영역 단위의 영상처리 Thread의 수행 속도이다. 이 부분의 우려를 불식시키기 위해서는 병렬처리를 고려해 볼 수 있다. 기본적으로 OpenCV를 사용할 경우 GPU나 SIMD를 활용한 Custom 라이브러리를 사용하는 것을 첫번째로 고려하고 아니면 수작업으로 SIMD나 CUDA를 이용한 방법을 고려해보자.

# 배워야할 거리들

boost::circular_buffer, QThreadPool, QRunnable, OpenCV with SIMD, and CUDA enabled, SIMD, CUDA


2021년 1월 3일 일요일

Repair the broken pip in python 3.8 venv against python 3.9 as system default

Suddenly distutils used for venv of python3.8 is disappeared after system updated.

In the look into /usr/lib/python3.8/distutils, many files are missing.

I found the workaround at https://askubuntu.com/questions/1239829/modulenotfounderror-no-module-named-distutils-util

My solution is that distutils in python3.8 has to be copied from distutils in python 3.9.

root@T480s:~# cp -r /usr/lib/python3.9/distutils /usr/lib/python3.8


2020년 9월 21일 월요일

How to disable annoying Tracker (gathering file index to speed up for file searching)

Tracker tool is one of heavy user of CPU capacity, and do cause read/write operation of SSD, which may reduce the life time of it.

However, if remove Tracker tool, and related, I have to remove some of desktop software in spite of no glue from Tracker.

Therefore, the below is workaround without uninstallation of unwanted desktop software, and Tracker.

(Notice !, these command have to be type in user terminal, not in root privilegeterminal.) 


# systemctl --user mask tracker-store.service tracker-miner-fs.service tracker-miner-rss.service tracker-extract.service tracker-miner-apps.service tracker-writeback.service
 
# tracker reset --hard
 
Reboot the system...

2020년 9월 4일 금요일

How to refresh linux debian system with preserving Home, and installed packages.

 
At first, make the list of installed deb packages.

# apt-mark showmanual > $(backupdir)/installed_packages.txt
# cp /etc/apt/sources.list  $(backupdir)/

In my case, root partition separated with home partition.
So, I do reboot the system with bootable USB flash.
Then, cleaned up the root partition, and install it from USB flash.

Restore sources.list from backed up.

# cp $(backupdir)/sources.list /etc/apt/
# apt update

Finally, restore the packages as installed before.

# cat installed_packages.txt | xargs sudo apt install -y


2020년 9월 1일 화요일

How to connect the internet via wifi on BeagleBone Green Wireless, and update APT package.

* Preparation
Thick and short USB micro cable
Linux host computer with being able to provide USB power as much as possible like usb 3.0 and higher.

* Doing things
Connect USB cable between BBGW, and Linux host. and then, ssh connect to 192.168.7.2

# ssh debian@192.168.7.2

.....


debian@beaglebone:~$
debian@beaglebone:~$ sudo connmanctl
Error getting VPN connections: The name net.connman.vpn was not provided by any connmanctl> enable wifi
Error wifi: Already enabled
connmanctl> scan wifi
Scan completed for wifi
connmanctl> services
    DESKTOP-7MMLAUO 1038 wifi_2cf7f106571a_4445534b544f502d374d4d4c41554f2031303338_managed_psk
    U+zone               wifi_2cf7f106571a_552b7a6f6e65_managed_ieee8021x
    FREE_U+zone          wifi_2cf7f106571a_465245455f552b7a6f6e65_managed_none
    LGU+_POLY            wifi_2cf7f106571a_4c47552b5f504f4c59_managed_psk
connmanctl> agent on
Agent registered
connmanctl> connect wifi_2cf7f106571a_4
wifi_2cf7f106571a_4445534b544f502d374d4d4c41554f2031303338_managed_psk
wifi_2cf7f106571a_465245455f552b7a6f6e65_managed_none
wifi_2cf7f106571a_4c47552b5f504f4c59_managed_psk
connmanctl> connect wifi_2cf7f106571a_4
wifi_2cf7f106571a_4445534b544f502d374d4d4c41554f2031303338_managed_psk
wifi_2cf7f106571a_465245455f552b7a6f6e65_managed_none
wifi_2cf7f106571a_4c47552b5f504f4c59_managed_psk
connmanctl> connect wifi_2cf7f106571a_4445534b544f502d374d4d4c41554f2031303338_managed_psk
Agent RequestInput wifi_2cf7f106571a_4445534b544f502d374d4d4c41554f2031303338_managed_psk
  Passphrase = [ Type=psk, Requirement=mandatory, Alternates=[ WPS ] ]
  WPS = [ Type=wpspin, Requirement=alternate ]
Passphrase? $(user_passwd)
Connected wifi_2cf7f106571a_4445534b544f502d374d4d4c41554f2031303338_managed_psk
connmanctl> quit
debian@beaglebone:~$ ifconfig -a
SoftAp0   Link encap:Ethernet  HWaddr a0:f6:fd:8a:04:fb 
          inet addr:192.168.8.1  Bcast:192.168.8.255  Mask:255.255.255.0
          inet6 addr: fe80::a2f6:fdff:fe8a:4fb/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:36 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:8421 (8.2 KiB)

lo        Link encap:Local Loopback 
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:370 errors:0 dropped:0 overruns:0 frame:0
          TX packets:370 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1
          RX bytes:29149 (28.4 KiB)  TX bytes:29149 (28.4 KiB)

usb0      Link encap:Ethernet  HWaddr a0:f6:fd:8a:04:f0 
          inet addr:192.168.7.2  Bcast:192.168.7.255  Mask:255.255.255.0
          inet6 addr: fe80::a2f6:fdff:fe8a:4f0/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1516 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1166 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:102420 (100.0 KiB)  TX bytes:397352 (388.0 KiB)

wlan0     Link encap:Ethernet  HWaddr 2c:f7:f1:06:57:1a 
          inet addr:192.168.137.71  Bcast:192.168.137.255  Mask:255.255.255.0
          inet6 addr: fe80::2ef7:f1ff:fe06:571a/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST DYNAMIC  MTU:1500  Metric:1
          RX packets:14 errors:0 dropped:0 overruns:0 frame:0
          TX packets:72 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:1911 (1.8 KiB)  TX bytes:16732 (16.3 KiB)

debian@beaglebone:~$ sudo apt update

2020년 8월 31일 월요일

First things to do after installation of raspberry pi OS

Make sure the internet connection to update old packages by blind period between time to make official OS and current status.

# sudo apt update; sudo apt full-upgrade

In order to reduce sd-card usage down as much as possible, in my case these commands may be helpful after installation.

# sudo apt purge libreoffice* thonny* smartsim* scratch* sonic-pi* wolfram-engine* geany* mu-editor*
# sudo apt autoremove
# sudo apt clean

then, to fuse firmware is needed to improve the performance of your raspberry pi.

# sudo rpi-update



2020년 2월 21일 금요일

Attempt to remove annoying hanging debian system due to libreoffice's unstablity

Remove configuration of libreoffice.
$ cd ~/.config
$ rm -rf libreoffice

Remove libreoffice
# apt remove --purge libreoffice*
# apt clean
# apt autoremvoe

Remove default-jdk, default-jdk-headless, default-jre, and default-jre-headless
# apt remove --purge default-jdk default-jdk-headless default-jre default-jre-headless
# apt clean
# apt autoremove

Reinstall default-jdk, default-jdk-headless, default-jre, and default-jre-headless.
# apt install default-jdk default-jdk-headless default-jre default-jre-headless

Reinstall libreoffice
# apt install libreoffice

Finally, wait, and see....

2020년 2월 19일 수요일

when libreoffice is unstable slow, I would use libreoffice-qt5 instead of libreoffice-gtk3.

Environment

daysleep@t480s-debian ~> lsb_release -a
No LSB modules are available.
Distributor ID:    Debian
Description:    Debian GNU/Linux bullseye/sid
Release:    9.12
Codename:    stretch

Libreoffice's Version
Version: 6.4.1.1Build ID: 1:6.4.1~rc1-2
CPU threads: 8; OS: Linux 5.4; UI render: default; VCL: x11;
Locale: en-US (en_US.UTF-8); UI-Language: en-US
Calc: threaded

Action for Replacement

$ apt install libreoffice-qt5
$ apt remove libreoffice-gtk3

2019년 10월 7일 월요일

Setup develop environment for Bluetooth SOC, nRF52840

1. Install Toolchain on debian testing(currently bulleseye)
# apt install libnewlib-dev libstdc++-arm-none-eabi-newlib libnewlib-arm-none-eabi gcc-arm-none-eabi binutils-arm-none-eabi

1.2. Verify the version of installed gcc
# arm-none-eabi-gcc --version
arm-none-eabi-gcc (15:7-2018-q2-6+b1) 7.3.1 20180622 (release) [ARM/embedded-7-branch revision 261907]
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2. Download, and install the nRF5 SDK
Go to https://www.nordicsemi.com/Software-and-Tools/Software/nRF5-SDK/, and
download the latest verion of SDK at https://www.nordicsemi.com/-/media/Software-and-other-downloads/SDKs/nRF5/Binaries/nRF5SDK153059ac345.zip
Unzip nRF5SDK153059ac345.zip like as:
nRF5_SDK_15.3.0_59ac345
+- components
+- config
+- documentation
+- examples
+- external
+- external_tools
+- intergation
+- modules
+- license.txt
+- nRF5x_MDK_8_24_1_IAR_NordicLicense.msi
+- nRF5x_MDK_8_24_1_Keil4_NordicLicense.msi

At "$(SDK_ROOT)/components/toolchain/gcc" under SDK, there are several kinds of Makefile for Windows/Linux/MacOs.
Now, we should edit "Makefile.posix" in the case of Linux or MacOs like the below.

GNU_INSTALL_ROOT ?= /usr/local/gcc-arm-none-eabi-7-2018-q2-update/bin/
GNU_VERSION ?= 7.3.1
GNU_PREFIX ?= arm-none-eabi

into

GNU_INSTALL_ROOT ?= /usr/bin/
GNU_VERSION ?= 7.3.1
GNU_PREFIX ?= arm-none-eabi

2.1. Try to compile the example.
Under "$(SDK_ROOT)/examples/peripheral/blinkyPCA10056/blank/armgcc",
$ make
mkdir _build
cd _build && mkdir nrf52840_xxaa
Assembling file: gcc_startup_nrf52840.S
Compiling file: nrf_log_frontend.c
Compiling file: nrf_log_str_formatter.c
Compiling file: boards.c
Compiling file: app_error.c
Compiling file: app_error_handler_gcc.c
Compiling file: app_error_weak.c
Compiling file: app_util_platform.c
Compiling file: nrf_assert.c
Compiling file: nrf_atomic.c
Compiling file: nrf_balloc.c
Compiling file: nrf_fprintf.c
Compiling file: nrf_fprintf_format.c
Compiling file: nrf_memobj.c
Compiling file: nrf_ringbuf.c
Compiling file: nrf_strerror.c
Compiling file: nrfx_atomic.c
Compiling file: main.c
Compiling file: system_nrf52840.c
Linking target: _build/nrf52840_xxaa.out
   text       data        bss        dec        hex    filename
   2168        112        172       2452        994    _build/nrf52840_xxaa.out
Preparing: _build/nrf52840_xxaa.hex
Preparing: _build/nrf52840_xxaa.bin
DONE nrf52840_xxaa

2019년 4월 26일 금요일

리눅스에서 안드로이드 카카오톡 앱 실행해보기

먼저, 리눅스 시스템에서 안드로이드 시스템을 구성해주는 anbox (Android in Box)를 설치하자.

# apt install anbox

설치는 되었지만, 실행에 뭔가 문제가 있다. 문제가 뭔지 살펴보자.

$ anbox session-manager
 [ 2019-04-25 14:41:11] [session_manager.cpp:130@operator()] Failed to start as either binder or ashmem kernel drivers are not loaded

커널 드라이버가 없어서 실행이 되지 않는 것 같다.

그래서, 설치된 패키지의 설명서를 살펴보았다.

....
This package needs Android kernel modules and rootfs image, see
/usr/share/doc/anbox/README.Debian for information.
...

따라해 보기로 했다. /usr/share/doc/anbox/README.Debian을 살펴보자.

그 내용은 요약하자면 다음과 같다.

/lib/modules/`uname -r`/kernel/drivers/android/binder_linux.ko
/lib/modules/`uname -r`/kernel/drivers/staging/android/ashmem_linux.ko
위의 두 커널 모듈이 있는지 확인하자.

그리고, https://build.anbox.io/android-images 에서 사전에 만들어진 안드로이드 이미지를 다운로드하자. 이왕이면 가장 최신의 것으로 다운로드 한다. 현 시점에선

Index of /android-images/2018/07/19

[ICO]NameLast modifiedSizeDescription

[PARENTDIR]Parent Directory-
[   ]android_amd64.img2018-07-20 01:46 311M
[   ]android_amd64.img.sha256sum2018-07-20 02:11 84


이 최신이다.

이제 부터는 좀 불친절하게 되어 있다. 말도 많고 탈도 많은 systemd와 관련된 문제이다.
다자고짜 anbox-container-manager.service 를 실행하라고 한다.
찾아보니 다음과 같이 하면 될 것 같다. 우선 해보기로 했다.

# systemctl start anbox-container-manager.service

얼추 된 것 같다. 한번 실행해 보자. .... 안된다. 뭔가 빠진 것 같다.
 다시 한번 더 실행해보자

$ anbox session-manager
 [ 2019-04-25 15:01:08] [session_manager.cpp:130@operator()] Failed to start as either binder or ashmem kernel drivers are not loaded

여전하다. 커널 모듈 로딩 목록에 강제적으로 넣어 주자. 아래와 같이...

@/etc/modules
# /etc/modules: kernel modules to load at boot time.
#
# This file contains the names of kernel modules that should be loaded
# at boot time, one per line. Lines beginning with "#" are ignored.
ashmem_linux
binder_linux


그리고 리부팅...

다시 실행.

$ anbox session-manager
[ 2019-04-25 15:07:35] [daemon.cpp:61@Run] Failed to connect to socket /run/anbox-container.socket: No such file or directory


아 돌겠네.

# systemctl start anbox-container-manger.service

또 실행.

$ anbox session-manager
[ 2019-04-25 15:09:28] [daemon.cpp:61@Run] Failed to connect to socket /run/anbox-container.socket: No such file or directory


서비스에 문제가 있나보다. 휴우...




# systemctl status anbox-container-manager.service
● anbox-container-manager.service - Anbox Container Manager
   Loaded: loaded (/lib/systemd/system/anbox-container-manager.service; enabled;
   Active: inactive (dead)
Condition: start condition failed at Fri 2019-04-26 00:06:55 KST; 4min 6s ago
           └─ ConditionPathExists=/var/lib/anbox/android.img was not met
     Docs: man:anbox(1)

 4월 26 00:05:22 T480s systemd[1]: Condition check resulted in Anbox Container M
 4월 26 00:06:55 T480s systemd[1]: Condition check resulted in Anbox Container M
lines 1-9/9 (END)




안드로이드 이미지를 못찾는다. 다운로드한 이미지 /var/lib/anbox 에 복사.

$ su
# anbox container-manager
[ 2019-04-25 15:17:48] [container_manager.cpp:71@operator()] You are running the container manager manually which is most likely not
[ 2019-04-25 15:17:48] [container_manager.cpp:72@operator()] what you want. The container manager is normally started by systemd or
[ 2019-04-25 15:17:48] [container_manager.cpp:73@operator()] another init system. If you still want to run the container-manager
[ 2019-04-25 15:17:48] [container_manager.cpp:74@operator()] you can get rid of this warning by starting with the --daemon option.
[ 2019-04-25 15:17:48] [container_manager.cpp:75@operator()]
[ 2019-04-25 15:17:48] [container_manager.cpp:119@operator()] boost::filesystem::create_directories: Invalid argument
# exit

$ anbox session-manager
[ 2019-04-25 15:18:23] [daemon.cpp:61@Run] Failed to connect to socket /run/anbox-container.socket: No such file or directory


장시간 복기 끝에 문제점을 찾은 것 같다.

/var/lib/anbox 에 이름을 android_amd64.img에서 android.img로 안바꾼 것이 탈이 된 것 같다.

anbox-container-manager.service 를 멈추고 다시 시작하자.

# systemctl stop anbox-container-manager.service
# systemctl start anbox-container-manager.service
# systemctl status anbox-container-manager.service
● anbox-container-manager.service - Anbox Container Manager
   Loaded: loaded (/lib/systemd/system/anbox-container-manager.service; enabled;
   Active: active (running) since Fri 2019-04-26 00:23:27 KST; 5s ago
     Docs: man:anbox(1)
  Process: 27421 ExecStartPre=/sbin/modprobe ashmem_linux (code=exited, status=0
  Process: 27422 ExecStartPre=/sbin/modprobe binder_linux (code=exited, status=0
  Process: 27423 ExecStartPre=/usr/share/anbox/anbox-bridge.sh start (code=exite
 Main PID: 27499 (anbox)
    Tasks: 9 (limit: 4915)
   Memory: 4.8M
   CGroup: /system.slice/anbox-container-manager.service
           └─27499 /usr/bin/anbox container-manager --daemon --privileged --data

 4월 26 00:23:27 T480s systemd[1]: Starting Anbox Container Manager...
 4월 26 00:23:27 T480s systemd[1]: Started Anbox Container Manager.
 

뭔가 느낌이 좋다. 한번 더 실행해보자.




된다.

2019년 3월 6일 수요일

[Note] Setup DepthEyes-H1

1. Download DepthEyeSdk-master from https://github.com/pointcloud-ai/DepthEyeSdk


2. Unzip it.

3. copy the rules of permission for USB connection under root privilige.

# cp DepthEyeSdk-master/third_party/udev/rules.d/72-DepthEyeH1CDK.rules /etc/udev/rules.d/

3.1. Reload udev rules.

# udevadm control --reload-rules && udevadm trigger

4. Plug DepthEye-H1 in USB hub powered by external adaptor.

5. Verify the connection.

# lsusb
Bus 003 Device 002: ID 8087:8000 Intel Corp.
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 002: ID 8087:8008 Intel Corp.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub
Bus 002 Device 050: ID 0451:9107 Texas Instruments, Inc. 
Bus 002 Device 002: ID 17ef:60a9 Lenovo
Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

6. Export SDK path.
$ export VOXEL_SDK_PATH="third_party/voxelsdk_ubuntu_4.13"
$ export PATH=$VOXEL_SDK_PATH/lib:$VOXEL_SDK_PATH/bin:$PATH

7. Build SDK.

$ mkdir build

$ cd build/

$ cmake ..
-- The C compiler identification is GNU 8.2.0
-- The CXX compiler identification is GNU 8.2.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info -- Detecting C compiler ABI info - done
-- Detecting C compile features -- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done CMAKE_SYSTEM_NAME = Linux VERSION=4.19.0-2-amd64(4-19-0) ARCH = x86_64 use Voxel SDK ./third_party/voxelsdk_ubuntu_4.13/lib
-- Configuring done
-- Generating done
-- Build files have been written to: /home/user/Workspace/DepthEyeSdk-master/build

$ make
Scanning dependencies of target deptheye
[ 25%] Building CXX object src/CMakeFiles/deptheye.dir/DepthEyeInterface.cpp.o
[ 50%] Linking CXX static library ../lib/libdeptheye.a
[ 50%] Built target deptheye Scanning dependencies of target H1AsciiSample
[ 75%] Building CXX object test/CMakeFiles/H1AsciiSample.dir/H1AsciiSample.cpp.o
[100%] Linking CXX executable ../bin/H1AsciiSample
[100%] Built target H1AsciiSample

8. Test

$ ./bin/H1AsciiSample
 INFO: load path path size:3 INFO: load path file size =0
 INFO: load path /home/user/.Voxel/lib file size =0
 INFO: load path /usr/lib/voxel file size =0
 WARNING: CameraSystem: No depth camera library found or loaded.
 ERROR: Find depth camera FAILED
 Press any key to quit

Woops...


2019년 2월 12일 화요일

When CUDA_ERROR_UNKNOWN comes up to call cuInit,

The detailed error messge is

(venv) user@LifeNTech:~/Workspace/deep_neural_network$ python test_keras.py Using TensorFlow backend. Epoch 1/5 2019-02-11 17:45:26.303774: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 FMA 2019-02-11 17:45:26.315447: E tensorflow/stream_executor/cuda/cuda_driver.cc:397] failed call to cuInit: CUDA_ERROR_UNKNOWN 2019-02-11 17:45:26.315530: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:163] retrieving CUDA diagnostic information for host: LifeNTech 2019-02-11 17:45:26.315552: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:170] hostname: LifeNTech 2019-02-11 17:45:26.315635: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:194] libcuda reported version is: 390.87.0 2019-02-11 17:45:26.315687: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:198] kernel reported version is: 390.87.0 2019-02-11 17:45:26.315695: I tensorflow/stream_executor/cuda/cuda_diagnostics.cc:305] kernel version seems to match DSO: 390.87.0 

This thing  might be helpful.
# nvidia-modprobe -u


2019년 1월 24일 목요일

Install wxPython 4.0.4 in raspberry pi

1. preparation
1.2. sdhc >= 16GB installed raspbian
1.3. Install dependencies
# sudo apt install libjpeg-dev libtiff5-dev libnotify-dev libgtk2.0-dev libgtk-3-dev libsdl1.2-dev libgstreamer-plugins-base0.10-dev libwebkitgtk-dev freeglut3 freeglut3-dev

1.4. Turn off the GUI boot chaning to CLI
Preferences -> Raspberry Pi Configuration -> At Boot, select To CLI


2. Install wxpython 4.0.4
# sudo pip3 install wxpython

3. Wait and do not see .....

4. return to GUI
#sudo raspi-config
 -> 3. BootOptions -> B1 Desktop / CLI -> B4 Desktop Autologin -> double 'TAB' -> Finish

# reboot

5. Check the installation
$ python3

>>> import wx
>>> wx.__version__
'4.0.4'