From 5de807143bff74a7718f4c182f8d4f4a1f7beb0c Mon Sep 17 00:00:00 2001 From: cproudlock Date: Mon, 16 Feb 2026 15:32:39 -0500 Subject: [PATCH] Fix WinPE SMB auth and timeout commands, restore autoinstall disk match - Add /user:pxe-upload pxe credentials to all net use commands (share requires auth) - Replace timeout with ping delays (timeout.exe not available in WinPE) - Restore size: largest disk match in autoinstall (root cause was BIOS RST mode) - Simplify autoinstall late-commands structure Co-Authored-By: Claude Opus 4.6 --- autoinstall/user-data | 36 +++++++++--------------------------- playbook/startnet.cmd | 22 +++++++++++----------- startnet-template.cmd | 22 +++++++++++----------- 3 files changed, 31 insertions(+), 49 deletions(-) diff --git a/autoinstall/user-data b/autoinstall/user-data index d35ecab..feb9aba 100644 --- a/autoinstall/user-data +++ b/autoinstall/user-data @@ -35,7 +35,7 @@ autoinstall: identity: hostname: pxeserver username: pxe - password: '$6$8AerqUockJh6ycgl$HJFBYjiFqXpzgcU9edto4CMrnaDpEX71Epin.kNTpj57GVjimIDHhcQs0AC4tmkEkKUaj.S/55wsBfMsV0KC71' + password: '$6$MV3UwfSxKqxDYCwt$2IPUfSvqpzUdH6QVKHfPH8I9E0SPqNCh0lLvn.D9btxhZUYmceOGcB51Ryfg1Fojlroin.qguSKYFoIDGUIC20' # Enable SSH ssh: @@ -44,7 +44,7 @@ autoinstall: # Installer-stage late commands late-commands: - # Install deb packages from CIDATA USB, then disable cloud-init + # Step 1: Install deb packages from CIDATA USB - | curtin in-target --target=/target -- bash -c ' mkdir -p /mnt/cidata @@ -61,51 +61,37 @@ autoinstall: fi umount /mnt/cidata fi - # Disable cloud-init AFTER dpkg (dpkg may overwrite earlier disables) - mkdir -p /etc/cloud - touch /etc/cloud/cloud-init.disabled - ln -sf /dev/null /etc/systemd/system/cloud-init.service - ln -sf /dev/null /etc/systemd/system/cloud-init-local.service - ln -sf /dev/null /etc/systemd/system/cloud-config.service - ln -sf /dev/null /etc/systemd/system/cloud-final.service - ln -sf /dev/null /etc/systemd/system/cloud-init.target - # Disable networkd-wait-online (no gateway on air-gapped network, causes 2min hang) - ln -sf /dev/null /etc/systemd/system/systemd-networkd-wait-online.service ' - # Create first-boot.sh + disable cloud-init (in same block we know works) + # Step 2: Disable networkd-wait-online (hangs on air-gapped network) + - ln -sf /dev/null /target/etc/systemd/system/systemd-networkd-wait-online.service + + # Step 3: Create first-boot.sh - | curtin in-target --target=/target -- bash -c ' - mkdir -p /etc/cloud/cloud.cfg.d - echo "datasource_list: [None]" > /etc/cloud/cloud.cfg.d/99-nocloud.cfg - touch /etc/cloud/cloud-init.disabled - ln -sf /dev/null /etc/systemd/system/systemd-networkd-wait-online.service cat <<"EOF" > /opt/first-boot.sh #!/bin/bash CIDATA_DEV=$(blkid -L CIDATA) if [ -n "$CIDATA_DEV" ]; then mkdir -p /mnt/usb mount "$CIDATA_DEV" /mnt/usb - # Install all offline .deb packages (ansible, dnsmasq, apache2, samba, etc.) if compgen -G "/mnt/usb/packages/*.deb" > /dev/null; then dpkg -i /mnt/usb/packages/*.deb 2>/dev/null || true dpkg -i /mnt/usb/packages/*.deb 2>/dev/null || true fi - # Run the Ansible playbook if [ -f /mnt/usb/playbook/pxe_server_setup.yml ]; then cd /mnt/usb/playbook ansible-playbook -i localhost, -c local pxe_server_setup.yml fi umount /mnt/usb fi - # Disable rc.local to prevent rerunning sed -i "s|^/opt/first-boot.sh.*|# &|" /etc/rc.local lvextend -r -l +100%FREE /dev/mapper/ubuntu--vg-ubuntu--lv || true EOF + chmod +x /opt/first-boot.sh ' - - curtin in-target --target=/target -- chmod +x /opt/first-boot.sh - # Create rc.local without unintended indentation + # Step 4: Create rc.local - | curtin in-target --target=/target -- bash -c ' cat <<"EOF" > /etc/rc.local @@ -113,15 +99,11 @@ autoinstall: /opt/first-boot.sh > /var/log/first-boot.log 2>&1 & exit 0 EOF + chmod +x /etc/rc.local ' - - curtin in-target --target=/target -- chmod +x /etc/rc.local user-data: disable_root: false - runcmd: - - touch /etc/cloud/cloud-init.disabled - - systemctl disable cloud-init.service cloud-init-local.service cloud-config.service cloud-final.service - - systemctl mask cloud-init.service cloud-init-local.service cloud-config.service cloud-final.service refresh-installer: update: no diff --git a/playbook/startnet.cmd b/playbook/startnet.cmd index 759ec27..38fd01e 100644 --- a/playbook/startnet.cmd +++ b/playbook/startnet.cmd @@ -43,7 +43,7 @@ echo. echo Starting GEA Standard setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-standard /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-standard /user:pxe-upload pxe /persistent:no goto end :gea-engineer @@ -51,7 +51,7 @@ echo. echo Starting GEA Engineer setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-engineer /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-engineer /user:pxe-upload pxe /persistent:no goto end :gea-shopfloor @@ -59,7 +59,7 @@ echo. echo Starting GEA Shopfloor setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-shopfloor /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-shopfloor /user:pxe-upload pxe /persistent:no goto end :gea-shopfloor-mce @@ -67,7 +67,7 @@ echo. echo Starting GEA Shopfloor MCE setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-shopfloor-mce /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-shopfloor-mce /user:pxe-upload pxe /persistent:no goto end :ge-standard @@ -75,7 +75,7 @@ echo. echo Starting GE Standard setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-standard /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-standard /user:pxe-upload pxe /persistent:no goto end :ge-engineer @@ -83,7 +83,7 @@ echo. echo Starting GE Engineer setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-engineer /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-engineer /user:pxe-upload pxe /persistent:no goto end :ge-shopfloor-lockdown @@ -91,7 +91,7 @@ echo. echo Starting GE Shopfloor Lockdown setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-lockdown /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-lockdown /user:pxe-upload pxe /persistent:no goto end :ge-shopfloor-mce @@ -99,23 +99,23 @@ echo. echo Starting GE Shopfloor MCE setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-mce /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-mce /user:pxe-upload pxe /persistent:no goto end :end echo. echo Waiting for PESetup.exe to start... :wait_start -timeout /t 2 /nobreak >NUL +ping -n 3 127.0.0.1 >NUL tasklist /FI "IMAGENAME eq PESetup.exe" 2>NUL | find /I "PESetup.exe" >NUL if errorlevel 1 goto wait_start echo PESetup.exe is running. Waiting for imaging to complete... :wait_finish -timeout /t 10 /nobreak >NUL +ping -n 11 127.0.0.1 >NUL tasklist /FI "IMAGENAME eq PESetup.exe" 2>NUL | find /I "PESetup.exe" >NUL if not errorlevel 1 goto wait_finish echo. echo Imaging complete. Rebooting in 15 seconds... echo Press Ctrl+C to cancel. -timeout /t 15 +ping -n 16 127.0.0.1 >NUL wpeutil reboot diff --git a/startnet-template.cmd b/startnet-template.cmd index 759ec27..38fd01e 100644 --- a/startnet-template.cmd +++ b/startnet-template.cmd @@ -43,7 +43,7 @@ echo. echo Starting GEA Standard setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-standard /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-standard /user:pxe-upload pxe /persistent:no goto end :gea-engineer @@ -51,7 +51,7 @@ echo. echo Starting GEA Engineer setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-engineer /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-engineer /user:pxe-upload pxe /persistent:no goto end :gea-shopfloor @@ -59,7 +59,7 @@ echo. echo Starting GEA Shopfloor setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-shopfloor /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-shopfloor /user:pxe-upload pxe /persistent:no goto end :gea-shopfloor-mce @@ -67,7 +67,7 @@ echo. echo Starting GEA Shopfloor MCE setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\gea-shopfloor-mce /persistent:no +net use Z: \\10.9.100.1\winpeapps\gea-shopfloor-mce /user:pxe-upload pxe /persistent:no goto end :ge-standard @@ -75,7 +75,7 @@ echo. echo Starting GE Standard setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-standard /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-standard /user:pxe-upload pxe /persistent:no goto end :ge-engineer @@ -83,7 +83,7 @@ echo. echo Starting GE Engineer setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-engineer /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-engineer /user:pxe-upload pxe /persistent:no goto end :ge-shopfloor-lockdown @@ -91,7 +91,7 @@ echo. echo Starting GE Shopfloor Lockdown setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-lockdown /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-lockdown /user:pxe-upload pxe /persistent:no goto end :ge-shopfloor-mce @@ -99,23 +99,23 @@ echo. echo Starting GE Shopfloor MCE setup... start "FlatApp" %SYSTEMDRIVE%\GESetup\FlatSetupLoader.exe for /l %%i in (1,1,2000000) do rem -net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-mce /persistent:no +net use Z: \\10.9.100.1\winpeapps\ge-shopfloor-mce /user:pxe-upload pxe /persistent:no goto end :end echo. echo Waiting for PESetup.exe to start... :wait_start -timeout /t 2 /nobreak >NUL +ping -n 3 127.0.0.1 >NUL tasklist /FI "IMAGENAME eq PESetup.exe" 2>NUL | find /I "PESetup.exe" >NUL if errorlevel 1 goto wait_start echo PESetup.exe is running. Waiting for imaging to complete... :wait_finish -timeout /t 10 /nobreak >NUL +ping -n 11 127.0.0.1 >NUL tasklist /FI "IMAGENAME eq PESetup.exe" 2>NUL | find /I "PESetup.exe" >NUL if not errorlevel 1 goto wait_finish echo. echo Imaging complete. Rebooting in 15 seconds... echo Press Ctrl+C to cancel. -timeout /t 15 +ping -n 16 127.0.0.1 >NUL wpeutil reboot