October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
VGSources
Blog

How to Check That Cloud-Init Has Finished Running on a Server

Learn the exact commands to check cloud-init, wait for Final-stage completion, interpret exit codes, use JSON timing data, and troubleshoot a missing or failed boot-finished signal.
Length9 min Posted Quest giverVGSources Team
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The quickest check is cloud-init status. To make another script wait until initialization is complete, run cloud-init status --wait; it blocks until cloud-init finishes instead of requiring a polling loop. Use cloud-init status --long for a human-readable diagnosis or cloud-init status --format=json when automation needs status, errors, and per-stage timestamps.

Run the right check first

Connect to the target server and run:

cloud-init status

This reports cloud-init’s current state. Depending on what happened during boot, the result can indicate that cloud-init is still running, has completed, is disabled, or encountered an error. The command is useful for an operator checking a machine interactively, but its plain-text output is not the best interface for a provisioning script that must wait.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

For an external script, use the blocking form:

cloud-init status --wait

Canonical’s boot documentation recommends this subcommand for scripts outside cloud-init. It waits for cloud-init to finish without requiring you to build a custom polling loop or a separate systemd dependency chain. Once the command returns, inspect its exit status before allowing the next provisioning step to proceed.

What “finished” means in cloud-init

Cloud-init does not perform all of its work in one instant. Its boot sequence is organized into five stages:

#1 Best Overall
Sale
Gaoye Blue Light Blocking Glasses
  • BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
  • EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
  • COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
  • LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
  • WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
  • Detect: cloud-init identifies the environment and available datasource.
  • Local: early local initialization runs before normal network availability.
  • Network: network-dependent initialization takes place.
  • Config: configuration modules are applied.
  • Final: late-boot actions, including many user-data operations, run.

The Final stage is implemented by cloud-final.service and runs as late in boot as possible. User-defined scripts, package installation, and configuration-management plugins commonly run there. Therefore, if your next action depends on user-data effects, network setup, installed packages, or final-stage configuration, treat the server as ready only after the Final stage has completed—not merely because an earlier stage has finished.

This distinction explains why a machine can be reachable over SSH while provisioning is still in progress. Network availability proves that the network stage has made enough progress for a connection; it does not prove that final scripts or package operations are done.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to know cloud-init is done interactively

Use the short status command for a quick answer

cloud-init status

Use this when you are at the shell and need a quick state check. It is intentionally compact, so it does not show the full error arrays or timing details needed to explain a failed or unexpectedly slow boot.

Use the blocking command when timing matters

cloud-init status --wait

This command waits for cloud-init to reach completion. It is the preferred synchronization mechanism for an external script because the waiting behavior is provided by cloud-init itself. You do not need to guess a sleep interval, repeatedly invoke the short status command, or maintain a second definition of what “done” means.

Use long output when the result needs explanation

cloud-init status --long

The long form adds diagnostic information such as the datasource, a boot status code, an extended status, error arrays, and stage timing data. Use it when the short command says error, when expected user-data work is missing, or when you need to determine which portion of boot consumed the time.

Rank #2
Windex Gaming Cleaning Wipes, Pre-Moistened Wipes to Instantly Clean all Gaming Gear and Electronics, Resealable Packaging for a Freshness Lock, 25 count (Pack of 1)
  • WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
  • AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
  • PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
  • ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
  • COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed

Use JSON for a machine-readable result

cloud-init status --format=json

JSON output is suitable for automation that needs more than a single success or failure gate. It exposes fields including status, extended_status, errors, and per-stage start and finished timestamps. The stage data includes entries such as init, init-local, modules-config, and modules-final.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Parse the documented field names rather than scraping human-readable text. A deployment controller can wait with --wait, then collect JSON for logging and decide whether to continue based on the command’s exit code and the returned error information.

Understand the exit codes before declaring success

The cloud-init status command documents three relevant outcomes:

Exit code Meaning Operational response
0 Cloud-init ran without error. The command completed successfully. Continue only if your workflow also requires particular user-data effects and those effects are present.
1 Cloud-init crashed. Stop dependent automation and investigate the failure. A reachable server is not evidence that provisioning succeeded.
2 Cloud-init finished with recoverable errors. Do not silently treat this as an unqualified success. Review the reported errors and decide whether your workload can tolerate them.

A shell script should preserve these distinctions. For example:

#!/bin/sh
cloud-init status --wait
rc=$?

