Category Archives: linux

[InnoDB] Tablespace 1, name ‘sys/sys_config’, file ‘./sys/sys_config.ibd’ is missing!

su - mysql -s /bin/bash
mysqld_safe --upgrade=MINIMAL --skip-grant-tables --skip-networking

mysql> DROP DATABASE sys;
ERROR 3679 (HY000): Schema directory './sys/' does not exist

mkdir /var/lib/mysql/sys
chown mysql:mysql /var/lib/mysql/sys

mysql> drop database sys;
Query OK, 101 rows affected (0.03 sec)

upgrade postgres 15 -> 16

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg

apt update
apt install postgresql-16

pg_dropcluster --stop 16 main
pg_upgradecluster --method=upgrade --link 15 main

pg_lsclusters

15 main 5433 down postgres /var/lib/postgresql/15/main /var/log/postgresql/postgresql-15-main.log
16 main 5432 online postgres /var/lib/postgresql/16/main /var/log/postgresql/postgresql-16-main.log

wireguard-ui without docker

wget wireguard-ui:
https://github.com/ngoduykhanh/wireguard-ui/releases

tar -xvzf wireguard-ui-*.tar.gz
mkdir /opt/wireguard-ui
mv wireguard-ui /opt/wireguard-ui/

vim /opt/wireguard-ui/.env
SESSION_SECRET=
WGUI_USERNAME=
WGUI_PASSWORD=

vim /opt/wireguard-ui/postup.sh
#!/usr/bin/bash
# /opt/wireguard-ui/postup.sh
ufw route allow in on wg0 out on eth0
iptables -t nat -I POSTROUTING -o eth0 -j MASQUERADE

vim /opt/wireguard-ui/postdown.sh
#!/usr/bin/bash
# /opt/wireguard-ui/postdown.sh
ufw route delete allow in on wg0 out on eth0
iptables -t nat -D POSTROUTING -o eth0 -j MASQUERADE

chmod +x /opt/wireguard-ui/post*.sh

vim /etc/systemd/system/wireguard-ui-daemon.service
[Unit]
Description=WireGuard UI Daemon
Wants=network-online.target
After=network-online.target

[Service]
User=root
Group=root
Type=simple

systemctl daemon-reload
systemctl start wireguard-ui-daemon.service

vim /etc/systemd/system/wgui.service
[Unit]
Description=Restart WireGuard
After=network.target

[Service]
Type=oneshot
ExecStart=/usr/bin/systemctl restart [email protected]

[Install]
RequiredBy=wgui.path

vim /etc/systemd/system/wgui.path
[Unit]
Description=Watch /etc/wireguard/wg0.conf for changes

[Path]
PathModified=/etc/wireguard/wg0.conf

[Install]
WantedBy=multi-user.target

systemctl daemon-reload
systemctl enable wgui.{path,service}
systemctl start wgui.{path,service}

Nginx proxy:

add_header Cache-Control no-cache;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $http_host;
proxy_pass http://127.0.0.1:5000/;