Skip to main content
All pages in this manual

Keeping it safe and current

Server updates and restarts

What this page is for: keep the machine your project runs on patched, and restart it safely when it asks for one.

There are three different "updates" on this server. People mix them up, and that is how the wrong thing gets updated on a busy Friday.

What you want newerWhere in the panelOver SSH
Your 6ammart codeDeploys → updatesudo sixpanel deploy
SixPanel itself (the panel, the CLI, the serving configuration)Settings → panel updatessudo sixpanel server update
The server itself (Ubuntu, security fixes)Settings → Server security updatessudo sixpanel server os-update

This page is about the third one. For the first two, see Deploy and update your code and Update SixPanel itself.

You need

  • The panel open on the Settings page, or root SSH access.
  • The server able to reach the internet.
  • A backup from the last few days. See below — this is the important one.

0. Some of this already happens by itself

The installer switches on Ubuntu's own unattended security upgrades, so security fixes for the packages on this machine are installed automatically as they are published. That is the baseline, and it is the reason a SixPanel server that nobody touches for a month is still a patched server.

What it does not do is restart the services that are still running the old libraries, or restart the machine after a kernel update. That is what the rest of this page is for: a deliberate pass, done when it suits you.

0b. Or let the server do the whole pass itself, once a week

Everything the rest of this page asks you to do by hand, SixPanel can do on a schedule. Settings → Maintenance → Scheduled server maintenance.

Pick a day and time — the default is Wednesday 02:00 to 02:20 UTC, and the page also shows that same moment in your own timezone, so you can see whether it lands at a quiet hour for your shop. Turn it on, and each week at that time the server does this, in this order:

  1. It checks that starting is safe at all. Enough free disk for the packages to unpack, and no other job running. If either is wrong, it skips the week and emails you why. Skipping changes nothing, which is why the check goes first.
  2. It takes a full backup. Database and files, before anything is changed, every single time. If that backup does not succeed, the window stops there and your server is exactly as it was. It will not even start if you have no backup destination set up — see Backups.
  3. Database care — clears out what your app can never use again, and re-checks the database indexes.
  4. Any certificate that is due for renewal.
  5. SixPanel itself, if a newer release is out.
  6. Your operating system's security updates. A PHP version you set to "install in the maintenance window" is left out here — the next step installs it safely. The job's log says which PHP packages it left to that step. Node.js is left out too: SixPanel keeps it on the version the panel was built with, and a SixPanel update moves it.
  7. PHP patches. Every PHP version is checked for a patch update (for example 8.3.35 → 8.3.36). What happens next is each version's own setting on Software → PHP → Manage → Patches: notify only (the default) tells you a patch is waiting and installs nothing; install in the maintenance window installs it — the build installed now is kept first, every website and shop on that version is checked before and after, and if anything answers differently the old build is put back and you are emailed. See PHP and Node.js versions.
  8. A restart, only if the operating system says one is needed — after a kernel update, for example. Your shop is offline for about 60 to 90 seconds. You can change this to restart every week instead, but "only when needed" is the setting that keeps you patched without weekly downtime.

Two things it will not do. It will not carry on after a failed step — if the backup fails, nothing else runs; if an update fails, the restart is held back rather than rebooting into a half-finished state. And it will not do any of it silently: every step appears in Jobs with its own log, Activity shows the maintenance window as what started them, and you get an email if anything did not finish cleanly or if a week was skipped.

There is a Run maintenance now button on the same card for when you would rather not wait for the schedule. It runs exactly the same steps, backup first. The card follows the run it started: Last run changes once the window has finished, and if it could not start — too little free disk, or the server too busy — Last run says it was skipped within a few seconds and the button comes back.

You can leave the window off and keep doing this by hand — the rest of this page is how. The window exists because "I will patch it next weekend" is how a server ends up four months behind.

1. Why a backup first

