Commit Graph

1708 Commits

Author SHA1 Message Date
CanbiZ (MickLesk)
2708b36416 Fix container locale, TERM and tty sizing
Add a forced container env (_ct_env) exporting LC_ALL/LANG=C.UTF-8 and DEBIAN_FRONTEND to ensure commands (apt, sed, locale-gen, getent, tz setup) run reliably in fresh templates that lack generated locales. Use the env when running pct exec for locale setup, timezone symlink, DNS checks, and apt installs.

Improve terminal handling: set TERM=xterm-256color only for SSH sessions by appending a guarded block to /root/.bashrc, disable /etc/profile.d/vte.{sh,csh} by renaming them to avoid CSI 6n prompt garbage on LXC/noVNC consoles, and add /etc/profile.d/00-lxc-term-size.sh to force a sane stty rows/cols when the pseudo-tty reports 0x0. These changes prevent locale-related errors and stray CSI responses in LXC containers.
2026-04-27 14:24:28 +02:00
CanbiZ (MickLesk)
7a8b8e56ca Update install.func 2026-04-27 14:18:07 +02:00
CanbiZ (MickLesk)
b994f6a2c0 Improve LXC getty autologin handling
Configure both container-getty@1 and console-getty to auto-login root with unified agetty options, ensuring either Proxmox noVNC (/dev/tty1) or pct/serial (/dev/console) works. Add stable _agetty_opts, write per-service override files, enable console-getty on distros that need it, and reload systemd. Disable vte profile scripts to avoid cursor-query noise on first prompt, restart only active getty services to avoid duplicates, and create /root/.hushlogin to suppress login messages.
2026-04-27 14:13:41 +02:00
CanbiZ (MickLesk)
5334accd1c Support non-apt OS, fix sysvinit autologin
Refine LXC container bootstrap and sysvinit autologin handling.

- Fix case branch formatting and change Debian-family check to an elif to avoid logic fall-through.
- Add a non-apt branch for Fedora/Rocky/Alma/CentOS/openEuler/openSUSE/Arch/Gentoo that sets the container timezone from the host and ensures curl is installed via the appropriate package manager.
- Improve sysvinit (/etc/inittab) auto-login changes: use more robust sed patterns, append a console autologin entry via heredoc, signal init to reload inittab before killing getty processes, and target getty processes more precisely to ensure proper respawn with new settings.
2026-04-27 14:04:39 +02:00
CanbiZ (MickLesk)
582eb5c718 add compare 2026-04-27 13:57:46 +02:00
CanbiZ (MickLesk)
c0af703716 Set C.UTF-8 locale for apt-based containers
Suppress perl/apt locale warnings by configuring C.UTF-8 for apt-based systems. The script now exports DEBIAN_FRONTEND=noninteractive and LC_ALL/LANG/LANGUAGE=C.UTF-8 when PKG_MANAGER==apt, and appends LC_ALL and LANG to /etc/environment if not present. This addresses cases where a container inherits an ungenerated host locale (e.g. Devuan) and ensures C.UTF-8, which is always available, is used.
2026-04-27 13:56:46 +02:00
CanbiZ (MickLesk)
ac042d1388 fix preflight 2026-04-27 13:55:26 +02:00
CanbiZ (MickLesk)
796b79241c Add Arch Linux CT support and pacman integration
Add Arch Linux container support and integrate pacman into install utilities. New files: ct/archlinux.sh (container build/update script), install/archlinux-install.sh (install entrypoint), and json/archlinux.json (metadata). misc/install.func: detect_arch in detect_os, add pacman bootstrap, and implement pacman handlers for pkg_upgrade, pkg_install, pkg_remove, pkg_clean and package refresh; include openssh install path for pacman and provide a cleanup_lxc override to run pkg_clean. Enables creating/updating Arch Linux LXC containers and proper package manager handling.
2026-04-27 13:46:18 +02:00
CanbiZ (MickLesk)
bbd890bc3f Add telemetry pings & improve container install funcs
Bump Fedora template to 43 and enhance container installation tooling. Persist DIAGNOSTICS setting and introduce post_progress_to_api() to send lightweight telemetry pings from inside containers (fire-and-forget, enabled when DIAGNOSTICS=yes and RANDOM_UUID set). Harden package management flows: re-detect PKG_MANAGER when commands are missing, add apt mirror fallback logic (apt_update_safe) and more robust apt-cacher proxy parsing. Fix Debian 13 LXC root ownership bug (chown /) and add additional DNS/Git host checks (including api.github.com). Improve downloading and validation of tools.func, add multiple post_progress_to_api hooks to signal progress, and add two new install entrypoints (misc/main/install.func and misc/main/alpine-install.func) that consolidate network checks, OS updates, MOTD/SSH setup and container customization.
2026-04-27 13:40:30 +02:00
CanbiZ (MickLesk)
89095f3d5d trek: seed default admin, fix install and hooks
Seed a default admin account and harden the installer; update symlink behavior and LXC hook argument handling.