case "$rc" in
  0)
    echo "cloud-init completed without error"
    ;;
  1)
    echo "cloud-init crashed" >&2
    exit 1
    ;;
  2)
    echo "cloud-init completed with recoverable errors" >&2
    exit 2
    ;;
  *)
    echo "unexpected cloud-init status exit code: $rc" >&2
    exit "$rc"
    ;;
esac

The example treats code 2 as a separate policy decision instead of collapsing it into the same path as code 0. Your deployment can choose to continue after reviewing those errors, but that choice should be explicit.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
LISEN Cell Phone Stand Phone Holder for Desk, Office Decor Gadgets for Men
  • Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
  • Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
  • Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
  • ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
  • Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)

Check the boot-finished file

Cloud-init documents a persistent marker at:

/var/lib/cloud/instance/boot-finished

The file is created by the final_message cloud-config module and indicates that “boot” is finished. A shell script or image-building tool can test for it directly:

test -f /var/lib/cloud/instance/boot-finished

A successful file test means the marker exists; a failed test means it does not. The marker is useful when the surrounding tool already works with filesystem signals, but it is less observable than the status commands: it does not by itself report whether cloud-init is still running, which datasource was used, what errors occurred, or how long individual stages took.

It also does not replace cloud-init status --wait as a synchronization primitive. If you build a workflow around the marker, you must provide your own polling or file-watching behavior and decide how to handle a server that never creates it. Prefer the status wait command when you control the script that needs to block.

Choose a completion check for the job

Check Synchronization Observability Automation safety Best use
cloud-init status Does not itself describe a waiting workflow. Short state result. Useful for an operator; limited for structured parsing. Quick, interactive question: “How do I know cloud-init is done?”
cloud-init status --wait Blocks until cloud-init completes. Completion and documented exit code. Safer than a hand-written polling loop for an external script. Gating the next provisioning step.
cloud-init status --long Reports the current/completed state; it is not the primary blocking interface. Extended status, boot status code, datasource, errors, and stage timing. Readable by people, but text parsing is less robust than JSON. Incident response and one-off diagnosis.
cloud-init status --format=json Use with the wait command when a workflow must block first. Structured fields and per-stage start/finished timestamps. Best choice when a controller must parse results consistently. Logging, dashboards, and policy decisions in automation.
test -f /var/lib/cloud/instance/boot-finished Requires your own polling or watcher. Only the marker’s presence is visible. Simple but provides no error or stage detail. Shell-based image building or tools that already use file markers.

A reliable operator procedure

1. Ask for the current state

cloud-init status

If it reports that cloud-init is running, do not infer that it is stuck just because the server accepts connections. Continue with the diagnostic form while allowing the process to finish.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Wait when your task depends on provisioning

cloud-init status --wait

Run this before installing software, registering the host, starting a service that depends on user-data configuration, or handing the machine to another automation system. The wait command is specifically intended for scripts external to cloud-init.

Rank #4
Ledagic IC+RGBW USB Powered Led Light Bar with App & Remote Control, 2 Pack
  • Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
  • Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
  • 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
  • Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
  • USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC

3. Capture details if the result is not clean

cloud-init status --long
cloud-init status --format=json

Use long output for a human-readable incident record and JSON when another program will consume the result. Save the output with the host’s provisioning logs so the state, datasource, errors, and timing can be correlated with the deployment.

4. Confirm the stage that matters to your workload

Read the stage information and identify whether the work you are waiting for belongs to Final. If your requirement is “all user-data scripts and package installation have completed,” a successful earlier stage is not sufficient; the relevant completion point is the Final stage represented by cloud-final.service.

5. Apply an explicit exit-code policy

Code 0 is a clean run, code 1 is a crash, and code 2 means completion with recoverable errors. Decide in advance whether code 2 blocks your deployment, and record that decision rather than hiding it in a generic “command failed” branch.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Automation patterns that avoid race conditions

Gate a dependent command with the wait result

if cloud-init status --wait; then
    echo "cloud-init completed cleanly"
    # Run the next provisioning action here.
else
    rc=$?
    echo "cloud-init did not complete cleanly (exit $rc)" >&2
    cloud-init status --long >&2
    exit "$rc"
fi

This pattern prevents the dependent action from starting while cloud-init is still running. It also records the long status when the wait command returns a nonzero result. If your policy allows recoverable errors, handle exit code 2 in a separate branch instead of using a broad success test.

Collect structured evidence after waiting