An operating-system update replaces files that everything else on the machine depends on. It almost always goes fine. When it does not, there is no undo button: the only way back is a backup taken before it.

So the safe order is always the same:

sudo sixpanel backup run full
sudo sixpanel server os-update

In the panel, take the backup on the Backups page first, then come back to Settings.

If there is no successful backup in the last 7 days, the panel refuses to start the update. It shows a warning and a tick box. You can tick the box and go ahead anyway — but read the warning first. It is telling you the truth.

Over SSH the same rule applies: unattended runs (--yes) refuse without a recent backup unless you add --no-backup.

2. When to update

  • Every month or so is enough for most projects, on top of the automatic security upgrades above.
  • Straight away when the check says the updates are security fixes and you are on a public domain.
  • Not in the middle of your busiest hours. Your site keeps working while the update runs, but a few services restart at the end.

3. Check first — this changes nothing

In the panel: Settings → Server security updates → Check for server updates.

You get:

  • how many packages can be updated, and how many are security fixes,
  • the list of package names,
  • how much free disk the server has,
  • how old your newest backup is,
  • whether the server already owes you a restart.

Over SSH:

sudo sixpanel server os-update --check

Add --json if you want to read it from a script. Add --full-upgrade to see what a full upgrade would do instead: the list then includes the packages held back for a new dependency and names the ones it would remove.

4. Install the updates

In the panel, press Install server updates and confirm. It runs as a job: its name appears in the top bar, and a card at the top of Settings ticks off each step. The live log opens only when you ask for it — press the job's name in the top bar, or Watch the log on that card. It has five steps: safety check, refresh the list, install, restart the services running old code, report.

Over SSH:

sudo sixpanel server os-update

What it does, and what it deliberately does not do:

  • Your site stays open while it runs.
  • Your configuration files are kept. The update never asks you a question and never replaces a config file you have edited.
  • It refuses to start if the system disk is nearly full. The installer unpacks new files before it removes the old ones, and a disk that fills up half way through leaves broken packages behind.
  • At the end it restarts the services that are still running the old libraries — the web server, PHP, the database, the cache and your project's workers — because a patched library only reaches a program that starts after the patch.
  • It never restarts the panel itself from inside its own update job. When the panel is one of the programs still running an old library, the report says so and gives the command that restarts it — sudo sixpanel service restart panel. Your site is not affected, and the server does not need a restart for that.
  • It never restarts the system message bus, or Docker if you run your own containers on this server — a restart mid-session is worse than waiting for a reboot. When it skips one of those, it says so and tells you a server restart is needed.
  • If the web server will not accept its own configuration, it is left running as it was and the report shows what it refuses, so you can fix that first.

What the report at the end tells you

The last step of the job, Report what changed and what to do next, is written from what the server really has installed, not from what was planned. SixPanel asks the server which version of every package it has before the install and again after it, and the difference is what it reports. So the numbers are true even when the update stopped half way.

  • updated — how many packages really changed version, and how many of those were security fixes. If it says it could not be counted, the server did not answer when asked; the log above is then the only record.
  • still pending — every package that is still waiting, with the reason:
  • left to the maintenance window's PHP patches step — on purpose; that step installs PHP with a way back and checks every site. See PHP and Node.js versions.
  • held by SixPanel on purpose — Node.js, which only runs the panel on the version it was built with.
  • held with apt-mark — held by you or another tool; sudo apt-mark unhold <name> lets the next update take it.
  • held back by apt — it needs a new package or a removal that a plain upgrade does not do. A full upgrade (above) does, at a quiet hour and after a backup.
  • Ubuntu rolls it out in stages — apt takes it on a later run, usually within days.
  • not installed — the update stopped before it — only in a run that failed.
  • WHAT TO DO NEXT — "Nothing. The update is finished" only when it finished. When it did not, this part says so first, says what was and was not installed, and says what to do.

The same words are in the email that tells you a job failed, and in the message of the weekly window's "maintenance finished with a problem" email.

