Transmission SSL 설정하기

토렌트 머신으로 사용할 때 Transmission을 설치해서 사용한다. 우분투에서도 https://blog.dasomoli.org/raspberrypi-torrent-%eb%a8%b8%ec%8b%a0-%eb%a7%8c%eb%93%a4%ea%b8%b0/ 의 내용을 그대로 설정하면 된다. 이대로 설정하면 http 프로토콜을 이용하게 되는데, 여기서 한 단계 더 나아가서 SSL 설정을 통해 https를 쓰도록 설정하자. letsencrypt 인증서를 사용하는 certbot을 사용하면, 설정은 매우 간단하다.

# certbot --apache

실행 예제 화면은 다음과 같다.

root@bamtol:/etc/letsencrypt# certbot --apache
Saving debug log to /var/log/letsencrypt/letsencrypt.log

Which names would you like to activate HTTPS for?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: blog.dasomoli.org
2: torrent.dasomoli.org
3: www.dasomoli.org
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate numbers separated by commas and/or spaces, or leave input
blank to select all options shown (Enter 'c' to cancel): 2

Requesting a certificate for torrent.dasomoli.org

Successfully received certificate.
Certificate is saved at: /etc/letsencrypt/live/torrent.dasomoli.org/fullchain.pem
Key is saved at:         /etc/letsencrypt/live/torrent.dasomoli.org/privkey.pem
This certificate expires on 2023-06-07.
These files will be updated when the certificate renews.

Deploying certificate
Successfully deployed certificate for torrent.dasomoli.org to /etc/apache2/sites-available/torrent.dasomoli.org-le-ssl.conf
Congratulations! You have successfully enabled HTTPS on https://torrent.dasomoli.org

NEXT STEPS:
- The certificate will need to be renewed before it expires. Certbot can automatically renew the certificate in the background, but you may need to take steps to enable that functionality. See https://certbot.org/renewal-setup for instructions.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
If you like Certbot, please consider supporting our work by:
 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate
 * Donating to EFF:                    https://eff.org/donate-le
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

그럼 /etc/apache2/sites-enabled/torrent.dasomoli.org-le-ssl.conf 파일이 생성되는데 여기에 SSLProxyEngine on 옵션을 추가해준다. 그럼 이렇게 된다.

<IfModule mod_ssl.c>
<VirtualHost *:443>
        # The ServerName directive sets the request scheme, hostname and port that
        # the server uses to identify itself. This is used when creating
        # redirection URLs. In the context of virtual hosts, the ServerName
        # specifies what hostname must appear in the request's Host: header to
        # match this virtual host. For the default virtual host (this file) this
        # value is not decisive as it is used as a last resort host regardless.
        # However, you must set it for any further virtual host explicitly.
        ServerName torrent.dasomoli.org
        ServerAdmin dasomoli@gmail.com

        ProxyPass / http://localhost:9000/
        ProxyPassReverse / http://localhost:9000/

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
        # error, crit, alert, emerg.
        # It is also possible to configure the loglevel for particular
        # modules, e.g.
        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/torrent.log
        CustomLog ${APACHE_LOG_DIR}/torrent.access.log combined

        # For most configuration files from conf-available/, which are
        # enabled or disabled at a global level, it is possible to
        # include a line for only one particular virtual host. For example the
        # following line enables the CGI configuration for this host only
        # after it has been globally disabled with "a2disconf".
        #Include conf-available/serve-cgi-bin.conf


SSLCertificateFile /etc/letsencrypt/live/torrent.dasomoli.org/fullchain.pem
SSLCertificateKeyFile /etc/letsencrypt/live/torrent.dasomoli.org/privkey.pem
Include /etc/letsencrypt/options-ssl-apache.conf
SSLProxyEngine on
</VirtualHost>
</IfModule>

이게 끝. apache2 서비스를 재시작한 후 https로 접근한다.

Bkouen AK7 Pro Mini PC 사용기

