All jobs / DevOps / SRE / cloud / Linux
DevOps / SRE / cloud interview question · 0–1 years
A VM was rebooted for patching. The API on it did not come back; a teammate says systemd is broken.
What do you check, and what was the likely mistake?
The strongest answer
`systemctl status api` and `journalctl -u api -b` first; most likely the unit was started but never enabled, so it does not start at boot — `systemctl enable --now` fixes both
Why it works
Exactly — start is for now, enable is for boot, and the journal tells you whether it tried and failed or never tried.
What a good answer covers
- Start is now; enable is at boot.
- Check status and the unit’s journal.
- Enable what must survive a reboot.
- Do not bolt cron onto systemd.
Answers that fall short
- Close, but not the strongest: Start it again with `systemctl start api` and move on; reboots are rare
You fixed the symptom; the next reboot repeats it because nothing told systemd to start it at boot. - Weak: Put the start command in a cron job with @reboot so it comes up
systemd already owns boot order, restarts and logging; a parallel cron start fights it and hides failures. - Red flag: Add a `while true` restart loop to the deploy script and run it in a screen session
A hand-rolled loop in a screen session is a snowflake nobody can see, restart or audit.
Who gets asked this
More Linux questions
- Everyone SSHes as root with the same key. What do you change first?
- A service fails to start with “address already in use” on port 8080. How do you find out what holds it?
- A runbook installs a CLI on every server with `curl https://… | sudo bash`. What do you prefer, and why?
- A deploy script failed on step two (the build), carried on, and pushed an empty artifact to production. What…
- `df -h` says the root volume is 100% full. `du -sh /` adds up to less than half of that. What is going on…
- Load average is 40 on an eight-core VM, yet `top` shows CPU mostly idle and the app is crawling. What does…
- `./deploy.sh` says “Permission denied” and `ls -l` shows `-rw-r--r--`. What do you do?