The same goes for the command line. sudo sixpanel server os-update leaves the PHP packages your maintenance window patches alone, exactly as the panel's button does — it asks the running panel which PHP versions those are, holds them for the length of the run, and lets go of them afterwards. It also says how many of the listed packages it is leaving (--check shows the same count), and its Packages updated line is counted the same way, from what the server really has before and after: a package that was added shows as Newly installed, one a full upgrade removed as Removed, and one apt began and left half-finished is named under Changed but NOT finished (with the command that finishes it) and the closing lines do not say "Done." — the same facts the panel's report states. An update that stops part-way says what it had changed by then.

When SixPanel cannot tell which PHP versions the window patches — the panel's settings could not be read, or (over SSH) the panel does not answer — it does not guess "none". It holds every installed PHP package for that one run and says so, on the terminal and in the job's log: holding too much only means a PHP patch waits for the maintenance window or the daily updates, while holding too little would restart PHP under every site with no check. --check states the same and changes nothing.

Which holds are SixPanel's, and which are yours. Before it holds anything, an update opens a small file in the panel's data folder that says which process is taking the holds, and then adds one line for each package after that package was actually held — so the file never claims a package that was not held, even if the update is killed half-way through. It lets go of exactly those packages, line by line, and deletes the file only when every one came off (if the server is busy with the package database, each release is retried for a minute, and a package that still will not come off stays in the file for the next look). If the update is killed (a timeout, a restart of the server), the next time the panel starts, a server update runs, or a PHP patch is checked, SixPanel releases the packages in that file — but only when the process that took them is gone, never while it is still running, and never on a reading that may have failed (if the list of held packages cannot be read, the file is left alone for the next look). A process whose start time cannot be read is treated as still running, not as gone. A package you held yourself is in no file, so SixPanel never lets go of it: not when an update ends, not after a crash, and not when you switch the maintenance window off. The one thing a kill cannot be made to undo is the single package held in the instant before the file's line for it was written; it stays held, and the PHP patch check names it if it is ever refused because of it. --check reads these files and changes nothing. This holds for the panel's button and for sudo sixpanel server os-update alike.

A package held with apt-mark hold is still an installed package. Software → Updates shows it, the Hold / Unhold button reaches it, the Software cards show its version, and an extension you held under Software → PHP is listed with the reason it cannot be removed until you release it.

There is one extra option, full-upgrade (--full-upgrade over SSH). It allows bigger changes: it can install and remove packages, not only update them. It is the riskier one. Leave it off unless support asked you for it.

When you tick it, the server is asked again with that option and the list changes: every package the full upgrade would remove is added to it, marked [removed], with a line above saying how many. Install then runs that same full upgrade; the job's log lists what it is about to remove before it starts (read fresh from the server at that moment), and the report at the end names what was removed. A plain upgrade never removes anything.

5. Restart the server when it asks

Some updates — the Linux kernel, core libraries — only take effect after the machine restarts. The report says so, and Settings → Updates says so under Server security updates, with a link to where the restart is.

A restart takes your site offline for the whole time it lasts — usually 60 to 90 seconds, sometimes longer on a slow server. Pick a quiet hour.

Nothing is lost. The database is written to disk cleanly first, so every order that was already placed is safe, and everything starts again by itself after the machine comes back — every SixPanel service is enabled at boot.

In the panel: Server → Services → Restart this server, the last card on that tab, under the server's own services. You have to confirm. After that the page says the server is restarting and reconnects on its own in about 60 to 90 seconds.

Over SSH:

sudo sixpanel server reboot

Your SSH session ends when the machine goes down. That is normal.

6. If the browser will not open — the SSH fallback

Everything on this page works over SSH, and it works even when the panel is down. Log in as root and run:

sudo sixpanel server os-update --check
sudo sixpanel server os-update
sudo sixpanel server reboot

Full help for any of them:

sudo sixpanel help server os-update
sudo sixpanel help server reboot