인터넷 커뮤니티를 기웃거리다 전력 사용이 적다는 미니 PC 딜을 발견했습니다. 라즈베리 파이 4를 기존에 개인 NAS 및 블로그 용도로 사용했는데, 이걸 사용하던 주된 이유가 전력을 적게 먹으면서도 필요한 기능을 다 할 수 있었기 때문이었거든요. M1이나 M2 맥 미니로 바꿀까 생각 중이었는데, 이 정도로도 충분하다고 생각하고 질렀습니다! 아마존에서 구입했는데, 배송비 포함 157.29 달러 외 별도 금액은 들지 않았습니다.

모델명은 AK7 Pro이고, 사양은 11th Gen Intel N5105 (Up to 2.9GHz), 램 8GB, SSD 256GB, 그리고 4K@60Hz를 지원하는 HDMI 2개, WIFI와 블루투스 4.2, 기가비트 이더넷, USB 3.0 2개, USB 2.0 2개를 지원합니다. 그리고 윈도우즈 11 Pro 정품이 설치되어 있습니다. 아마존 Q&A에 사용되는 드라이버를 따로 받을 수 있냐는 질문에 안된다고 깔려 있는 거 쓰라고 합니다.

외형을 살펴볼까요? 한 쪽 면에는 전원 스위치와 USB 3.0 포트 두개, USB 2.0 포트 하나가 있습니다.

다른 한쪽 면에는 DC 전원어댑터 구멍, USB 2.0, HDMI 단자 두 개, 이더넷, AUX/MIC 홀이 있습니다.

DC 전원 어댑터는 아래처럼 생겼습니다. 프리볼트긴 합니다만, 11자라 돼지코 필요합니다. 켜져 있을 때는 괜찮은데, 꺼져 있을 때 전원 어댑터를 연결해두면 삐~ 고주파가 들립니다. 저야 24시간 돌아 갈 용도이긴 합니다.

아래 면은 VESA 홀이 있어서 모니터에 붙여서 사용할 수 있습니다. 붙일 수 있는 부속품을 함께 제공합니다.

자, 외형은 다 봤으니 뜯어봅시다.

윗 면에 안테나가 얇은 선으로 연결되어 있으니 조심합시다. 뜯을 때는 https://www.youtube.com/watch?v=YCuRs7jR-ss 를 참고했습니다.

SATA M.2 SSD 256GB 가 달려있습니다. CYX는 어디건지.. 나중에 찾아보니 이 Mini PC 제조사인 것 같습니다. M.2 SSD 옆에 SATA 단자와 2핀짜리 Power도 있어서 확장도 할 수 있다고는 합니다. 그런데 어디로 저 선을 빼야…. 구멍을 뚫어야 하려나요.. 나사가 또 보이니까 더 뜯어봅시다.

방열판에 써멀 발라 붙이고 팬을 돌려서 방열을 하고 있네요. 다시 덮고 전원을 넣어서 켜 봅니다. 윈도우 설치는 영어로 진행할 수 있는데, 언어팩 등을 설치하고 전역 설정을 해주면 한글로도 잘 사용할 수 있습니다. 4K@60Hz도 잘 나오네요. 정보에 프로세서는 2.00 GHz로 나오네요.

SATA SSD 성능을 한번 볼까요?

근데 아까 M.2 슬롯을 보니 NVME도 꽂을 수 있을 거 같던데요? 한번 꽂아봅시다. WD_BLACK SN750 1TB입니다.

인식을 할까요? 오! BIOS에서 잡네요! 그럼 NVME SSD를 하나 사서 달아야겠습니다. 어차피 라즈베리 파이 4에서는 MicroSD 썼었는데 NVME SSD면 차고도 넘칩니다. 같은 용량으로 싼 거 사서 답니다.

다른 PC에서 마이그레이션해서 부팅하니 잘 됩니다. SSD 성능도 잘 나옵니다. 더 좋은 걸 달고 싶지만, 이왕이면, 이왕이면.. 하다 어떻게 되는지 우리는 잘 알고 있습니다.

그럼 다 봤으니.. 우분투를 깝니다. 몇 가지 삽질이 있었습니다만, 잘 뜹니다.

