### Installation Environment Readiness Output Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Example output indicating the status and accessibility of the installation environment. ```text **** Initializing Installation Environment **** Network: [IP configuration] SSH: Available on [IP]:[port] Logs: http://[IP]:[web-port]/ ``` -------------------------------- ### Kernel Command Line Parameters Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Shows example boot parameters passed to the kernel during the installation environment boot. ```text root=/dev/sda1 ro quiet console=ttyS0,115200 [network parameters] [installation flags] ``` -------------------------------- ### Setup Nginx Web Server Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Starts the Nginx web server to serve installation logs via HTTP. It listens on a configurable port, defaulting to 80 or 8080. ```bash setup_nginx() ``` -------------------------------- ### Check Windows Setup Error Log Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md If the installation hangs at 'Installing Windows', SSH into the system and check the setuperr.log file for errors. ```powershell Get-Content C:\Windows\Panther\setuperr.log ``` -------------------------------- ### Commonly Used Image Names for OS Installation Source: https://github.com/bin456789/reinstall/blob/main/README.en.md These are examples of image names that can be used with the `--image-name` flag to specify the desired system edition during installation. The names are case-insensitive. ```text Windows 7 Ultimate ``` ```text Windows 11 Pro ``` ```text Windows 11 Enterprise LTSC 2024 ``` ```text Windows Server 2025 SERVERDATACENTER ``` -------------------------------- ### Minimal Ubuntu Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Perform a minimal installation of Ubuntu. ```bash bash reinstall.sh ubuntu 24.04 --minimal ``` -------------------------------- ### Install Ubuntu with Custom Credentials Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Install Ubuntu with custom username, password, and SSH port. ```bash bash reinstall.sh ubuntu 22.04 \ --username alice \ --password "secure123" \ --ssh-port 2222 ``` -------------------------------- ### Install Appropriate Drivers Post-Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md If hypervisor detection fails, install the appropriate drivers after the system is installed. This ensures optimized performance. ```bash Warning: Unable to detect virtualization platform ``` -------------------------------- ### Conditionally Setup Web Service Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Conditionally starts a web service based on available RAM. It checks if there is sufficient memory to avoid Out-Of-Memory errors on constrained systems. ```bash setup_web_if_enough_ram() ``` -------------------------------- ### SSH Access to Installation Environment Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Demonstrates how to connect to the installation environment via SSH using provided credentials. ```bash ssh root@[server-ip] -p [port] # Credentials from --username/--password ``` -------------------------------- ### Install Windows Server with Drivers Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Install Windows Server specifying the image name, language, and adding custom drivers. ```bash bash reinstall.sh windows \ --image-name "Windows Server 2022 SERVERDATACENTER" \ --lang en-us \ --add-driver /path/to/virtio-drivers/ ``` -------------------------------- ### Setup with Network Isolation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Configure a server installation with network isolation by providing a Frp client configuration URL and an SSH public key for secure access. ```bash bash reinstall.sh ubuntu 22.04 \ --frpc-config https://tunnel.example.com/config.toml \ --ssh-key /root/.ssh/id_ed25519.pub ``` -------------------------------- ### Basic Alpine Linux Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/00-index.md Installs the Alpine Linux distribution version 3.24. Use this command for a standard Alpine setup. ```bash bash reinstall.sh alpine 3.24 ``` -------------------------------- ### Basic Ubuntu Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Installs Ubuntu 22.04 using the reinstall script. This is the most basic usage scenario. ```bash bash reinstall.sh ubuntu 22.04 ``` -------------------------------- ### Access Installation Logs via SSH Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md Connect via SSH to a running installation to view the live installation log file. Ensure you have the correct IP address, port, and root credentials. ```bash ssh root@[ip] -p [port] tail -f /install.log ``` -------------------------------- ### Windows Entry Point Syntax Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Shows the basic syntax for invoking the installation script on Windows systems. ```bash .\reinstall.bat [COMMAND] [COMMAND_ARGS] [GLOBAL_OPTIONS] ``` -------------------------------- ### Download Kernel and Initrd Files Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Lists the typical files downloaded during the installation process, including the kernel, initrd, and optional firmware. These are essential for booting into the installation environment. ```text /reinstall-vmlinuz # Linux kernel (3-10 MB typical) /reinstall-initrd # Initial ramdisk filesystem (100-500 MB) /reinstall-firmware # Optional firmware blob (if needed) ``` -------------------------------- ### Viewing Installation Logs Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Access the installation log file via SSH to debug issues during a failed installation. This command tails the log in real-time. ```bash tail -f /install.log ``` -------------------------------- ### Linux Entry Point Syntax Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Shows the basic syntax for invoking the installation script on Linux systems. ```bash bash reinstall.sh [COMMAND] [COMMAND_ARGS] [GLOBAL_OPTIONS] ``` -------------------------------- ### Windows ISO Installation (Manual URL) Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Installs Windows from an official ISO by providing a direct URL to the ISO file. Requires specifying the image name. ```bash bash reinstall.sh windows \ --image-name "Windows 11 Enterprise LTSC 2024" \ --iso "https://go.microsoft.com/fwlink/?linkid=2289029" ``` -------------------------------- ### Add Multiple Driver Directories for Windows Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md Inject drivers from multiple specified directories during Windows setup. The script recursively scans each directory for .inf files. ```bash --add-driver /drivers/virtio/ \ --add-driver /drivers/network/ \ --add-driver /drivers/storage/ ``` -------------------------------- ### Windows ISO Installation (Magnet Link) Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Installs Windows from an official ISO using a magnet link. Requires specifying the image name. ```bash bash reinstall.sh windows \ --image-name "Windows 11 Enterprise LTSC 2024" \ --iso "magnet:?xt=urn:btih:7352bd2db48c3381dffa783763dc75aa4a6f1cff" ``` -------------------------------- ### Add Driver Directory to Windows Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md Specify a directory to recursively scan for and inject drivers during Windows setup. ```bash --add-driver /path/to/driver/directory ``` -------------------------------- ### Install GRUB for Windows Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Installs GRUB modules and configuration files to the C: drive for Windows systems. Requires a Cygwin environment with GRUB tools and write access to the C: partition. ```bash install_grub_win() ``` -------------------------------- ### Set Next OS Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Sets the operating system for the next stage of installation. Use these commands to specify the distribution and version for both the installation environment and the final target OS. ```bash setos nextos [DISTRO] [VERSION] # Installation environment OS setos finalos [DISTRO] [VERSION] # Target OS ``` -------------------------------- ### Initrd Boot Sequence Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Outlines the steps executed by the initrd upon booting into the installation environment. ```text 1. Mount /proc, /sys, /dev 2. Load network drivers 3. Configure network (IP, gateway, DNS) 4. Start SSH service (if requested) 5. Execute trans.sh ``` -------------------------------- ### Example Linux Kernel Parameters Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/06-configuration-reference.md Standard kernel parameters assembled during installation. These control the root partition, read-only mounting, and log output suppression. ```bash root=/dev/sda1 # Root partition ro # Mount read-only quiet # Suppress log output [network parameters] # From network config [console settings] # ttyS0 for serial, etc. ``` -------------------------------- ### Upgrade Server Distro Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Perform a fresh install to upgrade your server's operating system, for example, from Ubuntu 20.04 to 22.04. SSH key can be provided using a GitHub alias or a local file path. ```bash bash reinstall.sh ubuntu 22.04 --ssh-key github:username ``` -------------------------------- ### New Installation Command Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/00-index.md Execute the reinstall script for a new installation on Ubuntu 22.04, specifying username and password. ```bash bash reinstall.sh ubuntu 22.04 --username admin --password "secure123" ``` -------------------------------- ### Standard EFI Windows Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md Use this command for a standard EFI boot installation of Windows. ```bash bash reinstall.sh windows --image-name "..." --iso "..." ``` -------------------------------- ### Windows ISO Installation (Automatic Discovery) Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Installs Windows from an official ISO using automatic discovery. Requires specifying the image name and optionally the language. ```bash bash reinstall.sh windows \ --image-name "Windows 11 Enterprise LTSC 2024" \ --lang zh-cn ``` -------------------------------- ### Install Ubuntu using ISO (Deprecated) Source: https://github.com/bin456789/reinstall/blob/main/README.en.md This deprecated command installs Ubuntu using an ISO image. It requires more than 1GB of memory and a dynamic IP. The username is 'root', password is '123@@@', and SSH port is '22'. Modifying these is not supported. ```bash bash reinstall.sh ubuntu --installer ``` -------------------------------- ### Install Debian using Cloud Image (Deprecated) Source: https://github.com/bin456789/reinstall/blob/main/README.en.md This deprecated command installs Debian using a cloud image, suitable for machines with slower CPUs. It is recommended to use the standard installation method if possible. ```bash bash reinstall.sh debian --ci ``` -------------------------------- ### Get Windows Image Info using wimlib Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md Use `wiminfo` to list available images within a Windows installation WIM file on Linux. ```bash wiminfo /path/to/install.wim 1 ``` -------------------------------- ### Hold Installation Environment Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Hold the installation at the environment stage. SSH into the system to verify network, then rerun without --hold to complete. ```bash bash reinstall.sh debian 12 --hold 1 # SSH into system, verify network # Rerun without --hold 1 to complete ``` -------------------------------- ### Migrate Linux to Windows Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Install Windows on a server by specifying the 'windows' target and providing an image name and language code. ```bash bash reinstall.sh windows --image-name "Windows Server 2022" --lang en-us ``` -------------------------------- ### Cloud-Init Data Path Configuration Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/06-configuration-reference.md Specifies the path or URL to cloud-init data for Linux installations. This data, including user-data and meta-data, is used to automate the setup of Linux images. ```bash --cloud-data /path/to/seed/ ``` ```bash --cloud-data https://example.com/seed/ ``` -------------------------------- ### Install Various Linux Distributions Source: https://github.com/bin456789/reinstall/blob/main/README.en.md Use this command to install a specified Linux distribution and version. Ensure you provide the correct distribution name and version number. Some distributions may have specific requirements or options. ```bash bash reinstall.sh anolis 7|8|23 rocky 8|9|10 oracle 8|9|10 almalinux 8|9|10 opencloudos 8|9|23 centos 9|10 fnos 1 fygoos 1 nixos 26.05 fedora 43|44 debian 9|10|11|12|13 opensuse 16.0|tumbleweed openeuler 20.03|22.03|24.03 alpine 3.21|3.22|3.23|3.24 ubuntu 18.04|20.04|22.04|24.04|26.04 [--minimal] kali arch gentoo aosc redhat --img="http://access.cdn.redhat.com/xxx.qcow2" ``` -------------------------------- ### Setup Lighttpd Web Server Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Sets up Lighttpd as an alternative lightweight HTTP server for serving logs. This is used as a fallback when Nginx is not available. ```bash setup_lighttpd() ``` -------------------------------- ### Mount Root Partition and Get Mount Point Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/03-bash-functions-api.md Demonstrates how to get the root partition device path and then find its corresponding mount point from /proc/mounts. ```bash root_part=$(get_os_part) mount_point=$(grep "$root_part" /proc/mounts | awk '{print $2}') ``` -------------------------------- ### Windows Installation with Driver Injection Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/00-index.md Installs Windows, specifying the image name and providing a path for additional drivers. Ensure the driver path is correct. ```bash bash reinstall.sh windows --image-name "Windows Server 2022" --add-driver /drivers/ ``` -------------------------------- ### Install Debian with SSH Key Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Install Debian using an SSH key for authentication and specify the SSH port. ```bash bash reinstall.sh debian 12 \ --ssh-key github:myusername \ --ssh-port 22 ``` -------------------------------- ### Setup WebSocket Daemon for Live Logs Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Sets up the WebSocket daemon (`websocketd`) for real-time log streaming to a web viewer. This provides live log updates. ```bash setup_websocketd() ``` -------------------------------- ### Ubuntu Installation with Custom Credentials and SSH Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Installs Ubuntu 22.04 with specified username, SSH key from GitHub, and a custom SSH port. Useful for automated deployments requiring specific user configurations. ```bash bash reinstall.sh ubuntu 22.04 \ --username admin \ --ssh-key github:myusername \ --ssh-port 2222 ``` -------------------------------- ### Install GRUB for Linux EFI Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Installs the GRUB EFI binary, configuration file, and modules to the EFI partition for Linux systems. Ensure the EFI mount point is correctly specified. ```bash install_grub_linux_efi() ``` -------------------------------- ### Install Linux Distributions Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Installs a specified Linux distribution and version. This command clears all disk data. Ensure you have the correct distribution and version number. ```bash bash reinstall.sh anolis 7|8|23 ``` ```bash bash reinstall.sh rocky 8|9|10 ``` ```bash bash reinstall.sh oracle 8|9|10 ``` ```bash bash reinstall.sh almalinux 8|9|10 ``` ```bash bash reinstall.sh centos 9|10 ``` ```bash bash reinstall.sh fnos 1 ``` ```bash bash reinstall.sh fygoos 1 ``` ```bash bash reinstall.sh nixos 26.05 ``` ```bash bash reinstall.sh fedora 43|44 ``` ```bash bash reinstall.sh debian 9|10|11|12|13 ``` ```bash bash reinstall.sh opensuse 16.0|tumbleweed ``` ```bash bash reinstall.sh openeuler 20.03|22.03|24.03 ``` ```bash bash reinstall.sh alpine 3.21|3.22|3.23|3.24 ``` ```bash bash reinstall.sh ubuntu 18.04|20.04|22.04|24.04|26.04 [--minimal] ``` ```bash bash reinstall.sh kali ``` ```bash bash reinstall.sh arch ``` ```bash bash reinstall.sh gentoo ``` ```bash bash reinstall.sh aosc ``` ```bash bash reinstall.sh redhat --img="http://access.cdn.redhat.com/xxx.qcow2" ``` -------------------------------- ### EFI Directory Structure Example Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Illustrates the typical directory layout within the EFI partition for bootloader files, including GRUB and netboot.xyz. ```tree [EFI_MOUNT]/EFI/ ├── reinstall/ │ ├── grub.cfg # GRUB configuration │ ├── grubx64.efi # GRUB EFI binary (x86-64) │ ├── grubaa64.efi # GRUB EFI binary (ARM64) │ ├── netboot.xyz.efi # netboot.xyz EFI (x86-64) │ └── netboot.xyz-arm64.efi # netboot.xyz EFI (ARM64) └── [other OS entries]/ # Original system EFI entries ``` -------------------------------- ### Access Filesystem During Failed Installation (PE) Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md Connect via SSH during a failed installation held in the Preinstallation Environment (PE) to access and inspect the target filesystem mounted at /os or /target. This allows for manual modifications before resuming or abandoning the installation. ```bash ssh root@[ip] # Mounted as /os or /target cd /os # Inspect/modify filesystem # Exit to resume installation ``` -------------------------------- ### Windows Bootloader Installation (UEFI/BIOS) Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Command to install the Windows bootloader using bcdboot, specifying the target system's firmware type (UEFI or BIOS). ```bash # Via PE environment during installation # bcdboot /s C: /f UEFI (or BIOS) # Optional: WinRE setup via reagentc ``` -------------------------------- ### Start System Service Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Starts a system service using systemctl or rc-service. It automatically handles service dependencies and waits for the service to be running. ```bash ensure_service_started SERVICE_NAME ``` -------------------------------- ### GPU/Display Issues on ARM64 Windows Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md A black screen during ARM64 Windows installation is normal. Wait for the installation to progress and check SSH connectivity. ```bash ConvertPages: failed to find range ``` -------------------------------- ### Windows Installation with Automatic Driver Injection Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Installs Windows using a specified image name and language, with automatic driver injection enabled. Suitable for deploying Windows on virtualized or specific hardware environments. ```bash bash reinstall.sh windows \ --image-name "Windows Server 2022 SERVERDATACENTER" \ --lang en-us ``` -------------------------------- ### Configure Network in initrd (Linux) Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Sets up network interfaces, including DHCP and static IP configuration, within the initial RAM disk environment during Linux installation. This script is crucial for network-aware installations. ```shell #!/bin/bash # initrd-network.sh # --- Network Detection --- find_network_interface() { # Logic to find active network interface echo "eth0" } get_ipv4_info() { # Logic to detect IPv4 address, netmask, gateway echo "192.168.1.100" echo "255.255.255.0" echo "192.168.1.1" } get_ipv6_info() { # Logic to detect IPv6 address, prefix, gateway echo "" } get_dns_servers() { # Logic to retrieve DNS servers echo "8.8.8.8" } # --- DHCP Configuration --- configure_dhcp() { local interface=$1 echo "Configuring DHCP for $interface..." # Logic to request IP via DHCP and parse response } # --- Static IP Configuration --- configure_static_ip() { local interface=$1 local ip_address=$2 local netmask=$3 local gateway=$4 local dns_servers=$5 echo "Configuring static IP for $interface..." # Logic to apply static IP, gateway, and DNS } # --- Main Execution --- INTERFACE=$(find_network_interface) # Example: Attempt DHCP first # configure_dhcp $INTERFACE # Example: Fallback to static IP if DHCP fails or is not desired # STATIC_IP="192.168.1.150" # NETMASK="255.255.255.0" # GATEWAY="192.168.1.1" # DNS="8.8.8.8 8.8.4.4" # configure_static_ip $INTERFACE $STATIC_IP $NETMASK $GATEWAY "$DNS" echo "Network configuration in initrd complete." ``` -------------------------------- ### DD Raw Image Installation with Tunnel Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/00-index.md Installs an operating system from a raw disk image using a tunnel for data transfer. Requires a valid image URL and FRPC configuration path. ```bash bash reinstall.sh dd --img "https://example.com/image.xz" --frpc-config /path/frpc.toml ``` -------------------------------- ### Windows Configuration Snippets Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Examples of configuration methods for passwords, SSH keys, network settings, hostname, and locale/timezone on Windows systems, often via unattend.xml. ```bash # Windows: Inject via unattend.xml, Base64-encoded ``` ```bash # Windows: Inject via unattend.xml or PowerShell script ``` ```bash # Windows: Network adapters via netsh or registry ``` ```bash # Windows: Registry via unattend.xml ``` ```bash # Windows: Regional settings via unattend.xml ``` -------------------------------- ### Check Cloud Image Method Enabled Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Checks if the cloud image installation method is enabled. Returns 0 if cloud image (qcow2) will be used, and 1 if the traditional installer will be used. ```bash is_use_cloud_image ``` -------------------------------- ### Netboot.xyz PXE Environment Boot Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Boots into the netboot.xyz PXE environment for manual OS selection via VNC. No automatic installation is performed. ```bash bash reinstall.sh netboot.xyz ``` -------------------------------- ### Install CentOS/AlmaLinux/Rocky/Fedora using ISO (Deprecated) Source: https://github.com/bin456789/reinstall/blob/main/README.en.md These deprecated commands install CentOS, AlmaLinux, Rocky, or Fedora using an ISO image. This method has specific requirements: more than 2GB of memory and a dynamic IP. The username is 'root', password is '123@@@', and SSH port is '22'. Modifying these is not supported. ```bash bash reinstall.sh centos --installer ``` ```bash bash reinstall.sh almalinux --installer ``` ```bash bash reinstall.sh rocky --installer ``` ```bash bash reinstall.sh fedora --installer ``` -------------------------------- ### Linux Configuration Snippets Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Examples of configuration file paths for passwords, SSH keys, network settings, hostname, locale, and timezone on Linux systems. ```bash # Linux: Store in /etc/shadow as SHA-512 crypt hash ``` ```bash # Linux: Write to /root/.ssh/authorized_keys (mode 600) ``` ```bash # Linux: /etc/network/interfaces or /etc/sysconfig/network-scripts/ ``` ```bash # Linux: /etc/hostname ``` ```bash # Linux: /etc/locale.gen, /etc/timezone ``` -------------------------------- ### Typical Usage Flow Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Follow these steps to download and run the reinstall script for a new OS installation. The script automates bootloader preparation, kernel downloads, and system reboots. ```bash curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh ``` ```bash bash reinstall.sh ubuntu 22.04 --username myuser --password mypass ``` -------------------------------- ### Migrate Windows to Linux Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Install a Linux distribution, such as Debian 12, on a server. A new password for the user can be set directly via the command line. ```bash bash reinstall.sh debian 12 --password newpass ``` -------------------------------- ### Recreate GRUB or Extlinux Configuration Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Recreates the bootloader configuration file for local GRUB or Extlinux installations. Use this when not relying on external bootloader management. ```bash recreate_grub_or_extlinux_cfg() ``` -------------------------------- ### Reset Command for Failed Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/00-index.md Use the reset command to clean up the system if a reinstall has failed and the system has not yet rebooted. ```bash bash reinstall.sh reset ``` -------------------------------- ### Add Specific Driver INF to Windows Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md Specify a single driver INF file to be injected during Windows setup. ```bash --add-driver /path/to/driver.inf ``` -------------------------------- ### Web Log Viewer HTML Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md The HTML and JavaScript file for the real-time installation progress viewer. Accessed via http://[server-ip]:[port]/. ```html ## logviewer.html - Web Log Viewer **Location:** `logviewer.html` (4587 lines) **Format:** HTML + JavaScript **Purpose:** Real-time installation progress viewing **Features:** - Live log scrolling - Auto-refresh capability - Responsive design - Works in any modern browser **Accessed:** `http://[server-ip]:[port]/ ` ``` -------------------------------- ### frpc TOML Configuration Example Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/06-configuration-reference.md This TOML file configures the frpc client, specifying server connection details and tunnel settings for services like SSH. It's used during installation to provide network access to isolated environments. ```toml [common] server_addr = relay.example.com server_port = 7000 token = your-secret-token [ssh] type = tcp local_ip = 127.0.0.1 local_port = 22 remote_port = 2222 ``` -------------------------------- ### DD Raw Image Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/02-installation-commands.md Writes a raw disk image to storage. Supports various compressed formats. Ensure the image URL is correct. ```bash bash reinstall.sh dd --img "https://example.com/xxx.xz" ``` -------------------------------- ### Remove Previous Installation Artifacts Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Cleans up artifacts from a previous installation, including boot entries, temporary files, and installation media mounts. ```bash clear_previous ``` -------------------------------- ### Check for DD Installation Configuration Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/03-bash-functions-api.md Use this function to determine if the system is configured for a raw disk image (DD) installation. It helps in conditionally displaying specific tips for DD installations. ```bash is_use_dd ``` ```bash if is_use_dd; then show_dd_password_tips fi ``` -------------------------------- ### Package Installation Failure Error Message Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md This error message appears when the script fails to install a required package. Check network connectivity, package availability, disk space, and try manual installation. ```text ***** ERROR ***** Can't install [package] ``` -------------------------------- ### RHEL/CentOS/Fedora System Update Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Update installed packages on RHEL, CentOS, or Fedora systems after installation. ```bash yum update ``` -------------------------------- ### BIOS Boot Flow Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Illustrates the sequence of components involved in booting from BIOS. ```text BIOS → GRUB/extlinux → kernel (vmlinuz) → initrd ``` -------------------------------- ### Arch System Update Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Update package lists and upgrade installed packages on Arch Linux systems after installation. ```bash pacman -Syu ``` -------------------------------- ### Install Windows with Manual ISO Link Source: https://github.com/bin456789/reinstall/blob/main/README.en.md Specify a direct download link for the Windows ISO when automatic search is not suitable. The --iso parameter accepts a direct URL or a magnet link. The --image-name can be a placeholder if the exact name is unknown. ```bash bash reinstall.sh windows \ --image-name "Windows 11 Enterprise LTSC 2024 Evaluation" \ --iso "https://go.microsoft.com/fwlink/?linkid=2289029" ``` ```bash bash reinstall.sh windows \ --image-name "Windows 11 Enterprise LTSC 2024" \ --iso "magnet:?xt=urn:btih:7352bd2db48c3381dffa783763dc75aa4a6f1cff" ``` -------------------------------- ### Alpine System Update Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Update package lists and upgrade installed packages on Alpine Linux systems after installation. ```bash apk update && apk upgrade ``` -------------------------------- ### Debian/Ubuntu System Update Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Update package lists and upgrade installed packages on Debian or Ubuntu systems after installation. ```bash apt update && apt upgrade ``` -------------------------------- ### Windows BIOS Boot Entry Creation with BCDEdit Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Demonstrates how to create a Windows BIOS boot entry using the `bcdedit` command, specifying the bootloader path. ```cmd bcdedit /create {1c41f649-1637-52f1-aea8-f96bfebeecc8} /d "Reinstall" /application bootsector bcdedit /set {1c41f649-1637-52f1-aea8-f96bfebeecc8} device partition=C: bcdedit /set {1c41f649-1637-52f1-aea8-f96bfebeecc8} path \grub\grub.exe ``` -------------------------------- ### EFI Boot Flow Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Illustrates the sequence of components involved in booting from EFI. ```text EFI firmware → GRUB EFI binary → kernel → initrd ``` -------------------------------- ### Linux EFI Bootloader Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Commands to install the GRUB bootloader for a Linux EFI system and configure the UEFI boot entry. ```bash grub-install --efi-directory=/boot/efi /dev/sdX efibootmgr --create --label "[OS]" --loader '\EFI\[distro]\grubx64.efi' ``` -------------------------------- ### Linux Filesystem Creation (GPT/MBR) Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Commands to detect the target disk, zap existing partition tables (GPT or MBR), and format partitions for a Linux installation. Assumes partitions are already created. ```bash # Detect disk disk=$(find_main_disk) # Create partition table sgdisk --zap-all "$disk" # For EFI/GPT parted --script "$disk" mklabel msdos # For BIOS/MBR # Create partitions # Boot partition (if needed): ~200-500 MB # Root partition: remaining space # Swap: none (maximize space) # Format partitions mkfs.ext4 /dev/sdX1 ``` -------------------------------- ### Check for Cloud Image Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/03-bash-functions-api.md This function checks if the installation method is configured to use a cloud image. Use this to conditionally download cloud images. ```bash is_use_cloud_image ``` ```bash if is_use_cloud_image; then download_cloud_image "$url" fi ``` -------------------------------- ### Check Available RAM Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Checks the available RAM on the system. This function is used to determine the installation method, such as using a cloud image or a traditional installer. ```bash check_ram() # Detect available RAM via wmic (Windows) or /proc/meminfo (Linux) ``` -------------------------------- ### Re-attempt Reinstall After Cleanup Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md After a failed installation, first run the reset command to clean up previous attempts, then re-run the reinstall script with the desired distribution, version, and options. Skipping the reset may lead to conflicts. ```bash # First, clean up bash reinstall.sh reset # Then retry bash reinstall.sh [distro] [version] [options] ``` -------------------------------- ### Project Structure Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Overview of the directory and file structure for the Project Reinstall tool. ```text reinstall/ ├── README.md, README.en.md # Project overview ├── reinstall.sh (5,208 lines) # Main orchestration script (Linux/Unix entry) ├── reinstall.bat (247 lines) # Windows entry point ├── trans.sh (8,528 lines) # Installation executor (runs in boot environment) ├── fix-eth-name.sh # Network interface configuration ├── windows-driver-utils.sh # Windows driver detection/injection ├── windows-setup.bat # Windows installation setup ├── initrd-network.sh # Network setup in initrd ├── get-frpc-url.sh, get-xda.sh # Utility scripts ├── logviewer.html # Web log viewer ├── debian.cfg # Debian installation template └── frpc-example.toml # Network tunnel configuration ``` -------------------------------- ### Linux BIOS Bootloader Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Commands to install the GRUB bootloader to the Master Boot Record (MBR) and generate its configuration file for a Linux BIOS system. ```bash grub-install /dev/sdX # Install to MBR grub-mkconfig -o /boot/grub/grub.cfg # Generate config ``` -------------------------------- ### Find Main Installation Disk Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Finds the primary installation disk device path. It avoids removable media and small disks, selecting the largest available disk. ```bash find_xda ``` -------------------------------- ### Convert MBR to GPT Post-Windows Installation Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md Convert the MBR partition table to GPT after installing Windows in BIOS mode. This command preserves the BIOS boot mode. ```cmd MBR2GPT /convert /allowFullOS ``` -------------------------------- ### Custom Mirror and GitHub Proxy Configuration Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/06-configuration-reference.md Demonstrates setting environment variables to override default mirrors or use a proxy for GitHub downloads. These variables are set before executing the reinstall script to customize its behavior. ```bash confhome_cn="https://custom.mirror.com" bash reinstall.sh debian 12 ``` ```bash github_proxy="https://ghproxy.com/https://github.com/" bash reinstall.sh ubuntu 22.04 ``` -------------------------------- ### Specify Version for Reinstall Script Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md Always include the version number as a separate argument when reinstalling a distribution. This example shows the correct way to specify the Debian version. ```bash bash reinstall.sh debian 12 ``` -------------------------------- ### Example Error Output Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md This is an example of the output generated when an ERR trap is triggered due to a command failure or 'set -e'. It shows the line number, exit code, and the failing command. ```shell ***** ERROR ***** Line 5000 return 1 some_command_that_failed ``` -------------------------------- ### Bootloader Initialization Logic Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Platform detection logic to determine the correct configuration file path for bootloaders based on the operating system and environment (EFI/BIOS). ```bash if Windows: if EFI: target_cfg = C:\grub.cfg else: target_cfg = C:\grub\grub.cfg else (Linux): if EFI: efi_dir = detect_efi_mount() target_cfg = efi_dir/EFI/reinstall/grub.cfg else: if GRUB: target_cfg = /boot/grub*/custom.cfg else (Extlinux): target_cfg = /boot/extlinux.conf ``` -------------------------------- ### List GRUB Environment Variables Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md Display the current environment variables for the GRUB bootloader, including 'next_entry'. Useful for diagnosing boot entry issues. ```bash grub-editenv - list ``` -------------------------------- ### Extlinux Boot Entry Format Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Specifies the configuration format for an Extlinux boot entry, used for Linux BIOS systems. ```text LABEL reinstall MENU LABEL Reinstall [Distro Name] LINUX /reinstall-vmlinuz INITRD /reinstall-initrd APPEND root=/dev/sda1 ro quiet [additional_params] TIMEOUT 5 ``` -------------------------------- ### DD Raw Image Installation with Network Tunnel Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/README.md Installs from a DD raw image, potentially compressed, and sets up a network tunnel using frpc. This is useful for deploying custom disk images or when network access needs to be tunneled. ```bash bash reinstall.sh dd \ --img "https://example.com/debian-arm64.raw.xz" \ --frpc-config /path/to/frpc.toml ``` -------------------------------- ### is_use_cloud_image Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/03-bash-functions-api.md Determines if the cloud image installation method is enabled. ```APIDOC ## is_use_cloud_image() ### Description Check if cloud image installation method is enabled. ### Method Bash Function ### Signature is_use_cloud_image ### Return - 0: Cloud image installation will be used - 1: Traditional netboot/installer method ### Example ```bash if is_use_cloud_image; then download_cloud_image "$url" fi ``` ``` -------------------------------- ### List EFI Boot Entries Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Lists all EFI boot entries and filters for entries related to 'reinstall'. ```bash efibootmgr efibootmgr | grep -i "reinstall" ``` -------------------------------- ### List All Block Devices Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/09-helper-scripts-reference.md Lists all available block devices on the system, outputting their paths (e.g., `/dev/sda`, `/dev/nvme0n1`) one per line. Used for disk selection and validation. ```bash get_all_disks() ``` -------------------------------- ### is_use_dd Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/03-bash-functions-api.md Checks if the DD (raw disk image) installation method is configured. ```APIDOC ## is_use_dd() ### Description Check if DD (raw disk image) installation is configured. ### Method Bash Function ### Signature is_use_dd ### Return - 0: DD installation active - 1: Regular installation ### Example ```bash if is_use_dd; then show_dd_password_tips fi ``` ``` -------------------------------- ### Extlinux Boot Entry Configuration Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/08-installation-flow.md Appends a boot entry for the reinstall process to the extlinux.conf file. This is typically used for minimal Linux distributions. ```bash extlinux --once=reinstall ``` -------------------------------- ### Delete Windows BCDEdit Entry Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/04-bootloader-and-efi.md Deletes a boot entry from Windows BCDEdit using its GUID. ```cmd bcdedit /delete {guid} ``` -------------------------------- ### Specify Image Name for Windows Reinstall Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/07-error-codes-and-troubleshooting.md When reinstalling Windows, you must provide the image name using the --image-name flag. This example shows how to specify 'Windows 11 Pro'. ```bash bash reinstall.sh windows --image-name "Windows 11 Pro" --lang en-us ``` -------------------------------- ### Verify Network Gateway Source: https://github.com/bin456789/reinstall/blob/main/_autodocs/05-windows-installation.md When network connectivity is unavailable after installation, check the system's default gateway configuration. ```cmd route print ```