[{"content":"Proxmox Virtual Environment\nProxmox VE Downloads\nProxmox VE Administration Guide\nBefore You Start These notes cover initial configuration after installing Proxmox VE 9.2. Run the host commands from the Proxmox shell or an SSH session as root.\nThe examples use pve-01 as the node name and 192.168.2.4 as its management address. Replace both with the values configured during installation.\nAccess the Web Interface From another computer on the same network, open the management address on HTTPS port 8006:\nProxmox Web Interface\nSign in using the installation credentials:\nField Value Username root Realm Linux PAM standard authentication (pam) Password Root password configured during installation A browser certificate warning may appear because Proxmox initially uses a self-signed HTTPS certificate. Confirm that you are connecting to the intended host before proceeding.\nConnect over SSH Connect to the Proxmox host:\nssh root@192.168.2.4 Inspect the hostname, network configuration, storage devices, and memory:\nhostnamectl ip -br addr ip route lsblk free -h Configure Package Repositories A fresh installation may have enterprise repositories enabled. These require a valid Proxmox subscription; without one, apt update may report an authentication error:\n401 Unauthorized Disable Enterprise Repositories For a host without a subscription, open the repository settings in the web interface:\npve-01 \u0026gt; Updates \u0026gt; Repositories\nSelect each enabled enterprise entry and click Disable:\nProxmox VE Enterprise. Ceph Enterprise, if present. Keep the Debian base, updates, and security repositories enabled.\nEnable the No-Subscription Repository On the same page, select Add \u0026gt; No-Subscription to enable the Proxmox VE repository.\nProxmox VE 9.2 uses Debian Trixie. The equivalent traditional APT source entry is shown below as a reference:\ndeb http://download.proxmox.com/debian/pve trixie pve-no-subscription Only one active entry for this repository is needed. If it is already configured through the web interface, do not add a duplicate entry manually.\nThe no-subscription repository is intended for testing and non-production use. Proxmox recommends the enterprise repository for production. See the repository documentation.\nIf the host uses Ceph, configure its repository separately for the installed Ceph release. Adding the Proxmox VE no-subscription repository does not configure Ceph package updates.\nUpdate the Host From the Proxmox host shell, refresh package metadata:\napt update Resolve repository errors before upgrading. Then run the full upgrade and review the proposed changes before confirming:\napt full-upgrade Reboot when required, especially after a kernel update. Shut down or migrate running guests before restarting the host:\nreboot Verify the Installed Version Reconnect after the reboot and display the Proxmox package versions:\npveversion -v The setup notes recorded an update to version 9.2.21. Use the pveversion -v output to identify the actual installed package versions; this recorded value is not a required upgrade target.\n","date":"2026-10-14T16:25:37-04:00","permalink":"/p/proxmox-ve-initial-configuration/","title":"Proxmox VE Initial Configuration"},{"content":"Robocopy Command Reference\nChange a Drive Letter\nBefore You Start Use Robocopy to migrate files from a Windows data drive to a replacement drive, then assign the original drive letter to the replacement. These commands migrate files; they do not clone a Windows system or boot drive.\nThe examples use these drive letters:\nDrive Role D: Original drive (source) E: Replacement drive (destination) Back up important files before starting. Confirm which physical disk is the replacement drive, assign it E:, and check that it has enough free space for the source data. Replace the example drive letters with the actual assignments on your computer.\nIf the replacement volume needs formatting, use NTFS to support the metadata copied below. Formatting erases all existing data on the selected volume.\nOpen Command Prompt as administrator for the Robocopy commands.\nCheck the source and destination before every copy. /MIR removes destination files and directories that are absent from the source. Use a destination dedicated to this migration.\nCopy the Data Run the initial copy:\nrobocopy D:\\ E:\\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /MT:16 /LOG:C:\\drive-migration.log Option Purpose /MIR Mirror the directory tree, including empty directories; remove destination-only entries. /COPYALL Copy file data, attributes, timestamps, permissions, ownership, and auditing information. /DCOPY:DAT Copy directory data, attributes, and timestamps. /R:2 Retry a failed copy twice. /W:2 Wait two seconds between retries. /XJ Exclude junction points. /MT:16 Use 16 copy threads. /LOG: Write output to a log file, replacing an existing log at that path. Junction points excluded by /XJ need separate review and recreation if they are part of your setup. This is a file migration, not a sector-by-sector disk clone.\nMonitor Progress While the copy runs, open a separate PowerShell window:\nGet-Content C:\\drive-migration.log -Tail 20 -Wait Press Ctrl+C in this window to stop monitoring. The copy continues in the Command Prompt window.\nSynchronize the Final Changes After the initial copy finishes, close applications and stop services that write to D:, including synchronization tools. Keep them stopped until the replacement is complete.\nRun a final copy to capture changes made during the initial pass:\nrobocopy D:\\ E:\\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /MT:16 /LOG:C:\\drive-migration-final.log Immediately after each copy, check its exit code in the same Command Prompt window:\necho %ERRORLEVEL% An exit code of 8 or greater indicates at least one copy failure. Lower codes can still report differences; review the log summary and resolve failures before continuing.\nVerify the Copy Run a comparison without changing either drive:\nrobocopy D:\\ E:\\ /MIR /COPYALL /DCOPY:DAT /R:2 /W:2 /XJ /L /LOG:C:\\drive-migration-verify.log /L lists proposed operations without copying, deleting, or updating timestamps. Review any remaining differences and open a sample of important files from E:. This comparison is not a checksum-based integrity check.\nReplace the Original Drive Letter Once verification is complete, use Disk Management to make the replacement drive available at the original path:\nConfirm that applications and services using D: are stopped. Open Disk Management as administrator. Right-click the original data volume and select Change Drive Letter and Paths. Change D: to an unused letter, such as F:. Change the replacement volume from E: to D:. Restart the affected applications and services, then check their paths and file access. Applications installed on the drive may require additional repair or configuration after a drive-letter change. Keep the original drive intact until the replacement works as expected.\n","date":"2026-10-11T14:10:18-04:00","permalink":"/p/migrate-and-replace-a-windows-data-drive/","title":"Migrate and Replace a Windows Data Drive"},{"content":"LineageOS\nLineageOS - Xiaomi Mi 8 Pro (equuleus)\nAndroid SDK Platform-Tools\nGoogle USB Driver\nMindTheGapps 15.0 ARM64\nXiaomi Mi 8 Pro Device: Xiaomi Mi 8 Pro Codename: equuleus LineageOS: 22.2 Android: 15 GApps: MindTheGapps 15.0 ARM64 Firmware: V12.0.2.0.QECMIXM Windows 11 Extract Android Platform-Tools to:\nC:\\platform-tools ├── recovery.img ├── lineage-22.2-20260825-nightly-equuleus-signed.zip └── MindTheGapps-15.0.0-arm64-20250812_214357.zip Check Device Enable USB debugging and connect the phone.\ncd C:\\platform-tools adb devices adb reboot bootloader fastboot devices fastboot getvar product fastboot oem device-info Verify:\nproduct: equuleus Device unlocked: true Device critical unlocked: true Install Recovery fastboot flash recovery recovery.img Boot directly into LineageOS Recovery:\nVolume Up + Power Factory Reset Factory reset → Format data / factory reset → Confirm Install LineageOS Select:\nApply update → Apply from ADB Run:\nadb devices adb sideload lineage-22.2-20260825-nightly-equuleus-signed.zip Successful installation:\nInstall completed with status 0. Do not boot Android before installing GApps.\nInstall Google Apps In Recovery select again:\nApply update → Apply from ADB Run:\nadb devices adb sideload MindTheGapps-15.0.0-arm64-20250812_214357.zip If signature verification fails, select Continue / Yes.\nSuccessful installation:\nInstall completed with status 0. Reboot Select:\nReboot system now The first boot may take several minutes. Complete the Android setup wizard and sign in with a Google account.\n","date":"2026-08-30T22:53:32-04:00","permalink":"/p/mi8-pro-lineageos/","title":"Mi8 Pro LineageOS"},{"content":"LLaMA.cpp\nGitHub\nUbuntu 26.04 LTS apt update \u0026amp;\u0026amp; sudo apt upgrade -y apt install -y git build-essential cmake libvulkan-dev glslc spirv-headers apt install -y libssl-dev git clone https://github.com/ggml-org/llama.cpp.git cd ./llama.cpp cmake -B build -DLLAMA_OPENSSL=ON -DGGML_VULKAN=ON cmake --build build --config Release -j$(nproc) mkdir -p ~/models \u0026amp;\u0026amp; cd ~/models sudo apt install pipx -y pipx ensurepath pipx install \u0026#34;huggingface_hub[cli]\u0026#34; source ~/.bashrc hf models ls --search \u0026#34;qwen\u0026#34; hf download Qwen/Qwen2.5-7B-Instruct-GGUF --include \u0026#34;qwen2.5-7b-instruct-q4_k_m-*.gguf\u0026#34; --local-dir . ~/llama.cpp/build/bin/llama-cli -m qwen2.5-7b-instruct-q4_k_m-00001-of-00002.gguf -p \u0026#34;Introduce yourself.\u0026#34; -ngl 33 ","date":"2026-06-27T09:22:24-04:00","permalink":"/p/llama.cpp/","title":"LLaMA.cpp"},{"content":"Ollama\nUbuntu 26.04 LTS apt update \u0026amp;\u0026amp; sudo apt upgrade -y curl -fsSL https://ollama.com/install.sh | sh sudo mkdir -p /home/shared_models sudo chown -R ollama:ollama /home/shared_models sudo systemctl edit ollama.service [Service] Environment=\u0026#34;OLLAMA_NUM_PARALLEL=2\u0026#34;\tEnvironment=\u0026#34;OLLAMA_MAX_LOADED_MODELS=3\u0026#34; Environment=\u0026#34;OLLAMA_MODELS=/home/shared_models\u0026#34; Environment=\u0026#34;OLLAMA_HOST=0.0.0.0\u0026#34; sudo systemctl daemon-reload sudo systemctl restart ollama ollama pull llama3.1 ollama pull qwen2.5:0.5b curl http://127.0.0.1:11434/api/tags ollama list ollama ps ","date":"2026-06-26T09:22:24-04:00","permalink":"/p/ollama/","title":"Ollama"},{"content":"TroubleShootingScript toolset\nVisit Microsoft’s official TSS download page DownloadTSS.zip and extract it to a folder (e.g.,C:\\TSS) Run PowerShell as Administrator Press Win + X → SelectWindows PowerShell (Admin) . Avoid PowerShell ISE (not supported by TSS). Temporarily Allow Script Execution\nSet-ExecutionPolicy -Scope Process -ExecutionPolicy RemoteSigned -Force Run TSS to Collect Windows Update Logs\n.\\TSS.ps1 -Collectlog DND_SetupReport -AcceptEULA .\\TSS.ps1 -Collectlog Update -AcceptEULA Find the Collected Logs\nOnce complete, logs are saved in: C:\\MS_DATA\\TSS__.zip\nActive Directory .\\TSS.ps1 -Scenario ADS_AuthEx # Client .\\TSS.ps1 -Scenario ADS_Auth # Server .\\TSS.ps1 -Start -ADS_ADCS # Server Application management .\\TSS.ps1 -Scenario PRF_UWP .\\TSS.ps1 -Scenario PRF_Store .\\TSS.ps1 -Scenario PRF_WinGet .\\TSS.ps1 -Scenario PRF_Photo .\\TSS.ps1 -Scenario PRF_Clipboard .\\TSS.ps1 -Scenario PRF_MediaCamera Clustering and high availability .\\TSS.ps1 -SDP Cluster Group Policy .\\TSS.ps1 -Scenario ADS_AuthEx # Client .\\TSS.ps1 -Scenario ADS_Auth # Server Hyper-V .\\TSS.ps1 -SDP HyperV .\\TSS.ps1 -SDP HyperV -SkipSDPList skipBPA .\\TSS.ps1 -SDP HyperV -SkipSDPList skipHang .\\TSS.ps1 -SDP HyperV -SkipSDPList skipTS .\\TSS.ps1 -SDP HyperV -SkipSDPList skipCsvSMB .\\TSS.ps1 -SDP HyperV -SkipSDPList skipHVreplica Licensing and activation .\\TSS.ps1 -CollectLog DND_SETUPReport Windows networking Domain Name System (DNS) .\\TSS.ps1 -Scenario NET_DNSCli .\\TSS.ps1 -Scenario NET_DNSSrv TCP/IP connectivity .\\TSS.ps1 -Scenario NET_WinSock Access to file shares .\\TSS.ps1 -Scenario NET_SMBCli .\\TSS.ps1 -Scenario NET_SMBSrv Dynamic Host Configuration Protocol (DHCP) .\\TSS.ps1 -Scenario NET_DHCPCli .\\TSS.ps1 -Scenario NET_DHCPSrv Wired/wireless (802.1x, Bluetooth, Miracast, and mobile broadband) .\\TSS.ps1 -Scenario NET_802Dot1x .\\TSS.ps1 -Scenario NET_WLAN Performance System reliability (crashes, errors, bug checks, or blue screens, and unexpected restarts) .\\TSS.ps1 -SDP Perf System performance (slow, unresponsive, high CPU, and resource leak) .\\TSS.ps1 -Scenario PRF_General Black screen after logon .\\TSS.ps1 -Scenario PRF_UWP .\\TSS.ps1 -set crashmode .\\TSS.ps1 -Scenario PRF_UWP -crash .\\TSS.ps1 -StartAutoLogger -Scenario PRF_UWP -crash App, process, and service reliability (crashes and errors) .\\TSS.ps1 -set wer .\\TSS.ps1 -Scenario PRF_General App, process, and service performance (slow and unresponsive) .\\TSS.ps1 -Scenario PRF_General Boot problems .\\TSS.ps1 -Scenario PRF_Boot .\\TSS.ps1 -StartAutoLogger -Scenario PRF_Boot Performance library (Perflib) counters .\\TSS.ps1 -Scenario PRF_Perflib Remote Desktop Services (RDS) .\\TSS.ps1 -Scenario UEX_RDScli .\\TSS.ps1 -Scenario UEX_RDSsrv .\\TSS.ps1 -Scenario UEX_RDSsrv -UEX_ServerManager -UEX_WMI -UEX_WinRM Windows servicing, Updates, and Features on Demand .\\TSS.ps1 -CollectLog DND_SETUPReport Shell experience Desktop (Shell, Explorer.exe initialization, themes, colors, icons, and Recycle Bin) .\\TSS.ps1 -Scenario PRF_UWP .\\TSS.ps1 -StartAutoLogger -Scenario PRF_UWP Start menu .\\TSS.ps1 -Scenario PRF_StartMenu .\\TSS.ps1 -StartAutoLogger -Scenario PRF_StartMenu Search .\\TSS.ps1 -Scenario PRF_Search .\\TSS.ps1 -StartAutoLogger -Scenario PRF_Search SQL cluster (AG/FCI) Virtualization and Hyper-V .\\TSS.ps1 -SDP SQLbase Optional parameters .\\TSS.ps1 -SDP SQLbase -SkipSDPList skipBPA .\\TSS.ps1 -SDP SQLbase -SkipSDPList skipHang .\\TSS.ps1 -SDP SQLbase -SkipSDPList skipTS .\\TSS.ps1 -SDP SQLbase -SkipSDPList skipCsvSMB ","date":"2026-01-20T13:20:24-05:00","permalink":"/p/troubleshootingscript/","title":"TroubleShootingScript"},{"content":"iPerf\nGitHub\nServer iperf3.exe -s Client iperf3.exe -c 192.168.1.1 iperf3.exe -c 192.168.1.1 -R iperf3.exe -c 192.168.1.1 -P 4 iperf3.exe -c 192.168.1.1 -u ","date":"2026-01-19T13:20:24-05:00","permalink":"/p/iperf/","title":"iPerf"},{"content":"Windows 11 Download\nCreate Installation Media\nCreate a Windows 11 Installation USB Use a Windows PC with administrator access, an internet connection, and a blank USB drive with at least 8 GB of storage. Back up the USB drive first: the creation process erases its contents.\nOpen the Windows 11 download page above. Under Create Windows 11 Installation Media, select Download Now. Run the Media Creation Tool as administrator and accept the license terms. Choose the installation language and Windows 11. Clear the recommended-options checkbox if you need different settings. Select USB flash drive and choose the correct drive. Wait for the tool to finish, then close it. The Media Creation Tool creates x64 installation media. For an Arm-based PC, use Microsoft\u0026rsquo;s Arm64 download option and the device manufacturer\u0026rsquo;s installation guidance. See the download instructions.\nIn the examples below, E: is the installation USB drive. Replace it with its actual drive letter. A mounted ISO is read-only; make configuration changes on the writable USB drive after creating it.\nSelect the Installation Edition Select the edition matching your license when Windows Setup offers an edition list. For more predictable deployment, specify an edition with ei.cfg.\nCheck the Available Images Open Terminal (Admin) and use PowerShell:\nGet-ChildItem -LiteralPath \u0026#39;E:\\sources\u0026#39; -Filter \u0026#39;install.*\u0026#39; For media containing install.wim:\ndism /Get-ImageInfo /ImageFile:E:\\sources\\install.wim For media containing install.esd, use this command instead:\ndism /Get-ImageInfo /ImageFile:E:\\sources\\install.esd Find the required image index, then inspect it. Replace N with that index and use the filename present on your media:\ndism /Get-ImageInfo /ImageFile:E:\\sources\\install.esd /Index:N Use the reported edition identifier in the configuration below. An edition name such as Windows 11 Pro is different from its identifier, Professional. Microsoft documents image inspection and configuration in the EI.cfg reference.\nConfigure ei.cfg Create an ei.cfg file to enable edition selection\nOpen you Windows(e.g., Windows 11 or 10) installation USB or ISO file Explorer. Create a new test file named ei.cfg. Save this ei.cfg file to the \\sources folder on your bootable USB drive. [EditionID] Professional [Channel] Retail [VL] 0 Boot and Install Back up the target computer before starting a clean installation.\nConnect the USB drive to the target computer. Restart and open its boot menu using the manufacturer\u0026rsquo;s documented key. Choose the UEFI entry for the USB drive. Follow Windows Setup and confirm the intended edition and installation disk before proceeding. If prompted for a product key during a reinstall, you can choose I don\u0026rsquo;t have a product key when the device already has a digital license for the same edition. Activation normally resumes after connecting to the internet. A Home license does not activate Pro. See Windows activation.\nCheck the Installed Edition Open Settings \u0026gt; System \u0026gt; About, or run this command from an elevated terminal:\ndism /Online /Get-CurrentEdition Editing the EditionID or ProductName registry values alone does not install another Windows edition or provide its license. Use the supported edition-upgrade process instead.\nUpgrade Home to Pro Open the Activation page:\nStart-Process \u0026#39;ms-settings:activation\u0026#39; Under Upgrade your edition of Windows, enter a valid Pro key through Change product key, or purchase the upgrade through the Microsoft Store option. Follow the prompts and restart if requested. See Upgrade Windows Home to Pro.\nEnterprise and IoT Enterprise LTSC require their own applicable deployment and licensing arrangements. For an IoT device, follow the manufacturer\u0026rsquo;s upgrade guidance and the Windows IoT documentation.\nRead the Firmware Product Key Open PowerShell as administrator:\n(Get-CimInstance -ClassName SoftwareLicensingService).OA3xOriginalProductKey This reads the original OEM key stored in firmware, if one exists. It may differ from the license currently used by Windows, and a blank result does not establish that Windows is unactivated. Microsoft\u0026rsquo;s activation documentation describes the firmware-key property.\nUse Get-CimInstance for this query rather than the old WMIC command. Microsoft is removing WMIC and recommends modern management tools.\nCheck Activation Use Settings \u0026gt; System \u0026gt; Activation to check the activation state or enter your product key.\nFor command-line details:\ncscript.exe //Nologo \u0026#34;$env:SystemRoot\\System32\\slmgr.vbs\u0026#34; /dlv cscript.exe //Nologo \u0026#34;$env:SystemRoot\\System32\\slmgr.vbs\u0026#34; /xpr /dlv displays detailed license information; /xpr reports activation expiration information. See the Slmgr.vbs reference.\nIf activation fails, confirm that the installed edition matches your license and use Troubleshoot on the Activation page. For an organization-managed installation, contact its administrator. See Activate Windows.\n","date":"2025-10-30T20:09:12-04:00","permalink":"/p/windows-11-installation-media-and-edition-selection/","title":"Windows 11 Installation Media and Edition Selection"},{"content":"Grafana\nGrafana Dashboards\nUbuntu 24.04 LTS Install Grafana OSS from the official stable APT repository. Run the following commands with a sudo-enabled account.\nInstall Grafana sudo apt update sudo apt install -y ca-certificates wget curl sudo install -d -m 0755 /etc/apt/keyrings sudo wget -O /etc/apt/keyrings/grafana.asc https://apt.grafana.com/gpg-full.key sudo chmod 0644 /etc/apt/keyrings/grafana.asc echo \u0026#39;deb [signed-by=/etc/apt/keyrings/grafana.asc] https://apt.grafana.com stable main\u0026#39; | sudo tee /etc/apt/sources.list.d/grafana.list \u0026gt; /dev/null sudo apt update apt-cache policy grafana sudo apt install -y grafana dpkg-query -W -f=\u0026#39;${Package} ${Version}\\n\u0026#39; grafana The .asc file contains the ASCII-armored signing key and does not need gpg --dearmor. The grafana package installs OSS; grafana-enterprise is a separate package choice. See the official Ubuntu installation guide.\nThe repository command replaces this dedicated source file instead of appending another entry. If Grafana was previously configured in a different .list or .sources file, reconcile those entries before running apt update.\nConfigure Local Access Back up the configuration and edit it:\nsudo cp -a /etc/grafana/grafana.ini \u0026#34;/etc/grafana/grafana.ini.bak.$(date +%Y%m%d-%H%M%S)\u0026#34; sudo nano /etc/grafana/grafana.ini Update the existing [server] section. Remove the leading semicolon from the settings you change; do not append a duplicate section.\n[server] protocol = http http_addr = 127.0.0.1 http_port = 3000 domain = localhost root_url = http://localhost:3000/ This example listens only on the server\u0026rsquo;s loopback interface. http_addr controls the listening address; domain does not create a DNS record, and root_url defines the URL users access. See the Grafana configuration reference.\nStart the Service sudo systemctl daemon-reload sudo systemctl enable --now grafana-server sudo systemctl restart grafana-server sudo systemctl status grafana-server --no-pager The restart also applies the configuration if the package was already running.\nsudo ss -ltnp \u0026#39;sport = :3000\u0026#39; curl --fail --silent --show-error http://127.0.0.1:3000/api/health The health response should report \u0026quot;database\u0026quot;: \u0026quot;ok\u0026quot;. This checks Grafana\u0026rsquo;s own database connection, not the health of external data sources. See the health API.\nFirst Login On the server, open http://localhost:3000.\nFor a remote server, run an SSH tunnel from your workstation, replacing the account and address:\nssh -N -L 3000:127.0.0.1:3000 username@192.168.1.50 Keep the tunnel open and visit http://localhost:3000 on the workstation. Local port 3000 must be available.\nFor a fresh installation, sign in with username admin and password admin, then set a new password. Existing installations retain their configured credentials. See Sign in to Grafana.\nOptional: Allow LAN Access To access Grafana directly from other computers on a trusted LAN, edit the same [server] section:\nsudo nano /etc/grafana/grafana.ini [server] protocol = http http_addr = 0.0.0.0 http_port = 3000 domain = 192.168.1.50 root_url = http://192.168.1.50:3000/ Replace 192.168.1.50 with the server\u0026rsquo;s LAN address. 0.0.0.0 listens on all IPv4 interfaces; alternatively, bind to a specific IP assigned to the server. Do not use a hostname or an unassigned public IP as http_addr.\nsudo systemctl restart grafana-server sudo systemctl status grafana-server --no-pager curl --fail --silent --show-error http://192.168.1.50:3000/api/health If UFW is already active, allow the required client subnet:\nsudo ufw allow from 192.168.1.0/24 to any port 3000 proto tcp sudo ufw status Replace the subnet to match your network, then open http://192.168.1.50:3000 from a client computer.\nFor a DNS name, create a record pointing to the server and update domain and root_url accordingly. This example uses HTTP. For access over an untrusted network, configure HTTPS or use the SSH tunnel above.\nAdd a Data Source Grafana needs a data source, such as Prometheus, to display your metrics. Installing Grafana alone does not collect host metrics.\nOpen Connections \u0026gt; Add new connection. Choose the data source type and select Add new data source. Enter its URL and any required authentication settings. Select Save \u0026amp; test. Use an address reachable from the Grafana server. For example, http://localhost:9090 refers to Prometheus on that server, not on your browser\u0026rsquo;s computer. See Data source management.\nAfter the connection succeeds, create a dashboard or use a compatible template from the dashboard catalog linked above. Dashboard queries must match the selected data source and the metrics it contains.\nService Management sudo systemctl restart grafana-server sudo systemctl stop grafana-server sudo systemctl start grafana-server sudo systemctl is-enabled grafana-server sudo journalctl -u grafana-server -n 100 --no-pager sudo journalctl -u grafana-server -f Restart Grafana after changing grafana.ini. Editing this file does not require systemctl daemon-reload; that command is needed when the systemd unit changes.\nTroubleshooting Symptom Check APT reports conflicting Signed-By values Look for duplicate Grafana repository entries referencing different key files. Service fails to bind Check whether port 3000 is occupied and whether http_addr exists on the server. Browser cannot connect Check service status, listening address, SSH tunnel, and firewall rules. Redirect points to the wrong host Set root_url to the URL used by clients, including the port when required. Configuration changes have no effect Remove comment semicolons, restart the service, and check for GF_* environment overrides. Dashboard has no data Test the data source, check its queries, and adjust the dashboard time range. ","date":"2025-09-05T22:35:57-05:00","permalink":"/p/grafana-installation-and-configuration-on-ubuntu/","title":"Grafana Installation and Configuration on Ubuntu"},{"content":"Prometheus\nNode Exporter\nWindows Exporter\nEnvironment This guide installs Prometheus and Node Exporter on one Ubuntu server, then adds an optional Windows host. It retains the original article\u0026rsquo;s versions as reproducible examples, not as a claim that they are the latest releases.\nComponent Example Prometheus host Ubuntu 24.04 LTS, x86_64, 192.168.1.50 Prometheus 3.5.0 Node Exporter 1.9.1 Windows host Windows Server 2019, x64, 192.168.1.60 Windows Exporter 0.31.3 Replace the IP addresses with your own. Review the projects\u0026rsquo; current releases before a new deployment. The Linux downloads below are for amd64; use the matching architecture on other systems.\nUbuntu 24.04 LTS Create the Service Account and Directories These commands assume a fresh installation. If the account or configuration already exists, inspect it and back up the configuration before proceeding.\nsudo apt update sudo apt install -y ca-certificates curl sudo useradd --system --user-group --no-create-home --shell /usr/sbin/nologin prometheus sudo install -d -o root -g prometheus -m 0750 /etc/prometheus sudo install -d -o prometheus -g prometheus -m 0750 /var/lib/prometheus The service needs write access to /var/lib/prometheus. Keep its executable files owned by root.\nDownload and Install Prometheus Run this block in Bash. Stop if a download or checksum check fails.\n( set -eu workdir=$(mktemp -d) cd \u0026#34;$workdir\u0026#34; version=3.5.0 archive=\u0026#34;prometheus-${version}.linux-amd64.tar.gz\u0026#34; release=\u0026#34;https://github.com/prometheus/prometheus/releases/download/v${version}\u0026#34; curl -fLO \u0026#34;$release/$archive\u0026#34; curl -fLO \u0026#34;$release/sha256sums.txt\u0026#34; grep -F \u0026#34; $archive\u0026#34; sha256sums.txt | sha256sum --check --strict - tar -xzf \u0026#34;$archive\u0026#34; sudo install -o root -g root -m 0755 \u0026#34;prometheus-${version}.linux-amd64/prometheus\u0026#34; /usr/local/bin/prometheus sudo install -o root -g root -m 0755 \u0026#34;prometheus-${version}.linux-amd64/promtool\u0026#34; /usr/local/bin/promtool ) prometheus --version promtool --version Official binaries include both the server and promtool. See Prometheus installation.\nConfigure Prometheus Start with a self-scrape target. Exporter jobs are added after their services are installed.\nsudo tee /etc/prometheus/prometheus.yml \u0026gt; /dev/null \u0026lt;\u0026lt;\u0026#39;EOF\u0026#39; global: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: prometheus static_configs: - targets: [\u0026#39;127.0.0.1:9090\u0026#39;] EOF sudo chown root:prometheus /etc/prometheus/prometheus.yml sudo chmod 0640 /etc/prometheus/prometheus.yml sudo -u prometheus /usr/local/bin/promtool check config /etc/prometheus/prometheus.yml scrape_interval controls metric collection; evaluation_interval controls rule evaluation. See the configuration reference.\nCreate the systemd Service sudo tee /etc/systemd/system/prometheus.service \u0026gt; /dev/null \u0026lt;\u0026lt;\u0026#39;EOF\u0026#39; [Unit] Description=Prometheus Monitoring Server Wants=network-online.target After=network-online.target [Service] Type=simple User=prometheus Group=prometheus ExecStart=/usr/local/bin/prometheus --config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/var/lib/prometheus --storage.tsdb.retention.time=15d --web.listen-address=127.0.0.1:9090 ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target EOF sudo systemd-analyze verify /etc/systemd/system/prometheus.service sudo systemctl daemon-reload sudo systemctl enable --now prometheus sudo systemctl status prometheus --no-pager curl --fail http://127.0.0.1:9090/-/ready The explicit retention period is 15 days; it is not a disk-space quota. See the server flags.\nOpen the Web Interface The service listens on loopback. From a remote workstation, open an SSH tunnel:\nssh -N -L 9090:127.0.0.1:9090 username@192.168.1.50 Visit http://localhost:9090 while the tunnel is open. Local port 9090 must be free.\nInstall Node Exporter Run these commands on the same Ubuntu server:\nsudo useradd --system --user-group --no-create-home --shell /usr/sbin/nologin node_exporter ( set -eu workdir=$(mktemp -d) cd \u0026#34;$workdir\u0026#34; version=1.9.1 archive=\u0026#34;node_exporter-${version}.linux-amd64.tar.gz\u0026#34; release=\u0026#34;https://github.com/prometheus/node_exporter/releases/download/v${version}\u0026#34; curl -fLO \u0026#34;$release/$archive\u0026#34; curl -fLO \u0026#34;$release/sha256sums.txt\u0026#34; grep -F \u0026#34; $archive\u0026#34; sha256sums.txt | sha256sum --check --strict - tar -xzf \u0026#34;$archive\u0026#34; sudo install -o root -g root -m 0755 \u0026#34;node_exporter-${version}.linux-amd64/node_exporter\u0026#34; /usr/local/bin/node_exporter ) node_exporter --version Create the service:\nsudo tee /etc/systemd/system/node_exporter.service \u0026gt; /dev/null \u0026lt;\u0026lt;\u0026#39;EOF\u0026#39; [Unit] Description=Prometheus Node Exporter After=network.target [Service] Type=simple User=node_exporter Group=node_exporter ExecStart=/usr/local/bin/node_exporter --web.listen-address=127.0.0.1:9100 Restart=on-failure RestartSec=5 [Install] WantedBy=multi-user.target EOF sudo systemd-analyze verify /etc/systemd/system/node_exporter.service sudo systemctl daemon-reload sudo systemctl enable --now node_exporter sudo systemctl status node_exporter --no-pager curl --fail --silent --show-error http://127.0.0.1:9100/metrics Node Exporter exposes Linux host metrics on /metrics. See the official monitoring guide.\nInstall Windows Exporter Run PowerShell as administrator on the Windows host. Download windows_exporter-0.31.3-amd64.msi from the release linked above, verify it against the release checksum, and save it in C:\\Installers.\nCreate the Configuration New-Item -ItemType Directory -Path \u0026#39;C:\\ProgramData\\windows_exporter\u0026#39; -Force @\u0026#39; collectors: enabled: cpu,logical_disk,memory,net,os,service,system log: level: info scrape: timeout-margin: 0.5 telemetry: path: /metrics \u0026#39;@ | Set-Content -LiteralPath \u0026#39;C:\\ProgramData\\windows_exporter\\config.yml\u0026#39; -Encoding Ascii This follows the versioned configuration example. The correct YAML key is telemetry:, not telemetry:iis. Enable role-specific collectors such as ad, dhcp, or iis only on appropriate servers. The obsolete cs and logon entries from the original notes are omitted.\nInstall the Service $installer = \u0026#39;C:\\Installers\\windows_exporter-0.31.3-amd64.msi\u0026#39; if (-not (Test-Path -LiteralPath $installer)) { throw \u0026#34;Installer not found: $installer\u0026#34; } $msiArguments = \u0026#39;/i \u0026#34;{0}\u0026#34; /qn /norestart CONFIG_FILE=\u0026#34;C:\\ProgramData\\windows_exporter\\config.yml\u0026#34; LISTEN_PORT=9115 ADDLOCAL=FirewallException REMOTE_ADDR=\u0026#34;192.168.1.50\u0026#34; /L*v \u0026#34;C:\\Installers\\windows_exporter-install.log\u0026#34;\u0026#39; -f $installer $installation = Start-Process -FilePath \u0026#39;msiexec.exe\u0026#39; -ArgumentList $msiArguments -Wait -PassThru -WindowStyle Hidden if ($installation.ExitCode -notin 0, 3010) { throw \u0026#34;MSI failed with exit code $($installation.ExitCode). Check the installation log.\u0026#34; } if ($installation.ExitCode -eq 3010) { Write-Warning \u0026#39;Restart Windows to complete installation.\u0026#39; } Get-Service windows_exporter (Invoke-WebRequest -UseBasicParsing \u0026#39;http://localhost:9115/metrics\u0026#39;).StatusCode Replace REMOTE_ADDR with the Prometheus server\u0026rsquo;s IP. The configuration file must exist before installation. This guide retains the custom port 9115; Windows Exporter\u0026rsquo;s default is 9182. Set the port through MSI so its firewall rule uses the same port. MSI properties override matching YAML settings; collectors are configured in YAML. See the v0.31.3 installer reference.\nAfter configuration changes:\nRestart-Service windows_exporter Add the Exporter Targets On the Ubuntu Prometheus server, first check Windows connectivity if using that host:\ncurl --fail --silent --show-error http://192.168.1.60:9115/metrics sudo nano /etc/prometheus/prometheus.yml Use this complete configuration. Omit the windows job if no Windows exporter is installed:\nglobal: scrape_interval: 15s evaluation_interval: 15s scrape_configs: - job_name: prometheus static_configs: - targets: [\u0026#39;127.0.0.1:9090\u0026#39;] - job_name: node static_configs: - targets: [\u0026#39;127.0.0.1:9100\u0026#39;] - job_name: windows static_configs: - targets: [\u0026#39;192.168.1.60:9115\u0026#39;] Validate before reloading:\nsudo -u prometheus /usr/local/bin/promtool check config /etc/prometheus/prometheus.yml \u0026amp;\u0026amp; sudo systemctl reload prometheus sudo journalctl -u prometheus -n 50 --no-pager The service\u0026rsquo;s ExecReload sends SIGHUP, which reloads Prometheus configuration without enabling the HTTP lifecycle API. See configuration reloads.\nOpen http://localhost:9090/targets through the SSH tunnel and confirm the configured targets are UP. Query:\nup Each successful scrape produces 1; a failed scrape produces 0. Allow at least one scrape interval after adding a target. up = 1 confirms a successful scrape, not that every optional collector succeeded.\nOptional: Remote Linux Hosts and LAN Access For a Node Exporter on another Linux host, bind its service to that host\u0026rsquo;s LAN IP or 0.0.0.0:9100, reload systemd, restart it, and add the host\u0026rsquo;s address to the node target list. If UFW is active on that host, permit only Prometheus:\nsudo ufw allow from 192.168.1.50 to any port 9100 proto tcp To allow a remote Grafana server to reach Prometheus, change its service flag to --web.listen-address=0.0.0.0:9090 or a specific LAN IP, then apply the unit change:\nsudo systemctl daemon-reload sudo systemctl restart prometheus sudo ufw allow from 192.168.1.70 to any port 9090 proto tcp Use the actual Grafana server IP instead of 192.168.1.70. These examples provide unauthenticated HTTP access on a trusted network; use TLS and authentication before exposing endpoints beyond it.\nConnect Grafana In Grafana, add a Prometheus data source and set its server URL:\nSame Ubuntu host, native services: http://127.0.0.1:9090. Separate Grafana server with LAN access configured: http://192.168.1.50:9090. Set the scrape interval to 15s and select Save \u0026amp; test. If Grafana runs in a container, 127.0.0.1 refers to that container; use an address reachable from its network. See Grafana\u0026rsquo;s Prometheus configuration guide.\nTroubleshooting sudo systemctl status prometheus node_exporter --no-pager sudo journalctl -u prometheus -n 100 --no-pager sudo journalctl -u node_exporter -n 100 --no-pager sudo ss -ltnp Prometheus cannot open its database: Verify ownership of /var/lib/prometheus and available disk space. Configuration reload fails: Run promtool check config, then inspect the service journal. Target is DOWN: Test its /metrics URL from the Prometheus server; check the port, listening address, and firewall. Windows service fails: Inspect the MSI log, Windows Application event log, and YAML configuration. Windows role metrics are missing: Check that the corresponding server role and collector are enabled. Grafana cannot connect: Use the Prometheus address reachable from Grafana\u0026rsquo;s host or container. ","date":"2025-09-01T22:35:57-05:00","permalink":"/p/prometheus-installation-and-host-monitoring-on-ubuntu-and-windows/","title":"Prometheus Installation and Host Monitoring on Ubuntu and Windows"},{"content":"osTicket\nDownloads\nInstallation Guide\nUbuntu 24.04 LTS This guide covers a fresh installation of osTicket 1.18.4, Apache, MariaDB, and PHP 8.3. The release supports PHP 8.2–8.4, so Ubuntu 24.04\u0026rsquo;s PHP 8.3 packages can be used without an additional PHP repository. See the versioned requirements.\nReplace helpdesk.example.com with your hostname and point its DNS record to the server. Run the administration commands with a sudo-enabled account. For an existing helpdesk, follow the upgrade guide instead.\nInstall Dependencies Use Apache\u0026rsquo;s PHP module for this installation:\nsudo apt update sudo apt install -y software-properties-common sudo add-apt-repository -y universe sudo apt update sudo apt install -y apache2 mariadb-server ca-certificates curl unzip cron openssl php8.3-cli libapache2-mod-php8.3 php8.3-mysql php8.3-curl php8.3-gd php8.3-imap php8.3-mbstring php8.3-intl php8.3-apcu php8.3-xml php8.3-zip php8.3-ldap php8.3-opcache sudo systemctl enable --now apache2 mariadb cron sudo a2enmod php8.3 rewrite php8.3 --version php8.3 -m IMAP supports mailbox fetching; LDAP is included for the optional LDAP authentication plugin. On a server already using PHP-FPM or another PHP version, reconcile the existing Apache configuration before enabling another handler.\nConfigure PHP Create a local override for Apache:\nsudo tee /etc/php/8.3/apache2/conf.d/99-osticket.ini \u0026gt; /dev/null \u0026lt;\u0026lt;\u0026#39;EOF\u0026#39; date.timezone = America/Montreal memory_limit = 512M upload_max_filesize = 20M post_max_size = 32M display_errors = Off log_errors = On EOF sudo cp /etc/php/8.3/apache2/conf.d/99-osticket.ini /etc/php/8.3/cli/conf.d/99-osticket.ini sudo apache2ctl configtest sudo systemctl restart apache2 Change the timezone as needed. These upload sizes are examples; keep post_max_size larger than the total request size you intend to accept. Set the application\u0026rsquo;s attachment limits accordingly under System Settings.\nphp8.3 -m checks the CLI environment. Confirm the web runtime and extensions in the installer and later under Admin Panel \u0026gt; Dashboard \u0026gt; Information.\nConfigure MariaDB sudo mariadb-secure-installation openssl rand -hex 32 sudo mariadb Retain socket authentication for the local database administrator when appropriate. Use the generated password below in place of REPLACE_WITH_RANDOM_PASSWORD and keep it for the web installer.\nCREATE DATABASE osticket CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci; CREATE USER \u0026#39;osticket\u0026#39;@\u0026#39;localhost\u0026#39; IDENTIFIED BY \u0026#39;REPLACE_WITH_RANDOM_PASSWORD\u0026#39;; GRANT ALL PRIVILEGES ON osticket.* TO \u0026#39;osticket\u0026#39;@\u0026#39;localhost\u0026#39;; SHOW GRANTS FOR \u0026#39;osticket\u0026#39;@\u0026#39;localhost\u0026#39;; EXIT; Test the application account:\nmariadb -u osticket -p -h localhost osticket -e \u0026#39;SELECT DATABASE();\u0026#39; The account has privileges on the osTicket database only. CREATE USER sets the password; the GRANT statement does not change it.\nDownload osTicket Use the packaged release ZIP, which contains an upload directory, rather than GitHub\u0026rsquo;s automatic source-code archive. The URL and archive name below both use v1.18.4.\nRun this block in Bash:\n( set -eu workdir=$(mktemp -d) cd \u0026#34;$workdir\u0026#34; curl -fL -o osTicket-v1.18.4.zip https://github.com/osTicket/osTicket/releases/download/v1.18.4/osTicket-v1.18.4.zip unzip -q osTicket-v1.18.4.zip -d package test -f package/upload/include/ost-sampleconfig.php sudo install -d -o root -g root -m 0755 /var/www/osticket sudo cp -a package/upload/. /var/www/osticket/ ) sudo chown -R root:root /var/www/osticket sudo find /var/www/osticket -type d -exec chmod 0755 {} + sudo find /var/www/osticket -type f -exec chmod 0644 {} + sudo cp /var/www/osticket/include/ost-sampleconfig.php /var/www/osticket/include/ost-config.php sudo chown root:www-data /var/www/osticket/include/ost-config.php sudo chmod 0660 /var/www/osticket/include/ost-config.php The web server temporarily needs write access to ost-config.php. Keep the rest of the application owned by root. This guide copies the contents of upload directly into /var/www/osticket, which becomes the document root.\nConfigure Apache sudo tee /etc/apache2/sites-available/osticket.conf \u0026gt; /dev/null \u0026lt;\u0026lt;\u0026#39;EOF\u0026#39; \u0026lt;VirtualHost *:80\u0026gt; ServerName helpdesk.example.com DocumentRoot /var/www/osticket \u0026lt;Directory /var/www/osticket\u0026gt; Options -Indexes +FollowSymLinks AllowOverride All Require all granted DirectoryIndex index.php \u0026lt;/Directory\u0026gt; ErrorLog ${APACHE_LOG_DIR}/osticket-error.log CustomLog ${APACHE_LOG_DIR}/osticket-access.log combined \u0026lt;/VirtualHost\u0026gt; EOF sudo a2ensite osticket.conf sudo apache2ctl configtest sudo systemctl reload apache2 curl -I -H \u0026#39;Host: helpdesk.example.com\u0026#39; http://127.0.0.1/ The final request tests the intended virtual host even before DNS is configured. Browse using the configured hostname; an IP-only request may select another site\u0026rsquo;s default virtual host.\nIf UFW is already active:\nsudo ufw allow \u0026#39;Apache Full\u0026#39; sudo ufw status This virtual host initially serves HTTP. Configure a valid TLS certificate and HTTPS before entering administrator credentials over an untrusted network. Port 443 being allowed through the firewall does not itself enable HTTPS.\nComplete the Web Installer Open the site\u0026rsquo;s /setup/ page and resolve any prerequisite errors. Enter:\nThe helpdesk name, support email address, and primary language. A separate administrator name, email address, username, and strong password. Database host: localhost. Database name and username: osticket. The database password created earlier. A table prefix such as ost_. Complete the installation and sign in at /scp/. Keep the setup directory until the installer reports success. See the installation instructions.\nFinish the Installation Only after the web installer succeeds, remove its directory and make the configuration read-only for Apache:\nsudo rm -r -- /var/www/osticket/setup sudo chown root:www-data /var/www/osticket/include/ost-config.php sudo chmod 0640 /var/www/osticket/include/ost-config.php sudo -u www-data test -r /var/www/osticket/include/ost-config.php \u0026amp;\u0026amp; echo \u0026#39;Configuration is readable\u0026#39; sudo -u www-data test ! -w /var/www/osticket/include/ost-config.php \u0026amp;\u0026amp; echo \u0026#39;Configuration is not writable\u0026#39; Check the helpdesk URL, timezone, system email, and online/offline status in the Admin Panel. Create a test ticket and verify that an agent can reply before making the helpdesk available to users. See the post-install guide.\nScheduled Tasks and Email Test the CLI task as the web-server user:\nsudo -u www-data /usr/bin/php8.3 /var/www/osticket/api/cron.php Schedule it every five minutes:\necho \u0026#39;*/5 * * * * www-data /usr/bin/php8.3 /var/www/osticket/api/cron.php\u0026#39; | sudo tee /etc/cron.d/osticket \u0026gt; /dev/null sudo chmod 0644 /etc/cron.d/osticket sudo systemctl status cron --no-pager Configure incoming mailbox access and outbound SMTP in the Admin Panel, then enable email fetching if required. Cron does not configure mailbox credentials or SMTP automatically. See the POP3/IMAP settings guide.\nLanguage Packs Download compatible language .phar files from the official download page. From the directory containing those files, install the languages you need:\nsudo install -o root -g root -m 0644 ar.phar /var/www/osticket/include/i18n/ar.phar sudo install -o root -g root -m 0644 fr.phar /var/www/osticket/include/i18n/fr.phar sudo install -o root -g root -m 0644 es_MX.phar /var/www/osticket/include/i18n/es_MX.phar sudo install -o root -g root -m 0644 zh_CN.phar /var/www/osticket/include/i18n/zh_CN.phar Run only the commands corresponding to files you downloaded. Language packs belong in include/i18n; select the installed language in the appropriate system or user preferences. See osTicket downloads.\nOptional Plugins Download plugin builds compatible with the installed osTicket version. Install only the plugins you need:\nsudo install -o root -g root -m 0644 auth-oauth2.phar /var/www/osticket/include/plugins/auth-oauth2.phar sudo install -o root -g root -m 0644 storage-fs.phar /var/www/osticket/include/plugins/storage-fs.phar sudo install -o root -g root -m 0644 auth-ldap.phar /var/www/osticket/include/plugins/auth-ldap.phar Open Admin Panel \u0026gt; Manage \u0026gt; Plugins, add the plugin, activate it, and configure its instance. Copying a PHAR file alone does not finish plugin setup.\nFor Microsoft integration, follow the applicable official guide:\nMicrosoft Authorization Guide for mailbox authorization. Microsoft Authentication (SSO) Guide for user authentication. Store Attachments on the Filesystem Create a writable storage directory outside the Apache document root:\nsudo install -d -o www-data -g www-data -m 0750 /var/lib/osticket/attachments Install and activate Attachments on the Filesystem, create an active instance, and configure its storage path as /var/lib/osticket/attachments. Then select filesystem storage under Admin Panel \u0026gt; Settings \u0026gt; System \u0026gt; Store Attachments.\nUpload a test attachment and confirm it can be downloaded through the helpdesk. Changing the storage setting does not by itself migrate existing database attachments. Back up both the database and attachment directory. See the filesystem storage guide.\nTroubleshooting sudo systemctl status apache2 mariadb cron --no-pager sudo apache2ctl configtest sudo apache2ctl -S sudo tail -n 100 /var/log/apache2/osticket-error.log sudo journalctl -u mariadb -n 100 --no-pager Wrong site opens: Check DNS, the requested hostname, and Apache\u0026rsquo;s virtual-host mapping. Database connection fails: Test the same username and password with the MariaDB command above; use localhost consistently. Installer cannot write configuration: Check ownership and temporary permissions on include/ost-config.php. HTTP 500 or missing extension: Check the Apache error log and the web PHP environment, which can differ from CLI PHP. Email is not fetched: Check mailbox settings, OAuth authorization when applicable, fetching status, and cron execution. Attachments fail: Check PHP/application upload limits and write access to the configured storage directory. ","date":"2025-07-01T22:35:57-05:00","permalink":"/p/osticket-installation-and-configuration-on-ubuntu/","title":"osTicket Installation and Configuration on Ubuntu"},{"content":"FOG is a free and open-source computer imaging platform. It can capture a reference computer, store the image on a central server, and deploy that image to other computers over the network.\nThis guide installs the stable FOG release on a dedicated Ubuntu 24.04 LTS server. It assumes that an existing router or Windows/Linux DHCP server assigns addresses to clients. If FOG will provide DHCP instead, select that option during installation and make sure no other DHCP server is active on the same network.\nOfficial references:\nFOG installation guide FOG DHCP settings FOG firewall requirements FOG security guidance FOG source repository Environment The examples use the following values. Replace them with addresses and names from your network.\nSetting Example FOG server name fog.example.com FOG server address 192.168.50.10/24 Default gateway 192.168.50.1 Imaging network 192.168.50.0/24 Network interface enp1s0 Image storage /images Use a dedicated server or virtual machine with a static address, reliable storage, and at least a gigabit network connection. Size /images for the number and size of the images you plan to retain. RAID and tested backups are recommended for production installations.\nFOG relies on PXE, TFTP, HTTP, NFS, and related services. Place it on a trusted imaging VLAN rather than exposing it directly to the Internet.\nPlan the Network Before installing FOG, confirm the following:\nThe server has a static address and working forward and reverse DNS where possible. Only one DHCP server will be active on the imaging network. You know whether the clients use legacy BIOS, 64-bit UEFI, ARM64 UEFI, or a mixture. DHCP relay or IP helper settings can reach the required DHCP and FOG services when clients are on another subnet. The imaging VLAN permits the required unicast and multicast traffic. Do not create a local Linux account named fogproject. The FOG installer manages its own service accounts and credentials.\nPrepare Ubuntu 24.04 LTS Update the server and reboot it before installation.\nsudo apt update sudo apt full-upgrade -y sudo systemctl reboot After reconnecting, verify the hostname, address, route, time, and available storage.\nhostnamectl ip -brief address ip route timedatectl df -h / If the server still uses DHCP, assign a static address through your network management system or Netplan. The following example is for a directly configured Ethernet interface. Run sudo netplan try from a local console so that an incorrect network configuration can be rolled back safely.\nsudoedit /etc/netplan/01-fog.yaml network: version: 2 ethernets: enp1s0: dhcp4: false addresses: [192.168.50.10/24] routes: - to: default via: 192.168.50.1 nameservers: addresses: [192.168.50.2, 1.1.1.1] search: [example.com] Test and apply the configuration.\nsudo netplan try sudo netplan apply Install Git and the certificate bundle. Do not preinstall Apache, MariaDB, PHP, TFTP, NFS, or FTP packages; the FOG installer installs and configures the versions it requires.\nsudo apt install -y git ca-certificates Download and Install FOG The stable branch receives the latest supported patch releases and is the recommended branch for most installations. Development and working branches may contain unfinished changes.\nBecome root, clone the stable branch, review the latest commit, and start the installer.\nsudo -i cd /root git clone --branch stable --single-branch https://github.com/FOGProject/fogproject.git fogproject-stable git -C /root/fogproject-stable log -1 --oneline cd /root/fogproject-stable/bin ./installfog.sh Answer the installer prompts carefully:\nSelect Normal Server unless this machine will only add storage capacity to an existing FOG installation. Confirm Ubuntu as the operating system. Select the interface connected to the imaging network. Confirm the server address, gateway, and hostname. If another device already provides DHCP, answer No when asked whether FOG should provide DHCP. Configure that existing DHCP server in the next section. Decide whether to enable HTTPS after reviewing the installer notes for your FOG version. In the stable 1.5 series, HTTPS and the network boot chain are linked, so this choice can affect Secure Boot compatibility. Review the summary before allowing the installer to make changes. During installation, the script pauses and asks you to update the database schema. Open the management URL printed in the terminal, select Install/Update Now, wait for it to finish, and then return to the terminal and press Enter.\nWhen the installer completes, open the displayed management URL. If the installation still uses the documented default login, sign in with fog and password, then change the password immediately.\nThe installer stores its settings in /opt/fog/.fogsettings. This file may contain database and service credentials, so restrict access to it and include it in a protected backup.\nConfigure an Existing DHCP Server When DHCP runs on another server, configure these PXE options for the imaging scope:\nOption 66 / next-server: the FOG server address, such as 192.168.50.10. Option 67 / boot file: the correct boot file for the client architecture. Use the following current FOG boot files:\nClient firmware Boot file Legacy BIOS undionly.kkpxe 64-bit UEFI, Secure Boot on or off secureboot/snponly-shimx64.efi ARM64 UEFI secureboot/arm64-efi/snponly-shimaa64.efi 32-bit UEFI i386-efi/snponly.efi A single scope-wide Option 67 cannot correctly serve a mixture of legacy BIOS and UEFI computers. Create DHCP policies or classes that select the boot file from the PXE client architecture reported in the DHCP request.\nDo not set DHCP Option 60 unless Windows Deployment Services and DHCP run on the same Windows server and the design specifically requires it. An unnecessary Option 60 can prevent UEFI clients from booting.\nIf the existing DHCP server cannot set PXE options, use FOG\u0026rsquo;s documented ProxyDHCP configuration. For clients on another subnet, configure the router\u0026rsquo;s DHCP relay or IP helper to forward requests to the DHCP server and the relevant FOG or ProxyDHCP service.\nCheck the Firewall Recent FOG installers can configure the host firewall, but you should verify the result. Keep the rules limited to the trusted imaging network whenever possible.\nsudo ufw status verbose sudo ss -lntup The official FOG firewall guide currently requires the following access from imaging clients:\nPurpose Protocol and port Web interface, boot files, and FOG client TCP 80 HTTPS, when enabled TCP 443 TFTP UDP 69 FTP control TCP 21 Passive FTP TCP 65000-65100 NFS TCP 2049 RPC bind TCP and UDP 111 NFS mount daemon TCP and UDP 20048 Multicast imaging UDP 63100-63228 DHCP, only when FOG provides DHCP UDP 67 Ubuntu\u0026rsquo;s firewall also needs the TFTP connection-tracking helper. Load it now and at startup.\necho nf_conntrack_tftp | sudo tee /etc/modules-load.d/fog-conntrack.conf sudo modprobe nf_conntrack_tftp If UFW is enabled and the installer did not add the rules, add source-restricted rules for the example imaging network.\nsudo ufw allow from 192.168.50.0/24 to any port 80 proto tcp comment \u0026#39;FOG HTTP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 443 proto tcp comment \u0026#39;FOG HTTPS\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 69 proto udp comment \u0026#39;FOG TFTP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 21 proto tcp comment \u0026#39;FOG FTP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 65000:65100 proto tcp comment \u0026#39;FOG passive FTP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 2049 proto tcp comment \u0026#39;FOG NFS\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 111 proto tcp comment \u0026#39;FOG RPC TCP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 111 proto udp comment \u0026#39;FOG RPC UDP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 20048 proto tcp comment \u0026#39;FOG mountd TCP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 20048 proto udp comment \u0026#39;FOG mountd UDP\u0026#39; sudo ufw allow from 192.168.50.0/24 to any port 63100:63228 proto udp comment \u0026#39;FOG multicast\u0026#39; sudo ufw reload Open UDP 67 only when this FOG server provides DHCP. DHCP discovery begins before a client has an address, so this rule should not be limited to the example source subnet.\nsudo ufw allow 67/udp comment \u0026#39;FOG DHCP\u0026#39; Do not expose MariaDB port 3306 to the whole network. If a remote FOG storage node needs database access, allow only that node\u0026rsquo;s address and follow the current storage-node documentation.\nVerify the Installation Check the web interface, listening services, NFS exports, and the required boot files.\ncurl -I http://127.0.0.1/fog/management/ sudo systemctl --type=service --state=running | grep -E \u0026#39;apache2|mariadb|mysql|tftp|nfs|vsftpd\u0026#39; sudo exportfs -v ls -l /tftpboot/undionly.kkpxe /tftpboot/secureboot/snponly-shimx64.efi Boot one test computer from the network. A successful initial test should:\nReceive an address from DHCP. Download the correct BIOS or UEFI boot file from FOG. Display the FOG iPXE menu. Register with the server and appear in the web interface. Capture and Deploy an Image Create an image definition in Images, register the reference computer, associate it with the image, and schedule a capture task. Prepare Windows reference systems before capture by installing updates, removing temporary data, and using Sysprep when the image will be deployed to multiple machines.\nFully decrypt BitLocker-protected volumes before capturing an image that must be resizable. Shut Windows down completely so that Fast Startup or hibernation does not leave the filesystem in an inconsistent state.\nTest the first deployment on a disposable computer. A capture task reads the reference computer and writes an image to the server; a deploy task overwrites the target computer\u0026rsquo;s disk. Confirm the task direction and target before starting it.\nUpdate FOG Back up the FOG database, /images, and /opt/fog/.fogsettings before an upgrade. Update the local stable checkout and rerun the installer.\nsudo -i cd /root/fogproject-stable git fetch origin git checkout stable git pull --ff-only origin stable cd bin ./installfog.sh Complete any database schema update shown in the browser, then repeat the PXE and test-deployment checks. Stay on the stable branch unless you are deliberately testing a development release in a non-production environment.\nTroubleshooting The Web Interface Does Not Open Check Apache, the local URL, and the web server log.\nsudo systemctl status apache2 --no-pager curl -I http://127.0.0.1/fog/management/ sudo journalctl -u apache2 -n 100 --no-pager The Client Gets an Address but Does Not Download a Boot File Verify DHCP Options 66 and 67, confirm that the selected boot file exists, and inspect the TFTP service.\nls -l /tftpboot sudo systemctl status tftpd-hpa --no-pager sudo journalctl -u tftpd-hpa -n 100 --no-pager For mixed BIOS and UEFI fleets, confirm that the DHCP architecture policy selects the correct file rather than assigning one file to every client.\nImaging Starts but Cannot Access Storage Check the NFS exports, RPC services, routes, and firewall rules for TCP 2049 and TCP/UDP 111 and 20048.\nsudo exportfs -v sudo rpcinfo -p localhost sudo journalctl -u nfs-server -n 100 --no-pager The Installer Fails Review the installer logs in the cloned repository. The main log is normally stored under /root/fogproject-stable/bin/error_logs/.\nsudo ls -lah /root/fogproject-stable/bin/error_logs sudo less /root/fogproject-stable/bin/error_logs/foginstall.log Correct the reported problem and rerun /root/fogproject-stable/bin/installfog.sh. Avoid manually replacing individual FOG-managed packages unless the official documentation directs you to do so.\n","date":"2025-06-01T22:35:57-05:00","permalink":"/p/deploy-a-fog-imaging-server-on-ubuntu-24.04-lts/","title":"Deploy a FOG Imaging Server on Ubuntu 24.04 LTS"},{"content":"Tabby Web provides the Tabby terminal in a browser and can also synchronize Tabby desktop configurations. This guide deploys the official prebuilt image with Docker Compose, MariaDB, GitHub OAuth, persistent storage, and an HTTPS reverse proxy.\nThe upstream maintainer currently has limited time to support Tabby Web. The official container also retains an older runtime. Review the project status, test upgrades before production use, and avoid exposing an unmaintained deployment to sensitive networks without additional controls.\nOfficial references:\nTabby Web repository Tabby Web deployment guide Tabby Web container registry Tabby Web application versions Docker Engine installation on Ubuntu Environment The examples use the following values:\nSetting Example Server operating system Ubuntu 24.04 LTS Public hostname tabby.example.com Local Tabby Web address 127.0.0.1:9090 Installation directory /opt/tabby-web Authentication provider GitHub OAuth Create a public DNS record for tabby.example.com before configuring HTTPS. Allow inbound TCP ports 80 and 443 to the reverse proxy. The application port remains bound to localhost and should not be published directly to the Internet.\nInstall Docker Engine If Docker Engine and the Docker Compose plugin are already installed, verify them and continue to the next section.\nsudo docker version sudo docker compose version On a clean Ubuntu 24.04 LTS server, install Docker from Docker\u0026rsquo;s official repository.\nsudo apt update sudo apt install -y ca-certificates curl sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc echo \u0026#34;deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu noble stable\u0026#34; | sudo tee /etc/apt/sources.list.d/docker.list \u0026gt; /dev/null sudo apt update sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin sudo systemctl enable --now docker sudo docker run --rm hello-world Membership in the docker group grants privileges equivalent to root. This guide keeps sudo in the Docker commands instead of changing group membership.\nRegister a GitHub OAuth App Open GitHub Developer Settings, select OAuth Apps, and create a new OAuth app.\nUse these values:\nField Value Application name Tabby Web Homepage URL https://tabby.example.com Authorization callback URL https://tabby.example.com/api/1/auth/social/complete/github/ Copy the Client ID, generate a Client secret, and store both in a password manager. The callback URL must match exactly, including the /api/1/auth/social/complete/github/ path and trailing slash.\nCreate the Deployment Files Create the project directory.\nsudo install -d -m 0750 /opt/tabby-web sudo chown \u0026#34;$USER\u0026#34;:\u0026#34;$USER\u0026#34; /opt/tabby-web cd /opt/tabby-web Generate three hexadecimal secrets. Hexadecimal database passwords do not require URL encoding inside DATABASE_URL.\nopenssl rand -hex 32 openssl rand -hex 32 openssl rand -hex 32 Create /opt/tabby-web/.env and replace every placeholder with the appropriate generated secret or GitHub OAuth value.\nnano /opt/tabby-web/.env DB_PASSWORD=replace_with_the_first_generated_value DB_ROOT_PASSWORD=replace_with_the_second_generated_value DJANGO_SECRET_KEY=replace_with_the_third_generated_value SOCIAL_AUTH_GITHUB_KEY=replace_with_the_github_client_id SOCIAL_AUTH_GITHUB_SECRET=replace_with_the_github_client_secret Restrict access to the secrets file.\nchmod 600 /opt/tabby-web/.env Create /opt/tabby-web/compose.yaml.\nnano /opt/tabby-web/compose.yaml services: db: image: mariadb:10.11 restart: unless-stopped environment: MARIADB_DATABASE: tabby MARIADB_USER: tabby MARIADB_PASSWORD: ${DB_PASSWORD} MARIADB_ROOT_PASSWORD: ${DB_ROOT_PASSWORD} volumes: - db-data:/var/lib/mysql healthcheck: test: [CMD, healthcheck.sh, --connect, --innodb_initialized] interval: 10s timeout: 5s retries: 10 tabby: image: ghcr.io/eugeny/tabby-web:latest restart: unless-stopped depends_on: db: condition: service_healthy ports: - \u0026#34;127.0.0.1:9090:80\u0026#34; environment: DATABASE_URL: mysql://tabby:${DB_PASSWORD}@db:3306/tabby PORT: \u0026#34;80\u0026#34; DOCKERIZE_ARGS: -wait tcp://db:3306 -timeout 60s APP_DIST_STORAGE: file:///app-dist DJANGO_SECRET_KEY: ${DJANGO_SECRET_KEY} SOCIAL_AUTH_GITHUB_KEY: ${SOCIAL_AUTH_GITHUB_KEY} SOCIAL_AUTH_GITHUB_SECRET: ${SOCIAL_AUTH_GITHUB_SECRET} volumes: - app-dist:/app-dist volumes: app-dist: db-data: Do not add DEBUG=False to this deployment. The current upstream settings convert any nonempty DEBUG value to true, so the literal string False unexpectedly enables Django debug mode. Leaving the variable unset keeps debug mode disabled.\nThe original sample also used SQLite and exposed port 8000. The current official image listens on container port 80, and MariaDB is a better choice for a persistent multi-user deployment.\nValidate the Compose file before starting the containers.\ncd /opt/tabby-web sudo docker compose config --quiet The expanded output of docker compose config contains substituted secrets. Do not redirect or publish it.\nStart Tabby Web Pull the images and start the services.\ncd /opt/tabby-web sudo docker compose pull sudo docker compose up -d sudo docker compose ps Check the application locally.\ncurl -fsS http://127.0.0.1:9090/api/1/auth/providers sudo docker compose logs --tail=100 tabby The providers endpoint should return JSON that includes GitHub. If it returns an empty list, recheck the two SOCIAL_AUTH_GITHUB_* values and recreate the application container.\nsudo docker compose up -d --force-recreate tabby Add a Tabby Web Application Version The backend stores browser application distributions separately from the server image. Check the available versions of tabby-web-container, then add the selected version. The following version was available when this guide was updated.\ncd /opt/tabby-web sudo docker compose exec tabby /manage.sh add_version 1.0.231-nightly.0 sudo docker compose exec tabby ls -lah /app-dist The app-dist volume preserves these files when the Tabby Web container is replaced.\nConfigure HTTPS with a Reverse Proxy Tabby Web handles authentication tokens and synchronized terminal settings, so use HTTPS outside a local test environment. Keep port 9090 bound to 127.0.0.1 and proxy the public hostname to it.\nFor Caddy, add this site block to /etc/caddy/Caddyfile:\ntabby.example.com { reverse_proxy 127.0.0.1:9090 } Validate and reload Caddy.\nsudo caddy validate --config /etc/caddy/Caddyfile sudo systemctl reload caddy Caddy obtains and renews the TLS certificate automatically when DNS is correct and TCP ports 80 and 443 reach the server. Other reverse proxies must preserve the Host, X-Forwarded-For, and X-Forwarded-Proto headers and support WebSocket upgrades.\nOpen https://tabby.example.com, select the login button, and authenticate with GitHub. If GitHub reports a callback mismatch, compare the configured callback URL character by character with:\nhttps://tabby.example.com/api/1/auth/social/complete/github/ Configure Tabby Desktop Synchronization After signing in to Tabby Web, open its settings and copy the Config sync token. Treat this token like a password.\nBefore the first synchronization, open Settings → Config file in the Tabby desktop app and create a backup. Then open Settings → Config Sync and enter:\nField Value Sync host https://tabby.example.com Secret sync token The token copied from Tabby Web Do not add /api/1/ or a trailing API path to the sync host. Tabby adds its API paths automatically.\nFor the first device, choose the option that uploads the known-good local configuration as a new remote configuration. On additional devices, choose the intended remote configuration and verify the download direction before overwriting local settings. Enable automatic synchronization only after confirming that the correct configuration exists on both sides.\nOptional: Browser SSH and Telnet Connections Configuration synchronization does not require a connection gateway. Browser-based SSH and Telnet connections do require one because a browser cannot open arbitrary TCP connections directly.\nTabby Web can use the hosted gateway, but connection traffic then passes through that external service. For sensitive environments, deploy the separate Tabby Connection Gateway, protect it with a strong token, and publish it through HTTPS and WebSockets.\nBack Up the Deployment Back up both named volumes and the protected configuration files. A database backup is safer than copying a live database volume.\ncd /opt/tabby-web sudo docker compose exec -T db sh -c \u0026#39;mariadb-dump -u root -p\u0026#34;$MARIADB_ROOT_PASSWORD\u0026#34; --single-transaction --databases tabby\u0026#39; \u0026gt; tabby-db.sql sudo tar -C /opt/tabby-web -czf tabby-web-config.tar.gz .env compose.yaml Also back up the app-dist volume or retain a record of every version added with manage.sh so it can be recreated.\nUpdate Tabby Web Back up the database and configuration first. Then pull the current images and recreate the services.\ncd /opt/tabby-web sudo docker compose pull sudo docker compose up -d sudo docker compose ps sudo docker compose logs --tail=100 tabby Because latest is a moving tag and the project has limited maintenance, test the update with a restored copy of the data before applying it to an important deployment. For reproducible production updates, replace latest with a tested image digest.\nTroubleshooting No Authentication Providers Are Shown Check that the OAuth variables reached the application container without printing their values.\ncd /opt/tabby-web sudo docker compose exec tabby sh -c \u0026#39;env | cut -d= -f1 | grep ^SOCIAL_AUTH_\u0026#39; curl -fsS http://127.0.0.1:9090/api/1/auth/providers GitHub Reports a Callback Error The callback registered in GitHub must use HTTPS, the correct hostname, and the complete path /api/1/auth/social/complete/github/. Also verify that the reverse proxy sends X-Forwarded-Proto: https.\nThe Page Is Blank or an Application Version Is Missing Inspect the persisted distribution directory and add a valid version from the npm package list.\ncd /opt/tabby-web sudo docker compose exec tabby ls -lah /app-dist sudo docker compose logs --tail=200 tabby The Database Is Unavailable Check the database health and review both service logs.\ncd /opt/tabby-web sudo docker compose ps sudo docker compose logs --tail=200 db sudo docker compose logs --tail=200 tabby sudo docker compose exec tabby python -c \u0026#34;import django; django.setup(); from django.db import connection; connection.ensure_connection(); print(\u0026#39;Database connection succeeded\u0026#39;)\u0026#34; Configuration Sync Does Not Start Confirm that the sync host contains only the HTTPS origin, copy a fresh token from the authenticated Tabby Web settings, and verify that the desktop clock is correct. Restore the local configuration backup if the wrong synchronization direction overwrites the device.\n","date":"2024-12-02T12:47:40-05:00","permalink":"/p/self-host-tabby-web-with-docker-compose-and-github-oauth/","title":"Self-Host Tabby Web with Docker Compose and GitHub OAuth"},{"content":"Let's Encrypt\nCertbot\nacme.sh\nUbuntu 26.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade sudo apt install certbot python3-certbot-nginx sudo certbot --nginx -d dixu.ddns.net sudo certbot renew --dry-run curl -I http://dixu.ddns.net systemctl status certbot.timer systemctl list-timers | grep certbot sudo certbot certificates sudo certbot delete --cert-name dixu.ddns.net sudo systemctl disable --now certbot.timer Ubuntu 24.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade sudo apt install python3-certbot-nginx\t# For Nginx sudo apt install python3-certbot-apache\t# For Apache Request a new Let\u0026rsquo;s Encrypt SSL certificate and install the certificate.\nsudo certbot --nginx -d www.example.com Verify that Certbot auto-renews the SSL certificate upon expiry.\nsudo certbot renew --dry-run sudo certbot certificates sudo certbot delete --cert-name www.example.com CentOS 7 \u0026amp; 8 sudo yum install epel-release sudo yum install certbot python3-certbot-nginx # For Nginx sudo yum install certbot python3-certbot-apache # For Apache Automatically Obtain and Install Certificates\nsudo certbot --nginx sudo certbot --apache Using Standalone Mode to Generate Certificates\nsudo systemctl stop nginx sudo certbot certonly --standalone -d example.com -d www.example.com sudo systemctl start nginx Obtain a certificate by writing to the Webroot directory of a running Web server.\ncertbot certonly --webroot -w /var/www/example -d www.example.com Test Certificate Renewal Process\nsudo certbot renew --dry-run Manual renewal of certificates\nsudo certbot renew Notes Port 80 needs to be reachable from the internet for the http-01 challenge, not just port 443.\n","date":"2024-11-28T10:51:18-05:00","permalink":"/p/certbot-ssl-certificates/","title":"Certbot SSL Certificates"},{"content":"ESXCLI Command Reference\nBroadcom Knowledge Base\nBefore You Begin Run these commands directly in the ESXi Shell or an SSH session to the ESXi host, using an account with the necessary privileges. They are not commands for a Linux guest, Windows PowerShell, or the vCenter Server appliance.\nUse this article as a reference, not as a script to run from top to bottom. Replace example addresses, interface names, and VM_ID with values from your host. Command availability can vary by ESXi release; check local help before changing settings:\nesxcli system version get esxcli --help esxcli network ip interface ipv4 set --help vim-cmd help vmsvc/snapshot.create Host Information esxcli system version get esxcli system hostname get esxcli hardware platform get esxcli hardware cpu list For an extensive host configuration report:\nesxcfg-info -a Network Configuration Inspect Interfaces and Routes esxcli network nic list esxcli network nic get --nic-name=vmnic0 esxcli network ip interface list esxcli network ip interface ipv4 get esxcli network ip route ipv4 list vmnic0 identifies a physical adapter. vmk0 identifies a VMkernel interface. They serve different purposes. The legacy esxcfg-nics -l command can also list physical adapters. See the network command reference.\nSet a Static VMkernel Address Changing the management interface address can disconnect SSH and the Host Client. Have local or out-of-band console access available and record the existing configuration first.\nesxcli network ip interface ipv4 set --interface-name=vmk0 --ipv4=192.168.1.20 --netmask=255.255.255.0 --type=static This example changes the address and mask of an existing interface. It does not create a port group, configure a VLAN, or update DNS and routing. Verify those separately, especially when moving to another subnet.\nesxcli network ip interface ipv4 get --interface-name=vmk0 esxcli network ip route ipv4 list vmkping -I vmk0 192.168.1.1 Use your actual gateway address for the connectivity check.\nDisable or Enable a Physical Adapter Confirm the adapter\u0026rsquo;s role before changing it. Disabling an uplink can interrupt management, VM traffic, or storage connectivity.\nDisable the selected adapter:\nesxcli network nic down --nic-name=vmnic1 Enable it again:\nesxcli network nic up --nic-name=vmnic1 esxcli network nic list These commands replace the original notes\u0026rsquo; esxcfg-nics --enable and --disable examples. See Broadcom\u0026rsquo;s adapter troubleshooting guidance.\nStorage and Datastores Inspect Storage esxcli storage core adapter list esxcli storage core device list esxcli storage filesystem list esxcli storage nfs list esxcli storage nfs41 list Mount an NFS 3 Datastore Configure the NFS server\u0026rsquo;s export permissions for the ESXi host first. Replace the server address, exported path, and datastore name:\nesxcli storage nfs add --host=192.168.1.30 --share=/exports/esxi --volume-name=nfs-datastore esxcli storage nfs list esxcli storage filesystem list storage nfs manages NFS 3; NFS 4.1 uses the separate storage nfs41 namespace. Match the command to the export protocol. See the storage command reference.\nVirtual Machine Management Find the VM ID vim-cmd vmsvc/getallvms Identify the correct VM by both its name and datastore path. Replace VM_ID below with the numeric ID returned by this host.\nCheck Power State and Start a VM vim-cmd vmsvc/power.getstate VM_ID vim-cmd vmsvc/power.on VM_ID Shut Down a Guest Gracefully vim-cmd vmsvc/power.shutdown VM_ID vim-cmd vmsvc/power.getstate VM_ID Guest shutdown requires working VMware Tools or open-vm-tools. Allow the guest time to shut down before checking again.\nForce a VM Off Use this only when an immediate power-off is intended or graceful shutdown has failed. It can lose unsaved guest data:\nvim-cmd vmsvc/power.off VM_ID See Broadcom\u0026rsquo;s VM power troubleshooting procedure.\nSnapshots Create a snapshot without guest memory and without filesystem quiescing:\nvim-cmd vmsvc/snapshot.create VM_ID \u0026#34;before-maintenance\u0026#34; \u0026#34;Before configuration changes\u0026#34; 0 0 vim-cmd vmsvc/snapshot.get VM_ID The final arguments are includeMemory and quiesced. Both are disabled in this example. For a running VM, this does not provide an application-consistent backup. Keep enough datastore space and remove temporary snapshots through normal snapshot management when finished. See the snapshot command guidance.\nUnregister or Delete a VM Unregistering removes a VM from the host inventory while retaining its files:\nvim-cmd vmsvc/unregister VM_ID Destroying deletes the VM and its associated files. Verify the VM ID, shut it down, and confirm any required backup before running:\nvim-cmd vmsvc/destroy VM_ID Choose the operation you actually intend; do not run both as a sequence. See Broadcom\u0026rsquo;s VM command comparison.\nManagement Services Check service status:\n/etc/init.d/hostd status /etc/init.d/vpxa status hostd handles local host management; vpxa connects a managed host to vCenter. A standalone host may not have an active vCenter agent.\nWhen troubleshooting an unresponsive management service, restart only the affected service:\n/etc/init.d/hostd restart Or, for the vCenter agent:\n/etc/init.d/vpxa restart Expect a temporary management disconnect and possible disruption to active management tasks. Review cluster-specific restrictions for vSAN, NSX, and LACP before proceeding. Broadcom cautions against broad restarts through services.sh restart or DCUI\u0026rsquo;s management-agent restart in these environments. See Restarting management agents.\nLocal Accounts List local accounts and current shell sessions:\nesxcli system account list who Create an account using the correct system account namespace:\nesxcli system account add --id=operator1 --password=\u0026#39;REPLACE_WITH_PASSWORD\u0026#39; --password-confirmation=\u0026#39;REPLACE_WITH_PASSWORD\u0026#39; --description=\u0026#39;Operations user\u0026#39; Replace both password placeholders with the same strong password. Command-line passwords can be exposed in history or logging; the Host Client provides an alternative for interactive account creation. Creating an account does not automatically assign an administrator role. Configure the required permissions separately. See the system command reference.\nLogs and Performance tail -n 100 /var/log/vmkernel.log tail -n 100 /var/log/hostd.log tail -n 100 /var/log/vpxa.log tail -f /var/log/vmkernel.log Press Ctrl+C to stop following a log.\nesxtop Use c for CPU, m for memory, n for networking, and q to quit.\nHost Maintenance and Shutdown Migrate or gracefully shut down the host\u0026rsquo;s VMs before maintenance. For a vSAN cluster, use its maintenance workflow and appropriate data-migration option rather than applying a generic command without reviewing storage impact.\nEnter maintenance mode and verify its state:\nesxcli system maintenanceMode set --enable=true esxcli system maintenanceMode get After maintenance mode is confirmed, choose one action.\nReboot:\nesxcli system shutdown reboot --delay=60 --reason=\u0026#39;Planned maintenance\u0026#39; Or power off:\nesxcli system shutdown poweroff --delay=60 --reason=\u0026#39;Planned shutdown\u0026#39; After the host returns and checks are complete, exit maintenance mode:\nesxcli system maintenanceMode set --enable=false The ESXCLI shutdown commands require maintenance mode. See the system command reference.\nDirect Console Interface From a supported interactive ESXi shell session:\ndcui The physical or out-of-band console remains useful when a network change disconnects SSH. Disable temporary ESXi Shell or SSH access when troubleshooting is complete, according to your host access policy.\n","date":"2024-08-28T11:50:21-05:00","permalink":"/p/vmware-esxi-administration-command-reference/","title":"VMware ESXi Administration Command Reference"},{"content":"Remote Desktop Services Overview\nBuild and Deploy RDS\nChoose the Supported Platform Windows 10 and Windows 11 Professional, Enterprise, and Education can accept incoming Remote Desktop connections, but a normal Windows client installation is not a supported multiuser session host. Adding several users to Remote Desktop Users permits those accounts to connect; it does not create concurrent, isolated desktop sessions.\nUse Windows Server Remote Desktop Services, specifically the RD Session Host role, when multiple users need simultaneous sessions on one server. Each user or device also needs the applicable Windows Server access license and RDS CAL. See Microsoft\u0026rsquo;s RDS CAL guidance.\nWindows Server permits up to two remote sessions for server administration without RDS CALs. Those sessions are only for administering the server, not for delivering applications or desktops to regular users. Connect to an administrative session with:\nmstsc.exe /admin This guide does not use RDP Wrapper or patch termsrv.dll. Those methods modify or intercept protected Windows components, can stop working after updates, and do not provide valid multiuser licensing.\nPlan the RDS Deployment A basic session-based deployment contains these roles:\nRD Session Host: Runs the users\u0026rsquo; desktops and applications. RD Connection Broker: Assigns users to sessions and reconnects them to existing sessions. RD Web Access: Publishes desktops and RemoteApps through a web portal and client feed. RD Licensing: Issues and tracks RDS CALs. RD Gateway: Provides external RDP access over HTTPS without exposing TCP 3389 directly. For a domain deployment, prepare domain-joined Windows Server hosts with static addressing, working DNS, current updates, and valid TLS certificate names. A lab can combine roles on fewer servers, but separate roles are easier to secure and scale.\nDeploy a Session-Based Desktop Sign in to the server that will manage the deployment with an appropriate domain administrator account.\nOpen Server Manager and select Manage \u0026gt; Add Servers. Add every server that will participate in the RDS deployment. Select Manage \u0026gt; Add Roles and Features. Choose Remote Desktop Services installation. Choose Standard deployment, then Session-based desktop deployment. Select the servers for RD Connection Broker, RD Web Access, and RD Session Host. Allow the destination servers to restart if required, then select Deploy. Wait until every role reports a successful installation. These steps follow Microsoft\u0026rsquo;s RDS infrastructure deployment. Use Quick Start only for a small test environment where all core roles intentionally run on one server.\nAdd and License the RD Licensing Server In Server Manager:\nOpen Remote Desktop Services \u0026gt; Overview. Select RD Licensing, choose the license server, and add the role. Open Remote Desktop Licensing Manager from the license server. Right-click the server and select Activate Server. Complete the activation wizard using the appropriate connection method. Right-click the activated server and select Install Licenses. Select the license program and install the purchased RDS CALs. See Activate the RD Licensing server and Install RDS CALs.\nConfigure the deployment to use the license server:\nOpen Server Manager \u0026gt; Remote Desktop Services \u0026gt; Overview. Select Tasks \u0026gt; Edit Deployment Properties. Open RD Licensing. Select Per User or Per Device according to the licenses purchased. Add the activated license server and apply the settings. Domain-joined deployments can use Per User or Per Device licensing. Microsoft requires Per Device licensing for workgroup RD Session Hosts. See License RD Session Hosts.\nCreate a Session Collection Open Server Manager \u0026gt; Remote Desktop Services \u0026gt; Collections. Select Tasks \u0026gt; Create Session Collection. Enter a descriptive collection name. Select one or more RD Session Host servers. Specify the user groups allowed to connect. Avoid granting access to a broad group unless it is intentional. Configure user profile disks or your selected profile-management solution when required. Create the collection. A collection makes a full session desktop available to its assigned users. To provide individual applications, select the collection and use RemoteApp Programs \u0026gt; Publish RemoteApp programs. See Create an RDS collection.\nConfigure Concurrent Session Policies Apply these settings to the RD Session Host servers through a domain Group Policy Object. For an isolated server, use gpedit.msc locally.\nOpen:\nComputer Configuration \u0026gt; Administrative Templates \u0026gt; Windows Components \u0026gt; Remote Desktop Services \u0026gt; Remote Desktop Session Host \u0026gt; Connections\nConfigure:\nAllow users to connect remotely by using Remote Desktop Services: Enabled. Limit number of connections: Enabled, with a value appropriate for the server\u0026rsquo;s capacity and licensed deployment. Restrict Remote Desktop Services users to a single Remote Desktop Services session: Enabled when each user should reconnect to one session, or Disabled only when the same user intentionally needs multiple separate sessions. The connection limit is a technical ceiling. It does not replace RDS CALs or guarantee that the server has enough CPU, memory, storage I/O, and application licenses for that number of users.\nRequire Network Level Authentication under:\nComputer Configuration \u0026gt; Administrative Templates \u0026gt; Windows Components \u0026gt; Remote Desktop Services \u0026gt; Remote Desktop Session Host \u0026gt; Security\nSet Require user authentication for remote connections by using Network Level Authentication to Enabled. Microsoft recommends NLA because authentication occurs before a complete remote session is created. See the Remote Desktop Services policy reference.\nApply updated policy and display the resulting computer policy:\ngpupdate.exe /force gpresult.exe /scope computer /r A policy change can disconnect users or change reconnection behavior. Schedule disruptive changes during a maintenance window.\nGrant User Access Assign access through the session collection\u0026rsquo;s User Groups setting. The assigned users also need the right to sign in through Remote Desktop Services, normally granted through the local Remote Desktop Users group or domain policy.\nInspect the local group:\nGet-LocalGroupMember -Group \u0026#39;Remote Desktop Users\u0026#39; On a standalone RD Session Host, add a domain group when appropriate:\nAdd-LocalGroupMember -Group \u0026#39;Remote Desktop Users\u0026#39; -Member \u0026#39;CONTOSO\\RDS Users\u0026#39; Replace the example domain and group. In a centrally managed environment, use Group Policy to maintain membership consistently.\nSecure Remote Access Keep TCP 3389 restricted to trusted internal networks. For access from the internet, use an RD Gateway with a trusted TLS certificate, a VPN, or another approved secure access path. Do not expose an RD Session Host directly through unrestricted router port forwarding.\nUse strong account passwords, account lockout controls, supported multifactor authentication at the gateway or identity layer, and timely Windows updates. Limit clipboard, drive, printer, and device redirection according to the data handled by the environment.\nCheck the Remote Desktop firewall rules:\nGet-NetFirewallRule -DisplayGroup \u0026#39;Remote Desktop\u0026#39; | Select-Object DisplayName, Enabled, Direction, Action Verify Active Sessions Display sessions on the local RD Session Host:\nqwinsta.exe Query another session host:\nqwinsta.exe /server:RDSH01 Display user-oriented session information:\nquser.exe The output shows the username, session ID, state, idle time, and sign-in time. See the qwinsta command reference.\nCheck the installed RDS roles from an elevated PowerShell session:\nGet-WindowsFeature RDS-RD-Server, RDS-Connection-Broker, RDS-Web-Access, RDS-Licensing, RDS-Gateway On the RD Connection Broker, inspect the deployment and collections:\nGet-RDServer Get-RDSessionCollection Get-RDLicenseConfiguration The RDMgmt cmdlets require the RDS management tools and a configured deployment.\nTroubleshooting Open Event Viewer and check:\nApplications and Services Logs \u0026gt; Microsoft \u0026gt; Windows \u0026gt; TerminalServices-LocalSessionManager. Applications and Services Logs \u0026gt; Microsoft \u0026gt; Windows \u0026gt; TerminalServices-RemoteConnectionManager. Applications and Services Logs \u0026gt; Microsoft \u0026gt; Windows \u0026gt; TerminalServices-Licensing. Run the RD Licensing Diagnoser from Server Manager when users receive licensing errors.\nA second user disconnects the first user: Confirm that the host is Windows Server with the RD Session Host role and a session collection. Windows client editions are not multiuser RDS hosts. The same user reconnects to an existing session: Check Restrict Remote Desktop Services users to a single Remote Desktop Services session. Users cannot connect after the grace period: Confirm that the license server is activated, the correct mode is selected, and sufficient compatible RDS CALs are installed. A user is denied sign-in: Check collection membership, the Remote Desktop Users group, sign-in rights, NLA, and account status. Connections work internally but not externally: Check the RD Gateway, DNS, certificates, firewall rules, and client gateway settings. Sessions are slow: Review CPU, memory, disk latency, profile size, redirected devices, and application behavior on every RD Session Host. ","date":"2024-06-23T07:26:21-04:00","permalink":"/p/multiple-remote-desktop-sessions-with-windows-server-rds/","title":"Multiple Remote Desktop Sessions with Windows Server RDS"},{"content":"journalctl reads the structured logs collected by systemd-journald. It can search service, kernel, boot, user-session, and application messages without manually opening separate text log files.\nOfficial references:\njournalctl manual journald.conf manual Journal field reference Access the Journal Run journalctl without arguments to display every journal entry available to the current user, starting with the oldest entry.\njournalctl Most distributions restrict access to system-wide logs. Use sudo when diagnosing system services, or use --user for services in the current user\u0026rsquo;s systemd session.\nsudo journalctl journalctl --user journalctl --user -u syncthing.service Output normally opens in a pager. Press Space or Page Down to move forward, b to move backward, / to search, and q to quit. Add --no-pager when redirecting output or using the command in a script.\nsudo journalctl --no-pager Read Recent Messages Jump to the end of the journal.\nsudo journalctl -e Display the newest entries first.\nsudo journalctl -r Show the last 10 entries, which is the default when -n has no value.\nsudo journalctl -n Show the last 50 entries.\nsudo journalctl -n 50 Follow new messages in real time. Press Ctrl+C to stop.\nsudo journalctl -f -x adds explanatory text from the systemd message catalog when a matching explanation exists. It is useful during interactive troubleshooting, but omit it when attaching raw logs to a bug report.\nsudo journalctl -xe Filter by Boot List the boots retained in the journal, including their relative indexes and boot IDs.\nsudo journalctl --list-boots Show messages from the current boot.\nsudo journalctl -b Show messages from the previous boot.\nsudo journalctl -b -1 Use a boot ID from --list-boots when a relative index could be ambiguous.\nsudo journalctl -b 0123456789abcdef0123456789abcdef Show kernel messages from the current boot. The -k option implies -b.\nsudo journalctl -k Show kernel messages from the previous boot.\nsudo journalctl -k -b -1 Filter by Time --since and --until accept complete timestamps and convenient relative expressions.\nsudo journalctl --since \u0026#34;2026-09-24 09:00:00\u0026#34; sudo journalctl --since \u0026#34;20 minutes ago\u0026#34; sudo journalctl --since today sudo journalctl --since yesterday --until today sudo journalctl --since \u0026#34;2026-09-23\u0026#34; --until \u0026#34;2026-09-24 03:00\u0026#34; sudo journalctl --since 09:00 --until \u0026#34;1 hour ago\u0026#34; Add --utc when logs from multiple time zones must use a consistent timestamp.\nsudo journalctl --since today --utc Filter by Service Show every available message for a systemd unit.\nsudo journalctl -u nginx.service Limit a unit to the current boot or a time period.\nsudo journalctl -u nginx.service -b sudo journalctl -u nginx.service --since today Follow a service in real time and start with its last 50 messages.\nsudo journalctl -u nginx.service -n 50 -f Display messages for either of two units. Repeated -u filters are alternatives, so an entry matching either unit is shown.\nsudo journalctl -u nginx.service -u php8.3-fpm.service --since today The common troubleshooting form below jumps to the newest messages, adds catalog explanations, and limits the result to one unit.\nsudo journalctl -xeu nginx.service Filter by Priority Journal priorities use the standard syslog levels.\nNumber Name Meaning 0 emerg System is unusable 1 alert Immediate action is required 2 crit Critical condition 3 err Error condition 4 warning Warning condition 5 notice Significant normal event 6 info Informational message 7 debug Debug message A single priority includes that level and every more severe level. This command shows err, crit, alert, and emerg entries from the current boot.\nsudo journalctl -p err -b Use a range when you need exact boundaries. This command shows only messages whose priority is exactly err.\nsudo journalctl -p err..err -b Show warnings and more severe messages for one service since the start of the current boot.\nsudo journalctl -u nginx.service -p warning -b Search Message Text Use --grep or -g to match the MESSAGE field with a regular expression.\nsudo journalctl -b -g \u0026#39;failed|error|timeout\u0026#39; sudo journalctl -u nginx.service --since today -g \u0026#39;upstream.*timed out\u0026#39; An all-lowercase pattern is matched without regard to case. Set the behavior explicitly when capitalization matters.\nsudo journalctl -b -g \u0026#39;ERROR\u0026#39; --case-sensitive=yes Filter by Structured Fields Journal entries contain fields such as process ID, user ID, executable path, command name, transport, and systemd unit. Inspect all fields in matching entries with verbose output.\nsudo journalctl -u nginx.service -n 1 -o verbose Filter by process ID, user ID, command name, or executable path.\nsudo journalctl _PID=1 sudo journalctl _UID=33 --since today sudo journalctl _COMM=sshd sudo journalctl _EXE=/usr/bin/bash List the field names present in the journal or the known values for a specific field.\nsudo journalctl --fields sudo journalctl --field=_SYSTEMD_UNIT sudo journalctl --field=SYSLOG_IDENTIFIER Matches for different fields are combined with AND. This example requires both the specified unit and process ID.\nsudo journalctl _SYSTEMD_UNIT=nginx.service _PID=1234 Multiple matches for the same field are combined with OR. This example returns entries from either service.\nsudo journalctl _SYSTEMD_UNIT=nginx.service _SYSTEMD_UNIT=php8.3-fpm.service Filter messages by the syslog identifier recorded by an application.\nsudo journalctl -t sshd --since today Choose an Output Format Use ISO 8601 timestamps with microsecond precision.\nsudo journalctl -u nginx.service -o short-iso-precise Print only message text without timestamps or metadata.\nsudo journalctl -u nginx.service -o cat Produce one JSON object per journal entry for scripts and log processors.\nsudo journalctl -u nginx.service -b -o json --no-pager Use formatted JSON for manual inspection.\nsudo journalctl -u nginx.service -b -o json-pretty Limit structured output to selected fields.\nsudo journalctl -u nginx.service -o json --output-fields=__REALTIME_TIMESTAMP,PRIORITY,_SYSTEMD_UNIT,MESSAGE --no-pager Export Logs to a File Save one service\u0026rsquo;s messages from today as plain text.\nsudo journalctl -u nginx.service --since today -o short-iso-precise --no-pager \u0026gt; nginx-today.log Save warnings and errors from the current boot.\nsudo journalctl -b -p warning -o short-iso-precise --no-pager \u0026gt; boot-warnings.log Use the journal export format when the structured fields must be preserved for transfer or later processing.\nsudo journalctl -b -o export --no-pager \u0026gt; current-boot.journal-export Remember that logs can contain hostnames, usernames, IP addresses, environment details, command arguments, and application data. Review exported files before sharing them.\nCheck and Reduce Disk Usage Display the combined size of active and archived journal files.\nsudo journalctl --disk-usage Vacuum operations remove archived journal files. Rotate active files first so the cleanup can reclaim as much eligible data as possible.\nsudo journalctl --rotate --vacuum-size=1G sudo journalctl --rotate --vacuum-time=30days The following command retains no more than 10 archived journal files after rotation.\nsudo journalctl --rotate --vacuum-files=10 Vacuuming is immediate maintenance, not a permanent retention policy. Configure limits in journald.conf for ongoing control.\nEnable Persistent Logs and Set Retention Limits With the default Storage=auto, journald stores persistent logs under /var/log/journal when that directory exists; otherwise it uses volatile storage under /run/log/journal, which is lost at reboot.\nCreate a drop-in configuration rather than editing the vendor file.\nsudo mkdir -p /etc/systemd/journald.conf.d sudoedit /etc/systemd/journald.conf.d/retention.conf [Journal] Storage=persistent Compress=yes SystemMaxUse=1G SystemKeepFree=2G MaxRetentionSec=30day Restart journald and flush any eligible runtime entries to persistent storage.\nsudo systemctl restart systemd-journald sudo journalctl --flush sudo journalctl --disk-usage SystemMaxUse limits journal usage, while SystemKeepFree reserves space for the rest of the filesystem. Journald follows whichever condition is reached first. Only archived files are removed when enforcing limits, so total usage can temporarily exceed the configured maximum while the active file remains open.\nVerify Journal Integrity Check journal files for internal consistency.\nsudo journalctl --verify A verification failure may indicate an incomplete write, storage corruption, or a damaged copied journal. Preserve the affected files before attempting recovery if they are needed for an investigation.\nRead Logs from Another System Read journal files copied into a directory without merging them into the local journal.\nsudo journalctl --directory=/mnt/recovered/var/log/journal Read a particular journal file or a quoted file pattern.\nsudo journalctl --file=\u0026#39;/mnt/recovered/var/log/journal/*/*.journal\u0026#39; Troubleshooting Recipes A Service Failed to Start Check its current state, then inspect warnings and errors from the current boot.\nsudo systemctl status nginx.service --no-pager sudo journalctl -u nginx.service -b -p warning -n 100 --no-pager A Problem Happened During the Previous Boot List retained boots and inspect the previous boot from newest to oldest.\nsudo journalctl --list-boots sudo journalctl -b -1 -p warning -r A Kernel or Hardware Error Is Suspected Inspect kernel warnings from the current boot.\nsudo journalctl -k -p warning -b A Problem Must Be Reproduced Live Start a filtered follow session, reproduce the problem, and stop the command with Ctrl+C.\nsudo journalctl -u nginx.service -n 50 -f Older Boots Are Missing Check the boot list and storage mode. If /var/log/journal does not exist and Storage=auto is in effect, logs are probably volatile and disappear at reboot.\nsudo journalctl --list-boots sudo test -d /var/log/journal \u0026amp;\u0026amp; echo persistent || echo volatile sudo systemd-analyze cat-config systemd/journald.conf ","date":"2023-11-23T00:37:27-05:00","permalink":"/p/use-journalctl-to-inspect-and-manage-systemd-logs/","title":"Use journalctl to Inspect and Manage systemd Logs"},{"content":"systemd is the service manager used by most current Linux distributions. Its systemctl command controls services and other unit types, including sockets, timers, mounts, paths, devices, and targets.\nOfficial references:\nsystemctl manual systemd.unit manual systemd.service manual systemd.resource-control manual The examples use nginx.service. Replace it with the unit installed on your system.\nCheck the systemd Version Display the installed systemd version and enabled features.\nsystemctl --version Check whether systemd is PID 1.\nps -p 1 -o pid,comm,args Display the overall manager status.\nsystemctl status --no-pager Understand Unit Names A complete unit name contains a suffix that identifies its type:\nUnit type Example Purpose Service nginx.service Daemon or process Socket ssh.socket Socket-based activation Timer fstrim.timer Scheduled activation Mount home.mount Filesystem mount Path example.path Path-based activation Target multi-user.target Group of units and boot state For many service commands, systemctl adds .service when the suffix is omitted. Writing the complete name makes scripts and documentation clearer.\nStart, Stop, and Restart a Service Start a service now.\nsudo systemctl start nginx.service Stop it now.\nsudo systemctl stop nginx.service Restart it even if it is currently inactive.\nsudo systemctl restart nginx.service Reload the application\u0026rsquo;s configuration without restarting its process. This succeeds only when the unit implements a reload operation.\nsudo systemctl reload nginx.service Reload the service when supported, or restart it otherwise.\nsudo systemctl reload-or-restart nginx.service Restart the service only if it is already running.\nsudo systemctl try-restart nginx.service systemctl daemon-reload has a different purpose: it makes the systemd manager reread unit files and dependency definitions. It does not reload an application\u0026rsquo;s own configuration and does not restart running services.\nsudo systemctl daemon-reload Enable or Disable Automatic Startup Enabling and starting are separate operations. enable creates the links described by the unit\u0026rsquo;s [Install] section so it can be activated during boot or by another unit; it does not start the service unless --now is included.\nEnable a service for future boots.\nsudo systemctl enable nginx.service Enable and start it in one operation.\nsudo systemctl enable --now nginx.service Disable future automatic startup without stopping the currently running service.\nsudo systemctl disable nginx.service Disable and stop it.\nsudo systemctl disable --now nginx.service Do not manually create links under a target\u0026rsquo;s .wants directory. systemctl enable reads the unit metadata, creates the correct links, and reloads the manager configuration.\nMask or Unmask a Unit Masking prevents every form of activation, including manual starts and dependency-based starts. Use it only when a service must not run.\nsudo systemctl mask nginx.service Mask and stop the service immediately.\nsudo systemctl mask --now nginx.service Remove the mask before enabling or starting the unit again.\nsudo systemctl unmask nginx.service Check Service State Show a human-readable status report with recent log messages.\nsystemctl status nginx.service Prevent the output from opening a pager and show untruncated lines.\nsystemctl status nginx.service --no-pager --full Use state-check commands in scripts. They print a state and return zero only when the requested condition is true.\nsystemctl is-active nginx.service systemctl is-enabled nginx.service systemctl is-failed nginx.service Check only the exit status in a shell condition.\nif systemctl is-active --quiet nginx.service; then echo running; else echo stopped; fi An enabled service can be inactive, and an active service can be disabled. The first state controls future activation; the second describes its current runtime state.\nInspect Unit Properties and Files Display every runtime property known to systemd.\nsystemctl show nginx.service Select the most useful properties for troubleshooting.\nsystemctl show nginx.service --property=LoadState,ActiveState,SubState,UnitFileState,MainPID,Result,ExecMainCode,ExecMainStatus,FragmentPath,DropInPaths Display the vendor unit file and every applied drop-in in precedence order.\nsystemctl cat nginx.service Show the unit\u0026rsquo;s vendor file path.\nsystemctl show nginx.service --property=FragmentPath --value Common system-unit locations are:\nDirectory Purpose /etc/systemd/system/ Local administrator units and overrides; highest persistent priority /run/systemd/system/ Runtime units and overrides removed at reboot /usr/lib/systemd/system/ Vendor or package-provided units /lib/systemd/system/ Vendor path used by some distributions Avoid editing package files under /usr/lib or /lib because upgrades can replace them.\nList Services and Unit Files List currently loaded units. Without --all, inactive units are normally omitted.\nsystemctl list-units systemctl list-units --type=service systemctl list-units --type=service --all List failed units.\nsystemctl --failed List installed unit files and their enablement state, including units that are not currently loaded.\nsystemctl list-unit-files systemctl list-unit-files --type=service systemctl list-unit-files --type=service --state=enabled List jobs that systemd is currently starting or stopping.\nsystemctl list-jobs Check the overall system state. Common results include running, degraded, starting, and maintenance.\nsystemctl is-system-running Inspect Dependencies and Ordering Display the units that the selected service depends on.\nsystemctl list-dependencies nginx.service Include all dependency levels.\nsystemctl list-dependencies nginx.service --all Display reverse dependencies: units that depend on the selected service.\nsystemctl list-dependencies nginx.service --reverse Dependency relationships and start order are different concepts. Requires= and Wants= express dependency strength, while After= and Before= control ordering.\nRead Service Logs Show all retained messages for a service.\nsudo journalctl -u nginx.service Show the last 100 messages from the current boot without a pager.\nsudo journalctl -u nginx.service -b -n 100 --no-pager Follow new messages while reproducing a problem.\nsudo journalctl -u nginx.service -n 50 -f Edit a Service Safely Use a drop-in to override a package-provided unit. This preserves the vendor file and survives package upgrades.\nsudo systemctl edit nginx.service For example, add restart behavior and a 1 GiB memory throttle with a 1536 MiB hard limit:\n[Service] Restart=on-failure RestartSec=5s MemoryHigh=1G MemoryMax=1536M Saving systemctl edit installs the drop-in under /etc/systemd/system/nginx.service.d/ and reloads the systemd manager. Restart the service when the changed setting applies only to a new process.\nsudo systemctl restart nginx.service Revert every local drop-in and full-file override created for the unit.\nsudo systemctl revert nginx.service If a unit file is edited manually, validate it and reload the manager before restarting the service.\nsudo systemd-analyze verify /etc/systemd/system/example.service sudo systemctl daemon-reload sudo systemctl restart example.service Set Resource Limits Set persistent cgroup v2 properties without manually editing a drop-in. The changes apply immediately when possible and are saved for future starts.\nsudo systemctl set-property nginx.service CPUWeight=200 MemoryHigh=1G MemoryMax=1536M Use --runtime to keep a test change only until reboot.\nsudo systemctl set-property --runtime nginx.service CPUWeight=200 MemoryHigh=1G Inspect the effective properties.\nsystemctl show nginx.service --property=CPUWeight,MemoryHigh,MemoryMax,ControlGroup CPUWeight is the current cgroup v2 replacement for the legacy CPUShares setting. A weight affects relative CPU distribution during contention; it is not a hard CPU limit. Use CPUQuota= when a hard bandwidth limit is required. MemoryHigh= is the preferred throttling control, while MemoryMax= is a last line of defense that can trigger an out-of-memory kill inside the unit.\nCreate a Custom Service Create custom system units under /etc/systemd/system/. The example below runs an existing application as a dedicated unprivileged account.\nsudoedit /etc/systemd/system/example.service [Unit] Description=Example application service Wants=network-online.target After=network-online.target [Service] Type=exec User=example Group=example WorkingDirectory=/opt/example ExecStart=/opt/example/bin/example Restart=on-failure RestartSec=5s NoNewPrivileges=yes PrivateTmp=yes [Install] WantedBy=multi-user.target Use network-online.target only when the application requires a configured network during startup. Many network services can start after network.target or without an explicit network ordering rule.\nSystemd does not apply shell syntax to ExecStart by default. Use an absolute executable path and pass arguments directly. Do not add a shell solely for environment-variable expansion or redirection unless the service genuinely requires shell behavior.\nValidate, load, enable, and start the unit.\nsudo systemd-analyze verify /etc/systemd/system/example.service sudo systemctl daemon-reload sudo systemctl enable --now example.service systemctl status example.service --no-pager --full The example account, group, working directory, and executable must exist before starting the service.\nManage Template Instances A template such as worker@.service can create multiple service instances. %i expands to the instance name inside the template.\n[Unit] Description=Worker instance %i [Service] Type=exec ExecStart=/opt/example/bin/worker --instance %i Restart=on-failure [Install] WantedBy=multi-user.target Enable and start instance 1.\nsudo systemctl enable --now worker@1.service Manage another instance independently.\nsudo systemctl start worker@2.service sudo systemctl status worker@2.service Manage User Services User services run under the current user\u0026rsquo;s service manager and do not require root access. Store custom user units in ~/.config/systemd/user/.\nmkdir -p ~/.config/systemd/user nano ~/.config/systemd/user/example.service systemctl --user daemon-reload systemctl --user enable --now example.service systemctl --user status example.service journalctl --user -u example.service By default, a user\u0026rsquo;s manager may stop after the last login session ends. An administrator can enable lingering when that user\u0026rsquo;s services must continue without an active login.\nsudo loginctl enable-linger username Recover a Failed Service Inspect status, logs, the recorded exit result, and the unit definition.\nsystemctl status nginx.service --no-pager --full sudo journalctl -u nginx.service -b -p warning -n 100 --no-pager systemctl show nginx.service --property=Result,ExecMainCode,ExecMainStatus,Restart,StartLimitBurst systemctl cat nginx.service After fixing the cause, clear the failed state and start the unit again.\nsudo systemctl reset-failed nginx.service sudo systemctl start nginx.service If the message says the start request was repeated too quickly, fix the underlying crash before using reset-failed; clearing the counter alone does not correct the service.\nSend a Signal to a Service systemctl kill sends a signal to processes in a unit. Normal service shutdown should use systemctl stop so the unit\u0026rsquo;s configured stop behavior and timeout are honored.\nSend SIGHUP only to the main process when an application documents that signal as a configuration reload request.\nsudo systemctl kill --kill-whom=main --signal=SIGHUP nginx.service Manage the Default Target Display the target used for a normal boot.\nsystemctl get-default Set a text-oriented multi-user boot.\nsudo systemctl set-default multi-user.target Set a graphical boot.\nsudo systemctl set-default graphical.target List installed and currently loaded targets.\nsystemctl list-unit-files --type=target systemctl list-units --type=target --all Traditional runlevel aliases commonly map as follows, although distribution presets can differ:\nRunlevel systemd target 0 poweroff.target 1 rescue.target 2, 3, 4 multi-user.target 5 graphical.target 6 reboot.target Switch the running system to another target with isolate. Units not required by the new target can be stopped, so use a local console before isolating a remote server.\nsudo systemctl isolate multi-user.target Enter rescue or emergency mode from a local console.\nsudo systemctl rescue sudo systemctl emergency Power and Sleep Commands The following commands affect the whole machine and can disconnect users or interrupt work.\nsudo systemctl reboot sudo systemctl poweroff sudo systemctl suspend sudo systemctl hibernate sudo systemctl hybrid-sleep sudo systemctl suspend-then-hibernate Hibernate and hybrid sleep require supported hardware, sufficient swap, and a correctly configured resume path. Check the journal if the machine returns immediately or fails to resume.\n","date":"2023-11-21T23:48:09-05:00","permalink":"/p/manage-systemd-services-with-systemctl/","title":"Manage systemd Services with systemctl"},{"content":"systemd-analyze reports timing and dependency information collected by the systemd manager. It can measure the current boot, rank unit activation times, identify the time-critical dependency chain, create an SVG timeline, and validate unit files.\nOfficial references:\nsystemd-analyze manual systemctl manual journalctl manual systemd.unit manual Establish a Baseline Confirm that systemd is the active service manager and record its version.\nps -p 1 -o pid,comm,args systemd-analyze --version systemctl get-default Measure the current boot.\nsystemd-analyze time Running systemd-analyze without a subcommand is equivalent.\nsystemd-analyze A typical result separates several phases:\nStartup finished in 6.112s (firmware) + 1.834s (loader) + 3.927s (kernel) + 4.215s (initrd) + 8.406s (userspace) = 24.495s graphical.target reached after 8.102s in userspace Phase Meaning Firmware UEFI or system firmware initialization Loader Bootloader time before starting the kernel Kernel Kernel initialization before the initrd or system manager Initrd Initial RAM filesystem initialization Userspace Systemd unit activation up to the reported target Firmware and loader timings are available only on supported boot environments. Containers usually report userspace time only.\nThe total does not mean that every application is fully initialized or that disks and network services are idle. It measures elapsed time until systemd has spawned the services required by the target and those jobs have reached the states systemd considers started.\nFor meaningful comparisons, measure several cold boots under similar conditions. Firmware caches, filesystem caches, pending updates, network availability, and attached hardware can change the result.\nRank Unit Activation Times List loaded units by the time they spent activating.\nsystemd-analyze blame Show the first 30 entries without opening a pager.\nsystemd-analyze blame --no-pager | head -n 30 Treat this list as a set of candidates rather than proof of causation:\nServices start in parallel, so several long activations may overlap. A service can appear slow because it waits for another service, device, mount, or network event. Units that move directly from inactive to active may not have a measurable activating period. Type=simple services are considered started immediately and normally do not show their real application initialization time. The list measures activation time, not time spent waiting in systemd\u0026rsquo;s job queue. Inspect the dependencies and logs before disabling or modifying a high-ranking unit.\nFind the Critical Chain Display the time-critical dependency chain for the default target.\nsystemd-analyze critical-chain Analyze the chain leading to a specific service.\nsystemd-analyze critical-chain nginx.service Analyze the chain leading to the graphical target explicitly.\nsystemd-analyze critical-chain graphical.target In the output, @ shows when a unit became active relative to boot, and + shows how long that unit spent activating.\ngraphical.target @8.102s └─multi-user.target @8.101s └─example.service @3.400s +4.699s Use --fuzz to include nearby branches that completed shortly before the latest dependency at each level.\nsystemd-analyze critical-chain --fuzz=1s The critical chain also has limits. Socket activation, parallel execution, and jobs that never enter a measurable activating state can make the output incomplete. It does not display every timeout or every possible dependency branch.\nCreate a Boot Timeline Generate an SVG chart showing unit activation across the boot timeline.\nsystemd-analyze plot \u0026gt; boot.svg Open boot.svg in a browser or vector-image viewer. The chart makes overlapping unit activations easier to see and helps distinguish one long critical path from several unrelated background operations.\nCheck that the output is an SVG document before sharing it.\nfile boot.svg Recent systemd versions can also print the plot data as a table.\nsystemd-analyze plot --table If --table is unavailable on the installed version, use the SVG output.\nGraph Unit Dependencies The dot command generates a dependency graph in Graphviz format. Install Graphviz first if the dot renderer is missing.\nOn Ubuntu or Debian:\nsudo apt update sudo apt install -y graphviz Render the complete dependency graph as SVG. A full system graph can be very large.\nsystemd-analyze dot | dot -Tsvg \u0026gt; systemd-dependencies.svg Limit the graph to relationships leading to one service.\nsystemd-analyze dot --to-pattern=\u0026#39;nginx.service\u0026#39; | dot -Tsvg \u0026gt; nginx-dependencies.svg Dependency graphs show declared relationships; they do not directly show which process consumed CPU, waited for storage, or stalled on an external network response.\nInspect Boot Logs with Monotonic Time Display current-boot messages with timestamps measured from the start of the boot.\nsudo journalctl -b -o short-monotonic Show warnings and more severe messages from the current boot.\nsudo journalctl -b -p warning --no-pager Search for common timeout and dependency failures.\nsudo journalctl -b --grep=\u0026#39;timed out|A start job is running|Dependency failed|Failed to start\u0026#39; --case-sensitive=no Inspect one candidate service.\nsystemctl status nginx.service --no-pager --full sudo journalctl -u nginx.service -b -o short-monotonic --no-pager Inspect kernel initialization separately.\nsudo journalctl -k -b -o short-monotonic List retained boots and read the previous boot\u0026rsquo;s logs.\njournalctl --list-boots sudo journalctl -b -1 -o short-monotonic systemd-analyze reports live timing data from the current manager. Use retained journal entries and saved reports when comparing the current boot with an earlier one.\nInspect Unit Timing and Configuration Display timestamps, result state, and the source unit file for a candidate service.\nsystemctl show nginx.service --property=ActiveEnterTimestamp,ActiveEnterTimestampMonotonic,InactiveExitTimestampMonotonic,ExecMainStartTimestampMonotonic,Result,FragmentPath,DropInPaths Display the complete vendor unit and every applied drop-in.\nsystemctl cat nginx.service Display direct and reverse dependencies.\nsystemctl list-dependencies nginx.service --all systemctl list-dependencies nginx.service --reverse Remember that dependency and ordering directives have different roles. Wants= and Requires= describe dependency strength, while After= and Before= determine order when both units participate in the same transaction.\nCheck for Failed Units List units in the failed state.\nsystemctl --failed Inspect one failure and its journal.\nsystemctl status example.service --no-pager --full sudo journalctl -u example.service -b -n 100 --no-pager A failed unit does not always delay the critical path, but repeated retries, dependency timeouts, and required units can extend boot time.\nValidate Unit Files Verify a custom or modified unit before reloading systemd.\nsudo systemd-analyze verify /etc/systemd/system/example.service After a manual edit, reload the manager and restart the affected service.\nsudo systemctl daemon-reload sudo systemctl restart example.service Use systemctl edit for local overrides of package-provided units so upgrades do not replace the changes.\nsudo systemctl edit example.service Analyze the User Service Manager Desktop startup can continue after the system target is reached. Analyze services belonging to the current user separately.\nsystemd-analyze --user time systemd-analyze --user blame systemd-analyze --user critical-chain systemctl --user --failed These commands require an active user systemd manager and describe user units rather than system services.\nInvestigate Network Wait Services Network-online wait services are common near the top of a blame list. Before disabling one, find which units require network-online.target.\nsystemctl list-dependencies network-online.target --reverse Inspect the active wait implementation and its logs. The unit name depends on the network manager.\nsystemctl status systemd-networkd-wait-online.service --no-pager --full sudo journalctl -u systemd-networkd-wait-online.service -b --no-pager For NetworkManager-based systems:\nsystemctl status NetworkManager-wait-online.service --no-pager --full sudo journalctl -u NetworkManager-wait-online.service -b --no-pager Do not disable a wait-online service until you confirm that no required mount, database, backup, or application needs a usable network during boot. Correcting an unused interface, DHCP timeout, or overly broad online requirement is safer than hiding the delay.\nOptimize Boot Safely Use this workflow for each proposed change:\nRecord systemd-analyze time, blame, critical-chain, failed units, and relevant boot logs. Identify whether the delay belongs to firmware, bootloader, kernel, initrd, or userspace. Confirm that a slow userspace unit lies on the critical chain or blocks a required dependency. Read the unit file and journal to find the actual wait condition. Change one setting at a time with a drop-in or the application\u0026rsquo;s supported configuration. Reboot under comparable conditions and repeat the measurements. Restore the original setting if the improvement is not repeatable or removes required behavior. Disable a service only after confirming that the machine does not need it.\nsudo systemctl disable --now example.service Socket- or timer-activated services may not need to start at boot. Inspect the related units before changing them.\nsystemctl list-dependencies example.service --reverse systemctl list-unit-files \u0026#39;example.*\u0026#39; systemctl cat example.service Avoid masking core system units as a performance experiment. Masking blocks manual and dependency-based activation and can make the system unusable.\nSave a Report for Comparison Create a directory and save the main reports after each test boot.\nmkdir -p ~/boot-analysis systemd-analyze time | tee ~/boot-analysis/time.txt systemd-analyze blame --no-pager \u0026gt; ~/boot-analysis/blame.txt systemd-analyze critical-chain --no-pager \u0026gt; ~/boot-analysis/critical-chain.txt systemd-analyze plot \u0026gt; ~/boot-analysis/boot.svg systemctl --failed --no-pager \u0026gt; ~/boot-analysis/failed-units.txt sudo journalctl -b -p warning --no-pager \u0026gt; ~/boot-analysis/boot-warnings.txt Record the kernel, systemd version, and boot ID with the report.\nuname -a \u0026gt; ~/boot-analysis/system.txt systemd-analyze --version \u0026gt;\u0026gt; ~/boot-analysis/system.txt cat /proc/sys/kernel/random/boot_id \u0026gt;\u0026gt; ~/boot-analysis/system.txt Some logs may contain hostnames, device identifiers, IP addresses, usernames, command arguments, or application data. Review the report before sharing it.\nTroubleshooting systemd-analyze blame Shows Almost Nothing Confirm that the system booted with systemd as PID 1. Containers and WSL environments may not provide complete firmware, kernel, or service timing data. Services using Type=simple also do not expose meaningful activation duration.\nps -p 1 -o pid,comm,args systemd-analyze time A Long Service Is Missing from the Critical Chain It may have started in parallel without delaying the target, been socket-activated, or never entered a measurable activating state. Inspect its timestamps, dependencies, and journal directly.\nsystemctl show example.service --property=ActiveEnterTimestampMonotonic,InactiveExitTimestampMonotonic,Result systemctl list-dependencies example.service --all sudo journalctl -u example.service -b -o short-monotonic Userspace Is Fast but the Total Boot Is Slow Look at the firmware, loader, kernel, and initrd fields in systemd-analyze time. Systemd service changes cannot reduce time spent before userspace. Firmware settings, device initialization, bootloader timeouts, storage detection, kernel messages, and initrd configuration require separate investigation.\nsystemd-analyze time sudo journalctl -k -b -o short-monotonic Results Change Substantially Between Boots Repeat several cold boots with the same peripherals and network conditions. Check for DHCP delays, storage errors, update jobs, filesystem checks, and services that contact external systems during startup.\nsudo journalctl -b -p warning --no-pager systemd-analyze critical-chain ","date":"2023-11-12T22:49:33-05:00","permalink":"/p/analyze-linux-boot-performance-with-systemd/","title":"Analyze Linux Boot Performance with systemd"},{"content":"Linux exposes CPU and memory information through /proc, /sys, firmware tables, and command-line tools. Each source answers a different question: CPU topology describes the processors visible to the operating system, free reports current memory use, and dmidecode reports the memory devices described by system firmware.\nOfficial references:\nlscpu manual nproc manual free source and options dmidecode project documentation Linux cgroup v2 documentation Install the Utilities Most distributions install lscpu, nproc, and free by default. Install the packages below if any command is missing.\nOn Ubuntu or Debian:\nsudo apt update sudo apt install -y util-linux coreutils procps dmidecode On Fedora, RHEL, or Rocky Linux:\nsudo dnf install -y util-linux coreutils procps-ng dmidecode Record the System Context Before comparing hardware reports, record the operating system, kernel, architecture, hostname, and virtualization environment.\ncat /etc/os-release uname -a hostnamectl systemd-detect-virt systemd-detect-virt prints a virtualization technology such as kvm, vmware, or wsl, or returns none on supported bare-metal systems. A virtual machine normally reports the virtual CPUs and memory assigned by the hypervisor rather than the host\u0026rsquo;s complete hardware.\nUnderstand CPU Counts CPU terminology is easy to mix up:\nA socket is a physical processor package or a virtual topology presented by a hypervisor. A core is an independent processing core within a socket. A thread is a hardware thread within a core when simultaneous multithreading is enabled. A logical CPU is one processor number that the Linux scheduler can use. For a typical two-socket system with 8 cores per socket and 2 threads per core, Linux sees 32 logical CPUs.\nDisplay CPU Architecture and Topology Use lscpu for a readable summary. It gathers information from sysfs, /proc/cpuinfo, and architecture-specific sources.\nlscpu The most useful fields are:\nField Meaning CPU(s) Logical CPUs visible to the operating system On-line CPU(s) list Logical CPUs currently online Thread(s) per core Hardware threads per core Core(s) per socket Physical or virtual cores in each socket Socket(s) Processor packages visible to the system NUMA node(s) Non-uniform memory-access nodes Model name Processor model reported by the platform Display one row per logical CPU with its core, socket, NUMA node, state, and frequency range.\nlscpu --extended=CPU,CORE,SOCKET,NODE,ONLINE,MAXMHZ,MINMHZ Use parseable output when another command or script will consume the topology. The default human-readable format can change between util-linux versions.\nlscpu --parse=CPU,CORE,SOCKET,NODE,ONLINE Produce structured JSON when the installed lscpu version supports it.\nlscpu --json Virtual machines may report a synthetic socket and core layout. Confirm the host topology in the hypervisor when licensing, NUMA placement, or performance tuning depends on physical hardware.\nCount Available Processing Units nproc reports the number of processing units available to the current process. CPU affinity, OpenMP environment variables, and cgroup v2 quotas may make this smaller than the number installed in the system.\nnproc Show the number of installed processors without applying those process-level restrictions.\nnproc --all This distinction matters for containers and restricted services. Use nproc when choosing a safe level of parallel work, such as a build job, and use lscpu when inspecting the machine\u0026rsquo;s topology.\nRead Raw CPU Information /proc/cpuinfo contains architecture-dependent information for each logical CPU.\nless /proc/cpuinfo Count the processor records exposed by architectures that provide the standard processor field.\ngrep -c \u0026#39;^processor\u0026#39; /proc/cpuinfo Display unique processor model strings on x86 systems.\ngrep \u0026#39;^model name\u0026#39; /proc/cpuinfo | sort -u Fields such as physical id, cpu cores, and model name are architecture-dependent and may be absent or synthetic in virtual machines. Avoid using them as the primary source for portable scripts.\nCheck Current Memory Usage Use free for a snapshot of physical memory and swap usage.\nfree -h The available column is usually more useful than the free column. Linux uses otherwise idle memory for caches and can reclaim much of it for applications, so a small free value alone does not indicate memory pressure.\nDisplay separate buffers and cache columns.\nfree -h --wide Display values in mebibytes, where one MiB is 1,048,576 bytes.\nfree -m Display values in decimal megabytes, where one MB is 1,000,000 bytes.\nfree --mega Refresh the report every two seconds and stop after five samples.\nfree -h --seconds 2 --count 5 For a compact view of the kernel\u0026rsquo;s raw memory counters, inspect selected fields in /proc/meminfo.\ngrep -E \u0026#39;^(MemTotal|MemAvailable|SwapTotal|SwapFree|HugePages_Total|HugePages_Free):\u0026#39; /proc/meminfo Observe Memory Pressure vmstat shows runnable processes, swapping, block I/O, interrupts, context switches, and CPU time. The first row contains averages since boot; later rows represent each sampling interval.\nvmstat 1 5 Sustained nonzero values in the si and so columns indicate swap-in and swap-out activity. High swap activity together with low available memory can indicate pressure, but interpret it with application behavior and storage latency.\nList processes using the most resident memory.\nps -eo pid,user,comm,%cpu,%mem,rss --sort=-rss | head -n 15 Show active swap devices and files.\nswapon --show --bytes Inspect Physical Memory Devices dmidecode reads SMBIOS or DMI data supplied by the system firmware. Root permission is normally required.\nShow only Type 17 Memory Device records, which describe installed DIMMs and empty slots.\nsudo dmidecode --type 17 Show all memory-related DMI record types.\nsudo dmidecode --type memory Common Type 17 fields include:\nField Meaning Locator Motherboard slot label Bank Locator Firmware bank name Size Installed capacity or No Module Installed Type DDR generation reported by firmware Speed Module-rated speed Configured Memory Speed Current configured speed Manufacturer Vendor reported in the module data Part Number Module part number Serial Number Module serial number when available dmidecode does not probe the DIMMs directly. It reports what the firmware provides, and the upstream project warns that DMI data can be incomplete or inaccurate. Virtual machines may expose synthetic memory-device records or none at all.\nInspect NUMA Layout lscpu summarizes NUMA nodes and the logical CPUs assigned to each node.\nlscpu If numactl is installed, show CPUs, memory size, free memory, and distance information for each NUMA node.\nnumactl --hardware On a multi-socket system, NUMA-aware placement can reduce remote-memory access. Do not force NUMA policies without measuring the workload because incorrect binding can reduce performance or exhaust one node while memory remains available elsewhere.\nCheck Container Resource Limits Inside a container, hardware inventory tools may describe the host or the container namespace rather than the resources the workload can actually consume. nproc may account for a cgroup v2 CPU quota, while some versions of free can still show host memory.\nOn a cgroup v2 system, display current memory use and the hard memory limit for the current cgroup.\ncat /sys/fs/cgroup/memory.current cat /sys/fs/cgroup/memory.max memory.max contains max when no hard limit is set; otherwise it contains a limit in bytes.\nDisplay the CPU quota and period.\ncat /sys/fs/cgroup/cpu.max The value max 100000 means there is no CPU bandwidth limit. A value such as 200000 100000 permits up to two CPUs worth of execution time during each period. Container runtimes can also restrict CPU affinity, so compare the result with nproc.\nTroubleshoot Memory and CPU Problems The System Is Slow but free Shows Little Free Memory Check MemAvailable, swap activity, and the largest resident processes rather than judging only the free column.\nfree -h --wide vmstat 1 5 ps -eo pid,user,comm,%cpu,%mem,rss --sort=-rss | head -n 15 A Process Was Killed Unexpectedly Search the current boot\u0026rsquo;s kernel journal for out-of-memory events.\nsudo journalctl -k -b --grep=\u0026#39;Out of memory|oom-kill|Killed process\u0026#39; For a container, also inspect its memory.max, memory.current, and memory.events files.\ncat /sys/fs/cgroup/memory.max cat /sys/fs/cgroup/memory.current cat /sys/fs/cgroup/memory.events CPU Counts Do Not Agree Compare physical topology, installed processors, and processing units available to the current process.\nlscpu nproc --all nproc Differences can result from offline CPUs, CPU affinity, cgroup quotas, virtual-machine topology, or OpenMP environment variables.\nA DIMM Is Missing or Has the Wrong Speed Compare the firmware table with kernel hardware messages, then verify the module in the system firmware interface.\nsudo dmidecode --type 17 sudo journalctl -k -b --grep=\u0026#39;memory|EDAC|ECC|MCE\u0026#39; --case-sensitive=no Power down the machine and follow the hardware vendor\u0026rsquo;s service procedure before reseating or replacing physical memory.\n","date":"2023-10-16T14:53:28-05:00","permalink":"/p/inspect-cpu-and-memory-resources-on-linux/","title":"Inspect CPU and Memory Resources on Linux"},{"content":"CodeFormer\nCodeFormer v0.1.0 models\nPyTorch previous versions\nOverview CodeFormer is a blind face-restoration model published with the NeurIPS 2022 paper Towards Robust Blind Face Restoration with Codebook Lookup Transformer. It can restore faces in cropped images, complete photos, and videos.\nThis guide installs the command-line version on 64-bit Windows 10 or Windows 11. An NVIDIA GPU is recommended, although CodeFormer can run on a CPU much more slowly.\nThe upstream installation instructions still specify Python 3.8 and do not provide a fully pinned dependency file. The environment below therefore uses Python 3.8 with PyTorch 1.12.0 and torchvision 0.13.0, a matching pair published in PyTorch\u0026rsquo;s official previous-version archive. This older environment is intentional and avoids compatibility errors caused by installing current packages into an older project.\nInstall the Prerequisites Install the following applications:\nGit for Windows Miniconda for Windows The current NVIDIA driver when using a supported NVIDIA GPU Open Anaconda Prompt after installation and verify Git and Conda:\ngit --version conda --version There is no need to add Conda directories to the system PATH manually when commands are run from Anaconda Prompt.\nFor an NVIDIA GPU, confirm that Windows can see the driver and graphics card:\nnvidia-smi The CUDA version displayed by nvidia-smi is the newest CUDA runtime supported by the installed driver. It does not mean that the same standalone CUDA Toolkit is installed. Normal CodeFormer inference uses the CUDA runtime supplied with PyTorch, so a separate Toolkit and the nvcc command are not required.\nDownload CodeFormer Choose a working directory, then clone the official repository:\ngit clone https://github.com/sczhou/CodeFormer.git cd CodeFormer Run all remaining commands from the repository root, where inference_codeformer.py and the basicsr directory are visible.\nCreate the Conda Environment Create and activate a dedicated Python 3.8 environment:\nconda create -n codeformer python=3.8 -y conda activate codeformer python -m pip install --upgrade \u0026#34;pip\u0026lt;25\u0026#34; The pip limit retains Python 3.8 support.\nNVIDIA GPU Install the matching CUDA 11.3 build of PyTorch 1.12.0:\nconda install -y pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.3 -c pytorch This package installs the required CUDA runtime inside the Conda environment. It does not replace the Windows display driver.\nCPU Only Use this command instead when the computer does not have a compatible NVIDIA GPU:\nconda install -y pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cpuonly -c pytorch Do not install both variants in the same environment.\nInstall CodeFormer Install the remaining dependencies and register the bundled BasicSR package:\npython -m pip install -r requirements.txt python basicsr/setup.py develop The separate gradio package from the original notes is not required for command-line inference.\nVerify the installed versions and the selected compute device:\npython -c \u0026#34;import torch, torchvision; print(\u0026#39;torch:\u0026#39;, torch.__version__); print(\u0026#39;torchvision:\u0026#39;, torchvision.__version__); print(\u0026#39;CUDA available:\u0026#39;, torch.cuda.is_available()); print(\u0026#39;device:\u0026#39;, torch.cuda.get_device_name(0) if torch.cuda.is_available() else \u0026#39;CPU\u0026#39;)\u0026#34; For the GPU installation, CUDA available should be True. A CPU-only installation should report False and CPU.\nDownload the Pretrained Models Download the face detection, face parsing, and CodeFormer model files with the repository scripts:\npython scripts/download_pretrained_models.py facelib python scripts/download_pretrained_models.py CodeFormer The files are stored under weights/facelib and weights/CodeFormer. If an automatic download fails, download the files from the official v0.1.0 release and place them in the corresponding directories.\nRestore a Cropped Face Cropped and aligned inputs are resized to 512 × 512 by the inference script. Run:\npython inference_codeformer.py -w 0.5 --has_aligned --input_path \u0026#34;C:/Photos/aligned-face.png\u0026#34; --output_path \u0026#34;C:/Photos/CodeFormer-output\u0026#34; To create aligned faces from a folder of source images, install the optional dlib detector and its model first:\nconda install -y -c conda-forge dlib python scripts/download_pretrained_models.py dlib python scripts/crop_align_face.py -i \u0026#34;C:/Photos/source\u0026#34; -o \u0026#34;C:/Photos/aligned\u0026#34; Then process the complete folder:\npython inference_codeformer.py -w 0.5 --has_aligned --input_path \u0026#34;C:/Photos/aligned\u0026#34; --output_path \u0026#34;C:/Photos/CodeFormer-output\u0026#34; Restore Faces in a Complete Photo CodeFormer can detect and restore faces without preparing them first:\npython inference_codeformer.py -w 0.7 --input_path \u0026#34;C:/Photos/input.jpg\u0026#34; --output_path \u0026#34;C:/Photos/CodeFormer-output\u0026#34; Add Real-ESRGAN when the background and restored faces should also be upscaled:\npython inference_codeformer.py -w 0.7 --bg_upsampler realesrgan --face_upsample --input_path \u0026#34;C:/Photos/input.jpg\u0026#34; --output_path \u0026#34;C:/Photos/CodeFormer-output\u0026#34; Real-ESRGAN uses more memory and is particularly slow on a CPU. Omit --bg_upsampler realesrgan and --face_upsample when only face restoration is needed.\nRestore Faces in a Video Install FFmpeg from Conda and verify that the environment uses it:\nconda install -y -c conda-forge ffmpeg ffmpeg -version Process an MP4, MOV, or AVI file:\npython inference_codeformer.py -w 0.7 --bg_upsampler realesrgan --face_upsample --input_path \u0026#34;C:/Videos/input.mp4\u0026#34; --output_path \u0026#34;C:/Videos/CodeFormer-output\u0026#34; CodeFormer does not require the Python packages named ffmpeg or ffmpeg-python for this command. Installing FFmpeg through Conda avoids conflicts with unrelated packages that use those names.\nChoose the Fidelity Weight The -w value accepts a number from 0 to 1:\nValue Typical effect Lower value Stronger restoration and more invented facial detail Higher value Greater resemblance to the input, with less aggressive restoration Start with 0.5 for an aligned face or 0.7 for a complete photo, then compare several values. Face restoration can generate details that were not present in the source, so do not treat the result as historical or forensic evidence.\nWithout --output_path, results are written below the repository\u0026rsquo;s results directory. With --output_path, they are written to the selected folder.\nOptional Colorization and Inpainting Colorize a cropped and aligned grayscale face:\npython inference_colorization.py --input_path \u0026#34;C:/Photos/aligned-face.png\u0026#34; Run face inpainting on a cropped and aligned image whose damaged area has been painted white:\npython inference_inpainting.py --input_path \u0026#34;C:/Photos/masked-face.png\u0026#34; The repository includes examples in inputs/masked_faces.\nTroubleshooting CUDA Is Not Available Check the driver and the PyTorch build from the activated codeformer environment:\nnvidia-smi conda activate codeformer python -c \u0026#34;import torch; print(torch.__version__); print(torch.version.cuda); print(torch.cuda.is_available())\u0026#34; If the installed PyTorch version contains cpu or CUDA remains unavailable, create a clean environment and install the GPU command from this guide again. Installing a standalone CUDA Toolkit does not convert a CPU-only PyTorch package into a CUDA-enabled package.\nBasicSR Cannot Be Imported Confirm that the prompt is in the cloned repository and rerun the development installation:\ncd CodeFormer python basicsr/setup.py develop python -c \u0026#34;import basicsr; print(basicsr.__file__)\u0026#34; torchvision Import Errors Errors involving removed torchvision modules usually indicate an incompatible torch and torchvision combination. Use the paired versions in this guide and avoid upgrading either package independently.\nNo Input File Is Found The current inference script scans image files ending in JPG, JPEG, or PNG and video files ending in MP4, MOV, or AVI. Quote paths that contain spaces and use an explicit filename or a directory containing supported images.\nGPU Memory Is Exhausted First remove background and face upsampling. If Real-ESRGAN is required, reduce its tile size:\npython inference_codeformer.py -w 0.7 --bg_upsampler realesrgan --face_upsample --bg_tile 200 --input_path \u0026#34;C:/Photos/input.jpg\u0026#34; --output_path \u0026#34;C:/Photos/CodeFormer-output\u0026#34; Process smaller images or individual files if memory errors continue.\nA Model Download Is Corrupted Close the process, remove the incomplete model file from weights/CodeFormer or weights/facelib, and run the corresponding download command again. Avoid loading model files from untrusted mirrors.\nMaintenance and License Activate the environment whenever CodeFormer is used:\nconda activate codeformer cd CodeFormer Record a working environment before changing dependencies:\nconda env export --from-history \u0026gt; environment-history.yml python -m pip freeze \u0026gt; requirements-lock.txt The upstream requirements.txt does not pin most packages, so a future reinstall may resolve different versions. Keep the exported files with your local setup notes.\nCodeFormer is distributed under the NTU S-Lab License 1.0. The license permits redistribution and use for non-commercial purposes under its conditions; commercial redistribution or use requires contacting the contributors. Review the license before publishing or using the software in a commercial service.\nThe project authors identify only their Hugging Face, Replicate, and OpenXLab deployments as official hosted demos. Use the local repository or links published in the official README when handling private photos.\n","date":"2023-01-13T22:09:12-05:00","permalink":"/p/install-and-run-codeformer-on-windows/","title":"Install and Run CodeFormer on Windows"},{"content":"Linux exposes hardware information through firmware tables, sysfs, procfs, device drivers, and management controllers. No single command reports everything, so this guide groups the most useful tools by component.\nOfficial references:\ndmidecode project lscpu manual lsblk manual lspci manual ethtool manual lm-sensors project ipmitool project nvme-cli project Install the Utilities On Ubuntu or Debian, install the common inspection tools:\nsudo apt update sudo apt install -y dmidecode ethtool pciutils usbutils util-linux ipmitool lm-sensors smartmontools nvme-cli lshw On Fedora, RHEL, or Rocky Linux:\nsudo dnf install -y dmidecode ethtool pciutils usbutils util-linux kernel-tools ipmitool lm_sensors smartmontools nvme-cli lshw Some commands are already included in a minimal installation. Package names and availability can differ between distribution releases.\nRecord the System Context Start with the operating system, kernel, architecture, hostname, and virtualization environment:\ncat /etc/os-release uname -a hostnamectl systemd-detect-virt A virtual machine normally reports the hardware and topology presented by its hypervisor. A container usually cannot access host firmware tables, physical storage health, sensors, or the management controller.\nDisplay a concise hardware tree:\nsudo lshw -short Use the sanitized report when the output will be shared. It removes serial numbers, IP addresses, and other potentially sensitive identifiers:\nsudo lshw -sanitize Inspect Firmware and DMI Information dmidecode reads the System Management BIOS tables supplied by the firmware. It reports what the firmware claims, which can be incomplete or incorrect.\nDisplay the complete table:\nsudo dmidecode Limit the output to one DMI type:\nsudo dmidecode --type bios sudo dmidecode --type system sudo dmidecode --type baseboard sudo dmidecode --type chassis sudo dmidecode --type processor sudo dmidecode --type cache sudo dmidecode --type memory Read individual strings for scripts or inventory records:\nsudo dmidecode --string bios-vendor sudo dmidecode --string bios-version sudo dmidecode --string system-manufacturer sudo dmidecode --string system-product-name sudo dmidecode --string system-serial-number Extract common BIOS fields:\nsudo dmidecode --type bios | grep -Ei \u0026#39;Vendor:|Version:|Release Date:\u0026#39; Serial numbers and asset tags can identify a specific machine. Remove them before posting diagnostic output publicly.\nInspect the CPU Display the CPU architecture, model, sockets, cores, threads, NUMA nodes, caches, and virtualization flags:\nlscpu Display one row per logical CPU:\nlscpu --extended=CPU,CORE,SOCKET,NODE,ONLINE,MAXMHZ,MINMHZ Read the kernel\u0026rsquo;s detailed per-CPU report:\ncat /proc/cpuinfo When cpupower is installed, inspect the frequency driver, available governors, limits, and current policy:\ncpupower frequency-info The exact package depends on the distribution. Ubuntu commonly supplies cpupower through linux-tools-common and a matching linux-tools package; Debian uses linux-cpupower, while Fedora and RHEL use kernel-tools.\nChanging the governor affects performance, power use, temperature, and battery life. Check the available governors before selecting one:\ncat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors Temporarily request the performance governor when the active driver supports it:\nsudo cpupower frequency-set --governor performance This setting may be reset at boot or overridden by the CPU frequency driver or a power-management service.\nInspect Memory Display current memory and swap use:\nfree -h Display the physical or virtual memory devices described by the firmware:\nsudo dmidecode --type memory Useful fields include Size, Locator, Type, Speed, Configured Memory Speed, Manufacturer, Part Number, and Serial Number. Virtual machines may report only a synthetic memory device.\nInspect PCI and USB Devices List PCI devices with numeric vendor and device IDs:\nlspci -nn Show the kernel driver assigned to each PCI device and other available modules:\nlspci -nnk Filter the report for wired and wireless network controllers:\nlspci -nnk | grep -Ei -A3 \u0026#39;ethernet|network\u0026#39; Use verbose PCI output only when more detail is needed:\nsudo lspci -vv List USB buses and devices:\nlsusb Display the USB device tree:\nlsusb --tree Inspect Network Adapters Find the interface names and current link state first:\nip -brief link Replace eno1 below with the actual wired interface name. Display the negotiated speed, duplex mode, port type, and link status:\nsudo ethtool eno1 Display the driver, firmware version, and PCI bus address:\nsudo ethtool --driver eno1 Display the permanent hardware address reported by the driver:\nsudo ethtool --show-permaddr eno1 Compare it with the address currently assigned to the interface:\nip link show dev eno1 The current address can differ when NetworkManager, systemd-networkd, a virtual machine, or a privacy feature applies MAC-address randomization.\nInspect Storage Devices Display disks, partitions, filesystems, models, serial numbers, and mount points:\nlsblk --output NAME,PATH,MODEL,SERIAL,SIZE,TYPE,FSTYPE,FSAVAIL,FSUSE%,MOUNTPOINTS Display filesystem UUIDs and labels:\nlsblk --fs Show mounted filesystems backed by real devices:\nfindmnt --real Discover devices supported by smartctl:\nsudo smartctl --scan-open Replace /dev/sda with a device returned by the scan, then display its identity, capabilities, health data, error log, and self-test history:\nsudo smartctl --all /dev/sda For NVMe devices, list the controllers and namespaces:\nsudo nvme list Current nvme-cli versions use this command for the SMART and health log:\nsudo nvme log smart /dev/nvme0 Older distribution packages may use the compatible legacy spelling:\nsudo nvme smart-log /dev/nvme0 A passing SMART status does not replace backups. Watch media errors, critical warnings, available spare, temperature, and rapidly increasing error counts.\nInspect Temperatures, Fans, and Voltages Display sensors already exposed by loaded kernel drivers:\nsensors On a physical machine, run hardware detection once when expected sensors are missing:\nsudo sensors-detect --auto Review the recommended kernel modules, load them as directed, and run sensors again. Do not expect useful motherboard readings inside most virtual machines or containers. Some laptops expose temperature data through ACPI instead of an lm-sensors-supported monitoring chip.\nInspect an IPMI Management Controller IPMI is normally available only on servers with a baseboard management controller. Local access requires a compatible Linux OpenIPMI driver and sufficient privileges.\nDisplay controller, chassis, field-replaceable unit, sensor, and event-log information:\nsudo ipmitool mc info sudo ipmitool chassis status sudo ipmitool fru print sudo ipmitool sensor list sudo ipmitool sdr elist sudo ipmitool sel list IPMI LAN channel numbers vary by vendor and model. Inspect likely channels before using a number in another command:\nsudo ipmitool channel info 1 sudo ipmitool channel info 8 After identifying the LAN channel, display its network settings and user slots. The following examples use channel 1:\nsudo ipmitool lan print 1 sudo ipmitool user list 1 For a remote IPMI 2.0 controller, use lanplus and request an interactive password prompt. Replace the example address and username:\nipmitool -I lanplus -H 192.0.2.10 -U administrator -a mc info Avoid -P password because it places the password in the command line and possibly the shell history or process list.\nOptional: Configure the IPMI Network IPMI network changes are persistent and can disconnect the management controller. Perform them from the server console or another recovery path, confirm the correct channel and user IDs, and record the existing configuration first:\nsudo ipmitool lan print 1 sudo ipmitool user list 1 Replace the documentation addresses below with the reserved management address, subnet mask, and gateway for the server. Apply the commands only after checking for an address conflict:\nsudo ipmitool lan set 1 ipsrc static sudo ipmitool lan set 1 ipaddr 192.0.2.10 sudo ipmitool lan set 1 netmask 255.255.255.0 sudo ipmitool lan set 1 defgw ipaddr 192.0.2.1 sudo ipmitool lan set 1 access on sudo ipmitool lan print 1 To change a known user slot\u0026rsquo;s password without putting the password in the command line, provide only the verified user ID and respond to the prompts. This example uses user ID 2:\nsudo ipmitool user set password 2 Never assume that user ID 2 is the intended administrator. Confirm it with ipmitool user list and verify remote access before ending the console session.\nTroubleshooting DMI Information Is Unavailable dmidecode requires root privileges and readable firmware tables. Containers, some virtual machines, ARM systems, and systems with restricted firmware access may return incomplete data or no supported entry point.\nethtool Reports Unsupported Operations Not every driver implements every ethtool query. Confirm the interface and driver, then use the driver\u0026rsquo;s kernel documentation or vendor utility for unsupported fields:\nip -brief link sudo ethtool --driver eno1 CPU Frequency Information Is Missing The guest hypervisor or active CPU driver may not expose cpufreq data. Identify the environment and driver before changing packages or policies:\nsystemd-detect-virt cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_driver Sensors Are Missing Check which hardware-monitoring modules are loaded and whether sysfs contains sensor devices:\nlsmod | grep -E \u0026#39;coretemp|k10temp|nct|it87\u0026#39; find /sys/class/hwmon -maxdepth 2 -type f -name name -print Sensor labels and scaling depend on the motherboard and driver. Do not treat an unexplained voltage or temperature reading as authoritative until it is matched with the board documentation.\nLocal IPMI Access Fails Check for an IPMI device and load the common local-interface modules when appropriate for the server:\nls -l /dev/ipmi* /dev/ipmi/* 2\u0026gt;/dev/null sudo modprobe ipmi_devintf sudo modprobe ipmi_si sudo ipmitool mc info If the server uses an OEM-specific transport or does not expose a local IPMI interface, use the vendor documentation or a secured remote lanplus connection.\nSave a Diagnostic Snapshot Create a directory with sanitized, read-only reports before a hardware change or support case:\nmkdir -p hardware-report sudo lshw -sanitize \u0026gt; hardware-report/lshw.txt lscpu \u0026gt; hardware-report/lscpu.txt lspci -nnk \u0026gt; hardware-report/lspci.txt lsusb --tree \u0026gt; hardware-report/lsusb.txt lsblk --output NAME,PATH,MODEL,SIZE,TYPE,FSTYPE,MOUNTPOINTS \u0026gt; hardware-report/lsblk.txt sensors \u0026gt; hardware-report/sensors.txt 2\u0026gt;\u0026amp;1 Review every file before sharing it. PCI and USB identifiers are usually harmless, but storage serial numbers, MAC addresses, firmware serial numbers, IPMI addresses, hostnames, and asset tags can identify the system or reveal management-network details.\n","date":"2022-12-21T09:30:12-05:00","permalink":"/p/inspect-hardware-information-on-linux/","title":"Inspect Hardware Information on Linux"},{"content":"Xiaomi Bootloader Unlocking FAQ\nMi Unlock\nAndroid SDK Platform Tools\nBefore You Start This guide applies only to the original Redmi 8A, whose device codename is olivelite. The Redmi 8A Dual uses the codename olivewood and requires different firmware. Flashing a package for another device or region can leave the phone unable to boot.\nConfirm all of the following before continuing:\nThe phone is a Redmi 8A and Fastboot reports olivelite. The ROM package matches the phone\u0026rsquo;s sales region: Global, EEA, India, Indonesia, or China. The battery is adequately charged and the USB cable is reliable. Photos, files, authenticator codes, and other important data are backed up elsewhere. The Xiaomi account credentials and any screen-lock credentials are available. Unlocking and fastboot flashing can erase the entire phone. Xiaomi also warns that unlocking and flashing increase security and device-failure risks and may affect warranty service. Do not continue unless you accept those consequences.\nIf Android still starts and the built-in updater accepts an official recovery package, use the recovery method first. Use the fastboot method to repair a failed installation, change the complete system image, or restore a phone whose updater cannot complete the installation.\nIdentify the Device in Fastboot Install Google\u0026rsquo;s current Platform Tools on Windows, open PowerShell in the extracted platform-tools directory, and start the powered-off phone by holding Volume Down + Power until the Fastboot screen appears. Connect the phone and run:\n.\\fastboot.exe devices .\\fastboot.exe getvar product Continue only when the serial number appears and the product is olivelite. Stop if it reports olivewood, another product, or no product at all.\nChoose and Verify the ROM Download an official MIUI ROM for olivelite and the phone\u0026rsquo;s original region. Xiaomi Firmware Updater maintains a convenient Redmi 8A ROM archive whose package links point to Xiaomi\u0026rsquo;s download servers. Treat it as a third-party index and verify the filename and checksum before using a package.\nThe original article used the following Global build as a reproducible example:\nRecovery: miui_OLIVELITEGlobal_V12.5.2.0.QCPMIXM_1c495cd112_10.0.zip Recovery MD5: 1c495cd112b635935acf00a655e17a06 Fastboot: olivelite_global_images_V12.5.2.0.QCPMIXM_20211025.0000.00_10.0_global_213ef1784d.tgz Fastboot MD5: 213ef1784df9cfc276a00d51b4498ae0 These Global packages are not appropriate for every Redmi 8A. Use a package with the correct regional suffix, such as MIXM for Global, EUXM for EEA, INXM for India, IDXM for Indonesia, or CNXM for China.\nVerify a downloaded file in PowerShell and compare the result with the checksum published beside that exact package:\nGet-FileHash -Algorithm MD5 -LiteralPath \u0026#39;C:\\Users\\YourName\\Downloads\\olivelite_global_images_V12.5.2.0.QCPMIXM_20211025.0000.00_10.0_global_213ef1784d.tgz\u0026#39; Replace the path and filename with the file you downloaded. Do not flash a file whose checksum differs.\nMethod 1: Install a Recovery ROM This method uses Android\u0026rsquo;s built-in updater and normally does not require an unlocked bootloader. It still requires an authentic package that the phone accepts for its model, region, and upgrade path.\nDownload the recovery .zip; do not extract it. Copy the file to the phone\u0026rsquo;s internal storage. Open Settings \u0026gt; About phone \u0026gt; MIUI version. Open the updater menu and select Choose update package if that option is available. Select the recovery .zip and wait while MIUI verifies it. Approve the installation and keep the phone connected to power until it restarts. If MIUI rejects the package, stop. Do not rename the package, edit its metadata, or use a verification bypass. Recheck the device codename, region, installed version, and whether the package is a recovery ROM rather than a fastboot ROM.\nMethod 2: Unlock and Flash a Fastboot ROM The fastboot procedure requires Windows, Xiaomi\u0026rsquo;s Mi Unlock utility, an unlocked bootloader, and MiFlash. Assume that both unlocking and flashing will delete all user data.\nPrepare the Phone and Xiaomi Account Sign in to the Xiaomi account that will be used in Mi Unlock. Open Settings \u0026gt; About phone \u0026gt; MIUI version and tap the MIUI version repeatedly until developer mode is enabled. Open Settings \u0026gt; Additional settings \u0026gt; Developer options. Enable OEM unlocking and USB debugging. Open Mi Unlock status, accept the notice, and select Add account and device while the phone is using mobile data. Keep the Xiaomi account signed in and use the phone normally during any waiting period shown by Xiaomi. The wait is determined by Xiaomi\u0026rsquo;s service. Follow the time displayed by Mi Unlock; do not assume it will always be 168 hours. Resetting the phone, removing the account, or rebinding the device may restart the waiting period.\nUnlock the Bootloader Download and extract Mi Unlock on a Windows PC. Power off the phone, then hold Volume Down + Power to enter Fastboot mode. Connect the phone directly to the PC with a reliable USB cable. Start Mi Unlock and sign in with the same Xiaomi account bound to the phone. Install the Xiaomi USB driver from the tool if the phone is not detected. Select Unlock and accept the data-loss warnings. If Xiaomi displays a waiting period, leave the account bound and repeat the unlock after that period has elapsed. When the tool reports success, restart the phone and complete its initial setup. The unlock operation performs a factory reset. After setup, re-enable developer options and USB debugging if they are needed for the checks below.\nReturn to Fastboot mode and confirm the state:\n.\\fastboot.exe getvar unlocked Continue only when the result shows that the bootloader is unlocked.\nExtract the Fastboot ROM The fastboot package ends in .tgz. Extract it completely; this commonly requires extracting the resulting .tar file a second time. The final folder must contain flash_all.bat, other flash scripts, and an images directory.\nMove the extracted folder to a short local path without special characters, for example:\nC:\\Xiaomi\\olivelite_global_images_V12.5.2.0.QCPMIXM Do not select the parent folder or the images subfolder in MiFlash. Select the folder that directly contains flash_all.bat.\nFlash with MiFlash Obtain MiFlash through Xiaomi\u0026rsquo;s phone flashing support page and install it on Windows. Start XiaoMiFlash.exe as an administrator. Put the phone in Fastboot mode and connect it directly to the PC. Select Refresh and confirm that MiFlash lists the device. Select the extracted fastboot ROM folder. At the bottom of MiFlash, select clean all. Select Flash and do not disconnect the cable until MiFlash reports success. Restart the phone if it does not restart automatically. The first boot can take several minutes. clean all is the safest general choice for a repair installation because it avoids carrying incompatible user data into the restored system. save user data is not a backup and may fail when partitions or Android versions differ.\nAvoid clean all and lock unless the ROM is an unmodified official package for the exact model and original region and you have already confirmed that it boots correctly. Relocking with an incompatible or cross-region image can prevent the phone from starting.\nTroubleshooting Fastboot Does Not Detect the Phone Try another data-capable cable and a direct USB port; avoid hubs. Open Windows Device Manager and reinstall the Google or Xiaomi bootloader driver if the device has a warning icon. Close MiFlash and Mi Unlock before testing with fastboot devices, because only one program should control the interface at a time. Try a USB 2.0 port if an older phone is unreliable on a particular USB 3.x controller. Mi Unlock Cannot Verify the Account Confirm that the same Xiaomi account is signed in on both the phone and Mi Unlock. Bind the account in Mi Unlock status while using mobile data instead of Wi-Fi. Confirm that the SIM is active and the phone\u0026rsquo;s date and time are correct. Follow the server-provided waiting period and avoid repeatedly removing and rebinding the account. MiFlash Reports a Path or File Error Extract the archive completely instead of opening it inside the archive utility. Move the ROM to a short path such as C:\\Xiaomi\\ROM. Select the directory containing flash_all.bat and the images folder. Recheck the archive checksum and download it again if extraction reports an error. The Phone Cannot Enter Fastboot Do not follow unofficial test-point, account-bypass, or Emergency Download authorization workarounds. If the phone cannot enter Fastboot, cannot boot Android, or needs an authorized EDL account, contact an authorized Xiaomi service center. Xiaomi\u0026rsquo;s flashing guidance also warns that an incorrect ROM, rollback, or interrupted flash can leave the phone unusable.\n","date":"2022-12-02T18:32:47-05:00","permalink":"/p/restore-official-miui-firmware-on-the-redmi-8a-olivelite/","title":"Restore Official MIUI Firmware on the Redmi 8A (olivelite)"},{"content":"This guide builds a small single-area OSPFv2 network on two Cisco IOS XE routers. It configures the interfaces, advertises both LANs through area 0, verifies the neighbor relationship, and explains the most common reasons an adjacency fails.\nOfficial references:\nCisco IOS XE OSPF configuration guide Enabling OSPFv2 on an interface Default passive interfaces Troubleshoot OSPF neighbor problems Managing IOS XE configuration files The commands in this article target Cisco IOS and IOS XE. Cisco IOS XR, NX-OS, and ASA use different configuration models or syntax.\nExample Topology The example uses one point-to-point transit link and one LAN on each router:\nRouter Interface IPv4 address Purpose R1 GigabitEthernet0/0/0 10.1.0.1/24 R1 LAN R1 Serial0/0/0 10.0.12.1/30 Link to R2 R2 Serial0/0/0 10.0.12.2/30 Link to R1 R2 GigabitEthernet0/0/0 172.16.2.1/24 R2 LAN Both routers place these interfaces in OSPF area 0. R1 uses router ID 1.1.1.1; R2 uses 2.2.2.2.\nReplace the interface names with those shown by the actual router:\nshow ip interface brief On a production router, review the running configuration and confirm an out-of-band recovery path before changing routing:\nshow running-config show ip route show ip protocols Configure R1 Enter privileged EXEC mode and configure the LAN interface:\nenable configure terminal hostname R1 interface GigabitEthernet0/0/0 description R1 LAN ip address 10.1.0.1 255.255.255.0 no shutdown exit Configure the point-to-point link to R2:\ninterface Serial0/0/0 description OSPF link to R2 ip address 10.0.12.1 255.255.255.252 bandwidth 128 no shutdown exit The bandwidth 128 command records an intended bandwidth of 128 Kbit/s. Routing protocols can use it to calculate a metric, but it does not set the physical serial clock or limit traffic.\nConfigure OSPF process 10:\nrouter ospf 10 router-id 1.1.1.1 passive-interface default no passive-interface Serial0/0/0 network 10.1.0.1 0.0.0.0 area 0 network 10.0.12.1 0.0.0.0 area 0 exit end The host wildcard 0.0.0.0 enables OSPF only on the interface with that exact address. The LAN remains passive, so its prefix is advertised without sending OSPF Hello packets to client devices. The transit interface is active and can form a neighbor relationship.\nConfigure R2 Configure the point-to-point link:\nenable configure terminal hostname R2 interface Serial0/0/0 description OSPF link to R1 ip address 10.0.12.2 255.255.255.252 bandwidth 128 no shutdown exit Configure the R2 LAN:\ninterface GigabitEthernet0/0/0 description R2 LAN ip address 172.16.2.1 255.255.255.0 no shutdown exit Configure OSPF with a different router ID:\nrouter ospf 10 router-id 2.2.2.2 passive-interface default no passive-interface Serial0/0/0 network 10.0.12.2 0.0.0.0 area 0 network 172.16.2.1 0.0.0.0 area 0 exit end The OSPF process ID is locally significant and does not have to match between routers. Matching it in a small example makes the configuration easier to compare. The area number, subnet, Hello and Dead timers, authentication settings, and compatible network type must agree across the transit link.\nConfigure a Lab Serial Clock When Required Physical serial links and some network simulators require a clock on the DCE end. Identify the cable role:\nshow controllers Serial0/0/0 If the local interface is the DCE end and the platform requires a clock, configure it there only:\nconfigure terminal interface Serial0/0/0 clock rate 128000 end The clock rate 128000 command sets the lab serial clock to 128,000 bit/s. It is different from bandwidth 128, which supplies a metric reference in Kbit/s.\nVerify Interface Status Run these commands on both routers:\nshow ip interface brief show interfaces Serial0/0/0 show interfaces Serial0/0/0 | include line protocol|Internet address|BW The transit interfaces should be up/up, use addresses from 10.0.12.0/30, and report the intended bandwidth. If the interface is administratively down, apply no shutdown. If its line protocol is down, inspect the cable, clock, encapsulation, and remote interface.\nTest direct connectivity before troubleshooting OSPF:\nOn R1:\nping 10.0.12.2 source 10.0.12.1 On R2:\nping 10.0.12.1 source 10.0.12.2 Verify OSPF Display the active routing protocols and confirm the process, router ID, networks, and passive interfaces:\nshow ip protocols show ip ospf show running-config | section router ospf Display the OSPF-enabled interfaces and inspect the transit link in detail:\nshow ip ospf interface brief show ip ospf interface Serial0/0/0 Check the neighbor table:\nshow ip ospf neighbor On a point-to-point link, the neighbor should reach the FULL state. R1 should see router ID 2.2.2.2; R2 should see 1.1.1.1.\nDisplay only OSPF-learned routes:\nshow ip route ospf R1 should learn the R2 LAN:\nshow ip route 172.16.2.0 R2 should learn the R1 LAN:\nshow ip route 10.1.0.0 Test routed connectivity with a source address from the local LAN:\nOn R1:\nping 172.16.2.1 source 10.1.0.1 On R2:\nping 10.1.0.1 source 172.16.2.1 Understand the Network Statements In IOS XE OSPFv2, a network statement selects local interfaces whose addresses match the address and wildcard mask. It does not directly advertise an arbitrary remote network.\nThis exact match selects only the interface using 10.0.12.1:\nnetwork 10.0.12.1 0.0.0.0 area 0 A subnet-wide match for 10.1.0.0/24 would use:\nnetwork 10.1.0.0 0.0.0.255 area 0 Broad wildcard masks can unintentionally enable OSPF on additional interfaces. Use an exact interface address when that behavior is not required.\nIOS XE can alternatively enable OSPF directly under an interface:\nconfigure terminal interface Serial0/0/0 ip ospf 10 area 0 end The interface command is an alternative to matching that interface with a router-level network statement. Use one clear method consistently in a small configuration.\nUnderstand OSPF Cost and Bandwidth Display the bandwidth and calculated OSPF cost:\nshow interfaces Serial0/0/0 | include BW show ip ospf interface Serial0/0/0 | include Cost OSPF calculates interface cost from the OSPF reference bandwidth and the interface bandwidth. For high-speed networks, configure a consistent reference bandwidth on every OSPF router so that faster links receive distinct costs:\nconfigure terminal router ospf 10 auto-cost reference-bandwidth 100000 end The value is in Mbit/s; 100000 represents 100 Gbit/s. Choose a value appropriate for the fastest link in the network and apply it consistently to every OSPF router. Changing it can change route selection.\nWhen a design requires a fixed metric for one interface, configure an explicit cost instead of changing its documented bandwidth:\nconfigure terminal interface Serial0/0/0 ip ospf cost 100 end Save the Configuration Review the active changes before saving:\nshow running-config | section interface GigabitEthernet0/0/0 show running-config | section interface Serial0/0/0 show running-config | section router ospf Save the running configuration to startup configuration on each router:\ncopy running-config startup-config Confirm the destination filename when prompted.\nTroubleshoot an OSPF Adjacency No Neighbor Appears Check Layer 1, Layer 2, addressing, reachability, OSPF activation, and passive-interface status:\nshow ip interface brief show interfaces Serial0/0/0 show ip ospf interface Serial0/0/0 show ip protocols show running-config | section router ospf ping 10.0.12.2 source 10.0.12.1 Confirm that:\nBoth interfaces are up/up and use the same IP subnet and mask. OSPF is enabled on both transit interfaces in the same area. Serial0/0/0 is excluded from passive-interface default on both routers. An access control list or firewall is not blocking IP protocol 89 or the OSPF multicast addresses. Each router has a unique router ID. The Neighbor Stays in INIT An INIT state means the router receives a neighbor\u0026rsquo;s Hello packets but does not see its own router ID returned in them. Check one-way connectivity, access control lists, link wiring, and the remote OSPF configuration.\nshow ip ospf neighbor show access-lists show cdp neighbors detail The Neighbor Stays in EXSTART or EXCHANGE An MTU mismatch is a common cause. Compare both ends:\nshow interfaces Serial0/0/0 | include MTU show ip ospf interface Serial0/0/0 Correct the underlying MTU inconsistency when possible. Do not hide it with ip ospf mtu-ignore until the effect on the network has been evaluated.\nHello or Dead Timers Do Not Match Compare the detailed OSPF interface output on both routers:\nshow ip ospf interface Serial0/0/0 Restore matching timers unless the network design intentionally uses non-default values. Also check that both ends use a compatible OSPF network type and authentication configuration.\nThe Router ID Is Wrong or Duplicated Display the router ID:\nshow ip ospf Configure a unique stable ID under the OSPF process. If the process is already running, the new ID normally takes effect after the OSPF process restarts:\nconfigure terminal router ospf 10 router-id 1.1.1.1 end The following command resets OSPF adjacencies and temporarily removes learned OSPF routes, so use it only during an approved change window:\nclear ip ospf process A Prefix Is Missing Check whether the local interface is up, whether its address matches an OSPF network statement, and whether the route is present in the OSPF database and remote routing table:\nshow ip interface brief show ip protocols show ip ospf database show ip route ospf show ip route 172.16.2.0 A passive interface still advertises its connected prefix when OSPF is enabled on that interface; it simply stops sending and receiving OSPF Hello packets there.\nUse Debugging Only When Necessary Debug output can be noisy and affect a busy router. Use it briefly from a controlled console session, then disable all debugging:\nterminal monitor debug ip ospf adj undebug all Collect the show-command output first. In most cases, interface state, IP reachability, area, timers, authentication, network type, MTU, passive-interface state, and router IDs identify the problem without debugging.\n","date":"2022-10-21T22:53:54-04:00","permalink":"/p/configure-and-troubleshoot-ospfv2-on-cisco-ios-xe/","title":"Configure and Troubleshoot OSPFv2 on Cisco IOS XE"},{"content":"This guide covers a practical initial configuration for a Cisco router running IOS or IOS XE. It configures a hostname, local administrator, SSH access, console security, Ethernet and serial interfaces, a loopback interface, configuration persistence, and an optional RIPv2 lab.\nOfficial references:\nBasic router configuration for Cisco IOS XE Configure SSH on Cisco routers Managing IOS XE configuration files Cisco IOS RIP command reference Commands and available features vary by platform, license, and software release. Check the device documentation and test remote access before closing the console session.\nUnderstand the Configuration Files IOS XE applies most commands to the running configuration immediately. The startup configuration is the saved copy loaded at boot. Unsaved running changes are lost after a reload.\nDisplay both configurations:\nshow running-config show startup-config Save the active configuration with the precise filesystem form:\ncopy system:running-config nvram:startup-config This commonly used alias performs the same operation on most routers:\ncopy running-config startup-config The names contain hyphens. copy running_config startup-config is not valid IOS XE syntax.\nInspect the Router Before Changing It Record the model, software version, interfaces, routes, and current management configuration:\nshow version show inventory show ip interface brief show interfaces description show ip route show ip protocols show running-config | section line show running-config | include ^username show running-config | include hostname|enable secret|ip domain On a production router, save an external backup and confirm console or out-of-band access before changing authentication, addressing, or routing.\nEnter Configuration Mode Enter privileged EXEC mode, then global configuration mode:\nenable configure terminal Use end to return directly to privileged EXEC mode. Use exit to move back one configuration level.\nConfigure the Device Identity Set a descriptive hostname and a domain name. SSH key generation requires both on common IOS and IOS XE platforms:\nhostname R1 ip domain name example.net Replace example.net with an internal domain assigned to the organization.\nConfigure a legal notice with a delimiter that does not appear in the message:\nbanner motd ^CUnauthorized access to this device is prohibited.^C The delimiter characters are not displayed to users.\nConfigure Local Credentials Replace both example secret strings before entering these commands. Use different, randomly generated values and store them in an approved password manager:\nsecurity passwords min-length 12 username netadmin privilege 15 secret REPLACE_WITH_A_UNIQUE_ADMIN_SECRET enable secret REPLACE_WITH_A_DIFFERENT_ENABLE_SECRET The secret keyword stores a one-way password verifier supported by the platform. Avoid the older password form for administrator credentials.\nOptionally obscure any remaining clear-text line or protocol passwords in the configuration:\nservice password-encryption This command commonly produces reversible type 7 values. It prevents casual viewing but does not provide strong password storage and does not encrypt credentials in transit. Use secret credentials and SSH for management access.\nSlow repeated login attempts:\nlogin block-for 180 attempts 3 within 60 login delay 2 Confirm that the emergency access procedure is documented before enabling login blocking on a remotely managed production device.\nConfigure Secure Console Access Use the local administrator database for console login and disconnect idle sessions after ten minutes:\nline console 0 login local exec-timeout 10 0 logging synchronous exit Keep the console session open until a second login has been tested. A credential or authorization mistake can otherwise lock administrators out.\nConfigure SSH Management Enable SSHv2 and generate an RSA host key. Cisco recommends the largest modulus supported by the platform and the organization\u0026rsquo;s security policy; the example uses 4096 bits:\nip ssh version 2 ip ssh time-out 60 ip ssh authentication-retries 3 crypto key generate rsa general-keys modulus 4096 Older or resource-constrained lab devices may support a smaller maximum. Use at least 2048 bits when the platform permits it.\nConfigure all available VTY lines to authenticate against the local user database and accept SSH only:\nline vty 0 15 login local transport input ssh exec-timeout 10 0 exit Some platforms expose only VTY lines 0 4. Check the existing line ranges and configure every VTY line supported by the device:\nshow running-config | section line vty Verify the SSH server configuration:\nend show ip ssh show crypto key mypubkey rsa show users From a management workstation with IP connectivity, test SSH in a second terminal before ending the console session:\nssh netadmin@192.168.1.1 For a production deployment, restrict VTY access to trusted management networks with an access class or a control-plane policy after confirming the correct source addresses. Use centralized AAA where the organization provides TACACS+ or RADIUS.\nConfigure the LAN Interface Discover the actual interface names first:\nshow ip interface brief The following example assigns 192.168.1.1/24 to GigabitEthernet0/0/0:\nconfigure terminal interface GigabitEthernet0/0/0 description Link to LAN1 ip address 192.168.1.1 255.255.255.0 no shutdown exit end Verify the interface and connected route:\nshow ip interface brief show interfaces GigabitEthernet0/0/0 show ip route connected The interface should report up/up. An administratively down interface needs no shutdown; an interface that is up with line protocol down usually has a Layer 1 or Layer 2 problem.\nConfigure a Loopback Interface A /32 loopback provides a stable management, monitoring, or routing-protocol identifier when the design routes it correctly:\nconfigure terminal interface Loopback0 description Router identifier ip address 10.0.0.1 255.255.255.255 exit end Verify it:\nshow ip interface brief | include Loopback0 show ip route 10.0.0.1 A loopback address is not reachable from other networks until a connected, static, or dynamic route advertises it.\nConfigure a Serial Interface The following example uses 192.168.2.0/30 for a point-to-point connection:\nconfigure terminal interface Serial0/0/0 description Link to R2 ip address 192.168.2.1 255.255.255.252 bandwidth 64 no shutdown exit end The bandwidth 64 value is in Kbit/s. It supplies information to routing protocols and management tools; it does not configure the physical bit rate or shape traffic.\nConfigure the DCE Clock When Required Check whether the local end supplies the serial clock:\nshow controllers Serial0/0/0 Configure clock rate only on the DCE end when required by the physical interface or network simulator:\nconfigure terminal interface Serial0/0/0 clock rate 64000 end Do not configure a clock rate on the DTE end. Valid rates depend on the platform and serial hardware.\nVerify the serial interface:\nshow ip interface brief show interfaces Serial0/0/0 show interfaces Serial0/0/0 | include line protocol|Internet address|MTU|BW Both physical status and line protocol should be up. If line protocol remains down, compare encapsulation, clocking, addressing, cabling, and the remote interface.\nOptional: Configure RIPv2 for a Lab RIP is a legacy distance-vector protocol with slow convergence and a 15-hop limit. Use OSPF, IS-IS, EIGRP, or another protocol chosen by the network design for new production deployments. This section preserves the original RIPv2 example for a small lab.\nOn R1, advertise the LAN and serial major networks. Keep the user-facing LAN passive while allowing updates on the link to R2:\nconfigure terminal router rip version 2 no auto-summary passive-interface default no passive-interface Serial0/0/0 network 192.168.1.0 network 192.168.2.0 exit end The command is router rip, not route rip. RIP network statements use classful major-network syntax to select participating interfaces. no auto-summary prevents automatic summarization when routes cross classful boundaries.\nFor a matching R2 lab, use 192.168.2.2/30 on its serial interface and 172.16.2.1/24 on its LAN interface, then configure:\nconfigure terminal router rip version 2 no auto-summary passive-interface default no passive-interface Serial0/0/0 network 192.168.2.0 network 172.16.0.0 exit end Verify the protocol, RIP database, and learned routes:\nshow ip protocols show ip rip database show ip route rip show ip route 172.16.2.0 Test the transit link and remote LAN interface from R1:\nping 192.168.2.2 source 192.168.2.1 ping 172.16.2.1 source 192.168.1.1 If no RIP route appears, confirm that the interfaces are up/up, the directly connected addresses and masks match, RIPv2 is enabled on both routers, the serial interface is not passive, and UDP port 520 is not filtered.\nFilter Configuration Output IOS and IOS XE output modifiers make large configurations easier to inspect.\nShow every line matching a regular expression:\nshow running-config | include hostname|username|enable secret Hide matching lines:\nshow running-config | exclude ^! Start at the first matching line and display the rest:\nshow running-config | begin line console 0 Display a configuration section:\nshow running-config | section router rip show running-config | section interface Serial0/0/0 The valid keywords are include, exclude, begin, and section.\nUse Command History Increase the history size for the current terminal session and display its contents:\nterminal history size 300 show history Use the Up and Down arrow keys to recall commands. Avoid copying secrets into shared terminal transcripts or support logs.\nVerify and Save the Configuration Review the important sections and operational state:\nshow running-config | include hostname|username|enable secret|ip domain show running-config | section line console show running-config | section line vty show running-config | section interface show ip interface brief show ip route show ip protocols show ip ssh Test console or SSH access, interface reachability, and routing before saving. Then write the running configuration to the startup configuration:\ncopy system:running-config nvram:startup-config Press Enter to accept the default destination filename when prompted, then confirm the saved file:\nshow startup-config Create an external backup using an approved secure transfer method. When SCP is configured and supported, IOS XE can copy the configuration to an SCP server:\ncopy system:running-config scp: Follow the prompts for the server, username, and destination filename. Protect backups because they can contain usernames, hashes, addresses, keys, and topology details.\nErase the Configuration and Reload Erasing the startup configuration is destructive and cannot be undone unless a backup exists. It does not remove the active running configuration until the router reloads.\nConfirm the correct device, save an external backup, and make sure console access is available. Then erase the startup configuration:\nerase nvram:startup-config Some platforms also accept:\nerase startup-config Verify that the startup configuration is absent, then reload only when the reset is intentional:\nshow startup-config reload When asked whether to save the modified configuration during this reset procedure, saving it would recreate a startup configuration. Read every prompt before responding. A router that boots without a startup configuration normally enters the initial setup dialog.\nTroubleshooting SSH Does Not Start Verify the hostname, domain name, RSA keys, SSH version, local username, and VTY lines:\nshow running-config | include hostname|ip domain|username show crypto key mypubkey rsa show ip ssh show running-config | section line vty Generate a supported RSA key after configuring the hostname and domain name. Ensure that login local and transport input ssh apply to every VTY line.\nThe LAN Cannot Reach the Router Check status, addressing, ARP, and the connected route:\nshow ip interface brief show interfaces GigabitEthernet0/0/0 show arp show ip route connected Confirm the client uses an address from 192.168.1.0/24 and the correct mask. Use 192.168.1.1 as the default gateway only when that matches the network design.\nThe Serial Link Is Down Inspect both ends of the link:\nshow controllers Serial0/0/0 show interfaces Serial0/0/0 show running-config | section interface Serial0/0/0 Confirm no shutdown, compatible encapsulation, the same subnet and mask, a clock on the DCE end when required, and working cabling or simulator links.\nChanges Disappear After Reload Compare the running and startup configurations. If the intended running configuration is correct, save it:\nshow running-config show startup-config copy system:running-config nvram:startup-config ","date":"2022-10-12T22:42:51-04:00","permalink":"/p/configure-a-cisco-ios-xe-router-from-the-cli/","title":"Configure a Cisco IOS XE Router from the CLI"},{"content":"This guide configures a Cisco Catalyst switch running IOS or IOS XE as a Layer 2 access switch. It adds secure management access, a dedicated management VLAN, data VLANs, access ports, a static trunk, spanning-tree edge protection, and an unused-port policy.\nOfficial references:\nCisco IOS XE VLAN configuration Cisco IOS XE VLAN trunk configuration Cisco switch virtual interfaces Configure SSH on Cisco devices Cisco PortFast and BPDU Guard Reset Catalyst switches to factory defaults Interface names, supported commands, VTY ranges, and file locations vary by switch model and software release. Review the platform documentation and keep console access until remote management has been tested.\nExample Design The example uses these VLANs and ports on a 24-port access switch:\nVLAN Name Purpose 10 USERS User access ports Gi1/0/1-16 20 SERVERS Server access ports Gi1/0/17-20 99 MANAGEMENT Switch management SVI 999 UNUSED Administratively disabled ports The switch management address is 192.168.99.2/24, and its Layer 2 management default gateway is 192.168.99.1. Port Gi1/0/24 is a static trunk carrying VLANs 10, 20, and 99 to the upstream switch or router.\nReplace the interface ranges, addresses, VLAN IDs, and uplink with values from the approved network design.\nInspect the Existing Switch Record the model, software, stack members, interfaces, VLANs, trunks, spanning-tree state, and current management configuration:\nshow version show inventory show switch show interfaces status show ip interface brief show vlan brief show interfaces trunk show spanning-tree summary show running-config | section line show running-config | include ^hostname|^username|^enable secret|^ip domain|^ip default-gateway|^ip routing The show switch command applies to supported stackable models and can be unavailable on a standalone switch. On a production switch, save an external backup and confirm console or out-of-band access before changing management, VLAN, trunk, or authentication settings.\nUnderstand Running and Startup Configuration Most IOS XE commands change the running configuration immediately. The startup configuration is the saved copy loaded after a reboot.\nDisplay both files:\nshow running-config show startup-config Save the running configuration:\ncopy system:running-config nvram:startup-config This common alias normally performs the same operation:\ncopy running-config startup-config The valid name is running-config, with a hyphen. running_config is not valid IOS or IOS XE syntax.\nConfigure the Switch Identity Enter privileged EXEC and global configuration modes:\nenable configure terminal Set the hostname and internal domain name. Common IOS and IOS XE platforms require both before generating an SSH host key:\nhostname SW1 ip domain name example.net banner motd ^CUnauthorized access to this device is prohibited.^C Replace example.net with the assigned internal domain. The ^C characters delimit the banner and are not displayed to users.\nConfigure Local Credentials Replace both example values with different, randomly generated secrets before entering the commands:\nsecurity passwords min-length 12 username netadmin privilege 15 secret REPLACE_WITH_A_UNIQUE_ADMIN_SECRET enable secret REPLACE_WITH_A_DIFFERENT_ENABLE_SECRET login block-for 180 attempts 3 within 60 login delay 2 The secret form stores a one-way verifier supported by the platform. Avoid shared line passwords and the older clear-text password form for administrator access.\nThe optional command below obscures remaining clear-text line or protocol passwords in the configuration:\nservice password-encryption This commonly creates reversible type 7 values. It prevents casual viewing but does not provide strong password storage or encrypt traffic. Use secret credentials and SSH.\nConfigure Console and SSH Access Use the local account for console access and close an idle console session after ten minutes:\nline console 0 login local exec-timeout 10 0 logging synchronous exit Enable SSHv2 and generate an RSA host key. The example uses 4096 bits; use the largest size supported by the platform and security policy, with at least 2048 bits when supported:\nip ssh version 2 ip ssh time-out 60 ip ssh authentication-retries 3 crypto key generate rsa general-keys modulus 4096 Configure every VTY line to use the local account and accept SSH only:\nline vty 0 15 login local transport input ssh exec-timeout 10 0 exit Some switches provide only VTY lines 0 4. Check the device and configure every available line:\nshow running-config | section line vty If the switch web interface is not part of the management design, disable both HTTP services:\nno ip http server no ip http secure-server Do not close the console session until SSH has been tested through the management network.\nCreate the VLANs Create the user, server, management, and unused-port VLANs:\nvlan 10 name USERS exit vlan 20 name SERVERS exit vlan 99 name MANAGEMENT exit vlan 999 name UNUSED exit Verify the VLAN database:\nend show vlan brief A dedicated management VLAN makes addressing and policy easier to operate, but it is not a security boundary by itself. Restrict it at the upstream router, firewall, management VRF, or control plane according to the network design.\nConfigure the Management SVI Create a switch virtual interface for VLAN 99 and assign its management address:\nconfigure terminal interface Vlan99 description Management SVI ip address 192.168.99.2 255.255.255.0 no shutdown exit For a Layer 2 switch with IP routing disabled, configure the next-hop router in the same subnet:\nip default-gateway 192.168.99.1 Do not disable IP routing blindly on a multilayer switch already providing routed services. First check the intended role and current setting:\nshow running-config | include ^ip routing|^ip default-gateway show ip route When ip routing is enabled on a Layer 3 switch, use a route instead of ip default-gateway, for example:\nip route 0.0.0.0 0.0.0.0 192.168.99.1 Use only the model that matches the approved Layer 2 or Layer 3 design.\nAn SVI generally reaches up/up only when its VLAN exists and at least one Layer 2 access or trunk port carrying that VLAN is physically up and forwarding for spanning tree. The management SVI may remain down until the uplink is configured and connected.\nConfigure User Access Ports Assign ports Gi1/0/1-16 to VLAN 10. Enable PortFast and BPDU Guard because these ports are intended for individual end devices:\ninterface range GigabitEthernet1/0/1-16 description User access ports switchport mode access switchport access vlan 10 spanning-tree portfast spanning-tree bpduguard enable no shutdown exit PortFast skips the normal spanning-tree forwarding delay. BPDU Guard places the port in an error-disabled state if it receives a bridge protocol data unit. Apply both only to edge ports connected to end devices, never to links between switches, bridges, or other Layer 2 infrastructure.\nConfigure Server Access Ports Assign ports Gi1/0/17-20 to VLAN 20:\ninterface range GigabitEthernet1/0/17-20 description Server access ports switchport mode access switchport access vlan 20 spanning-tree portfast spanning-tree bpduguard enable no shutdown exit Do not use PortFast when a server runs a bridge, hypervisor virtual switch, or appliance that can forward Layer 2 frames unless the design has evaluated the loop risk.\nDisable Unused Ports Move unused ports to an isolated VLAN and shut them down. This example uses ports Gi1/0/21-23:\ninterface range GigabitEthernet1/0/21-23 description UNUSED - administratively disabled switchport mode access switchport access vlan 999 shutdown exit The unused VLAN should not have an SVI or be allowed on trunks unless the design has a specific reason.\nConfigure the Uplink Trunk Configure Gi1/0/24 as a static trunk and limit it to the VLANs required by this switch:\ninterface GigabitEthernet1/0/24 description Uplink to distribution switch switchport mode trunk switchport trunk allowed vlan 10,20,99 switchport nonegotiate no shutdown exit end switchport nonegotiate stops Dynamic Trunking Protocol frames. Use it when the neighboring interface is also configured statically. Some platforms or interface types do not support this command.\nDo not enable PortFast or edge BPDU Guard on this switch-to-switch uplink. Configure the same allowed VLANs and a compatible native VLAN on both ends. A mismatch can interrupt connectivity or create untagged-VLAN problems.\nVerify the trunk and the per-interface switchport state:\nshow interfaces trunk show interfaces GigabitEthernet1/0/24 switchport Verify the Switch Check the VLAN membership, ports, trunk, SVI, spanning tree, and MAC-address learning:\nshow vlan brief show interfaces status show interfaces trunk show ip interface brief show spanning-tree summary show spanning-tree vlan 10,20,99 show mac address-table dynamic The expected state is:\nUser ports belong to VLAN 10. Server ports belong to VLAN 20. Unused ports belong to VLAN 999 and are disabled. The uplink trunks VLANs 10, 20, and 99. Vlan99 is up/up after an active forwarding port carries VLAN 99. Test the management gateway:\nping 192.168.99.1 source 192.168.99.2 From an authorized management workstation, test SSH in a second session:\nssh netadmin@192.168.99.2 Verify the SSH server and active users on the switch:\nshow ip ssh show ssh show users Inspect Individual Ports Display one interface\u0026rsquo;s physical state, errors, VLAN mode, and learned MAC addresses:\nshow interfaces GigabitEthernet1/0/1 show interfaces GigabitEthernet1/0/1 counters errors show interfaces GigabitEthernet1/0/1 switchport show mac address-table interface GigabitEthernet1/0/1 Check discovery information when CDP or LLDP is enabled by policy:\nshow cdp neighbors detail show lldp neighbors detail Save and Back Up the Configuration Review the management, VLAN, interface, and line configuration before saving:\nshow running-config | section interface Vlan99 show running-config | section interface GigabitEthernet1/0/24 show running-config | section line console show running-config | section line vty show vlan brief show interfaces trunk Save the running configuration:\ncopy system:running-config nvram:startup-config Press Enter to accept the default destination filename when prompted, then verify the startup configuration:\nshow startup-config When SCP is configured and permitted, create an external backup:\ncopy system:running-config scp: Protect configuration backups because they can contain usernames, password verifiers, addresses, keys, VLANs, and topology details.\nTroubleshooting The Management SVI Is Down Check that VLAN 99 exists, the SVI is enabled, and at least one active access or trunk port carries the VLAN in spanning-tree forwarding state:\nshow vlan id 99 show ip interface brief | include Vlan99 show interfaces trunk show spanning-tree vlan 99 show interfaces status An administratively down SVI needs no shutdown. A line-protocol-down SVI usually has no active forwarding member port in that VLAN.\nThe Switch Cannot Reach Another Subnet For a Layer 2 switch, verify the management address, mask, and default gateway:\nshow running-config | section interface Vlan99 show running-config | include ^ip default-gateway|^ip routing show arp ping 192.168.99.1 source 192.168.99.2 If ip routing is enabled, inspect the routing table and configure the appropriate static or dynamic route instead of relying on ip default-gateway:\nshow ip route A VLAN Does Not Cross the Uplink Compare both ends of the trunk:\nshow interfaces trunk show interfaces GigabitEthernet1/0/24 switchport show vlan brief show spanning-tree vlan 10 Confirm that the VLAN exists, is allowed on both ends, is not suspended, and uses a matching native VLAN. Also verify that spanning tree is forwarding on the expected path.\nAn Access Port Is Error-Disabled Check the reason and logs before re-enabling the port:\nshow interfaces status err-disabled show errdisable recovery show logging | include ERR_DISABLE|BPDUGUARD If BPDU Guard disabled the port, remove the connected bridge or correct the port role first. Then recover it manually:\nconfigure terminal interface GigabitEthernet1/0/1 shutdown no shutdown end Do not disable BPDU Guard simply to hide an unexpected BPDU on an end-device port.\nSSH Does Not Start Verify the hostname, domain, local user, RSA key, SSH version, VTY authentication, and management reachability:\nshow running-config | include ^hostname|^ip domain|^username show crypto key mypubkey rsa show ip ssh show running-config | section line vty show ip interface brief | include Vlan99 Generate a supported RSA key only after configuring the hostname and domain name. Ensure that every VTY line uses login local and transport input ssh.\nErase the Switch and VLAN Configuration Factory reset is destructive. It removes management access, interface settings, local users, VLANs, and other saved configuration. Save an external backup and use a console connection before proceeding.\nLocate the startup configuration and VLAN database because storage paths vary by platform and stack member:\nshow file systems dir nvram: dir flash: | include vlan.dat show startup-config Erase the startup configuration:\nerase nvram:startup-config This common alias is also supported on many Catalyst switches:\nerase startup-config When the platform stores VLAN information separately, delete the identified VLAN database file:\ndelete flash:vlan.dat Confirm the deletion prompts and verify that the exact path is correct. Stack members or older modular switches can store the file on a different filesystem.\nReload the switch only when the reset is intentional:\nreload When prompted to save the modified running configuration during this reset procedure, saving would recreate a startup configuration. Read every prompt before responding. After the reload, the switch normally starts with default settings or the initial setup dialog.\n","date":"2022-10-03T22:35:32-04:00","permalink":"/p/configure-a-cisco-ios-xe-layer-2-switch/","title":"Configure a Cisco IOS XE Layer 2 Switch"},{"content":"Any luck?\tIt\u0026rsquo;s slow.\nHow did you make it out there?\tIt\u0026rsquo;s\u0026rsquo; so so.\tIt\u0026rsquo;s ok.\tI caught a few.\nbig\u0026rsquo;un\tbig mama\ttrophy\tfish of a life time\tmonster\tpig / hawg\nJigheads Drop Shot Rig Carolina Spinnerbait Splitshort rig ","date":"2022-09-03T07:40:11-05:00","permalink":"/p/fishing-near-montreal/","title":"Fishing Near Montreal"},{"content":"Blockscout\nGitHub\nLegacy Manual Deployment\nUbuntu 18.04 LTS — Legacy Installation Install the Blockscout backend and its bundled legacy interface from source, then manage the application with systemd.\nThis is a revision of the original Ubuntu 18.04 installation notes, pinned to v4.1.8-beta. It is an archival guide for an existing private network. The legacy UI is deprecated; use the current deployment guide for a new installation. Do not apply these commands to the current master branch.\nThe configuration was checked against the tagged source. A complete installation has not been run for this revision; old package repositories and dependency downloads may require maintenance.\nEnvironment Component Version or example value Operating system Ubuntu 18.04.6 LTS, x86_64 Blockscout v4.1.8-beta Erlang/OTP 24.3.4.1 Elixir 1.13.4-otp-24 Node.js 16.16.0, with npm 8.x PostgreSQL 10.x from the original Ubuntu environment Explorer host 192.168.77.64 Geth-compatible node 192.168.77.70 Database Local to the explorer host, 127.0.0.1:5432 Native coin symbol NBAI The Erlang, Elixir, and Node.js versions match the release\u0026rsquo;s .tool-versions. Replace the example IP addresses and coin symbol with your network settings. This old stack is not a current production baseline.\nInstall Build Dependencies Run the administration commands from your regular sudo-enabled account.\nsudo apt update sudo apt install -y build-essential autoconf automake libtool libncurses5-dev libssl-dev libgmp-dev inotify-tools git curl ca-certificates unzip xz-utils python3 openssl postgresql postgresql-contrib sudo systemctl enable --now postgresql sudo -u postgres psql -c \u0026#39;SELECT version();\u0026#39; Create the Service Account Use the same account and directory for downloading, building, and running Blockscout.\nsudo adduser --system --group --home /opt/blockscout --shell /bin/bash blockscout sudo install -d -o blockscout -g blockscout -m 0750 /opt/blockscout Configure PostgreSQL Create the database as its owner. Enter a new database password when prompted; use a randomly generated hexadecimal password to avoid URL-encoding issues in DATABASE_URL.\nopenssl rand -hex 32 sudo -u postgres createuser --pwprompt blockscout sudo -u postgres createdb --owner=blockscout blockscout psql -h 127.0.0.1 -U blockscout -d blockscout -W -c \u0026#39;SELECT current_database();\u0026#39; The last command must succeed before continuing. This procedure uses a fresh local database, so PostgreSQL does not need a public listening address. If the role or database already exists, inspect it instead of recreating it.\nFor a separate database server, use its address consistently in DATABASE_URL, allow the explorer host in pg_hba.conf, configure listen_addresses, and verify the connection from the explorer host. Configure PostgreSQL TLS before enabling ECTO_USE_SSL=true for that connection.\nCheck the Blockchain Node The node must provide historical data and the tracing methods required by this Blockscout release. A successful eth_blockNumber request alone does not establish tracing or archive-data support. Check the client requirements for your node.\ncurl --fail --silent --show-error http://192.168.77.70:8545 -H \u0026#39;Content-Type: application/json\u0026#39; --data \u0026#39;{\u0026#34;jsonrpc\u0026#34;:\u0026#34;2.0\u0026#34;,\u0026#34;method\u0026#34;:\u0026#34;eth_blockNumber\u0026#34;,\u0026#34;params\u0026#34;:[],\u0026#34;id\u0026#34;:1}\u0026#39; curl --fail --silent --show-error http://192.168.77.70:8545 -H \u0026#39;Content-Type: application/json\u0026#39; --data \u0026#39;{\u0026#34;jsonrpc\u0026#34;:\u0026#34;2.0\u0026#34;,\u0026#34;method\u0026#34;:\u0026#34;eth_syncing\u0026#34;,\u0026#34;params\u0026#34;:[],\u0026#34;id\u0026#34;:2}\u0026#39; Check the JSON response for an RPC error. The block number should be returned as a hexadecimal value; eth_syncing normally returns false after synchronization. Permit RPC access from the explorer host on the private network.\nInstall the Versioned Toolchain Switch to the service account. The following commands, through the build section, run as blockscout.\nsudo -iu blockscout git clone --branch v0.10.2 --depth 1 https://github.com/asdf-vm/asdf.git \u0026#34;$HOME/.asdf\u0026#34; . \u0026#34;$HOME/.asdf/asdf.sh\u0026#34; asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git asdf plugin add elixir https://github.com/asdf-vm/asdf-elixir.git asdf plugin add nodejs https://github.com/asdf-vm/asdf-nodejs.git git clone --branch v4.1.8-beta --depth 1 https://github.com/blockscout/blockscout.git \u0026#34;$HOME/app\u0026#34; cd \u0026#34;$HOME/app\u0026#34; export KERL_CONFIGURE_OPTIONS=\u0026#39;--without-javac --without-wx\u0026#39; asdf install elixir --version node --version npm --version This uses the historical asdf shell interface. If an updated plugin no longer supports it, use an archived compatible plugin revision; do not silently replace the application\u0026rsquo;s required runtimes.\nThis release also builds Rust dependencies. Install Rust and Cargo together under the service account, without sudo:\ncurl --proto \u0026#39;=https\u0026#39; --tlsv1.2 -sSf https://sh.rustup.rs -o /tmp/blockscout-rustup.sh sh /tmp/blockscout-rustup.sh -y --profile minimal . \u0026#34;$HOME/.cargo/env\u0026#34; rustc --version cargo --version The release does not pin Rust in .tool-versions. If the old native dependencies fail with a current Rust compiler, use a toolchain compatible with the locked dependencies and record its version. Do not install a second Cargo package with apt.\nConfigure the Environment Create one environment file for both the build shell and systemd. These values follow the tagged production runtime configuration.\numask 077 cat \u0026gt; \u0026#34;$HOME/blockscout.env\u0026#34; \u0026lt;\u0026lt;\u0026#39;EOF\u0026#39; MIX_ENV=prod PORT=4000 BLOCKSCOUT_HOST=192.168.77.64 BLOCKSCOUT_PROTOCOL=http ETHEREUM_JSONRPC_VARIANT=geth ETHEREUM_JSONRPC_HTTP_URL=http://192.168.77.70:8545 ETHEREUM_JSONRPC_TRACE_URL=http://192.168.77.70:8545 ETHEREUM_JSONRPC_WS_URL=ws://192.168.77.70:8546 DATABASE_URL=postgresql://blockscout:REPLACE_WITH_DATABASE_PASSWORD@127.0.0.1:5432/blockscout ECTO_USE_SSL=false POOL_SIZE=40 POOL_SIZE_API=10 COIN=NBAI EOF printf \u0026#39;SECRET_KEY_BASE=%s\\n\u0026#39; \u0026#34;$(openssl rand -hex 64)\u0026#34; \u0026gt;\u0026gt; \u0026#34;$HOME/blockscout.env\u0026#34; chmod 600 \u0026#34;$HOME/blockscout.env\u0026#34; nano \u0026#34;$HOME/blockscout.env\u0026#34; Replace the database password before proceeding. Install nano from the administration account if needed, or use an available editor. The local database connection explicitly disables TLS; do not copy that setting to an untrusted network.\nSet ETHEREUM_JSONRPC_VARIANT to match the actual node client. Keep the WebSocket URL only when that endpoint is enabled; otherwise remove the line. HTTP and trace URLs may be identical when one node serves both APIs.\nDo not put export before assignments in this file. Load it into the build shell:\nset -a . \u0026#34;$HOME/blockscout.env\u0026#34; set +a Compile Blockscout Run all commands from the pinned checkout with MIX_ENV=prod loaded.\ncd \u0026#34;$HOME/app\u0026#34; mix local.hex --force mix local.rebar --force mix deps.get mix deps.compile mix compile mix ecto.migrate cd \u0026#34;$HOME/app/apps/block_scout_web/assets\u0026#34; npm ci npm run deploy cd \u0026#34;$HOME/app/apps/explorer\u0026#34; npm ci cd \u0026#34;$HOME/app\u0026#34; mix phx.digest asdf reshim The database was already created by the PostgreSQL administrator, so only migrations are needed here. Preserve the repository lockfiles; do not run npm audit fix or update dependencies as part of reproducing this build. If current Hex or Rebar tooling rejects the old runtime, select a compatible tooling release before continuing.\nThe asset build and digest steps follow the release\u0026rsquo;s Dockerfile and frontend scripts.\nTest the application in the foreground:\nmix phx.server Open http://192.168.77.64:4000 from a host that can reach the explorer. After checking the page and logs, press Ctrl+C and finish stopping the Erlang process before starting the service. Leave the service-account shell:\nexit Create the systemd Service Back in your regular sudo-enabled account:\nsudo tee /etc/systemd/system/blockscout.service \u0026gt; /dev/null \u0026lt;\u0026lt;\u0026#39;EOF\u0026#39; [Unit] Description=Blockscout Blockchain Explorer Wants=network-online.target After=network-online.target postgresql.service [Service] Type=simple User=blockscout Group=blockscout WorkingDirectory=/opt/blockscout/app Environment=HOME=/opt/blockscout Environment=PATH=/opt/blockscout/.asdf/shims:/opt/blockscout/.asdf/bin:/opt/blockscout/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin EnvironmentFile=/opt/blockscout/blockscout.env ExecStart=/opt/blockscout/.asdf/shims/mix phx.server Restart=on-failure RestartSec=10 TimeoutStopSec=60 UMask=0077 StandardOutput=journal StandardError=journal [Install] WantedBy=multi-user.target EOF sudo systemd-analyze verify /etc/systemd/system/blockscout.service sudo systemctl daemon-reload sudo systemctl enable --now blockscout.service The explicit PATH lets systemd find the same runtimes used during compilation. systemd handles restarts; a HEART_COMMAND that calls systemctl is unnecessary.\nVerify the Installation sudo systemctl status blockscout.service --no-pager sudo journalctl -u blockscout.service -n 100 --no-pager sudo ss -ltnp curl -I http://127.0.0.1:4000/ Confirm that the explorer shows the intended chain, new blocks appear, and the logs contain no repeating RPC, tracing, or database errors. Indexing historical blocks can take a long time.\nThis configuration serves HTTP on port 4000. It does not create an HTTPS listener on port 4001. HTTPS requires a separately configured TLS reverse proxy and matching public host/protocol settings.\nIf UFW is already active, allow HTTP only from the required private subnet:\nsudo ufw allow from 192.168.77.0/24 to any port 4000 proto tcp sudo ufw status Service Management sudo systemctl restart blockscout.service sudo systemctl stop blockscout.service sudo systemctl start blockscout.service sudo journalctl -u blockscout.service -f After changing the environment file, restart the service. Rebuild with the same environment when changing a compile-time setting. Run daemon-reload only when the service unit changes.\nTroubleshooting Symptom Check Database connection fails Use postgresql://, verify the password, and test the exact host with psql. Database SSL error Match ECTO_USE_SSL to the database\u0026rsquo;s TLS configuration. mix or erl is not found by systemd Check the service account, asdf shims, and unit PATH. Frontend assets are missing Run npm ci, npm run deploy, and mix phx.digest under the production environment. Blocks or internal transactions are missing Check RPC reachability, archive data, trace support, and the configured client variant. Port 4000 is already in use Stop the foreground test process and inspect sudo ss -ltnp. HTTPS on port 4001 fails This guide configures HTTP only; add a TLS reverse proxy separately. Inotify Limit Only change this setting if a development file watcher reports an inotify limit error. It is not a routine requirement for the production service.\ncat /proc/sys/fs/inotify/max_user_watches echo \u0026#39;fs.inotify.max_user_watches=524288\u0026#39; | sudo tee /etc/sysctl.d/99-blockscout-inotify.conf sudo sysctl -p /etc/sysctl.d/99-blockscout-inotify.conf ","date":"2022-06-15T12:24:34-04:00","permalink":"/p/blockscout/","title":"Blockscout"},{"content":"Largemouth bass\nSmallmouth bass\nStriped bass\nSauger\nWalleye\nAmerican shad\nNorthern pike\nRiver redhorse\nChannel catfish\nblue catfish\nflathead catfish\ncommon carp\nasian carp\ngrass carp\nsilver carp\nbighead carp\nrainbow trout\nbrown trout\nlake trout\nBluegill\nCrappie\nFallfish\nmuskie\ngar\n","date":"2022-06-04T07:40:11-05:00","permalink":"/p/fish-in-montreal/","title":"Fish in Montreal"},{"content":"Fail2ban\nFail2ban Documentation\nUbuntu 26.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade sudo apt install fail2ban sudo systemctl enable --now fail2ban sudo systemctl status fail2ban sudo vim /etc/fail2ban/jail.local [DEFAULT] bantime = 1h findtime = 10m maxretry = 5 [sshd] enabled = true port = ssh backend = systemd sudo fail2ban-client -t sudo systemctl restart fail2ban sudo fail2ban-client status sudo fail2ban-client status sshd sudo fail2ban-client set sshd unbanip 192.168.1.100 ","date":"2021-05-29T14:55:21-04:00","permalink":"/p/fail2ban/","title":"Fail2ban"},{"content":"SSH.COM\nOpenSSH\nUbuntu 26.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade sudo apt install openssh-server sudo vim /etc/ssh/sshd_config.d/50-cloud-init.conf Port 20000 PermitRootLogin [no/yes/prohibit-password] PubkeyAuthentication yes PasswordAuthentication no PermitEmptyPasswords no MaxAuthTries 3 MaxSessions 5 AllowUsers aaron amber Subsystem sftp internal-sftp sudo sshd -t sudo systemctl reload ssh systemctl status ssh sudo systemctl disable --now ssh.socket sudo systemctl enable --now ssh sudo systemctl restart ssh.service sudo ss -lntp | grep -E \u0026#39;:22|:20000\u0026#39; sudo journalctl -u ssh -n 100 --no-pager sudo journalctl -u ssh -f SSH Key-based Authentication ssh-keygen -t ed25519 -P \u0026#39;PASSPHRASE\u0026#39; -C \u0026#34;aaron\u0026#34; cp ~/.ssh/id_ed25519.pub ~/.ssh/authorized_keys chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys cat ~/.ssh/id_ed25519 FreeBSD 13 # ee /etc/rc.conf sshd_enable=\u0026#34;YES\u0026#34; # ee /etc/ssh/sshd_config Port 22 PermitRootLogin no PubkeyAuthentication yes AuthenticationMethods publickey PasswordAuthentication no PermitEmptyPasswords no ClientAliveInterval 30 ClientAliveCountMax 6 # /etc/rc.d/sshd restart Ubuntu 24.04 LTS $ sudo apt update \u0026amp;\u0026amp; sudo apt upgrade $ sudo apt install openssh-server $ sudo systemctl enable/disable ssh $ sudo systemctl start/stop/restart/status ssh $ systemctl is-active ssh.socket $ sudo vim /lib/systemd/system/ssh.socket [Socket] ListenStream=2222 $ sudo mkdir -p /etc/systemd/system/ssh.socket.d $ sudo nano /etc/systemd/system/ssh.socket.d/addresses.conf [Socket] ListenStream= ListenStream=0.0.0.0:2022 $ sudo systemctl daemon-reload $ sudo systemctl restart ssh.socket $ ss -tlnp | grep ssh $ journalctl -xeu ssh.socket $ sh -p 2022 localhost $ sudo tail -f /var/log/auth.log $ sudo vim /etc/ssh/sshd_config AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 PasswordAuthentication no $ sudo vim /etc/ssh/sshd_config AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2 PasswordAuthentication no $ sudo systemctl restart ssh Ubuntu 22.04 LTS $ sudo apt update \u0026amp;\u0026amp; sudo apt upgrade -y $ sudo apt install openssh-server -y $ sudo systemctl enable --now ssh $ sudo systemctl disable --now ssh $ sudo apt autoremove openssh-server -y $ sudo systemctl status ssh $ sudo ss -lt $ sudo vim /etc/ssh/sshd_config $ sudo systemctl restart sshd Port 22 PasswordAuthentication no PubkeyAcceptedKeyTypes=+ssh-rsa #publickey auth fails in ssh2 CentOS 7 \u0026amp; 8 $ sudo dnf install openssh-server $ sudo dnf install openssh $ sudo ssh -V $ sudo vim /etc/ssh/sshd_config $ sudo systemctl restart sshd $ sudo sshd -t Port 22 PermitRootLogin no\t#Whether to log in with a root. PermitEmptyPasswords no PasswordAuthentication no\t#Whether to use password authentication. AuthorizedKeysFile .ssh/authorized_keys ChallengeResponseAuthentication no UsePAM yes AllowUsers aaron\t#Allow specified users to log in. AllowGroups DenyUsers DenyGroups $ sudo vim ${HOME}/.ssh/config $ sudo systemctl start/status/stop/enable/disenanble sshd $ cat /var/log/secure SSH Key-based Authentication $ ssh-keygen -t rsa -b 4096 -P \u0026#39;hello\u0026#39; -C aaron -t rsa\tdsa, ecdsa, ed25519, rsa, default rsa.\n-b 4096\tbits, minimum 768 bits, default 2048 bits.\n-f ~/.ssh/id_rsa output keyfile.\n-C aaron\tcomment.\n-P 'abc'\tpassphrase\n$ cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys $ chmod 700 ~/.ssh\t#Check permissions. $ chmod 600 ~/.ssh/authorized_keys\t#Check permissions. $ cat ~/.ssh/id_rsa The private key passphrase that needs to be modified.\n$ ssh-keygen -p -f ~/.ssh/id_rsa Send public key to local server.\n$ cat ./.ssh/id_rsa.pub \u0026gt;\u0026gt; ~/.ssh/authorized_keys Send public key to remote server.\n$ ssh-copy-id remote_username@server_ip_address $ cat ~/.ssh/id_rsa.pub | ssh remote_username@server_ip_address \u0026#34;mkdir -p ~/.ssh \u0026amp;\u0026amp; chmod 700 ~/.ssh \u0026amp;\u0026amp; cat \u0026gt;\u0026gt; ~/.ssh/authorized_keys \u0026amp;\u0026amp; chmod 600 ~/.ssh/authorized_keys\u0026#34; $ ssh -i path/to/your/key developer@192.168.1.237 -p 23 $ scp -i path/to/your/key filename developer@192.168.1.237:/diskpath $ ssh -p 2222 user@host Firewall Firewalld $ sudo firewall-cmd --permanent --zone=public --add-rich-rule=\u0026#39; rule family=\u0026#34;ipv4\u0026#34; source address=\u0026#34;1.2.3.4/32\u0026#34; port protocol=\u0026#34;tcp\u0026#34; port=\u0026#34;22\u0026#34; accept\u0026#39; $ sudo firewall-cmd --permanent --zone=public --add-rich-rule=\u0026#39; rule family=\u0026#34;ipv4\u0026#34; source address=\u0026#34;1.2.3.0/24\u0026#34; port protocol=\u0026#34;tcp\u0026#34; port=\u0026#34;22\u0026#34; accept\u0026#39; UFW $ sudo ufw allow from 1.2.3.4/32 to any port 22 $ sudo ufw allow from 1.2.3.0/24 to any port 22 ","date":"2021-05-28T14:55:21-04:00","permalink":"/p/ssh-key-authentication/","title":"SSH Key Authentication"},{"content":"xrdp\nTigerVNC\nRHEL 9 Multiuser VNC Access\nScope This guide configures a GNOME desktop on Rocky Linux 9 and provides two independent remote-access options:\nxrdp: Connect with a standard RDP client, including Windows Remote Desktop Connection. TigerVNC: Create a virtual desktop and reach it through an SSH tunnel with a VNC viewer. Choose the protocol your clients require. Running both is possible, but it adds services and accounts that must be maintained.\nThe original article targeted CentOS Linux 7 and 8. CentOS Linux 8 reached end of life in December 2021, and CentOS Linux 7 reached end of life in June 2024. Migrate those systems instead of exposing obsolete installations to a network.\nThe commands below use a Rocky Linux 9 host, an example remote user named remoteuser, and a trusted LAN subnet of 192.168.2.0/24. Replace those values for your environment.\nPrepare the Desktop Update the host and install the GNOME server environment:\nsudo dnf upgrade --refresh -y sudo dnf group install -y \u0026#34;Server with GUI\u0026#34; List the installed desktop session names. The TigerVNC configuration later in this guide uses the gnome session:\nls -1 /usr/share/xsessions/ Setting the graphical target is optional for a headless remote-desktop server. Enable it when the machine should also show a local graphical login after boot:\nsudo systemctl set-default graphical.target Create a dedicated account if one does not already exist, then assign a strong Linux password:\nsudo useradd --create-home remoteuser sudo passwd remoteuser Do not run an xrdp or VNC desktop as root.\nOption 1: Configure xrdp xrdp listens for RDP connections on TCP 3389. Its upstream project recommends the xorgxrdp backend for the best experience. On Rocky Linux 9, the packages are available from EPEL.\nEnable EPEL and Install xrdp Enable Rocky Linux\u0026rsquo;s CodeReady Builder equivalent and EPEL, then install xrdp, its X.Org backend, and its SELinux policy:\nsudo dnf install -y dnf-plugins-core sudo dnf config-manager --set-enabled crb sudo dnf install -y epel-release sudo dnf install -y xrdp xorgxrdp xrdp-selinux Start xrdp and enable it at boot:\nsudo systemctl enable --now xrdp sudo systemctl status xrdp --no-pager The packaged configuration supplies the session startup scripts. Do not add exec gnome-session to /etc/xrdp/xrdp.ini; that file configures the RDP listener and connection modules rather than the desktop startup command.\nRestrict the Firewall Rule Permit RDP only from the trusted LAN. Confirm that the active network interface uses the public zone before applying this example:\nsudo firewall-cmd --get-active-zones sudo firewall-cmd --permanent --zone=public --add-rich-rule=\u0026#39;rule family=\u0026#34;ipv4\u0026#34; source address=\u0026#34;192.168.2.0/24\u0026#34; port port=\u0026#34;3389\u0026#34; protocol=\u0026#34;tcp\u0026#34; accept\u0026#39; sudo firewall-cmd --reload sudo firewall-cmd --zone=public --list-rich-rules Do not forward TCP 3389 directly from the public internet. Use a VPN, an RD Gateway, or another authenticated access layer for connections from outside the trusted network.\nConnect with RDP On Windows, open Remote Desktop Connection:\nmstsc.exe Enter the Rocky Linux host\u0026rsquo;s private address and sign in as remoteuser. Select Xorg on the xrdp login screen if the session type is shown. Use the Linux account password, not a VNC password.\nAvoid signing in to the local GNOME console and xrdp with the same account at the same time. GNOME services tied to one user session can conflict and produce an immediate disconnect or a blank desktop.\nVerify that the server is listening:\nsudo ss -lntp | grep \u0026#39;:3389\u0026#39; Option 2: Configure TigerVNC TigerVNC creates a separate virtual desktop. The current service uses /etc/tigervnc/vncserver.users to map display numbers to Linux users. Do not copy or edit the vendor vncserver@.service unit.\nInstall TigerVNC Install the server package:\nsudo dnf install -y tigervnc-server If this host has an old custom unit from an earlier CentOS guide, preserve it as a backup so the packaged unit takes precedence:\nsudo test ! -e /etc/systemd/system/vncserver@.service || sudo mv /etc/systemd/system/vncserver@.service /etc/systemd/system/vncserver@.service.legacy sudo systemctl daemon-reload Map the User to a Display Open the user-mapping file:\nsudoedit /etc/tigervnc/vncserver.users Map display :1 to the example user:\n:1=remoteuser Display :1 normally uses TCP port 5901. Each additional user needs a unique display number.\nConfigure the Virtual Desktop Open the default configuration:\nsudoedit /etc/tigervnc/vncserver-config-defaults Add these settings:\nsession=gnome geometry=1920x1080 localhost alwaysshared session must match a desktop file in /usr/share/xsessions without the .desktop suffix. The localhost setting prevents direct network connections to the VNC port; clients will use an encrypted SSH tunnel.\nSet the VNC password as the mapped user and restore the expected SELinux labels:\nsudo -iu remoteuser vncpasswd sudo restorecon -RFv /home/remoteuser/.vnc /etc/tigervnc The VNC password is separate from the Linux login password. Decline a view-only password unless it is specifically required.\nStart the VNC Service Enable the service for display :1:\nsudo systemctl enable --now vncserver@:1.service sudo systemctl status vncserver@:1.service --no-pager sudo ss -lntp | grep \u0026#39;:5901\u0026#39; Because the server accepts VNC connections only on loopback, do not open TCP 5901 in firewalld.\nConnect Through SSH From the client computer, create an SSH tunnel and leave the command running:\nssh -N -L 5901:127.0.0.1:5901 remoteuser@server.example.com Replace server.example.com with the server\u0026rsquo;s address. In the VNC viewer, connect to 127.0.0.1:5901. The SSH session encrypts the network traffic and forwards it to the VNC listener on the server.\nVerification Check the enabled services and their current state:\nsystemctl is-enabled xrdp vncserver@:1.service systemctl is-active xrdp vncserver@:1.service Display the listening ports:\nsudo ss -lntp | grep -E \u0026#39;:(3389|5901)\\b\u0026#39; With the configuration in this guide, xrdp should listen on the host network and VNC should listen only on 127.0.0.1 or ::1.\nTroubleshooting xrdp Shows a Black Screen or Disconnects Confirm that the packages and services are healthy:\nrpm -q xrdp xorgxrdp xrdp-selinux sudo journalctl -u xrdp -u xrdp-sesman -b --no-pager Log the same user out of the local graphical console, then try again. Also confirm that Xorg is selected at the xrdp login screen and that the user\u0026rsquo;s home directory is writable.\nTigerVNC Fails to Start Inspect the service and user-session logs:\nsudo systemctl status vncserver@:1.service --no-pager sudo journalctl -u vncserver@:1.service -b --no-pager Confirm that :1=remoteuser exists in /etc/tigervnc/vncserver.users, the user has run vncpasswd, and the configured session exists:\ngrep -F \u0026#39;:1=remoteuser\u0026#39; /etc/tigervnc/vncserver.users test -f /usr/share/xsessions/gnome.desktop \u0026amp;\u0026amp; echo \u0026#39;GNOME session found\u0026#39; sudo -iu remoteuser test -r /home/remoteuser/.vnc/passwd \u0026amp;\u0026amp; echo \u0026#39;VNC password found\u0026#39; TigerVNC cannot start a virtual desktop for a user who is already logged in to another graphical session. Use a dedicated remote account or log that user out before starting the service.\nSELinux Blocks a Service Keep SELinux enforcing. Inspect recent denials before changing policy:\nsudo ausearch -m AVC,USER_AVC -ts recent First restore file labels and confirm that xrdp-selinux is installed. Do not disable SELinux or generate a broad local policy merely to hide a configuration error.\nRemove Access Disable the services when remote desktop access is no longer required:\nsudo systemctl disable --now xrdp vncserver@:1.service Remove the restricted xrdp firewall rule:\nsudo firewall-cmd --permanent --zone=public --remove-rich-rule=\u0026#39;rule family=\u0026#34;ipv4\u0026#34; source address=\u0026#34;192.168.2.0/24\u0026#34; port port=\u0026#34;3389\u0026#34; protocol=\u0026#34;tcp\u0026#34; accept\u0026#39; sudo firewall-cmd --reload ","date":"2021-05-05T21:21:07-04:00","permalink":"/p/configure-xrdp-and-tigervnc-on-rocky-linux-9/","title":"Configure xrdp and TigerVNC on Rocky Linux 9"},{"content":"Ubuntu NFS Documentation\nNFS Exports Manual\nEnvironment This guide configures an NFSv4.1 and NFSv4.2 server on Ubuntu 24.04 LTS. The example uses:\nNFS server: nfs-server.example.com Trusted client network: 192.168.2.0/24 Server directory: /srv/nfs/share NFSv4 client path: /share Client mount point: /mnt/nfs-share Shared group: nfsshare, numeric GID 2000 Replace the hostnames, subnet, paths, and GID with values appropriate for your network. Reserve the selected GID in your identity-management system so it is not assigned to another group.\nNFS with the default sec=sys mode trusts numeric user and group IDs supplied by the client. It does not encrypt file traffic and is suitable only for trusted clients on a private network or VPN. Use NFS with Kerberos and sec=krb5p when clients require strong authentication and encrypted traffic.\nInstall the NFS Server Update the package index and install the server package:\nsudo apt update sudo apt install -y nfs-kernel-server Enable and start the service:\nsudo systemctl enable --now nfs-kernel-server.service sudo systemctl status nfs-kernel-server.service --no-pager Enable NFSv4.1 and NFSv4.2 Only Ubuntu 22.04 and later use /etc/nfs.conf and optional snippets under /etc/nfs.conf.d. Create a local override:\nsudo install -d -m 0755 /etc/nfs.conf.d sudoedit /etc/nfs.conf.d/local.conf Add:\n[nfsd] vers3=n vers4=y vers4.0=n vers4.1=y vers4.2=y This configuration removes the NFSv3 dependency on the externally reachable rpcbind and mountd protocols. NFSv4 uses TCP port 2049 for normal client access.\nRestart the server and check the enabled protocol versions:\nsudo systemctl restart nfs-kernel-server.service sudo cat /proc/fs/nfsd/versions The output should show NFSv3 and NFSv4.0 disabled and NFSv4.1 and NFSv4.2 enabled, similar to -3 +4 -4.0 +4.1 +4.2.\nDisplay the effective non-default NFS configuration when troubleshooting:\nsudo nfsconf --dump Create the Shared Directory Create a group with a fixed GID. The same numeric GID will be configured on every Linux client:\nsudo groupadd --gid 2000 nfsshare If the group already exists, verify its GID instead of creating it again:\ngetent group nfsshare Create the NFSv4 pseudo-root and the writable share:\nsudo install -d -o root -g root -m 0755 /srv/nfs sudo install -d -o root -g nfsshare -m 2770 /srv/nfs/share The set-group-ID bit in mode 2770 makes new files and directories inherit the nfsshare group. Local server accounts that need write access can also be added to this group.\nConfigure the Exports Open the export table:\nsudoedit /etc/exports Add these two lines:\n/srv/nfs 192.168.2.0/24(ro,fsid=0,sync,no_subtree_check,root_squash) /srv/nfs/share 192.168.2.0/24(rw,sync,no_subtree_check,root_squash) The first line defines the NFSv4 root. The second exports the writable directory as /share to clients.\nrw permits writes to the shared directory. sync commits changes to stable storage before the server replies. no_subtree_check avoids subtree verification problems when files are renamed. root_squash maps client root requests to the anonymous identity and is enabled by default; specifying it documents the intended security behavior. fsid=0 marks the distinguished NFSv4 root. Do not add no_root_squash for a general file share. It lets a client administrator act as server root on the exported filesystem and can permit modification of root-owned files.\nCheck the syntax, apply the configuration, and display the active exports:\nsudo exportfs -rav sudo exportfs -v showmount -e queries the older mount protocol and is not a reliable way to inspect an NFSv4-only server. Use exportfs -v on the server and perform a real NFSv4 mount from a client.\nRestrict the Firewall If UFW is active, allow TCP 2049 only from the trusted client network:\nsudo ufw allow from 192.168.2.0/24 to any port 2049 proto tcp comment \u0026#39;NFSv4 trusted clients\u0026#39; sudo ufw status verbose Do not expose NFS directly to the public internet. Apply an equivalent source-restricted rule on upstream routers, cloud security groups, and other host firewalls.\nConfigure an Ubuntu Client Install the client utilities:\nsudo apt update sudo apt install -y nfs-common Create the same group with the same numeric GID, then add the current user:\nsudo groupadd --gid 2000 nfsshare sudo usermod --append --groups nfsshare \u0026#34;$USER\u0026#34; If the group already exists, verify that it uses GID 2000. Sign out and back in after changing group membership, then confirm it with:\nid Create an empty mount point:\nsudo install -d -o root -g root -m 0755 /mnt/nfs-share Test an NFSv4.2 mount:\nsudo mount -t nfs4 -o vers=4.2,proto=tcp nfs-server.example.com:/share /mnt/nfs-share Verify the source, protocol version, and negotiated options:\nfindmnt --target /mnt/nfs-share nfsstat -m Test access as a user who belongs to nfsshare:\ntouch /mnt/nfs-share/client-write-test ls -ln /mnt/nfs-share/client-write-test rm /mnt/nfs-share/client-write-test If the client kernel cannot negotiate NFSv4.2, investigate and update the client rather than silently downgrading an environment intended to require NFSv4.1 or later.\nConfigure a Persistent Mount Back up the mount table before editing it:\nsudo cp --preserve=all /etc/fstab /etc/fstab.before-nfs sudoedit /etc/fstab Add one line:\nnfs-server.example.com:/share /mnt/nfs-share nfs4 rw,hard,_netdev,nofail,x-systemd.automount,vers=4.2,proto=tcp 0 0 hard keeps retrying an interrupted NFS request so applications do not silently receive partial I/O failures. _netdev identifies a network filesystem, nofail permits boot to continue when the server is unavailable, and x-systemd.automount connects when the path is first accessed.\nReload the generated systemd units, validate the file, and trigger the automount:\nsudo systemctl daemon-reload sudo mount -a ls /mnt/nfs-share findmnt --target /mnt/nfs-share Do not copy old examples that use nolock, intr, or a large actimeo value without a specific requirement. nolock is associated with older NFS behavior, intr is ignored by modern Linux kernels, and long attribute-cache periods can make file changes appear stale.\nWindows Clients The built-in Client for NFS in current Windows desktop releases supports NFSv2 and NFSv3, not NFSv4.1 or NFSv4.2. It therefore cannot mount the NFSv4-only export configured in this guide. Microsoft documents the version limits in its NFS overview.\nUse SMB for a share that must support normal Windows clients, or deploy a separately evaluated NFSv4-capable Windows client. Do not weaken this server to NFSv3 only to accommodate one desktop without also assessing the extra RPC services, firewall ports, identity mapping, and security implications.\nTroubleshooting The Export Configuration Is Rejected Reapply the table in verbose mode and inspect the server journal:\nsudo exportfs -rav sudo journalctl -u nfs-kernel-server.service -b --no-pager In /etc/exports, there must be no space between a client specification and its option list. For example, 192.168.2.0/24(rw) is valid, while 192.168.2.0/24 (rw) changes the meaning and can expose the directory with unintended defaults.\nThe Client Cannot Reach the Server Confirm name resolution and test TCP 2049:\ngetent hosts nfs-server.example.com nc -vz nfs-server.example.com 2049 Install netcat-openbsd if nc is unavailable. Check UFW, upstream firewalls, routing, and whether the client address is inside the subnet allowed by /etc/exports.\nThe Client Receives Permission Denied Compare the group IDs and inspect every component of the server path:\ngetent group nfsshare id namei -l /srv/nfs/share The nfsshare group must use the same numeric GID on the server and client. After adding a user to a supplementary group, start a new login session before testing.\nA Mount Is Busy Identify processes using the mount before unmounting it:\nsudo fuser -vm /mnt/nfs-share sudo umount /mnt/nfs-share Stop or move the listed processes instead of using a forced unmount during active writes.\nRemove the Export Unmount the share on each client and remove its /etc/fstab entry. On the server, remove the corresponding lines from /etc/exports, then reload the export table:\nsudo exportfs -rav To stop providing NFS entirely:\nsudo systemctl disable --now nfs-kernel-server.service ","date":"2021-05-05T11:27:17-04:00","permalink":"/p/configure-an-nfsv4-file-server-on-ubuntu-24.04-lts/","title":"Configure an NFSv4 File Server on Ubuntu 24.04 LTS"},{"content":"Chocolatey Documentation\nWinGet Documentation\nScoop\nBefore You Start The examples below use PowerShell. Run Chocolatey installation and machine-wide package changes from an administrator shell. Install Scoop from a normal, non-administrator shell. WinGet may request elevation when an application\u0026rsquo;s installer requires it.\nUse one package manager to maintain each application so that upgrades and uninstall operations remain predictable. The package names below are examples; check the package details before installing.\nChocolatey Install Chocolatey Open PowerShell as administrator and check the execution policy:\nGet-ExecutionPolicy -List $PSVersionTable.PSVersion Run the official installation command. The policy override applies only to the current process.\nSet-ExecutionPolicy Bypass -Scope Process -Force [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072 Invoke-Expression ((New-Object System.Net.WebClient).DownloadString(\u0026#39;https://community.chocolatey.org/install.ps1\u0026#39;)) Check the installation and update Chocolatey itself:\nchoco --version $env:ChocolateyInstall choco upgrade chocolatey Manage Packages Search for a package and inspect its details:\nchoco search git choco info git Install, update, or remove it as needed:\nchoco install git choco upgrade git choco uninstall git List installed packages and check for updates:\nchoco list choco outdated In Chocolatey CLI 2 and later, choco list lists installed packages. The old -l / --local-only options are no longer needed or supported. Use choco search to query a repository. See the Chocolatey 2 upgrade notes.\nUpdate all Chocolatey-managed packages only after reviewing the outdated list:\nchoco upgrade all Open a new terminal after installation if a command is not found. In a shell where Chocolatey\u0026rsquo;s helper is loaded, refreshenv refreshes environment variables without reopening the terminal.\nConfigure Features List features and their current state:\nchoco feature list For a specific command, add -y when you intend to accept its confirmation prompts:\nchoco install git 7zip -y To enable automatic confirmation for future commands, or restore prompting:\nchoco feature enable --name=allowGlobalConfirmation choco feature disable --name=allowGlobalConfirmation The following features make Chocolatey stop when it detects a pending or requested reboot; they do not disable reboot detection:\nchoco feature enable --name=usePackageExitCodes choco feature enable --name=exitOnRebootDetected See the feature reference and reboot handling options.\nInstallation Locations Chocolatey normally stores its own files in C:\\ProgramData\\chocolatey. Applications can still install into C:\\Program Files, C:\\Program Files (x86), or the user\u0026rsquo;s AppData directory, depending on the package and installer.\nChocolateyInstall selects Chocolatey\u0026rsquo;s own location before installation. Changing it afterward does not move installed files. ChocolateyToolsLocation applies to packages that use that variable; it does not relocate every application\u0026rsquo;s installation directory.\nNon-administrator installation is an advanced option with limited package support. Follow the non-administrative installation instructions instead of assuming every package supports it.\nSources and Proxy List configured repositories:\nchoco source list For a repository you administer, replace the example URL before adding it:\nchoco source add --name=MyCustomSource --source=https://example.com/packages/ choco source remove --name=MyCustomSource Use an HTTP proxy for an individual command:\nchoco outdated --proxy=http://127.0.0.1:7890 Export and Restore Packages Save the installed package list in a reinstallable configuration file:\nchoco export --output-file-path=packages.config Review the file before using it on another machine:\nchoco install packages.config See the export reference. The file records packages, not application settings or user data.\nChocolatey GUI Install the graphical interface from an administrator shell:\nchoco install chocolateygui Open Chocolatey GUI from the Start menu. See the GUI documentation.\nWinGet Check Availability WinGet is distributed with App Installer. If the command is missing, install or update App Installer through the Microsoft Store, then open a new terminal.\nwinget --version winget --info winget --help Manage Packages Search first, then use the exact package identifier to avoid ambiguous matches:\nwinget search git winget show --id Git.Git --exact --source winget winget install --id Git.Git --exact --source winget List installed applications and available updates:\nwinget list winget upgrade Update or remove the selected application:\nwinget upgrade --id Git.Git --exact --source winget winget uninstall --id Git.Git --exact To upgrade all eligible applications after reviewing the list:\nwinget upgrade --all Sources and Settings Display sources and refresh their metadata:\nwinget source list winget source update Open the settings file with the correctly spelled command:\nwinget settings For example, this JSON changes the progress-bar style:\n{ \u0026#34;$schema\u0026#34;: \u0026#34;https://aka.ms/winget-settings.schema.json\u0026#34;, \u0026#34;visual\u0026#34;: { \u0026#34;progressBar\u0026#34;: \u0026#34;accent\u0026#34; } } Merge the settings into the existing file if it already contains custom values. Package listing, upgrading, and uninstalling are standard commands and do not need the old experimental switches. See the settings reference.\nExport and Restore Packages Export applications that WinGet can match to its configured sources:\nwinget export --output winget-packages.json Review the file, then install its packages on the target machine:\nwinget import --import-file winget-packages.json Unmatched applications produce warnings and need separate handling. Export does not back up application settings or user data. See the export and import references.\nScoop Install Scoop Open a non-administrator PowerShell window. The normal installation places Scoop in $HOME\\scoop.\nSet-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser Invoke-RestMethod -Uri https://get.scoop.sh -OutFile install-scoop.ps1 Review the downloaded script, then run it:\n.\\install-scoop.ps1 scoop --version scoop checkup The execution policy change persists for the current user. Follow organizational policy if it prevents the change.\nChoose Custom Installation Locations As an alternative to the default installation, pass absolute paths when running the installer:\n.\\install-scoop.ps1 -ScoopDir \u0026#39;D:\\Applications\\Scoop\u0026#39; -ScoopGlobalDir \u0026#39;F:\\GlobalScoopApps\u0026#39; Choose existing drives appropriate for your machine. These parameters configure the installation; they do not move an existing Scoop setup. Administrator installation requires an explicit -RunAsAdmin option and is separate from the normal per-user installation. See the installer documentation.\nManage Packages Search, inspect, and install a package:\nscoop search git scoop info git scoop install git Update Scoop and its bucket metadata, then check installed applications:\nscoop update scoop list scoop status Update one application or all installed applications:\nscoop update git scoop update * Hold an application to exclude it from updates, or release the hold:\nscoop hold git scoop unhold git Remove the application when no longer needed:\nscoop uninstall git Use scoop help or scoop help update for command details. See the command reference.\nManage Buckets Buckets contain package manifests. List known and configured buckets:\nscoop bucket known scoop bucket list Install Git before adding the extras bucket:\nscoop install git scoop bucket add extras Removing a bucket does not uninstall its applications:\nscoop bucket rm extras Configure a Proxy Set an explicit proxy, or restore the default proxy behavior:\nscoop config proxy 127.0.0.1:7890 scoop config rm proxy See the proxy documentation.\nEnable Multi-Connection Downloads Install aria2 and enable its integration:\nscoop install aria2 scoop config aria2-enabled true Keep certificate validation enabled. The original --check-certificate=false setting is unnecessary for normal downloads. See Scoop\u0026rsquo;s aria2 documentation.\n","date":"2021-04-12T08:12:06-04:00","permalink":"/p/windows-package-managers/","title":"Windows Package Managers"},{"content":"Samba\nSamba Configuration\nInstall and Configure Samba\nUbuntu 26.04 LTS For a standalone file server using APT and systemd. Run commands in Bash with sudo privileges. Replace username1, username2, the example directories, and network addresses with your own values.\nInstall Samba sudo apt update sudo apt install samba samba-common-bin smbclient -y smbd --version Add Samba users Check whether the Linux users already exist:\nid username1 id username2 Run the corresponding command only for a missing account:\nsudo adduser username1 sudo adduser username2 Add Samba passwords interactively, then enable the accounts:\nsudo smbpasswd -a username1 sudo smbpasswd -a username2 sudo smbpasswd -e username1 sudo smbpasswd -e username2 sudo pdbedit -L Samba passwords are managed separately from Linux login passwords. Enter them at the prompts rather than including them in commands.\nPrepare shared directories Share Server directory Allowed user sync /srv/samba/sync username2 exchange /home/username1/exchange username1 documents /home/username1/documents username1 media /home/username1/media username1 backups /home/username1/backups username1 If /srv/samba/sync is intended to be a separate disk or mount, mount it first and confirm that findmnt -T /srv/samba/sync shows the intended filesystem.\nCreate missing directories. These commands leave existing directories and their permissions unchanged:\nif [ ! -e /srv/samba/sync ]; then sudo install -d -o username2 -g \u0026#34;$(id -gn username2)\u0026#34; -m 0755 /srv/samba/sync fi for dir in exchange documents media backups; do if [ ! -e \u0026#34;/home/username1/$dir\u0026#34; ]; then sudo install -d -o username1 -g \u0026#34;$(id -gn username1)\u0026#34; -m 0755 \u0026#34;/home/username1/$dir\u0026#34; fi done Inspect ownership and parent-directory permissions:\nls -ld /srv/samba/sync /home/username1 /home/username1/{exchange,documents,media,backups} namei -l /srv/samba/sync namei -l /home/username1/exchange sudo -u username2 sh -c \u0026#39;test -r /srv/samba/sync \u0026amp;\u0026amp; test -w /srv/samba/sync \u0026amp;\u0026amp; test -x /srv/samba/sync\u0026#39; \\ \u0026amp;\u0026amp; echo \u0026#39;/srv/samba/sync: permission check passed\u0026#39; for dir in exchange documents media backups; do sudo -u username1 sh -c \u0026#39;test -r \u0026#34;$1\u0026#34; \u0026amp;\u0026amp; test -w \u0026#34;$1\u0026#34; \u0026amp;\u0026amp; test -x \u0026#34;$1\u0026#34;\u0026#39; sh \u0026#34;/home/username1/$dir\u0026#34; \\ \u0026amp;\u0026amp; echo \u0026#34;$dir: permission check passed\u0026#34; done If a success message is missing, resolve ownership, group membership, ACLs, or a read-only mount before continuing. Parent directories must be traversable. Existing files need their own appropriate permissions; a successful directory check does not prove that every file is writable.\nSyncthing permissions Check which Linux account runs Syncthing. Using username2 for both services simplifies ownership. If Syncthing runs under a different account, configure a shared group or ACLs and adjust creation permissions for both services. The 0644/0755 settings below do not provide write access to another account by default.\nDo not recursively change ownership or permissions on an existing Syncthing directory without reviewing its current access requirements.\nConfigure Samba Create a timestamped backup:\nsudo cp -a /etc/samba/smb.conf \u0026#34;/etc/samba/smb.conf.bak.$(date +%Y%m%d-%H%M%S)\u0026#34; sudo vim /etc/samba/smb.conf Use another installed editor if preferred. Preserve the existing [global] section and confirm that this server is configured for standalone user authentication. Add the following shares at the end, replacing any existing sections with the same names rather than creating duplicates.\n[sync] comment = Sync Folder path = /srv/samba/sync browseable = yes read only = no guest ok = no valid users = username2 create mask = 0644 directory mask = 0755 force user = username2 [exchange] comment = Shared Folder path = /home/username1/exchange browseable = yes read only = no guest ok = no valid users = username1 create mask = 0644 directory mask = 0755 force user = username1 [documents] comment = documents path = /home/username1/documents browseable = yes read only = no guest ok = no valid users = username1 create mask = 0644 directory mask = 0755 force user = username1 [media] comment = media path = /home/username1/media browseable = yes read only = no guest ok = no valid users = username1 create mask = 0644 directory mask = 0755 force user = username1 [backups] comment = backups path = /home/username1/backups browseable = yes read only = no guest ok = no valid users = username1 create mask = 0644 directory mask = 0755 force user = username1 The masks permit local read access by other users when parent directories allow traversal; SMB access remains restricted by valid users. For private single-user data, consider 0600/0700 after checking the requirements of Syncthing and other services. Review existing global defaults, especially permission inheritance settings, because they can affect creation behavior. See the official parameter reference.\nCheck configuration and restart Samba sudo testparm -s Resolve configuration errors and unknown parameters, then verify the reported paths and users before proceeding. This checks configuration loading, not real client access.\nsudo systemctl enable --now smbd sudo systemctl restart smbd sudo systemctl status smbd --no-pager Restarting interrupts existing SMB connections.\nnmbd supplies legacy NetBIOS name and browsing services. If those services are required and the unit is available, run:\nsudo systemctl enable --now nmbd sudo systemctl restart nmbd Modern direct SMB connections by IP do not require nmbd. See the nmbd manual.\nFirewall Find the server\u0026rsquo;s LAN address:\nip -br address ip route show default Use the address on the appropriate LAN interface. The default route\u0026rsquo;s gateway address is not the server\u0026rsquo;s address.\nIf UFW is installed and used on this server, inspect its status and available profiles:\nsudo ufw status verbose sudo ufw app list Allow the Samba profile from your trusted LAN. Replace the example subnet with your actual network:\nsudo ufw allow from 192.168.1.0/24 to any app Samba sudo ufw status numbered This rule limits access to the example LAN subnet. Adding a rule does not activate an inactive firewall. If enabling UFW remotely, first allow your actual SSH port. Apply equivalent rules to any other firewall in use. See the Ubuntu firewall documentation.\nConnect to shares On the server, test authentication and directory listing. Enter passwords when prompted:\nsmbclient -L //127.0.0.1 -U username1 smbclient //127.0.0.1/sync -U username2 -c \u0026#39;ls\u0026#39; for share in exchange documents media backups; do smbclient \u0026#34;//127.0.0.1/$share\u0026#34; -U username1 -c \u0026#39;ls\u0026#39; done These cross-account tests should fail:\nsmbclient //127.0.0.1/sync -U username1 -c \u0026#39;ls\u0026#39; smbclient //127.0.0.1/exchange -U username2 -c \u0026#39;ls\u0026#39; A visible share name does not imply permission to open it.\nWindows Enter a path in File Explorer, replacing the example IP:\n\\\\192.168.1.10\\sync \\\\192.168.1.10\\exchange \\\\192.168.1.10\\documents \\\\192.168.1.10\\media \\\\192.168.1.10\\backups Sign in as username2 for sync and username1 for the other shares. If Windows reports conflicting credentials when switching accounts, close files and disconnect existing connections to that server before reconnecting. Use net use to inspect mappings and remove only the relevant connections; also review saved credentials for that server.\nmacOS and Linux In macOS Finder, select Go \u0026gt; Connect to Server. In a Linux file manager with SMB support, select Connect to Server. Enter:\nsmb://192.168.1.10/exchange smb://192.168.1.10/sync Verify writes For every share, connect from another computer with the permitted account. Create a temporary folder, upload a test file, edit it, rename it, and delete only the test content you created. Check access to existing files separately. For /srv/samba/sync, verify that Syncthing can process files created through SMB.\nNotes Symptom Check first NT_STATUS_LOGON_FAILURE Samba account, account status, and password. NT_STATUS_ACCESS_DENIED Allowed user, parent-directory traversal, file permissions, and ACLs. NT_STATUS_BAD_NETWORK_NAME Share name, directory existence, and loaded configuration. Read succeeds but write fails Ownership, existing file permissions, read-only mounts, disk space, and quotas. Local connection works but remote connection fails Server IP, firewall rules, network isolation, and TCP port 445. Server absent from Windows Network Try its IP path directly to distinguish discovery from connection problems. Useful diagnostics:\nsudo testparm -s sudo pdbedit -L sudo journalctl -u smbd -n 100 --no-pager sudo ss -lntp \u0026#39;sport = :445\u0026#39; findmnt -T /srv/samba/sync df -h /srv/samba/sync Restore configuration List the backups:\nls -lt /etc/samba/smb.conf.bak.* Replace the placeholder filename with your chosen backup:\nsudo cp -a /etc/samba/smb.conf.bak.YYYYMMDD-HHMMSS /etc/samba/smb.conf sudo testparm -s \u0026amp;\u0026amp; sudo systemctl restart smbd Restoring this file does not reverse account, password, filesystem permission, or firewall changes.\nConfiguration reviewed against official documentation; commands have not been run on the target server.\n","date":"2021-04-05T00:00:00Z","permalink":"/p/configure-samba-on-unix/","title":"Configure Samba on Unix"},{"content":"Plex\nSub-Zero for Plex\nUbuntu 26.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade -y sudo apt install -y curl gpg sudo install -d -m 0755 /etc/apt/keyrings curl -fsSL https://downloads.plex.tv/plex-keys/PlexSign.v2.key | sudo gpg --dearmor --yes -o /etc/apt/keyrings/plexmediaserver.gpg echo \u0026#34;deb [signed-by=/etc/apt/keyrings/plexmediaserver.gpg] https://repo.plex.tv/deb/ public main\u0026#34; | sudo tee /etc/apt/sources.list.d/plexmediaserver.list \u0026gt; /dev/null sudo apt update sudo apt install -y plexmediaserver sudo systemctl enable --now plexmediaserver systemctl status plexmediaserver --no-pager sudo ss -lntp | grep 32400 hostname -I http://192.168.2.1:32400/web FreeBSD 13 # pkg update \u0026amp;\u0026amp; pkg upgrade # pkg install plexmediaserver # portsnap fetch update # /usr/ports/multimedia/plexmediaserver # make install clean # cd /usr/local/plexdata/Plex Media Server/Plug-ins # wget https://github.com/pannal/Sub-Zero.bundle/releases/download/2.6.5.3268/Sub-Zero.bundle-2.6.5.3268.zip # unzip Sub-Zero.bundle-2.6.5.3268.zip # sysrc plexmediaserver_enable=YES # service plexmediaserver start Ubuntu 24.04 LTS sudo wget https://downloads.plex.tv/plex-media-server-new/1.41.2.9200-c6bbc1b53/debian/plexmediaserver_1.41.2.9200-c6bbc1b53_amd64.deb sudo dpkg -i plexmediaserver_1.41.2.9200-c6bbc1b53_amd64.deb sudo systemctl enable --now plexmediaserver sudo systemctl start --now plexmediaserver sudo systemctl status plexmediaserver Ubuntu 22.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade -y curl https://downloads.plex.tv/plex-keys/PlexSign.key | sudo apt-key add - echo deb https://downloads.plex.tv/repo/deb public main | sudo tee /etc/apt/sources.list.d/plexmediaserver.list sudo apt update sudo apt install plexmediaserver sudo systemctl status plexmediaserver sudo systemctl enable --now plexmediaserver CentOS 7 \u0026amp; 8 $ sudo dnf update -y $ sudo vim /etc/yum.repos.d/plex.repo [Plex] name=Plex baseurl=https://downloads.plex.tv/repo/rpm/$basearch/ enabled=1 gpgkey=https://downloads.plex.tv/plex-keys/PlexSign.key gpgcheck=1 dnf install plexmediaserver -y systemctl enable/start/status plexmediaserver Firewall firewalld sudo firewall-cmd --add-service=plex --permanent --zone=public sudo firewall-cmd --reload sudo firewall-cmd --zone=public --add-port=32400/tcp --permanent sudo firewall-cmd --zone=public --add-port=32469/tcp --permanent sudo firewall-cmd --zone=public --add-port=8324/tcp --permanent sudo firewall-cmd --zone=public --add-port=3005/tcp --permanent sudo firewall-cmd --zone=public --add-port=32412/udp --permanent sudo firewall-cmd --zone=public --add-port=32413/udp --permanent sudo firewall-cmd --zone=public --add-port=32414/udp --permanent sudo firewall-cmd --zone=public --add-port=32410/udp --permanent sudo firewall-cmd --zone=public --add-port=1900/udp --permanent sudo firewall-cmd --zone=public --add-port=5353/udp --permanent sudo firewall-cmd --zone=public --add-port=80/tcp --permanent sudo firewall-cmd --reload sudo setsebool httpd_can_network_connect on -P Plugins Sub-Zero.bundle\nGrab the latest release unpack it place the Sub-Zero.bundle folder inside restart your Plex Media Server. sudo cd /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Plug-ins sudo wget https://github.com/pannal/Sub-Zero.bundle/releases/download/2.6.5.3268/Sub-Zero.bundle-2.6.5.3268.zip sudo unzip Sub-Zero.bundle-2.6.5.3268.zip sudo systemctl restart plexmediaserver.service ","date":"2021-03-15T11:28:16-04:00","permalink":"/p/plex-media-server-setup-guide/","title":"Plex Media Server Setup Guide"},{"content":"no-ip\nDynamic Update Client (DUC)\nHow to Install the Dynamic Update Client on Linux\nUbuntu 26.04 LTS wget --content-disposition https://www.noip.com/download/linux/latest tar xf noip-duc_3.3.0.tar.gz cd /home/$USER/noip-duc_3.3.0/binaries sudo apt install ./noip-duc_3.3.0_amd64.deb noip-duc -g example.ddns.net -u USERNAME -p PASSWORD sudo systemctl enable --now noip-duc noip-duc --version systemctl status noip-duc noip-duc \\ -g all.ddnskey.com \\ -u \u0026#39;YOUR_DDNS_KEY_USERNAME\u0026#39; \\ -p \u0026#39;YOUR_DDNS_KEY_PASSWORD\u0026#39; sudo vim /etc/default/noip-duc NOIP_USERNAME=\u0026#39;YOUR_DDNS_KEY_USERNAME\u0026#39; NOIP_PASSWORD=\u0026#39;YOUR_DDNS_KEY_PASSWORD\u0026#39; NOIP_HOSTNAMES=\u0026#39;all.ddnskey.com\u0026#39; sudo systemctl enable --now noip-duc systemctl status noip-duc systemctl status noip-duc ps aux | grep -i noip systemctl list-units --type=service | grep -i noip sudo systemctl stop noip-duc sudo systemctl disable noip-duc sudo systemctl enable --now noip-duc sudo systemctl disable --now noip-duc Ubuntu 24.04 LTS wget --content-disposition https://www.noip.com/download/linux/latest tar xf noip-duc_3.3.0.tar.gz cd noip-duc_3.3.0/binaries sudo apt install ./noip-duc_3.3.0_amd64.deb noip-duc -g example.ddns.net -u USERNAME -p PASSWORD Running it at startup sudo systemctl enable noip-duc sudo vim /etc/default/noip-duc sudo vim /etc/default/noip-duc NOIP_USERNAME=username NOIP_PASSWORD=password NOIP_HOSTNAMES=example.ddns.net,exampledomain.com,noiptest.redirectme.net sudo systemctl daemon-reload sudo systemctl enable noip-duc sudo systemctl disable noip-duc sudo systemctl start noip-duc sudo systemctl restart noip-duc sudo systemctl status noip-duc sudo systemctl stop noip-duc Ubuntu 22.04 LTS wget https://dmej8g5cpdyqd.cloudfront.net/downloads/noip-duc_3.0.0-beta.5.tar.gz tar xf noip-duc_3.0.0-beta.5.tar.gz cd /home/$USER/noip-duc_3.0.0-beta.5/binaries \u0026amp;\u0026amp; apt install ./noip-duc_3.0.0-beta.5_amd64.deb noip-duc -g myhostname.ddns.net -u username -p password noip-duc -help Auto boot when bootstarup(rc.local) sudo vi /lib/systemd/system/rc-local.service [Install] WantedBy=multi-user.target Alias=rc-local.service sudo vim /etc/rc.local #!/bin/bash noip-duc -g myhostname.ddns.net -u username -p password exit 0 sudo chmod a+x /etc/rc.local sudo systemctl enable rc-local sudo systemctl start rc-local.service Auto boot when bootstarup(Systemd) sudo vim /etc/systemd/system/noip-1.service [Unit] After=network.service Description=Dynamic Update Client [Service] ExecStart=/usr/local/bin/dynamic_update_client-1.sh Type=oneshot [Install] WantedBy=default.target sudo chmod 664 /etc/systemd/system/noip-1.service sudo vim /usr/local/bin/dynamic_update_client-1.sh #!/bin/bash noip-duc -g myhostname.ddns.net -u username -p password sudo chmod 744 /usr/local/bin/dynamic_update_client-1.sh sudo systemctl daemon-reload sudo systemctl enable noip-1.service sudo systemctl start noip-1.service Centos 7 sudo yum install noip sudo noip2 -C sudo noip2 Centos 8 cd /usr/local/src wget http://www.no-ip.com/client/linux/noip-duc-linux.tar.gz tar xzf noip-duc-linux.tar.gz cd noip-2.1.9-1 make \u0026amp;\u0026amp; make install vim /usr/local/src/noip-2.1.9-1/README.FIRST /usr/local/bin/noip2 $ vim /etc/systemd/system/noip2.service # Simple No-ip.com Dynamic DNS Updater # # By Nathan Giesbrecht (http://nathangiesbrecht.com) # # 1) Install binary as described in no-ip.com\u0026#39;s source file (assuming results in /usr/local/bin) # 2) Run sudo /usr/local/bin/noip2 -C to generate configuration file # 3) Copy this file noip2.service to /etc/systemd/system/ # 4) Execute `sudo systemctl daemon-reload` # 5) Execute `sudo systemctl enable noip2` # 6) Execute `sudo systemctl start noip2` # # systemd supports lots of fancy features, look here (and linked docs) for a full list: # http://www.freedesktop.org/software/systemd/man/systemd.exec.html [Unit] Description=No-ip.com dynamic IP address updater After=network.target After=syslog.target [Install] WantedBy=multi-user.target Alias=noip.service [Service] # Start main service ExecStart=/usr/local/bin/noip2 Restart=always Type=forking ","date":"2021-02-06T20:26:37-05:00","permalink":"/p/no-ip-duc-setup/","title":"No-IP DUC Setup"},{"content":"vsftpd\nUbuntu 26.04 LTS sudo apt update sudo apt install vsftpd sudo systemctl enable --now vsftpd vsftpd -version sudo systemctl status vsftpd sudo vim /etc/vsftpd.conf userlist_enable=YES userlist_file=/etc/vsftpd.user userlist_deny=NO listen=NO listen_ipv6=YES anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 file_open_mode=0755 ascii_upload_enable=YES ascii_download_enable=YES chroot_local_user=YES allow_writeable_chroot=YES utf8_filesystem=YES sudo vim /etc/vsftpd.user aaron amber april beth Ubuntu 24.04.1 LTS \u0026amp; 22.04 LTS Update packages and install vsftpd sudo apt update \u0026amp;\u0026amp; sudo apt upgrade sudo apt install vsftpd vsftpd -version Add FTP user sudo adduser username -m sudo passwd username OR\nsudo vim /etc/vsftpd.user username username1 username2 Configure vsftpd sudo vim /etc/vsftpd.conf listen=NO listen_ipv6=YES connect_from_port_20=YES ftpd_banner=Welcome to blah FTP service. anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 file_open_mode=0755 pasv_enable=YES pasv_min_port=10190 pasv_max_port=10200 ascii_upload_enable=YES ascii_download_enable=YES userlist_enable=YES userlist_file=/etc/vsftpd.user userlist_deny=NO chroot_local_user=YES allow_writeable_chroot=YES dirmessage_enable=YES use_localtime=YES xferlog_enable=YES xferlog_file=/var/log/vsftpd.log secure_chroot_dir=/var/run/vsftpd/empty pam_service_name=vsftpd rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key ssl_enable=NO Restart vsftpd Service sudo systemctl enable/disable vsftpd sudo systemctl start/stop/restart/statussud vsftpd CentOs 7 wget https://security.appspot.com/downloads/vsftpd-3.0.3.tar.gz tar -zxvf vsftpd-3.0.3.tar.gz ./configure make \u0026amp;\u0026amp; make install sudo rpm -ivh vsftpd-3.0.2-28.el7.x86_64.rpm sudo yum install -y vsftpd sudo systemctl start/stop/restart/status/enable/disable vsftpd sudo firewall-cmd --zone=public --add-service=ftp --permanent sudo firewall-cmd --reload SELinux sudo sestatus sudo setenforce 0 sudo vim /etc/sysconfig/selinux Change the SELINUX=enforcing directive to SELINUX=disabled PAM in Linux $ sudo vim /etc/pam.d/vsftpd #auth required pam_shells.so standalone sudo vim /etc/vsftpd/vsftpd.conf listen=YES #listen_ipv6=YES listen_port=21 #listen_address= xinetd sudo yum install xinetd sudo vim /etc/vsftpd/vsftpd.conf listen=NO $ sudo vim /etc/xinetd.d/vsftpd service ftp { socket_type = stream wait = no user = root server = /usr/sbin/vsftpd log_on_success += HOST DURATION log_on_failure += HOST disable = no } sudo systemctl start xinetd sudo systemctl enable xinetd vsftpd.conf sudo cp /etc/vsftpd/vsftpd.conf{,.bak} sudo vim /etc/vsftpd/vsftpd.conf anonymous_enable=NO local_enable=YES write_enable=YES local_umask=002 file_open_mode=0755 ascii_upload_enable=YES ascii_download_enable=YES Firewall UFW sudo ufw allow 20/tcp sudo ufw allow 21/tcp sudo ufw allow 990/tcp sudo ufw allow 10190:10200/tcp IPTables iptables -A INPUT -m tcp -p tcp -m multiport --dports 20,21 -m state --state NEW -j ACCEPT -m comment --comment \u0026#34; FTP Server \u0026#34; iptables -A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT modprobe nf_conntrack_ftp Notes Error message \u0026ldquo;500 OOPS: vsftpd: refusing to run with writable root inside chroot()\u0026rdquo; - keep user jailed Go to /etc/vsftpd.conf and add this:\nallow_writeable_chroot=YES Allow \u0026ldquo;ls -R\u0026rdquo; recursive directory list. Default is disabled. Go to /etc/vsftpd.conf and add this:\nls_recurse_enable=YES Enabling TLS encryption sudo openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/ssl/private/vsftpd.pem -out /etc/ssl/private/vsftpd.pem Go to /etc/vsftpd.conf and add this:\nssl_enable=YES rsa_cert_file=/etc/ssl/private/vsftpd.pem rsa_private_key_file=/etc/ssl/private/vsftpd.pem allow_anon_ssl=NO force_local_data_ssl=YES force_local_logins_ssl=YES ssl_tlsv1=YES ssl_sslv2=NO ssl_sslv3=NO require_ssl_reuse=NO ssl_ciphers=HIGH ","date":"2021-01-19T19:05:39-04:00","permalink":"/p/configure-vsftpd-on-linux/","title":"Configure vsftpd on Linux"},{"content":"NGINX\nUbuntu 26.04 LTS sudo apt install nginx nginx -v sudo systemctl enable/disable nginx sudo systemctl start/stop/restart/status/reload nginx Multiple Domains Setup sudo vim /etc/nginx/sites-available/example1.com server { listen 80; listen [::]:80; server_name example1.com www.example1.com; root /var/www/example1; index index.html; location / { try_files $uri $uri/ =404; } } sudo ln -s /etc/nginx/sites-available/example1.com /etc/nginx/sites-enabled/example1.com sudo nginx -t sudo systemctl reload nginx Gzip Setup sudo vim /etc/nginx/nginx.conf gzip on; gzip_vary on; gzip_min_length 1024; gzip_comp_level 5; gzip_types text/plain text/css text/javascript application/javascript application/json application/xml application/rss+xml image/svg+xml; sudo nginx -t sudo systemctl reload nginx curl -I -H \u0026#34;Accept-Encoding: gzip\u0026#34; http://localhost/ curl -I -H \u0026#34;Accept-Encoding: gzip\u0026#34; http://your-domain.com/ Ubuntu 24.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade sudo apt install nginx sudo nginx -v sudo vim /etc/nginx/sites-available/default sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/ sudo nginx -t sudo systemctl enable/disable nginx sudo systemctl start/stop/restart/status nginx Ubuntu 22.04 LTS sudo apt update sudo apt install nginx sudo systemctl enable --now nginx sudo systemctl start/restart/reload/stop/enable/disable nginx sudo vim /etc/nginx/sites-available/default sudo ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/ FreeBSD 13 # freebsd-update fetch install # pkg install -y nginx # sysrc nginx_enable=yes # service nginx start # ee /usr/local/etc/nginx/nginx.conf Centos 7 \u0026amp; 8 sudo dnf install nginx nginx -v nginx -V sudo vim /etc/nginx/nginx.conf sudo vim /etc/nginx/conf.d/*.conf nginx -t sudo vim /var/log/nginx/access.log sudo vim /var/log/nginx/error.log sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --reload sudo systemctl start/stop/status/enable/disable nginx nginx -s stop/quit/reopen/reload nginx -c filename Firewall sudo ufw app list sudo ufw allow \u0026#39;Nginx Full\u0026#39; sudo ufw reload sudo ufw status Notes reload[emerg]: bind() to 0.0.0.0:80 failed (98: Address already in use) Then it means nginx or some other process is already using port 80.\nYou can kill it using:\nsudo fuser -k 80/tcp And then try restarting nginx again:\nservice nginx start ","date":"2021-01-12T13:08:19-05:00","permalink":"/p/nginx/","title":"NGINX"},{"content":"Syncthing\nThe Syncthing Project\nStarting Syncthing Automatically\nSyncthing on FreeBSD\nUbuntu 26.04 LTS sudo mkdir -p /etc/apt/keyrings sudo curl -L -o /etc/apt/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg echo \u0026#34;deb [signed-by=/etc/apt/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable-v2\u0026#34; | sudo tee /etc/apt/sources.list.d/syncthing.list sudo vim /etc/apt/preferences.d/syncthing Package: syncthing Pin: origin \u0026#34;apt.syncthing.net\u0026#34; Pin-Priority: 600 sudo apt update apt policy syncthing sudo apt install syncthing syncthing --version sudo loginctl enable-linger USER loginctl show-user USER -p Linger systemctl --user enable --now syncthing.service systemctl --user status syncthing.service pgrep -a syncthing journalctl --user -u syncthing -n 30 --no-pager Ubuntu 24.04.1 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade -y sudo apt install syncthing sudo systemctl enable syncthing@username.service sudo systemctl start syncthing@username.service sudo vim /home/username/.local/state/syncthing/config.xml Ubuntu 22.04 LTS sudo apt update \u0026amp;\u0026amp; sudo apt upgrade -y sudo curl -s -o /usr/share/keyrings/syncthing-archive-keyring.gpg https://syncthing.net/release-key.gpg echo \u0026#34;deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing stable\u0026#34; | sudo tee /etc/apt/sources.list.d/syncthing.list #Import Syncthing Stable echo \u0026#34;deb [signed-by=/usr/share/keyrings/syncthing-archive-keyring.gpg] https://apt.syncthing.net/ syncthing candidate\u0026#34; | sudo tee /etc/apt/sources.list.d/syncthing.list #Import Syncthing Candidate (Pre-Release) sudo apt update sudo apt install syncthing -y syncthing --version sudo systemctl enable syncthing@username.service sudo systemctl start syncthing@username.service vim /home/username/.config/syncthing/config.xml FreeBSD # wget https://github.com/syncthing/syncthing/releases/download/v1.18.2/syncthing-freebsd-amd64-v1.18.2.tar.gz # tar zxvf syncthing-freebsd-amd64-v1.18.2.tar.gz # cd ./syncthing-freebsd-amd64-v1.18.2 # mv ./usr/local/bin/syncthing ./usr/local/bin/syncthing-bak # cp ./syncthing /usr/local/bin/ # cd ./syncthing-freebsd-amd64-v1.18.2/etc/freebsd-rc # mv ./usr/local/etc/rc.d/syncthing ./usr/local/etc/rc.d/syncthing-bak # cp ./syncthing /usr/local/etc/rc.d/ FreeBSD 14.1 # pkg update \u0026amp;\u0026amp; pkg upgrade # pkg install syncthing # mkdir /var/syncthing # chown -R syncthing:syncthing /var/syncthing # chmod -R 750 /var/syncthing # cp /usr/local/etc/syncthing/config.xml{,.bak} # portsnap fetch update # cd /usr/ports/net/syncthing # make install clean # ee /usr/local/etc/syncthing/config.xml # ee /usr/local/etc/rc.d/syncthing syncthing_user=username syncthing_group=groupname # sysrc syncthing_enable=YES # service syncthing restart CentOs 7 \u0026amp; 8 sudo yum update -y sudo vi /etc/yum.repos.d/syncthing.repo [copr:copr.fedorainfracloud.org:daftaupe:syncthing] name=Copr repo for syncthing owned by daftaupe baseurl=https://download.copr.fedorainfracloud.org/results/daftaupe/syncthing/epel-7-$basearch/ type=rpm-md skip_if_unavailable=True gpgcheck=1 gpgkey=https://download.copr.fedorainfracloud.org/results/daftaupe/syncthing/pubkey.gpg repo_gpgcheck=0 enabled=1 enabled_metadata=1 sudo wget https://github.com/syncthing/syncthing/releases/download/v1.18.3/syncthing-linux-amd64-v1.18.3.tar.gz sudo tar xzvf syncthing-linux* \u0026amp;\u0026amp; rm -rf syncthing-linux*.tar.gz sudo cd /root/syncthing* sudo cp ./syncthing /usr/local/bin/ sudo cd /root/syncthing*/etc/linux-systemd/system/ sudo cp syncthing@.service /etc/systemd/system/ sudo syncthing --version sudo vim /etc/systemd/system/syncthing@.service ExecStart=/usr/local/bin/syncthing -no-browser -no-restart -logflags=0 -gui-address=\u0026#34;0.0.0.0:8384\u0026#34; -home=/home/%i/syncthing sudo vim /.config/syncthing/config.xml \u0026lt;gui enabled=\u0026#34;true\u0026#34; tls=\u0026#34;false\u0026#34; debugging=\u0026#34;false\u0026#34;\u0026gt; \u0026lt;address\u0026gt;192.168.2.200:8384\u0026lt;/address\u0026gt; sudo systemctl daemon-reload sudo systemctl enable syncthing@aaa sudo systemctl start syncthing@aaa sudo syncthing -upgrade Windows 10 \u0026gt; syncthing.exe -no-console -no-browser -home=\u0026#34;D:\\Program Files\\syncthing-windows-amd64-v1.6.1\u0026#34; \u0026gt; syncthing.exe -no-restart -gui-address=localhost:8384 MacOs syncthing-macos\nFirewall UFW sudo ufw allow syncthing sudo ufw allow syncthing-gui OR sudo ufw allow 22000/tcp sudo ufw allow 80/tcp IPTables sudo firewall-cmd --zone=public --add-service=syncthing --permanent sudo firewall-cmd --zone=public --add-port=8384/tcp --permanent sudo firewall-cmd --reload ","date":"2020-10-30T11:33:41-04:00","permalink":"/p/syncthing/","title":"Syncthing"},{"content":"Repair a Windows Image\nDISM Command-Line Options\nUse System File Checker\nBefore You Start Deployment Image Servicing and Management, or DISM, can repair the running Windows component store and service offline Windows images. In DISM terminology:\n/Online targets the Windows installation that is currently running. /Image:C:\\Mount targets an offline Windows installation whose root is mounted at C:\\Mount. Image-management commands such as /Mount-Image operate on a WIM, VHD, VHDX, or FFU file rather than using /Online. Open Windows Terminal, PowerShell, or Command Prompt as an administrator. Back up important data before modifying an offline image, drivers, features, or Windows edition. Do not interrupt DISM while it is committing an image.\nDISM records servicing details in C:\\Windows\\Logs\\DISM\\dism.log. System File Checker writes details to C:\\Windows\\Logs\\CBS\\CBS.log.\nRepair the Running Windows Installation Install available Windows updates and restart first. Then open an elevated terminal.\nCheck whether Windows has already marked the component store as damaged:\nDISM.exe /Online /Cleanup-Image /CheckHealth /CheckHealth reads the existing corruption flag; it does not perform a new scan. Run a complete scan when the quick check reports damage or Windows is behaving unexpectedly:\nDISM.exe /Online /Cleanup-Image /ScanHealth Repair the component store. Without /Source, DISM uses the repair source defined by policy and can contact Windows Update:\nDISM.exe /Online /Cleanup-Image /RestoreHealth After DISM completes successfully, repair protected system files from the restored component store:\nsfc.exe /scannow Microsoft recommends running DISM before SFC. Wait until each command finishes; apparent pauses at one percentage do not necessarily mean that the process has stopped.\nRestart Windows after repairs, then verify the component store again:\nDISM.exe /Online /Cleanup-Image /CheckHealth Repair from Matching Installation Media Use a local source when Windows Update is unavailable or DISM reports that source files could not be found. The installation media must match the installed Windows architecture, language, edition, and release. A source older than the installed servicing level might not contain the required components.\nMount the Windows ISO. The examples below assume that it appears as drive D:.\nDetermine whether the media contains install.wim or install.esd:\ndir D:\\sources\\install.* List the editions and indexes in a WIM:\nDISM.exe /Get-WimInfo /WimFile:D:\\sources\\install.wim Use the index that matches the installed edition. The following example uses index 6; replace it with the value reported for your media:\nDISM.exe /Online /Cleanup-Image /RestoreHealth /Source:wim:D:\\sources\\install.wim:6 /LimitAccess For media containing an ESD, inspect and use it instead:\nDISM.exe /Get-WimInfo /WimFile:D:\\sources\\install.esd DISM.exe /Online /Cleanup-Image /RestoreHealth /Source:esd:D:\\sources\\install.esd:6 /LimitAccess /LimitAccess prevents DISM from contacting Windows Update. Omit it only when Windows Update should remain available as a fallback source.\nRun SFC after the source-based repair succeeds:\nsfc.exe /scannow Analyze and Clean the Component Store Analyze the WinSxS component store before deciding whether cleanup is useful:\nDISM.exe /Online /Cleanup-Image /AnalyzeComponentStore Remove superseded component versions:\nDISM.exe /Online /Cleanup-Image /StartComponentCleanup Do not manually delete files from C:\\Windows\\WinSxS.\nDISM also supports the more aggressive /ResetBase option:\nDISM.exe /Online /Cleanup-Image /StartComponentCleanup /ResetBase After /ResetBase completes, installed update packages incorporated into the new base cannot be uninstalled. Use it only after the system and its updates have been tested and rollback is no longer required.\nManage Optional Windows Features List feature names and their states:\nDISM.exe /Online /Get-Features /Format:Table Inspect one feature before changing it:\nDISM.exe /Online /Get-FeatureInfo /FeatureName:Microsoft-Hyper-V-All Enable a feature and all required parent features without restarting automatically:\nDISM.exe /Online /Enable-Feature /FeatureName:Microsoft-Hyper-V-All /All /NoRestart Disable a feature while retaining its payload:\nDISM.exe /Online /Disable-Feature /FeatureName:Microsoft-Hyper-V-All /NoRestart Feature availability depends on the Windows edition and hardware. Review the command result and restart when DISM reports that a reboot is required. Adding /Remove to /Disable-Feature removes the feature payload and can require a matching source when the feature is enabled again.\nCheck Windows Edition Information Display the current edition identifier:\nDISM.exe /Online /Get-CurrentEdition Display supported target editions:\nDISM.exe /Online /Get-TargetEditions /Set-Edition is not a general downgrade or cross-family conversion tool. Microsoft documents online edition conversion with DISM for supported Windows Server paths. Confirm that the target appears in /Get-TargetEditions, obtain a valid key, review the license terms, and follow Microsoft\u0026rsquo;s Windows Server conversion guidance.\nFor a supported Server Standard-to-Datacenter conversion, the command has this form:\nDISM.exe /Online /Set-Edition:ServerDatacenter /ProductKey:\u0026lt;product-key\u0026gt; /AcceptEula Replace \u0026lt;product-key\u0026gt; with the valid key without publishing it in documentation, scripts, or logs. Edition conversion can require a restart and cannot be used to convert an Active Directory domain controller from an evaluation edition to retail.\nExport Third-Party Drivers Create a destination and export the third-party INF driver packages from the running installation:\nmkdir C:\\DriversBackup DISM.exe /Online /Export-Driver /Destination:C:\\DriversBackup The export contains INF-style driver packages. It does not back up vendor installers, control applications, firmware tools, or every device-specific setting. Copy the result to separate storage and test it before relying on it for recovery.\nList third-party drivers installed in the running system:\nDISM.exe /Online /Get-Drivers /Format:Table DISM supports /Add-Driver for offline Windows images, not for the running installation. Use Windows Update, Device Manager, or the vendor\u0026rsquo;s supported installer to add a driver to the current operating system.\nMount and Service an Offline WIM These examples assume that a Windows ISO is mounted as D:, the writable image will be stored in C:\\Images, and the empty mount directory is C:\\Mount.\nCreate the working directories, copy the WIM from the read-only ISO, and remove its read-only attribute:\nmkdir C:\\Images mkdir C:\\Mount copy D:\\sources\\install.wim C:\\Images\\install.wim attrib -r C:\\Images\\install.wim List the available indexes:\nDISM.exe /Get-WimInfo /WimFile:C:\\Images\\install.wim Mount the required index. This example uses index 6; replace it with the correct index:\nDISM.exe /Mount-Image /ImageFile:C:\\Images\\install.wim /Index:6 /MountDir:C:\\Mount /CheckIntegrity Query the mounted image:\nDISM.exe /Image:C:\\Mount /Get-CurrentEdition DISM.exe /Image:C:\\Mount /Get-Features /Format:Table DISM.exe /Image:C:\\Mount /Get-Drivers /Format:Table Add signed INF drivers from a directory and its subdirectories:\nDISM.exe /Image:C:\\Mount /Add-Driver /Driver:C:\\DriversBackup /Recurse Review the warnings. /Recurse can add unnecessary drivers and increase the image size. Do not use /ForceUnsigned for a production image.\nCommit the changes and unmount the image:\nDISM.exe /Unmount-Image /MountDir:C:\\Mount /Commit /CheckIntegrity To abandon all changes instead:\nDISM.exe /Unmount-Image /MountDir:C:\\Mount /Discard Always choose either /Commit or /Discard. Back up the original WIM before servicing it and keep enough free disk space for the mount and commit operations.\nRepair an Offline Windows Installation In Windows Recovery Environment or Windows PE, drive letters can differ from normal Windows. Locate the offline installation before running repair commands:\ndir C:\\Windows dir D:\\Windows If the offline Windows directory is D:\\Windows, target its volume root:\nDISM.exe /Image:D:\\ /Cleanup-Image /CheckHealth DISM.exe /Image:D:\\ /Cleanup-Image /ScanHealth DISM.exe /Image:D:\\ /Cleanup-Image /RestoreHealth /Source:E:\\RepairSource\\Windows /LimitAccess Replace both drive letters with the paths shown in the recovery environment. The repair source must match the offline operating system.\n/RevertPendingActions exists for recovery from a boot failure caused by an incomplete servicing operation. It is unsupported against the running operating system and should be used only after diagnosing that specific recovery scenario.\nCapture and Append a WIM Image For deployment imaging, prepare the reference installation with Sysprep as required by the deployment plan, boot another operating system such as Windows PE, and capture the offline Windows volume. Do not capture an actively running system volume as a deployment image.\nCapture the prepared C: volume to another drive:\nDISM.exe /Capture-Image /ImageFile:D:\\Images\\Windows11.wim /CaptureDir:C:\\ /Name:\u0026#34;Windows 11 Pro\u0026#34; /Description:\u0026#34;Reference image\u0026#34; /Compress:Max /CheckIntegrity /Verify Append another prepared image to the existing WIM:\nDISM.exe /Append-Image /ImageFile:D:\\Images\\Windows11.wim /CaptureDir:C:\\ /Name:\u0026#34;Windows 11 Enterprise\u0026#34; /Description:\u0026#34;Reference image\u0026#34; /CheckIntegrity /Verify The appended image must use the compression type already assigned to the WIM. Ensure that the destination has enough free space; running out of space during an append can corrupt the image.\nVerify the resulting image indexes:\nDISM.exe /Get-WimInfo /WimFile:D:\\Images\\Windows11.wim Recover a Stale Mount List known mount points first:\nDISM.exe /Get-MountedImageInfo Try to recover an image whose mount directory became inaccessible:\nDISM.exe /Remount-Image /MountDir:C:\\Mount Use /Cleanup-Mountpoints only for corrupted mount resources that cannot be recovered or normally unmounted:\nDISM.exe /Cleanup-Mountpoints Cleanup does not commit image changes. Confirm that no recoverable mount contains work that still needs to be saved.\nTroubleshooting DISM Reports That Source Files Could Not Be Found Verify the ISO\u0026rsquo;s Windows release, architecture, language, edition, and servicing level. Confirm whether the media contains install.wim or install.esd. Use /Get-WimInfo and select the correct image index. Remove /LimitAccess if policy permits Windows Update to supply missing repair content. DISM Reports a Pending Restart Finish installing updates and restart Windows before retrying. Do not delete servicing registry keys or pending-operation files to bypass the requirement.\nReview the Logs Display recent DISM errors in PowerShell:\nSelect-String -Path \u0026#34;$env:windir\\Logs\\DISM\\dism.log\u0026#34; -Pattern \u0026#39;Error\u0026#39;,\u0026#39;Failed\u0026#39; | Select-Object -Last 50 Extract recent SFC entries from the CBS log:\nfindstr.exe /c:\u0026#34;[SR]\u0026#34; %windir%\\Logs\\CBS\\CBS.log \u0026gt; \u0026#34;%USERPROFILE%\\Desktop\\SFC-details.txt\u0026#34; Review the surrounding log context before acting on an isolated error line. If repairs repeatedly fail with matching media, check storage health, memory stability, update history, and the exact error code before attempting more invasive recovery.\n","date":"2020-10-30T11:33:37-04:00","permalink":"/p/repair-and-service-windows-images-with-dism/","title":"Repair and Service Windows Images with DISM"},{"content":"RHEL 9 Kernel Management\nELRepo\nELRepo kernel-ml\nELRepo kernel-lt\nScope This guide updates the kernel on Rocky Linux 9 and other compatible Enterprise Linux 9 rebuilds. The normal and preferred method is to install the distribution kernel from the standard repositories. An optional section covers ELRepo\u0026rsquo;s kernel-lt and kernel-ml packages for testing hardware that the distribution kernel does not support.\nThe original article targeted CentOS Linux 8, which reached end of life in December 2021. Migrate unsupported systems before changing their kernels.\nEnterprise Linux kernels retain a stable version family while backporting security fixes and drivers. A higher upstream version number does not by itself mean that the system is more secure, stable, or supported.\nPrepare for the Update Identify the distribution, running kernel, architecture, and default boot kernel:\ncat /etc/os-release uname -r uname -m sudo grubby --default-kernel List installed kernel packages and boot entries:\nrpm -q kernel kernel-core --last sudo grubby --info=ALL Check available space in the boot filesystems:\ndf -h /boot /boot/efi The /boot/efi path might not be a separate filesystem on a BIOS-based installation. Resolve a nearly full /boot before installing another kernel, but keep at least one known-good older kernel.\nBefore updating a remote server:\nConfirm that a hypervisor console, physical console, or other out-of-band recovery method is available. Back up important data and boot configuration. Record the current kernel path reported by grubby --default-kernel. Check whether storage, networking, GPU, security, or virtualization depends on an out-of-tree module. Take a tested virtual-machine snapshot when the platform supports it and the storage design makes snapshots safe. Inspect DKMS and installed third-party kernel modules when those tools are present:\ncommand -v dkms \u0026gt;/dev/null \u0026amp;\u0026amp; dkms status rpm -qa | grep -E \u0026#39;^(kmod-|akmod-)\u0026#39; Confirm that required module packages have a build compatible with the new kernel before rebooting.\nInstall the Supported Distribution Kernel Refresh metadata and review all available updates:\nsudo dnf check-update --refresh The safest routine update keeps the kernel and related userspace packages at a consistent supported level:\nsudo dnf upgrade --refresh For a maintenance window intentionally limited to kernel packages, use the documented kernel update command:\nsudo dnf update kernel DNF treats kernels as install-only packages. It installs the new kernel alongside older versions instead of replacing the running kernel immediately.\nList the installed kernels again and confirm that the new boot files exist:\nrpm -q kernel-core --last ls -lh /boot/vmlinuz-* /boot/initramfs-*.img sudo grubby --info=ALL The new distribution kernel normally becomes the default automatically. Confirm the selection:\nsudo grubby --default-kernel If the default is incorrect, copy the exact desired /boot/vmlinuz-... path from grubby --info=ALL and set it explicitly:\nsudo grubby --set-default /boot/vmlinuz-VERSION.ARCH sudo grubby --default-kernel Replace VERSION.ARCH with an installed kernel filename. Do not use grub2-set-default 0; numeric positions can change when another kernel is installed.\nReboot and Verify Schedule the interruption, then reboot:\nsudo systemctl reboot After the system returns, verify the running kernel and boot state:\nuname -r sudo grubby --default-kernel systemctl --failed sudo journalctl -b -p err..alert --no-pager Test storage, networking, firewall rules, virtualization, containers, monitoring, and application services that depend on kernel features. Confirm that required modules loaded:\nlsmod sudo dmesg --level=err,warn Warnings are not automatically failures. Compare them with the previous boot and investigate messages related to required hardware or services.\nRoll Back to an Older Distribution Kernel If the new kernel cannot boot, display the GRUB menu during startup by pressing Esc repeatedly and select a known-good older kernel. Console access is essential when the machine cannot reach the network.\nIf the system boots but the new kernel causes a problem, list the installed entries:\nsudo grubby --info=ALL Set the exact older kernel path as the default and reboot:\nsudo grubby --set-default /boot/vmlinuz-OLD_VERSION.ARCH sudo grubby --default-kernel sudo systemctl reboot After rebooting, verify that uname -r reports the selected version. Keep the failed kernel installed until logs and package state have been reviewed; removing it immediately can discard evidence needed for diagnosis.\nManage Retained Kernels DNF\u0026rsquo;s installonly_limit controls how many versions of install-only packages are retained. Inspect the configured value:\ngrep -R \u0026#39;^installonly_limit\u0026#39; /etc/dnf/dnf.conf /etc/dnf/dnf.conf.d 2\u0026gt;/dev/null DNF normally keeps three versions. A value of at least 2 preserves a rollback kernel; 1 is not permitted. Do not manually remove the running kernel or every older kernel.\nAfter the new kernel has passed testing and a known-good rollback kernel remains, preview obsolete install-only packages:\nsudo dnf remove --oldinstallonly --setopt installonly_limit=3 --assumeno Review the proposed transaction. If it preserves the running kernel, the default kernel, and a tested fallback, run it interactively without --assumeno:\nsudo dnf remove --oldinstallonly --setopt installonly_limit=3 Do not remove kernels by copying a version prefix into a broad wildcard command. That can remove the active kernel, dependencies, or the only bootable fallback.\nOptional: Test an ELRepo Kernel Use the distribution kernel whenever it supports the hardware. ELRepo describes its alternative kernels as a last resort for hardware testing and provides them without distribution support. They can expose the system to compatibility, security, performance, or data-integrity problems.\nkernel-lt follows an upstream long-term-support branch. kernel-ml follows the upstream mainline stable branch. Both install alongside the Rocky Linux kernel. Keep the Rocky Linux kernel and its boot entry intact.\nCheck Secure Boot Check the firmware state before installing an ELRepo kernel:\nsudo dnf install -y mokutil sudo mokutil --sb-state ELRepo states that kernel-lt and kernel-ml are not signed for Secure Boot. They will not boot under a standard Secure Boot policy. Do not disable Secure Boot merely to obtain a newer version number; use the supported distribution kernel unless there is a tested requirement and an approved signing or firmware policy.\nInstall the ELRepo Repository Import both current ELRepo RPM signing keys and install the EL9 repository package from its stable URL:\nsudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org sudo rpm --import https://www.elrepo.org/RPM-GPG-KEY-v2-elrepo.org sudo dnf install https://www.elrepo.org/elrepo-release-9.el9.elrepo.noarch.rpm sudo dnf update elrepo-release Display the enabled repository definition and available alternative kernels:\nsudo dnf repolist elrepo sudo dnf --disablerepo=\u0026#39;*\u0026#39; --enablerepo=elrepo-kernel list available \u0026#39;kernel-lt*\u0026#39; \u0026#39;kernel-ml*\u0026#39; Install One Kernel Family Install the long-term kernel for a conservative hardware test:\nsudo dnf --enablerepo=elrepo-kernel install kernel-lt Alternatively, install the mainline stable kernel when the required support is unavailable in kernel-lt:\nsudo dnf --enablerepo=elrepo-kernel install kernel-ml Do not install both without a specific test plan. If an out-of-tree module must be compiled, install the matching kernel-lt-devel or kernel-ml-devel package rather than the similarly named headers package:\nsudo dnf --enablerepo=elrepo-kernel install kernel-lt-devel Replace kernel-lt-devel with kernel-ml-devel when testing kernel-ml.\nSelect and Test the ELRepo Kernel List the new boot entry and copy its exact kernel path:\nsudo grubby --info=ALL Set the selected ELRepo kernel as the default:\nsudo grubby --set-default /boot/vmlinuz-ELREPO_VERSION.ARCH sudo grubby --default-kernel Replace ELREPO_VERSION.ARCH with the exact installed filename. Reboot and verify:\nsudo systemctl reboot After the host returns:\nuname -r systemctl --failed sudo journalctl -b -p err..alert --no-pager An ELRepo kernel version normally contains .el9.elrepo. Test every required service and device before considering it usable.\nReturn from ELRepo to the Distribution Kernel List the boot entries, select the exact Rocky Linux kernel path, and reboot:\nsudo grubby --info=ALL sudo grubby --set-default /boot/vmlinuz-ROCKY_VERSION.ARCH sudo grubby --default-kernel sudo systemctl reboot Confirm that the running kernel is the distribution build before removing ELRepo packages:\nuname -r rpm -qf /boot/vmlinuz-$(uname -r) Remove only the ELRepo kernel family that is no longer required:\nsudo dnf remove \u0026#39;kernel-lt*\u0026#39; For a mainline test, use:\nsudo dnf remove \u0026#39;kernel-ml*\u0026#39; Review the removal transaction before accepting it. Never remove the ELRepo kernel while it is still running, and never remove the remaining distribution kernel packages.\nTroubleshooting The New Kernel Does Not Appear in GRUB Confirm that the package and boot files exist:\nrpm -q kernel-core --last ls -l /boot/vmlinuz-* /boot/loader/entries/ sudo grubby --info=ALL Inspect the package transaction and kernel installation logs before manually rebuilding GRUB:\nsudo dnf history info last sudo journalctl -b --no-pager | grep -Ei \u0026#39;kernel-install|grub|dracut\u0026#39; Enterprise Linux 9 normally manages Boot Loader Specification entries automatically. Do not overwrite EFI loader files with commands copied from older RHEL or CentOS releases.\nA Required Module Is Missing Identify the device and expected module:\nlspci -nnk modinfo MODULE_NAME Replace MODULE_NAME with the required module. Boot the known-good kernel, then install or rebuild the matching signed module package. Do not force-load an incompatible module.\nThe System Boots but Networking or Storage Fails Boot the previous kernel from GRUB, make it the default with grubby, and collect logs from the failed boot:\nsudo journalctl --list-boots sudo journalctl -b -1 -k --no-pager The -1 boot is usually the immediately previous boot, but confirm the boot list before relying on that index.\n","date":"2020-07-11T22:14:00-04:00","permalink":"/p/safely-update-the-linux-kernel-on-rocky-linux-9/","title":"Safely Update the Linux Kernel on Rocky Linux 9"},{"content":"ZeroTier\nZeroTier Quickstart\nZeroTier Downloads\nPlan the Network ZeroTier creates encrypted virtual Ethernet networks between authorized devices. Each device receives a 10-character node address, and each network has a 16-character network ID.\nThis guide uses the following examples:\nZeroTier network: 10.147.20.0/24 Linux member: 10.147.20.10 Windows member: 10.147.20.20 Optional physical LAN behind the Linux member: 192.168.50.0/24 Select a ZeroTier subnet that does not overlap any LAN, VPN, container, or cloud network used by the members. Overlapping routes are a common cause of traffic going through the wrong interface.\nA network ID identifies a network but does not authorize a member. Keep the network private and approve only node addresses that you have verified. Never publish identity.secret, authtoken.secret, or a ZeroTier Central API token.\nCreate a Private Network Sign in to ZeroTier Central. Create an organization and network if they do not already exist. Keep the network private so new members require authorization. Copy the 16-character network ID. Configure an IPv4 auto-assignment pool inside a unique private subnet, such as 10.147.20.0/24. Leave default-route and public-address management disabled unless the network is intentionally designed as a full-tunnel VPN. The Central interface may label these settings differently as it evolves, but the network ID, member authorization, managed IPs, and managed routes remain the relevant controls.\nInstall ZeroTier on Linux ZeroTier\u0026rsquo;s installer supports common Debian, Ubuntu, Fedora, RHEL, and compatible distributions. Download the script from the official site to a file so it can be inspected before it runs:\ncurl -fsSL https://install.zerotier.com -o /tmp/install-zerotier.sh less /tmp/install-zerotier.sh sudo bash /tmp/install-zerotier.sh rm /tmp/install-zerotier.sh The installer configures ZeroTier\u0026rsquo;s package repository and installs zerotier-one. Future updates should come through the operating system\u0026rsquo;s package manager:\nsudo apt update \u0026amp;\u0026amp; sudo apt upgrade zerotier-one On a DNF-based distribution, use:\nsudo dnf upgrade zerotier-one Enable the service and confirm that the node is online:\nsudo systemctl enable --now zerotier-one.service sudo systemctl status zerotier-one.service --no-pager sudo zerotier-cli info A healthy node normally reports ONLINE. Record the 10-character node address shown by zerotier-cli info; use it to identify the correct member in Central.\nJoin the Network from Linux Join the private network, replacing NETWORK_ID with its 16-character ID:\nsudo zerotier-cli join NETWORK_ID The command should return 200 join OK. List the network state:\nsudo zerotier-cli listnetworks Before authorization, a private network normally reports ACCESS_DENIED or REQUESTING_CONFIGURATION. This does not mean that the installation failed.\nInstall and Join on Windows Download the Windows installer from the official ZeroTier download page. Run the signed installer and allow the ZeroTier service and virtual network adapter to be installed. Open the ZeroTier system-tray application and select Join New Network. Enter the same 16-character network ID. The same operation can be performed from Windows Terminal opened as an administrator:\nzerotier-cli join NETWORK_ID zerotier-cli listnetworks zerotier-cli info Check the Windows service independently of the tray application:\nGet-Service -Name ZeroTierOneService The background service provides the network connection. The tray application is only a user interface for controlling that service.\nAuthorize the Members Return to the network in ZeroTier Central:\nOpen the member list. Match each pending member\u0026rsquo;s node address with the value reported by zerotier-cli info on that device. Give the member a descriptive name. Authorize the member. Confirm its automatically assigned managed IP, or assign a fixed managed IP inside the configured subnet. Do not authorize a member based only on when it appeared in the list. Verify the node address on the device itself.\nAfter authorization, check each client again:\nsudo zerotier-cli listnetworks The network should report OK, display a virtual interface name such as ztabcdef12, and show at least one managed IP address.\nSet the Client Route Policy For an ordinary split-tunnel network, allow private managed addresses and routes while rejecting public and default routes:\nsudo zerotier-cli set NETWORK_ID allowManaged=1 sudo zerotier-cli set NETWORK_ID allowGlobal=0 sudo zerotier-cli set NETWORK_ID allowDefault=0 sudo zerotier-cli set NETWORK_ID allowDNS=0 Run the equivalent commands from an elevated Windows Terminal without sudo.\nallowManaged=1 accepts ZeroTier-managed private IP addresses and routes. allowGlobal=0 rejects managed routes for public address ranges. allowDefault=0 prevents this network from replacing the system\u0026rsquo;s default route. allowDNS=0 prevents this network from changing system DNS settings. Enable allowDNS, allowGlobal, or allowDefault only when the corresponding Central configuration is intentional and trusted. A full-tunnel or exit-node design also requires a correctly configured router; changing the client flag alone is insufficient.\nTest Connectivity On Linux, inspect the managed address and route:\nip -brief address ip route Ping another member\u0026rsquo;s managed IP rather than the current device\u0026rsquo;s own address:\nping -c 4 10.147.20.20 On Windows, test the Linux member:\nTest-Connection -ComputerName 10.147.20.10 -Count 4 Test-NetConnection -ComputerName 10.147.20.10 -Port 22 Successful ping proves basic IP connectivity. A failed application connection with successful ping usually indicates that the service is not listening or a host firewall is blocking its port.\nRestrict Services to the ZeroTier Network The ZeroTier interface behaves like another LAN interface and remains subject to the host firewall. Permit only the services that members need.\nFor example, allow SSH to an Ubuntu host only from the example ZeroTier subnet:\nsudo ufw allow from 10.147.20.0/24 to any port 22 proto tcp comment \u0026#39;SSH over ZeroTier\u0026#39; sudo ufw status verbose To allow RDP on a Windows member only from the same subnet, run this in an elevated PowerShell session:\nNew-NetFirewallRule -DisplayName \u0026#39;RDP over ZeroTier\u0026#39; -Direction Inbound -Action Allow -Protocol TCP -LocalPort 3389 -RemoteAddress 10.147.20.0/24 -Profile Any Create a rule only when the corresponding service is enabled and intended for ZeroTier members. Network authorization does not replace service authentication, host firewalls, updates, or strong account credentials.\nOptional: Route to a Physical LAN A ZeroTier member can route remote clients to a physical subnet without installing ZeroTier on every LAN device. Routed mode is easier to reason about than an Ethernet bridge and avoids extending broadcast traffic.\nThis example assumes:\nRouter\u0026rsquo;s ZeroTier IP: 10.147.20.10 Router\u0026rsquo;s physical IP: 192.168.50.5 Physical LAN: 192.168.50.0/24 ZeroTier interface: ztabcdef12 Physical interface: eth0 In ZeroTier Central, add this managed route:\n192.168.50.0/24 via 10.147.20.10 On the Linux router, enable IPv4 forwarding persistently:\nsudoedit /etc/sysctl.d/99-zerotier-forwarding.conf Add:\nnet.ipv4.ip_forward=1 Apply the setting:\nsudo sysctl --system If UFW manages the router, allow forwarding in both directions with the actual interface names:\nsudo ufw route allow in on ztabcdef12 out on eth0 from 10.147.20.0/24 to 192.168.50.0/24 sudo ufw route allow in on eth0 out on ztabcdef12 from 192.168.50.0/24 to 10.147.20.0/24 Finally, add a route on the physical LAN\u0026rsquo;s gateway so LAN devices can return traffic to ZeroTier members:\n10.147.20.0/24 via 192.168.50.5 The exact gateway procedure depends on the router. Without this return route, connections initiated from ZeroTier may reach the LAN device but replies will use the wrong gateway. NAT can avoid a return route but hides the original client addresses and should be a deliberate design choice.\nFirewall and NAT Requirements ZeroTier uses UDP hole punching. For the best chance of direct peer connections:\nPermit outbound UDP to arbitrary destination ports when policy allows. Permit established return traffic. Allow local ZeroTier traffic on UDP 9993. Avoid symmetric NAT, double NAT, and wireless client isolation when possible. Do not configure manual router port forwarding merely for a normal client installation. ZeroTier listens on UDP 9993 and additional high-numbered UDP ports. Restricting it to relay paths can increase latency and reduce throughput.\nOn a UFW-managed Linux endpoint, allow the standard ZeroTier transport port:\nsudo ufw allow 9993/udp comment \u0026#39;ZeroTier transport\u0026#39; Troubleshooting The CLI Cannot Reach the Service On Linux, inspect and restart the service:\nsudo systemctl status zerotier-one.service --no-pager sudo journalctl -u zerotier-one.service -b --no-pager sudo systemctl restart zerotier-one.service On Windows, use an elevated terminal:\nGet-Service -Name ZeroTierOneService Restart-Service -Name ZeroTierOneService The Network Reports Access Denied Compare the node address from zerotier-cli info with the pending member in Central, then authorize that exact member. If the member is already authorized, confirm that it has a managed IP and that the client joined the intended network ID.\nPeers Are Relayed Display the peer paths:\nsudo zerotier-cli peers sudo zerotier-cli info -j DIRECT is the preferred peer path. Many RELAY paths, TUNNELED status, or active TCP fallback indicate that UDP is blocked or NAT traversal is failing. Review the ZeroTier router guidance before changing firewall or NAT behavior.\nPing Works but an Application Does Not Confirm that the application listens on the expected address and port. On Linux:\nsudo ss -lntup On Windows:\nGet-NetTCPConnection -State Listen | Sort-Object LocalPort Then check the host firewall and the application\u0026rsquo;s own access-control configuration.\nTraffic Uses the Wrong Interface Look for an overlapping or more-specific route:\nip route get 10.147.20.20 On Windows:\nGet-NetRoute -AddressFamily IPv4 | Sort-Object DestinationPrefix,RouteMetric Renumber the ZeroTier network when it overlaps a local or remote subnet. Route metrics cannot reliably solve identical-address conflicts.\nProtect the Node Identity On Linux, ZeroTier stores its state under /var/lib/zerotier-one; on Windows, it uses C:\\ProgramData\\ZeroTier\\One. The identity.secret file permits node impersonation, and authtoken.secret permits local control of the service.\nDo not copy one identity to several active machines. Copy identity files only as part of a controlled migration in which the original node is permanently stopped. Restrict access to the state directory and revoke an old or compromised member in Central.\nLeave or Disable the Network Leave the network before removing the software:\nsudo zerotier-cli leave NETWORK_ID sudo zerotier-cli listnetworks On Windows, run the same commands from an elevated terminal without sudo, or remove the network from the tray application\u0026rsquo;s network details.\nRevoke or delete the member in ZeroTier Central so an abandoned identity cannot reconnect later. To stop ZeroTier on a Linux system without uninstalling it:\nsudo systemctl disable --now zerotier-one.service ","date":"2020-06-23T21:19:40-04:00","permalink":"/p/build-a-private-network-with-zerotier-on-linux-and-windows/","title":"Build a Private Network with ZeroTier on Linux and Windows"}]