온도도 확인해 봅시다.

8TB짜리 USB 3.0 HDD를 두 개 붙여서 NAS 완성! 제 블로그가 요걸로 계속 돌고 있는 겁니다..

장점은 저전력에 x86_64 PC환경과 같으니 하고 싶은 거 다 해볼 수 있습니다. 가격도 저렴한 편이고, 따로 뭐 살 필요 없이 무선랜, 블루투스도 사용 가능합니다. 전 NAS 용도지만, 윈도우즈 정품도 주니, 업무 용도나 서브 PC로 그냥 써도 될 거 같네요.

단점은 램이 8기가라 좀 아쉬운데 확장 불가, 꺼두었을 때 전원부 고주파음이 있습니다.

[Ubuntu] Bkouen MiniPC에 우분투 22.04 설치 후 발생했던 문제들 해결

Bkouen Mini PC에 Ubuntu 22.04.01 server edition에 ubuntu-desktop을 설치한 이후 발생하는 문제들을 해결한 기록이다.

PCIe Bus 에러 발생 처리

아래의 ACPI Error가 난다. 그 후 이더넷 포트에 네트워크 케이블을 연결해두면 로그가 계속 찍히면서 콘솔을 사용할 수 없게 된다.


Feb 25 20:03:27 nas-ubuntu kernel: [    0.383989] pcieport 0000:00:1c.0: DPC: error containment capabilities: Int Msg #0, RPExt+ PoisonedTLP+ SwTrigger+ RP PIO Log 4, DL_ActiveErr+
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384278] pcieport 0000:00:1c.1: PME: Signaling with IRQ 123
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384343] pcieport 0000:00:1c.1: AER: enabled with IRQ 123
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384387] pcieport 0000:00:1c.1: DPC: enabled with IRQ 123
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384390] pcieport 0000:00:1c.1: DPC: error containment capabilities: Int Msg #0, RPExt+ PoisonedTLP+ SwTrigger+ RP PIO Log 4, DL_ActiveErr+
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384652] pcieport 0000:00:1c.4: PME: Signaling with IRQ 124
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384711] pcieport 0000:00:1c.4: AER: enabled with IRQ 124
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384753] pcieport 0000:00:1c.4: DPC: enabled with IRQ 124
Feb 25 20:03:27 nas-ubuntu kernel: [    0.384756] pcieport 0000:00:1c.4: DPC: error containment capabilities: Int Msg #0, RPExt+ PoisonedTLP+ SwTrigger+ RP PIO Log 4, DL_ActiveErr+

...

Feb 25 20:03:27 nas-ubuntu kernel: [    0.385872] ACPI BIOS Error (bug): Could not resolve symbol [\\_SB.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385883]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385885] No Local Variables are initialized for Method [_CPC]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385887]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385889] No Arguments are initialized for method [_CPC]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385891]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385893] ACPI Error: Aborting method \\_SB.PR01._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385945] ACPI BIOS Error (bug): Could not resolve symbol [\\_SB.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385952]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385953] No Local Variables are initialized for Method [_CPC]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385955]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385956] No Arguments are initialized for method [_CPC]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385958]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.385960] ACPI Error: Aborting method \\_SB.PR02._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386007] ACPI BIOS Error (bug): Could not resolve symbol [\\_SB.PR00._CPC], AE_NOT_FOUND (20210730/psargs-330)
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386013]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386015] No Local Variables are initialized for Method [_CPC]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386016]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386018] No Arguments are initialized for method [_CPC]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386019]
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386021] ACPI Error: Aborting method \\_SB.PR03._CPC due to previous error (AE_NOT_FOUND) (20210730/psparse-529)
Feb 25 20:03:27 nas-ubuntu kernel: [    0.386410] ACPI: \\_TZ_.TZ00: Invalid active0 threshold

Troubleshooting PCIe Bus Error severity Corrected on Ubuntu and Linux Mint