How to check it worked

  • sudo sixpanel server os-update --check says 0 updates available.
  • sudo sixpanel doctor is green.
  • Your site opens as normal and you can place a test order.

If it went wrong

  • "not enough free disk" — the update refused and changed nothing. Free space first: sudo sixpanel disk, then sudo sixpanel prune, or delete old snapshots on the Backups page. Then run it again.
  • "could not reach the update servers" — the server has no internet or its update servers are down. Wait and try again. Nothing was installed.
  • The update stopped half way — it now tries to finish the job itself. If a package update fails part way, the update repairs what the system left unfinished and runs the install once more; the log says so in plain words. You only need to act if the log ends by naming a package it could not finish. Then run it again — package updates are safe to repeat and pick up where they stopped — and if it stops at the same package, see the next item.
  • "SixPanel could not hold back PHP package(s) …, so it did not start the upgrade" — the maintenance window installs PHP patches itself, with a way back, so a server update keeps PHP out of its own run. To do that SixPanel puts apt's hold on each installed PHP package for the length of the update. It tried for a minute and could not (the log line above says why — usually another program was using the package database). It stopped before installing anything, because going on would let apt restart PHP under your sites with no check. Nothing was installed. Over SSH:
  sudo apt-mark showhold

A PHP package listed there that you did not hold yourself can be released with sudo apt-mark unhold <name>. Then run the update again.

  • PHP patches never seem to be waiting, and apt-mark showhold lists every PHP package — an earlier SixPanel release (it wrote nothing down) left them held after a failed server update. The first time the panel starts on a release that writes the file, it looks once for exactly that, and releases packages only when all of these are true: no update is running, the panel's own job history holds a server update that failed with "Can't select installed nor candidate version from package 'php…'" for that PHP version, and every installed package of that version is held (and php-common, which the old text held with them). Each PHP version is judged on its own packages, so two versions left held by the same failure are both released, and php-common once with them. Each package it releases is named in a line on the Activity page, one line per PHP version, with the command that holds it again (sudo apt-mark hold <names>) in case the hold was yours. If you held a whole PHP version on purpose and no such failed update is in the history, nothing is released. After that single look, SixPanel releases a hold only from a file, as described above — if you see these holds later and no file names them, they are yours, and sudo apt-mark unhold <names> releases them.
  • "this server has package(s) the system cannot finish installing" — one package's own setup step is failing, and while that is true your server installs nothing new, including later security updates. The message names the package. Over SSH:
  sudo dpkg --configure -a

Read what it says about that package — that is the real problem, and it is usually one setting. Nothing you installed is lost; the packages that did install are installed.

  • "apt stopped with exit code 100 because another package run … was using apt" (or "the package mirror was being updated" / "could not be reached") — nothing on your server was changed. The update already waited and asked again, four times over three minutes; the daily automatic updates or a mirror took longer than that. Run the update again later.
  • "the server took longer than 60 minutes" — the update was stopped because it had run out of time, not because it failed. Finish what was in flight, then run the update again:
  sudo dpkg --configure -a
  sudo sixpanel server os-update
  • "packages held back" — apt kept some updates because they need new dependencies. That is normal and safe. If the same ones stay held back for weeks, --full-upgrade is the answer, at a quiet hour and after a backup.
  • "Deferred by phasing" — sudo sixpanel server os-update (and --check) names the updates Ubuntu is releasing to servers in stages. Nothing holds them back: they install by themselves once it is this server's turn, usually within a few days.
  • The site is slow or broken after an update — restart the services and read the log:
  sudo sixpanel service restart app
  sudo sixpanel logs app -n 50
  • The panel did not come back after a restart — give it three minutes. Servers with slow disks take longer. Then check the machine is actually running in your hosting provider's dashboard, and see Troubleshooting.
  • You want to go back — there is no undo. The way back is the backup you took before it. See Backups.

Something unclear?Ask Tia