Skip to content

Latest commit

 

History

History
278 lines (210 loc) · 9.05 KB

File metadata and controls

278 lines (210 loc) · 9.05 KB

Linux Embedded Systems

Field notes, commands and configs for embedded Linux boards.

Alpine · Debian / Ubuntu · BeagleBone · Raspberry Pi · Rockchip

System · Network · Remote Access · Boot & Services · Storage · Boards & Devices · Servers · Cheatsheet


System

Page Notes
Linux Commands Everyday shell commands and package handling
Cron Scheduled jobs with crontab
Date & Time Timezone and clock setup on Debian/Ubuntu
Alpine Setup Installing and preparing Alpine Linux
Free Desktop Desktop entries and autostart files
LightDM Start, stop and configure the display manager
Passwordless Login Auto-login without a password prompt

Network

Page Notes
IP & Network Interfaces, static IP and routing
iptables Chains, rules and NAT
UFW Simple firewall rules
curl Requests, downloads and build tooling
rsync Copying and syncing files between machines
Nekoray Proxy client setup on Linux
Ports Port and cape reference

Proxy

Script Notes
setup-proxy.sh Applies a proxy system-wide on Debian — every layer at once
clear-proxy.sh Removes every proxy setting again, with backups
Page Notes
Route Traffic Through a Remote VPS Exit through a VPS's IP: tinyproxy + ssh -L, or plain ssh -D SOCKS5
Usage

setup-proxy.sh writes the proxy into all the places that matter, because none of them read each other: systemd (system and user manager), /etc/environment, /etc/profile.d, apt, wget, git, sudo env_keep, cron.d, dconf for GTK apps, and fish/tcsh. It runs a preflight first — if the proxy host does not resolve or the port is closed, it aborts and writes nothing.

sudo ./setup-proxy.sh http://192.168.40.10:8080   # install
./setup-proxy.sh --show                           # resolved values, no changes
./setup-proxy.sh --verify                         # did it actually take effect?
./setup-proxy.sh --walk                           # find the stale process
sudo ./setup-proxy.sh --uninstall                 # undo

Dry run against a fake root, touching no real file:

ROOT=/tmp/proxytest ./setup-proxy.sh http://192.168.40.10:8080

The step people miss. A process copies its environment at exec() and it can never be changed from outside afterwards. So your current shell keeps the old value no matter how often you re-run the script — that is not a failure. Test what the next login gets, then refresh:

bash -lc 'echo $https_proxy'    # the honest test
exec bash -l                    # refresh this shell, keeps SSH alive
pkill -f '.vscode-server'       # the usual stale ancestor (ppid=1)

A stale ancestor poisons every child it spawns, so killing a leaf process does not help. sudo reboot clears every layer at once.

clear-proxy.sh reverses all of it and backs up each edited file to <file>.bak-<timestamp>:

sudo ./clear-proxy.sh             # system level; reports per-user files
sudo ./clear-proxy.sh --all       # also clean ~/.bashrc, ~/.npmrc, etc.
sudo ./clear-proxy.sh --dry-run   # show only

Both scripts default to a placeholder address and an internal domain of .emdad.local — override with INTERNAL_DOMAIN or edit the CONFIG block. For a loopback proxy (cntlm, v2ray/Xray on 127.0.0.1), make that client a systemd unit with WantedBy=multi-user.target, or boot-time services will run before it is up and fail.

Wi‑Fi

Page Notes
Wi‑Fi Hotspot Turning the board into an access point
Wi‑Fi Power Management Preventing the adapter from sleeping
Ad‑hoc Mode Direct board-to-board links
wpa_supplicant Manual Wi‑Fi client configuration

Cellular

Page Notes
SIM5320 AT commands and PPP dial-up

Remote Access

SSH — overview

Page Notes
Passwordless Login Key-based access to a board
Disable SSH Timeout Keeping long sessions alive
VS Code Remote SSH ~/.ssh/config for Remote‑SSH
SSH → PPK Converting keys for PuTTY
Deploy Key Restricted key for app updates
Clone a Private Repo Git over SSH on a board
VM & Windows Host Port forwarding to a guest VM

VNC

Page Notes
TigerVNC Direct connection guide

Boot & Services

Page Notes
Autostart / Init Scripts OpenRC, systemd, and legacy SysV init

Storage

Page Notes
Resize Disk Growing the root partition
Backup eMMC Full image backup and restore

Boards & Devices

Page Notes
BeagleBone Black Board setup, quirks, and pinout diagrams
Rockchip Setup and Python install scripts
Raspberry Pi Slimming Removing unnecessary packages
GPIO Reading and driving pins
Serial Port QextSerialPort usage
I²C & RTC Bus scanning and hardware clock
Bluetooth Pairing and services
Audio ALSA devices and test sounds
GIS Library Config GDAL / PROJ linker flags
Build Script Notes Packaging a config script

Servers & Containers

Page Notes
Compile Nginx Building from source with modules
Podman & Distrobox Rootless containers on a board

Cheatsheet

APT behind a proxy — manual, for one-off boards

For a full system-wide setup use setup-proxy.sh instead; this is the minimal manual equivalent.

sudo nano /etc/apt/apt.conf.d/90proxy
Acquire::http::Proxy  "http://172.20.10.1:3128";
Acquire::https::Proxy "http://172.20.10.1:3128";

With credentials:

Acquire::http::Proxy  "http://username:password@proxy.server:port";
Acquire::https::Proxy "http://username:password@proxy.server:port";

One-liner:

echo 'Acquire::http::Proxy "http://USERNAME:PASS@172.20.10.1:3128/";' \
  | sudo tee /etc/apt/apt.conf.d/95proxy
Extract an archive
tar xpvf /path/to/my_archive.tar.xz -C /path/to/extract
Change the root password
sudo su
passwd
Check free space

Per-directory usage, largest first:

du --max-depth=1 | sort -nr
668716  .
283508  ./lib
226560  ./share
 69668  ./local
 58544  ./bin

Mounted filesystems:

df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/root       1.2G  1.1G   17M  99% /
tmpfs           463M  6.2M  457M   2% /run
/dev/mmcblk0p1   60M   20M   41M  34% /boot
Change the hostname
echo "alpine_pc" > /etc/hostname
hostname -F /etc/hostname
hostname