네트워크 케이블을 빼두고, 위 링크의 첫번째 해결책(Handling PCIe Bus Error messages if you can boot in to your Linux system)을 사용한다. Disable MSI 해결 방법의 경우 부팅이 안됐다.

# cp /etc/default/grub ~/grub.back
$ sudo vi /etc/default/grub

GRUB_CMDLINE_LINUX_DEFAULTpci=noaer 을 추가.

GRUB_CMDLINE_LINUX_DEFAULT="pci=noaer"

아래 명령으로 grub을 업데이트한다.

$ sudo update-grub

위의 방법(”pci=noaer”)은 그냥 ‘Advanced Error Reporting’ 을 disable하는 것이다.

아래 내용도 참고하자. BIOS가 책임져야 하므로 커널 문제는 아니라고 한다. 위의 해결책을 적용해도 커널 로그에 에러는 여전히 찍힌다.

[Solved] ACPI errors during boot – Linux Mint Forums

sssd 설정

아래와 같은 sssd 실패 메시지가 보인다.

에러 메시지는 다음과 같다.

[DEPEND] Dependency failed for SSSD NSS Service responder socket.
[DEPEND] Dependency failed for SSSD AutoFS Service responder socket.
[DEPEND] Dependency failed for SSSD PAC Service responder socket.
[DEPEND] Dependency failed for SSSD PAM Service responder private socket.
[DEPEND] Dependency failed for SSSD PAM Service responder socket.
[DEPEND] Dependency failed for SSSD SSM Service responder socket.
[DEPEND] Dependency failed for SSSD Sudo Service responder socket.

sssd.conf 설정 파일을 /etc/sssd/ 아래에 넣자

$ sudo cp /usr/lib/x86_64-linux-gnu/sssd/conf/sssd.conf /etc/sssd/
$ sudo chmod 600 /etc/sssd/sssd.conf 
$ sudo systemctl enable sssd
$ sudo systemctl status sssd
$ sudo systemctl start sssd
$ sudo systemctl status sssd

reboot 나 halt 불가 해결

대기 모드 진입했다 다시 사용했다 하면 갑자기 GUI 진입 후 shell 에서 입력 출력 에러가 나오고, reboot나 halt도 안먹는다. 이런 에러가 나온다.

[!!!!!!] Failed to execute shutdown binary.

[22.04][EHL] can not shutdown and reboot

위 링크의 해결책을 사용했다.

sudo vi /etc/modprobe.d/blacklist.conf

아래 줄을 추가한다.

blacklist pinctrl_elkhartlake

이후 아래 명령을 실행한다.

sudo update-initramfs -u

그리고 재부팅.

[Ubuntu] cron-apt로 패키지 자동 업데이트 하기

cron-apt를 설치하면 오전 4시에 알아서 패키지 업데이트를 해준다.

sudo apt-get install cron-apt

/etc/cron.d/cron-apt 파일 안에서 시간 설정을 바꿀 수 있다. 나는 오전 5시로 바꿨다.

root@bamtol:/etc/cron.d# cat /etc/cron.d/cron-apt
#
# Regular cron jobs for the cron-apt package
#
# Every night at 5 o'clock.
0 5	* * *	root	test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt
# Every hour.
# 0 *	* * *	root	test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt /etc/cron-apt/config2
# Every five minutes.
# */5 *	* * *	root	test -x /usr/sbin/cron-apt && /usr/sbin/cron-apt /etc/cron-apt/config2

참고: https://help.ubuntu.com/community/AutoWeeklyUpdateHowTo

dd로 disk 전체 백업하기

$ sudo apt-get install ntfs-3g
$ sudo fdisk -l
$ sudo mkdir /mnt/sdb5 && sudo mount.ntfs-3g /dev/sdb5 /mnt/sdb5
$ sudo dd if=/dev/sdc of=/mnt/sdb5/IMAGE_NAME_HERE.img bs=64K status=progress

미니 PC를 하나 샀다. SATA M.2 SSD 안에 Windows 10 Pro 정품이 깔려 있다. 이미지로 만들어서 백업하고 우분투 깔아야겠다.

[Ubuntu] 20.04에서 Jenkins 설치하기