cloud-init status --wait
wait_rc=$?
cloud-init status --format=json > /var/log/cloud-init-status.json
exit "$wait_rc"

The first command provides synchronization. The second creates a structured snapshot for a controller or later review. Keep the wait result because the JSON file is evidence, not a substitute for checking the command’s exit code.

Best Value
Sale
HUANUO FlowLift™ Dual Monitor Stand, Fully Adjustable Gaming Monitor Desk Mount for 13–32″ Computer Screens, Full Motion VESA 75x75/100x100 with C-Clamp & Grommet Base, Each Arm Holds 4.4 to 19.8 lbs
  • Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
  • Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
  • Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
  • Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
  • Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.

Use the marker only when a file signal is required

while ! test -f /var/lib/cloud/instance/boot-finished; do
    sleep 1
done

This illustrates the additional machinery a marker-based workflow needs: polling and a policy for a marker that never appears. A production wrapper should also define a timeout and failure path appropriate to its environment. When possible, replace this loop with cloud-init status --wait so cloud-init owns the synchronization logic.

Troubleshoot a server that never reaches a clean state

Start with long status output

cloud-init status --long

Look at the reported state, extended status, boot status code, datasource details, errors, and stage timing. This tells you whether the issue is an active run, a crash, recoverable errors, or a machine on which cloud-init is disabled.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Switch to JSON when a tool must inspect fields

cloud-init status --format=json

Inspect status, extended_status, errors, and each stage’s finished value. A missing or unfinished field identifies where the sequence stopped without forcing a parser to interpret human-readable wording.

Inspect the final-stage service

systemctl status cloud-final.service

The Final stage is the place to focus when user-data scripts, package installation, or configuration-management plugins did not produce their expected effects. The exact packaging, service presentation, and log locations vary by distribution, so consult that system’s cloud-init and systemd records rather than assuming one universal log path.

Separate “disabled” from “finished”

The status command can report disabled as well as completed. A disabled instance is not evidence that the requested user-data work ran successfully; it means cloud-init is not performing its normal run. Treat that state as a configuration or image decision that requires confirmation before the host is handed to downstream automation.

Check the expected work, not only the signal

Even a clean completion signal does not tell you whether your application-specific objective was correct. After cloud-init completes, verify the concrete outcome your workflow needs: for example, that the configuration file exists, the expected package is installed, or the service has the intended settings. Keep this verification separate from cloud-init’s own completion check so a successful boot is not mistaken for a successful application deployment.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Common mistakes and their fixes

  • Checking SSH availability instead of cloud-init: a reachable network does not prove Final-stage work is complete. Run cloud-init status --wait.
  • Polling the short command forever: use the documented wait subcommand, and add a timeout around the broader job if your orchestration system requires one.
  • Parsing human-readable output: request --format=json and consume documented fields.
  • Treating every nonzero result identically: distinguish crash code 1 from recoverable-error code 2.
  • Using only the marker file for diagnosis: the file has no error, datasource, or timing information; pair it with long or JSON status when investigating.
  • Assuming an earlier stage is enough: user-data scripts and package installation commonly run in Final, represented by cloud-final.service.
  • Ignoring a disabled state: confirm that disabling cloud-init was intentional before declaring the server provisioned.

A compact runbook

  1. On the target server, run cloud-init status for an immediate state.
  2. If another process must wait, run cloud-init status --wait.
  3. Gate the next action on the documented exit code: 0 is clean, 1 is a crash, and 2 is completion with recoverable errors.
  4. For any unexpected result, capture cloud-init status --long and cloud-init status --format=json.
  5. Check the stage timestamps and confirm that Final/cloud-final.service completed if your workflow depends on user-data effects.
  6. Use test -f /var/lib/cloud/instance/boot-finished only when a persistent file marker fits the surrounding tool.
  7. Verify the application-specific outcome before handing the server to the next system.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More quests from Patch Notes

  1. How to Set Up a RedM (RDR2) Server in 2026: License Key, txAdmin and server.cfg, Step by StepBlog11min
  2. Best RedM (RDR2) Server Hosting in 2026: Comparing Four Hosts on Slots, Memory and PriceBlog10min
  3. How to Host a Mindustry Server in 2026: server-release.jar, Port 6567 and the Commands That MatterBlog7min
Recommended PC Tool
Recommended PC Tool
Crashes, No Sound, or Screen Glitches?Free driver scan
PC Slower Than It Used to Be?Free scan - under a minute

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.