Raspberry pi 4 partial USB boot+ moodeaudio 6.5.1 + nginx + vnc + transmission + vsftp + RGB Cooling HAT

$ sudo apt-get install vim

$ sudo sqlite3 “/var/local/www/db/moode-sqlite3.db” “DROP TRIGGER IF EXISTS ro_columns”
$ sudo sqlite3 “/var/local/www/db/moode-sqlite3.db” “UPDATE cfg_hash SET ACTION = ‘warning’ WHERE PARAM = ‘/etc/nginx/nginx.conf'”
$ sudo sqlite3 “/var/local/www/db/moode-sqlite3.db” “CREATE TRIGGER ro_columns BEFORE UPDATE OF param, value, [action] ON cfg_hash FOR EACH ROW BEGIN SELECT RAISE(ABORT, ‘read only’); END;”

$ sudo vim /var/www/inc/playerlib.php

Comment lines 217, 218, 219, 220
Code:
//if ($row[‘id’] ../../sda2
lrwxrwxrwx 1 root root 10 May 1 03:03 b64c0d28-6e63-f24d-a406-281a63af722c -> ../../sda1

$ sudo mkdir /media/b64c0d28-6e63-f24d-a406-281a63af722c
$ sudo mount /dev/sda1 /media/b64c0d28-6e63-f24d-a406-281a63af722c

$ cd /media/b8b5e21c-94e4-4e5b-96c2-ecf922a95c6f/etc
$ sudo vim fstab
#PARTUUID=738a4d67-02 / ext4 defaults,noatime 0 1
PARTUUID=b64c0d28-6e63-f24d-a406-281a63af722c / ext4 defaults,noatime 0 1
PARTUUID=a4f2f1ad-835d-264a-b0f7-03399e812ce0 /home2 xfs defaults,nofail 0 0

$ sudo vim /boot/cmdline.txt
net.ifnames=0 console=serial0,115200 console=tty1 root=PARTUUID=b64c0d28-6e63-f24d-a406-281a63af722c rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait

$ sudo reboot

$ sudo blkid -o list
$ sudo umount /dev/mmcblk0p2
$ sudo mkfs.ext4 /dev/mmcblk0p2
$ sudo reboot

$ sudo systemctl stop dphys-swapfile
$ sudo vim /etc/dphys-swapfile

CONF_SWAPFILE=/var/swap
CONF_SWAPSIZE=10240

$ sudo systemctl start dphys-swapfile
$ sudo systemctl enable dphys-swapfile
$ sudo reboot

$ sudo apt-get update
$ sudo apt full-upgrade
$ sudo reboot

$ sudo vim /boot/config.txt
dtoverlay=pi3-disable-wifi
dtoverlay=pi3-disable-bt
arm_64bit=1
$ sudo reboot

$ uname -a
Linux moode 4.19.115-v8+ #1305 SMP PREEMPT Fri Apr 17 12:06:34 BST 2020 aarch64 GNU/Linux

Go moodeaudio Configure -> open Network, change to static IP,

$ reboot
$ cd /mnt/SDCARD
$ sudo rm -rf ‘Stereo Test’/
$ sudo ln -s /home2/Music Music
open moode.local on web browser. Configure -> Library -> RE-GEN MPD database.

$ sudo apt-get install tightvncserver
$ sudo apt-get install –no-install-recommends xserver-xorg
$ sudo apt-get install –no-install-recommends xinit
$ sudo apt-get install –no-install-recommends raspberrypi-ui-mods lxsession
$ sudo apt-get install fonts-noto
$ sudo apt-get install openjdk-11-jre-headless
$ sudo reboot