1. java 설치되어 있는지 확인(java -version) 후 없으면 open-jdk 설치

sudo apt-get install openjdk-8-jdk

2. repository 키 추가

wget -q -O - https://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -

3. sources.list 에 추가

sudo sh -c 'echo deb http://pkg.jenkins.io/debian-stable binary/ > /etc/apt/sources.list.d/jenkins.list'

4. jenkins를 apt-get 으로 설치

sudo apt-get update && apt-get install jenkins

5. Jenkins 시작

sudo systemctl start jenkins

6. 혹시 방화벽 있으면 열기

sudo ufw allow 8080

7. http://IP:8080 으로 Jenkins 최초 접속. Administrator password는 아래에서 얻는다.

sudo cat /var/lib/jenkins/secrets/initialAdminPassword

그 다음은 그냥 쭉쭉 진행! 생략…

참고: https://www.digitalocean.com/community/tutorials/how-to-install-jenkins-on-ubuntu-20-04

[Linux] KVM의 Bridge mode network 사용 시 네트워크 사용 불가 문제

KVM 사용 시 Bridge mode로 GuestOS에 네트워크 셋팅을 해도 동작을 안하는 경우가 있다. 게이트웨이나 DNS로 ping조차 안가는데, docker 와 함께 사용 시 문제가 발생한다.

docker가 iptables 의 FORWARD chain의 정책을 DROP으로 해버리기 때문이다.

oot@justiny-desktop:~# iptables -L
Chain INPUT (policy ACCEPT)
target     prot opt source               destination         

Chain FORWARD (policy DROP)
target     prot opt source               destination         
DOCKER-USER  all  --  anywhere             anywhere            
DOCKER-ISOLATION-STAGE-1  all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere             ctstate RELATED,ESTABLISHED
DOCKER     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            
ACCEPT     all  --  anywhere             anywhere            

Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination         

Chain DOCKER (1 references)
target     prot opt source               destination         

Chain DOCKER-ISOLATION-STAGE-1 (1 references)
target     prot opt source               destination         
DOCKER-ISOLATION-STAGE-2  all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-ISOLATION-STAGE-2 (1 references)
target     prot opt source               destination         
DROP       all  --  anywhere             anywhere            
RETURN     all  --  anywhere             anywhere            

Chain DOCKER-USER (1 references)
target     prot opt source               destination         
RETURN     all  --  anywhere             anywhere 

다음처럼 해주면 잘된다.

# iptables -A FORWARD -i br0 -o br0 -j ACCEPT

[Linux][bash] git branch를 prompt에 넣기

~/.bashrc 에 다음을 추가.

parse_git_branch() {
     git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/ (\1)/'
}
export PS1="\u@\h \[\033[32m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\] $ "
#  PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[33m\]\$(parse_git_branch)\[\033[00m\]$ "

[Windows+Linux] WSL 사용 시 참고

Ubuntu 20.04 내의 파일 저장 경로

WSL 1

%localappdata%\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows어쩌고저쩌고\LocalState\rootfs\

예를 들어, C:\Users\dasom\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu20.04onWindows_79rhkp1fndgsc\LocalState\rootfs

WSL 2

\\wsl$ 를 입력하면 배포판이 보인다.

\\wsl$\Ubuntu-20.04

GUI

Xming 같은 Xserver를 사용해서 WSL로 설치한 Ubuntu 등에서 GUI 를 사용할 수 있다.

WSL 1을 WSL 2로 변환하기

WSL로 설치한 항목은 다음으로 확인 가능하다.

wsl -l -v

여기서 WSL Version이 1인 것을 다음과 같이 2로 바꿀 수 있다. 예제로 Ubuntu-20.04 를 바꾸고 싶다면 다음과 같이 하면 된다.

wsl --set-version Ubuntu-20.04 2

실행 시 기본 유저 바꾸기

명령 프롬프트에서 다음을 실행한다.

ubuntu config --default-user new_dasomoli

참고

아래 글이 매우 정리가 잘 되어 있다.