Disable snap core service on Ubuntu 18.04

1. To disable snapd service on Ubuntu 18.04 server, run below command to view all currently runnig snap service.

administrator@nagios:/etc/systemd/system$ systemctl list-unit-files | grep snapsnap-core-4486.mount                   disabledsnap-core-4830.mount                   disabledsnapd.autoimport.service               enabledsnapd.core-fixup.service               enabledsnapd.seeded.service                   disabledsnapd.service                          disabledsnapd.snap-repair.service              staticsnapd.system-shutdown.service          enabledsnapd.socket                           disabledsnapd.snap-repair.timer                enabled

2. Run below commands to disable all the enabled snap services 1 by 1.

sudo systemctl disable snapd.servicesudo systemctl disable snapd.seeded.servicesudo systemctl disable snapd.socketsudo systemctl disable snap-core-4486.mountsudo systemctl disable snap-core-4830.mount

Comments

Unknown said…
Thank you for your suggested method.

Based on your idea, I modify it to make it more automatic

#! /bin/bash
snap_services=$(systemctl list-unit-files | grep snap|grep enabled|cut -d ' ' -f 1)
for snap_service in $snap_services; do
cmd="sudo systemctl disable $snap_service"
echo $cmd
$cmd
done
Lee Pak Hong said…
Thanks for the script