$ sudo apt-get install fonts-ipaexfont
$ cd /usr/lib/jvm/java-11-openjdk-armhf/lib/
$ sudo mkdir fonts
$ sudo mkdir fonts/fallback
$ cd /usr/lib/jvm/java-11-openjdk-armhf/lib/fonts/fallback
$ ls
$ sudo ln -s /usr/share/fonts/opentype/ipaexfont-gothic/* ./

$ sudo vim /etc/nginx/nginx.conf
server {
listen 8080;

location / {
root /home2/t;
autoindex on;
}
}

$ sudo apt-get update
$ sudo apt-get install vsftpd ftp
$ sudo vim /etc/vsftpd.conf
Uncomment this to enable any form of FTP write command.
write_enable=YES

$ sudo systemctl enable vsftpd
$ sudo systemctl start vsftpd

$ sudo apt install transmission-daemon
$ sudo systemctl stop transmission-daemon
$ sudo systemctl disable transmission-daemon
$ cd ~/.config/
$ cp -r /home2/backup/pi/.config/transmission-daemon .
$ sudo reboot

$ sudo raspi-config
Then, select the【Interfacing Options】
Select 【P5 I2C】 and confirm with “YES”.
$ gcc -o fan fan.c -lwiringPi
$ gcc -o temp_control_with_rgb temp_control_with_rgb.c ssd1306_i2c.c -lwiringPi
$ ./install.sh

debug wordpress

modify wp-config.php

check /wp-content/debug.log

define(‘WP_DEBUG’, true); // enable debug.
if (WP_DEBUG) { // only if enabled
define(‘WP_DEBUG_LOG’, true); // write to debug.log
define(‘WP_DEBUG_DISPLAY’, false); // do not show on browser
@ini_set(‘display_errors’,0); //do not show on browser
}

raspberry pi + moodeaudio + tigervnc + jdownloader + transmission all in one

Make bootable sd card on Mac.

List disk.
$ diskutil list

unmount SD card.
$ sudo umount /dev/disk2s1

copy moodeaudio to SD card.
$ sudo dd bs=1m if=Downloads/moode-r630-iso.img of=/dev/rdisk2

update raspberry pi and install vim
$ sudo apt-get update
$ sudo apt-get install vim
$ sudo apt-get upgrade

Mount extra usb on raspberry pi
$ sudo fdisk -l
obtain UUID of usb disk

$ sudo mkdir /home2
$ sudo mount /dev/sda1 /home2

$ sudo vim /etc/fstab
UUID=dc69fc31-4a50-44e2-a3f7-f5648fea6f8d /media/usb0 ext4 defaults,nofail 0 0

Reboot -> open moode.local on web browser.

Go Configure -> open Network, change to static IP,
Go System check for update and update.

Check progress of update with
$ moodeutl -t

Reboot

Update USB music library.
$ cd /mnt/SDCARD
$ sudo ln -s /home2/Music Music

open moode.local on web browser. Configure -> Library -> RE-GEN MPD database.

Install vncserve
$ sudo apt-get install tightvncserver

Install x and gui

$ sudo apt-get install –no-install-recommends xserver-xorg
$ sudo apt-get install –no-install-recommends xinit
$ sudo apt-get install –no-install-recommends raspberrypi-ui-mods lxsession

Install Japanese font
$ sudo apt-get install fonts-noto

Run VNC
$ vncserver :0 -geometry 1600×1200 -depth 24

Install Jdownloader and Java

$ mkdir ~/bin
$ mkdir ~/bin/jdownloader
$ cd ~/bin/jdownloader
$ wget http://installer.jdownloader.org/JDownloader.jar

$ sudo apt-get install openjdk-11-jre-headless

Connect report desktop by VNC, Open xterm
$ java -jar JDownloader.jar -norestart
$ java -jar JDownloader.jar -norestart

Run Until jdownloader update finish.

Install transmission
$ sudo apt install transmission-daemon
$ sudo systemctl stop transmission-daemon
$ sudo systemctl disable transmission-daemon

$ transmission-daemon
$ ps -u pi
$ kill ****
$ vim ~/.config/transmission-daemon/settings.json
Remove web access restriction, update download folder etc..
$ transmission-daemon
transmission-daemon -f will run with log.
Open http://moode.local:9091 and update setting.

edit nginx.conf and add
$ sudo vim /etc/nginx/nginx.conf

server {
listen 8080;

location / {
root /home2/t;
autoindex on;
}
}

$ sudo sqlite3 /var/local/www/db/moode-sqlite3.db “DROP TRIGGER ro_columns”
$ sudo sqlite3 /var/local/www/db/moode-sqlite3.db “UPDATE cfg_hash SET ACTION = ‘warning’ WHERE PARAM = ‘/etc/nginx/nginx.conf'”

$ sudo systemctl restart nginx.service

Japanese font for jdownloader.
$ sudo apt-get install fonts-ipaexfont
$ cd /usr/lib/jvm/java-11-openjdk-armhf/
$ mkdir fonts
$ mkdir fonts/fallback
$ cd /usr/lib/jvm/java-11-openjdk-armhf/lib/fonts/fallback
$ ls
$ sudo ln -s /usr/share/fonts/opentype/ipaexfont-gothic/* ./

Install vsftpd
$ sudo apt-get update
$ sudo apt-get install vsftpd ftp
$ sudo vim /etc/vsftpd.conf
# Uncomment this to enable any form of FTP write command.
#write_enable=YES

$ sudo systemctl enable vsftpd
$ sudo systemctl start vsftpd

Reference:

Moode Audio でハイレゾオーディオ(Raspberry Pi Zero W DAC)

https://www.raspberrypi.org/forums/viewtopic.php?f=66&t=133691&sid=c71a1e9285378559ec9264dafe9ee1b1

Raspberry Pi 3B+ Downloadserver mit jDownloader und Deluge Torrent

https://support.jdownloader.org/Knowledgebase/Article/View/52/0/install-jdownloader-on-nas-and-embedded-devices

https://pimylifeup.com/raspberry-pi-transmission/

moodeaudio Integrity check (failed) when modify nginx.conf

pi@moode:~ $ moodeutl -t
20191207 162352 worker: — Start
20191207 162352 worker: Successfully daemonized
20191207 162352 worker: Integrity check (failed)
20191207 162352 worker: Exited

to fix

pi@moode:~ $ sudo sqlite3 /var/local/www/db/moode-sqlite3.db “DROP TRIGGER ro_columns”
pi@moode:~ $ sudo sqlite3 /var/local/www/db/moode-sqlite3.db “UPDATE cfg_hash SET ACTION = ‘warning’ WHERE PARAM = ‘/etc/nginx/nginx.conf'”

find size by folder…

[root@sandbox home]# df -h .; du -sh — * | sort -hr
Filesystem Size Used Avail Use% Mounted on
/dev/vda1 40G 14G 24G 37% /
3.0G xxx
1.7G xxw
1.4G xxdd

etc….

MacOS Sierra sysctl setting for better performance?

# OSX default of 3 is not big enough
net.inet.tcp.win_scale_factor=8
# increase OSX TCP autotuning maximums
net.inet.tcp.autorcvbufmax=33554432
net.inet.tcp.autosndbufmax=33554432
net.inet.tcp.delayed_ack=0

kern.ipc.somaxconn=2048
net.inet.tcp.rfc1323=1
net.inet.tcp.win_scale_factor=4
net.inet.tcp.mssdflt=1448
net.inet.tcp.v6mssdflt=1412
net.inet.tcp.msl=15000
net.inet.tcp.always_keepalive=0
net.inet.tcp.slowstart_flightsize=20
net.inet.tcp.local_slowstart_flightsize=9
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.icmp.icmplim=50
net.inet.tcp.sendspace=1042560
net.inet.tcp.recvspace=1042560