Backup Service, Full Disk, and an Unwanted Desktop
You support a 15-person design studio. Their file server is an Ubuntu Server 22.04 LTS machine with 8 GB RAM and a single 500 GB disk; it runs Samba for shared folders and a nightly backup script. Last month the owner installed a desktop environment 'to make it easier,' and since then the machine has twice become unresponsive during large file copies. After the last reboot, the custom backup service did not run at 02:00; systemctl status backup.service showed it as inactive (dead). You started it manually and it worked, but the next morning it was dead again. Separately, df -h shows / at 91% and the studio wants to avoid downtime. They ask whether to reinstall, add RAM, or change configuration.
1. Diagnose why the backup service starts manually but not after reboot, and list the checks in order. Include the difference between enabling and starting a unit and what a target is.
Read the worked answer
First distinguish start from enable. systemctl start backup.service starts it once in the current boot; systemctl enable backup.service creates the symlink under the target's .wants directory so it is pulled in at boot. If systemctl is-enabled backup.service says disabled, that alone explains the symptom. Check the unit's [Install] section with systemctl cat backup.service; if there is no WantedBy=multi-user.target (or graphical.target), enable has nothing to hook into and you must add it with a drop-in. Look for Condition...= or ExecStart pointing to a script on a filesystem that is not mounted yet, and for missing After=network-online.target or Wants=network-online.target if the backup writes to a network share. Read journalctl -u backup.service -b and the previous boot with -b -1; also check the script's PATH and permissions, since an interactive shell has a different environment. If the unit is a timer, systemctl list-timers and systemctl status backup.timer matter more than the service. A target is a grouping of units; multi-user.target is the text multi-user state, roughly the old runlevel 3, while graphical.target adds the display manager. After fixing, run systemctl daemon-reload, systemctl enable --now backup.service, and test with a reboot or systemctl isolate multi-user.target.
2. Address the disk at 91%. Give a safe triage sequence to find what is consuming space and reduce it without deleting active logs or breaking Samba. Include commands and one risk.
Read the worked answer
Triage before deleting. df -h / confirms the full filesystem; df -i / checks inode exhaustion, which looks similar but is fixed differently. Then du -xhd1 / | sort -h keeps the scan on one filesystem and shows the biggest top-level directories; drill into /var, /home, /srv, and /var/log. ls -lhS /var/log | head finds large files. journalctl --disk-usage reports the journal; journalctl --vacuum-time=14d or --vacuum-size=500M trims it safely. Check /var/cache/apt with du -sh and clean with apt clean; old kernels can be removed with apt autoremove --purge after verifying the running kernel. For an active log, do not rm it: the daemon keeps the file descriptor open and space is not reclaimed. Truncate with : > /var/log/foo.log or use logrotate with copytruncate; verify with lsof +L1 for deleted-but-open files. Samba may hold locks or temp files under /var/lib/samba; do not delete them blindly. The desktop install itself consumes space and pulls many packages; removing it may reclaim several GB. Risk: deleting a backup staging area can break the next backup, so confirm ownership and purpose before removal.
3. The owner thinks a GUI is harmless. Explain the resource and security trade-offs and recommend a path that avoids a reinstall.
Read the worked answer
A desktop environment is not just a wallpaper. It pulls in a display manager, X or Wayland, a session manager, font and icon caches, a browser, and often a full set of GNOME services. On an 8 GB server that also runs Samba and large file copies, those services compete for RAM and I/O; the desktop's indexing and update notifiers can make an unresponsive machine worse. Security surface grows: more listening services, more packages to patch, and a graphical login that may be exposed if the display manager listens on the network. You do not need a reinstall. Identify the metapackage (ubuntu-desktop, ubuntu-desktop-minimal, or gnome-shell), remove it with apt remove and then apt autoremove --purge, and set the boot default to text: systemctl set-default multi-user.target; verify with systemctl get-default. Keep SSH and the Samba services enabled. If occasional GUI administration is needed, use X11 forwarding over SSH for a single application or a separate workstation, not a permanent desktop on the server. Add RAM only after measuring with free -h, vmstat, and iostat during a file copy; the GUI removal is reversible, whereas a reinstall is a downtime event and risks the Samba configuration.