- Install: downgrade Node setup to 22, write ADMIN_EMAIL/ADMIN_PASSWORD into /opt/trek/server/.env for initial boot, chmod the file, wait for app health, then remove plaintext creds from the env and print the default admin credentials. Remove previous DB patching script and credentials file generation. Add health-check failure handling.
- ct/trek.sh: check for /opt/trek instead of ~/.trek, run npm ci without --production, and recreate server data/uploads by removing any existing dirs and creating explicit symlinks.
- Installer: mirror symlink strategy used in the container (rm then ln -s) and ensure generated ENCRYPTION_KEY note; add ADMIN_EMAIL default.
- json: set default username to admin@trek.local, update notes about seeded admin, ENCRYPTION_KEY storage, and APP_URL recommendation.
- tools/pve/lxc-prehook.sh: fix append_unique_line_in_ct to pass positional arguments into the bash -c snippet safely (avoid parent-shell expansion).

These changes ensure a reproducible default admin creation flow without leaving plaintext credentials, improve symlink handling, and fix a bug in the LXC prehook.
2026-04-24 09:52:03 +02:00
Michel Roegl-Brunner
587f9f9b0e Add generated mode 2026-04-07 16:09:52 +02:00
MickLesk
f7258d5268 fix(fleet,mysql): switch Fleet to MariaDB, add mysql case to manage_tool_repository
- fleet: use setup_mariadb instead of setup_mysql (MariaDB works fine for
  Fleet and avoids MySQL repo complexity on trixie)
- tools.func: add missing mysql) case block to manage_tool_repository
  (was causing 'Unknown tool repository: mysql' error)
2026-04-05 18:35:51 +02:00
MickLesk
363df9ddac fix(otbr,kan,mysql): OTBR vendor/model/socat/web binding, Kan build env vars, MySQL trixie support
- openthread-br: add socat dep for TCP adapters, add --vendor-name/--model-name
  (mandatory), bind REST API to 0.0.0.0:8081, configure otbr-web to listen on
  all interfaces, update TCP example with socat forkpty pattern
- kan: export BETTER_AUTH_SECRET and POSTGRES_URL before build (required by
  @t3-oss/env-nextjs zod validation at build time)
- mysql: remove MariaDB-on-trixie workaround (MySQL repo now has trixie packages),
  update GPG key from RPM-GPG-KEY-mysql-2023 to RPM-GPG-KEY-mysql-2025
2026-04-05 18:26:11 +02:00
MickLesk
63ae2eb8d4 fix(tools): use MariaDB on Debian trixie instead of MySQL repo
MySQL APT repo GPG key (RPM-GPG-KEY-mysql-2023) expired 2025-10-22
and no trixie packages exist. Use distro MariaDB which is a drop-in
replacement and natively available.
2026-04-04 23:33:17 +02:00
MickLesk
062a6f85fb fix(tools): don't use $STD for npm self-update
silent() hard-exits on non-zero rc, so the || fallback never
executes. Use plain redirect instead so npm update failures are
non-fatal as intended.
2026-04-04 23:30:45 +02:00
CanbiZ (MickLesk)
441158b195 Standardize mirror messaging; simplify apt update
Replace inconsistent msg_info calls with msg_warn for mirror-list warnings and msg_custom for "Attempting mirror" lines to unify output formatting in misc/build.func and misc/install.func. Simplify tools/pve/update-lxcs-cron.sh by removing the long mirror-probing block and using a straightforward apt-get update + noninteractive dist-upgrade (and cleanup of EXTERNALLY-MANAGED) in containers to reduce complexity and improve maintainability.
2026-03-26 16:32:25 +01:00
CanbiZ (MickLesk)
dd911670e1 Enhance apt/apk mirror fallback logic
Improve package mirror resiliency in misc/build.func and misc/install.func by adding fallback and detection logic for Debian/Ubuntu and Alpine CDNs. Changes include:

- Detect distro (debian vs ubuntu) and use appropriate mirror lists and primary mirror (ftp.debian.org vs archive.ubuntu.com).
- Add retry loops that try a shuffled list of regional mirrors, test connectivity, update repo files, and attempt package installs/updates again.
- For Alpine (apk) installs and updates, try alternate mirrors on failure, write /etc/apk/repositories, and surface clearer warnings/errors if all mirrors fail.
- Update interactive prompts and informational messages to reference the correct mirror list (Ubuntu vs Debian) and generalize prompt wording.
- Improve exit handling so failures are reported and abort the process when necessary.

These changes make automated installs more robust against CDN sync issues and unreachable primary mirrors.
2026-03-26 16:04:48 +01:00
CanbiZ (MickLesk)
937fd1cad4 Improve apt mirror logging and error messages
Standardize and clarify apt mirror diagnostics in misc/build.func and misc/install.func: update warning phrasing when apt-get update fails; change per-mirror failure messages from "Mirror X: <reason>" to "Mirror X failed (<reason>)"; change success messages to "CDN set to <mirror>: tests passed"; and add informational logs like "Attempting mirror: <mirror>" when trying alternate mirrors. These changes improve visibility into mirror selection and failure reasons during package update/installation.
2026-03-26 15:44:58 +01:00
CanbiZ (MickLesk)
5f25ce38b2 Report failing APT mirror on update failure
When apt-get update fails, capture and display the failing mirror host to aid debugging. Adds grep-based extraction of the upstream host (from /etc/apt/sources.list.d/debian.sources or /etc/apt/sources.list) with a fallback to "unknown", and includes the host in the warning/echo. Applied to misc/build.func (inside pct exec), misc/install.func (pkg_update), and tools/pve/update-lxcs-cron.sh.
2026-03-26 15:42:43 +01:00
CanbiZ (MickLesk)
92648bca13 Simplify mirror logs and use http for custom mirror
Reduce noisy mirror-related output and clarify messages across misc/build.func and misc/install.func. Reword various apt/mirror status lines (hash mismatch, SSL/certificate, apt-get update failed, package install failed) and standardize success to "Using mirror"/msg_ok. Remove verbose scan/try/skip/count logs and suppression of detailed apt output to make output cleaner for automated runs. Also change the custom_mirror sed replacement to use http:// instead of https:// to support non-HTTPS local mirrors.
2026-03-26 15:20:55 +01:00
CanbiZ (MickLesk)
f8ca562da6 Detect apt SSL errors and use http mirrors
Add explicit detection of SSL/certificate errors when running apt-get update and treat those mirrors as failed (logs a short SSL error snippet and returns failure). Change mirror URL rewrites to use http:// instead of https:// when substituting mirror hosts, and remove ftp.in.debian.org from the AP mirror lists. Changes applied to misc/build.func (try_mirrors) and misc/install.func (pkg_update/_try_apt_mirror) to improve mirror fallback behavior and error reporting.
2026-03-26 15:12:43 +01:00
CanbiZ (MickLesk)
cd1c412822 Try global mirrors first; add apt fallback
Reorder mirror probing in misc/build.func and misc/install.func to scan global (OTHERS) mirrors first and fall back to regional mirrors—pick up to 3 random reachable mirrors and try them. Rename related variables accordingly and keep the fallback logic intact. Update tools/pve/update-lxcs-cron.sh to define region-specific Debian mirror lists, detect container timezone to pick regional vs other mirrors, and implement a fallback loop that checks mirror connectivity, rewrites APT URIs to use a working mirror, and retries apt-get update before proceeding with dist-upgrade. These changes improve resilience against local CDN/local-regional outages by preferring globally reachable mirrors first and providing an automated mirror-switch fallback.
2026-03-26 14:52:03 +01:00
CanbiZ (MickLesk)
9db2169ee0 Improve apt mirror scanning and retry logic
Make APT mirror selection more robust by scanning for reachable mirrors and retrying installs with clearer failure reasons. In misc/build.func added mirror_exit, try_mirrors and scan_reachable helpers; prefer regional mirrors (pick up to 3), fall back to ftp.debian.org, then try global mirrors. Improved detection/reporting of hash mismatches vs apt-get errors and return codes, and use a short reachability TCP check before attempting updates. In misc/install.func added a reachable-mirror scan phase, count/report reachable mirrors, and provide clearer log messages when apt-get update/install fails. These changes aim to reduce failures caused by unreachable mirrors or CDN synchronization issues.
2026-03-26 14:46:27 +01:00
CanbiZ (MickLesk)
947a536351 Improve apt mirror selection and fallback
Refactor mirror logic in misc/build.func and misc/install.func to prefer regional Debian mirrors (detected from /etc/timezone), shuffle mirror lists, and include additional AP region hosts. Add quick TCP reachability checks, limit consecutive mirror failures, and surface clearer status messages. On repeated failures, prompt interactively for a custom mirror (with validation) and handle pct exec exit codes to present more informative errors and retry behavior.
2026-03-26 14:29:20 +01:00
CanbiZ (MickLesk)
76c79872e0 Fallback to alternate Debian mirrors on apt failure
When apt-get update fails, switch from disabling hash verification/insecure repos to trying a list of alternate Debian mirrors. Updated misc/build.func to iterate a curated mirror list, rewrite /etc/apt/sources.list* to point to each mirror, and attempt apt-get update/install until one succeeds (exiting with failure if all mirrors fail). Updated misc/install.func to perform a similar mirror-rotation loop and return an error if no mirror succeeds. Also adjusted warning/error messages to reflect the new behavior. This improves resilience against repo desyncs without enabling insecure apt settings.
2026-03-26 14:10:49 +01:00
CanbiZ (MickLesk)
6d213d511f Simplify APT retry logic and add insecure fallback
Replace the previous multi-step APT retry sequence (mirror swaps, sleeps, multiple retries) with a simpler fallback: on apt-get update failure disable Acquire::By-Hash, enable Acquire::AllowInsecureRepositories and attempt updates/installs using --allow-insecure-repositories/--allow-unauthenticated where needed. Restore secure settings and refresh lists afterwards, and preserve/propagate the original command exit status. Apply the same simplification in misc/build.func, misc/install.func and the Proxmox LXC cron updater (tools/pve/update-lxcs-cron.sh) to handle Debian repo desyncs more reliably and reduce complex retry logic.
2026-03-26 14:02:09 +01:00
CanbiZ (MickLesk)
a87cdd8b9e Update build.func 2026-03-26 13:50:55 +01:00
CanbiZ (MickLesk)
0f3a8c8406 Improve apt-get retry and mirror fallback
Add robust retry logic for APT operations in misc/build.func and misc/install.func. Introduces an apt_retry helper and multiple fallback steps: disable by-hash, switch to a country mirror (ftp.de.debian.org), wait and retry to allow mirror sync, and as a last resort temporarily relax APT verification to allow insecure repositories to complete updates. Ensures cleanup and restores secure settings where possible, with clearer failure handling and messages to increase resilience of package installation during container builds and installs.
2026-03-26 13:48:56 +01:00
CanbiZ (MickLesk)
66cd1fb05a Add APT by-hash bypass and mirror fallback
Improve APT retry logic to handle failures caused by by-hash/CDN issues. Both misc/build.func and misc/install.func now write an apt config to disable Acquire::By-Hash, remove /var/lib/apt/lists/* and retry apt-get update/install; if that still fails they substitute deb.debian.org with ftp.debian.org as a fallback. This makes container builds and package updates more robust against CDN/hash-related apt failures.
2026-03-26 13:33:58 +01:00
CanbiZ (MickLesk)
6614b65bc1 magicdns 2026-03-26 13:19:14 +01:00
CanbiZ (MickLesk)
785a215a50 base packages dns 2026-03-26 13:18:52 +01:00
CanbiZ (MickLesk)
ee15572375 Update install.func 2026-03-26 13:11:13 +01:00
CanbiZ (MickLesk)
6a5e7b88fd fix(tools.func): flat repo detection for suites ending with /
- setup_deb822_repo: skip Components for any suite ending with /
- Previously only skipped for exactly './' but 'stable/' is also flat
- Fixes Jitsi repo producing 'Malformed entry (absolute Suite Component)'
2026-03-25 12:41:33 +01:00
CanbiZ (MickLesk)
f95260387c move json 2026-03-25 10:30:56 +01:00
MickLesk
96fc169f4b fix(build): prevent error handler crash from pipefail on grep
The missing_cmd grep pipeline in the install error handler runs
under set -o pipefail. When grep finds no match (exit 1), the
entire pipeline fails and triggers the ERR trap recursively,
crashing the recovery menu. Add || true to suppress this.
2026-03-21 19:16:33 +01:00
CanbiZ (MickLesk)
7ab160ff75 gitea sync 2026-03-18 14:58:47 +01:00
CanbiZ (MickLesk)
aaaf18de91 switch urls back to github (due slow gitea syncs) 2026-03-18 14:47:29 +01:00
CanbiZ (MickLesk)
4b0fcf7d9d Update print statement from 'Hello' to 'Goodbye' 2026-03-18 12:36:33 +01:00
CanbiZ (MickLesk)
b056d30f9d fixes pg_cron 2026-03-16 16:57:55 +01:00
CanbiZ (MickLesk)
7d411e30d7 fixes 2026-03-16 16:50:49 +01:00
CanbiZ (MickLesk)
b8c147ebfc fixes 2026-03-12 14:27:06 +01:00
CanbiZ (MickLesk)
ec875e6e62 Run app install live during image build
Change VM app deployer to run CT install scripts during image customization (virt-customize --run) instead of via a first-boot systemd service. Updated docs to reflect live installation, new update workflow (curl the ct/<app>.sh inside the VM), and new troubleshooting/reinstall guidance. misc/vm-app.func now injects function libs, runs a temporary wrapper inside virt-customize (with logging and error handling), removes the first-boot service and update wrapper injection, and updates summary/status messages to mark apps as pre-installed.
2026-03-12 09:43:43 +01:00
CanbiZ (MickLesk)
be8e4483fc Update vm-app.func 2026-03-12 09:22:12 +01:00
CanbiZ (MickLesk)
19cc18037c vm app-deployer 2026-03-12 09:06:41 +01:00
tremor021
2afbe78348 Add fetch_and_deploy_gl_release 2026-03-04 12:34:52 +01:00
CanbiZ (MickLesk)
fdc30949e3 feat(preflight): add enterprise repo subscription check
- New preflight_repo_access() warns if enterprise repos are active without subscription
- Scans /etc/apt/sources.list.d/ for enterprise.proxmox.com entries
- Tests HTTP access (detects 401/403 Unauthorized)
- Warning only — not a blocker (packages come from pve-no-subscription repo)
2026-03-03 14:42:59 +01:00
CanbiZ (MickLesk)
d242100531 refactor(preflight): move to install_script, clean UX flow
- Move run_preflight from build_container() into install_script() after header_info
- Shows: Header → preflight checks → 2s pause → clear (via next header_info call)
- On failure: show summary + exit cleanly (no ERR trap)
- Change all return 1 → return 0 in preflight functions (prevents ERR trap under set -Ee)
- Remove PREFLIGHT_DONE guard from build_container (no longer needed)
2026-03-03 14:10:03 +01:00
CanbiZ (MickLesk)
4254e15bba Update build.func 2026-03-03 14:06:26 +01:00
CanbiZ (MickLesk)
c35cfb59fb Update build.func 2026-03-03 13:51:20 +01:00
CanbiZ (MickLesk)
e29561e401 Update build.func 2026-03-03 13:40:40 +01:00