ubuntu server 26.04 LTSの導入直後にsnapをpurgeする方法

 1.概要

LinuxMint 22.3にはsnapはinsltallされていません。aptコマンドを利用するのであればsnapは不要です。ubuntu server 26.04 LTSをminimizedで導入直後にsnapを削除する方法をネットで調べて試してみました。その内容を記述します。

2.詳細

手順を残すために、ubuntu server 26.04にsshでloginして作業をしました。consoleで作業されても問題ありません。
作業手順は以下の通りです。

(1) snapコマンドで状態を確認する
(2) snap listコマンドで導入されているパッケージを確認する。何もありません、snap本体のみ存在。
(3) aptコマンドでsnapをpurgeする
(4) snapが利用したdirectoryを削除する
(5) snapが再導入されないようにhold設定する
(6) snapコマンドで状態を確認する

実行結果

$ snap
The snap command lets you install, configure, refresh and remove snaps.
Snaps are packages that work across many different Linux distributions,
enabling secure delivery and operation of the latest apps and utilities.

Usage: snap <command> [<options>...]

Commonly used commands can be classified as follows:

           Basics: find, info, install, remove, list, components
          ...more: refresh, revert, switch, disable, enable, create-cohort
          History: changes, tasks, abort, watch
          Daemons: services, start, stop, restart, logs
      Permissions: connections, interface, connect, disconnect
    Configuration: get, set, unset, wait
      App Aliases: alias, aliases, unalias, prefer
          Account: login, logout, whoami
        Snapshots: saved, save, check-snapshot, restore, forget
  Issue reporting: report-issue
           Device: model, remodel, reboot, recovery
     Quota Groups: set-quota, remove-quota, quotas, quota
  Validation Sets: validate
        ... Other: warnings, okay, known, ack, version
      Development: download, pack, run, try, sign

For more information about a command, run 'snap help <command>'.
For a short summary of all commands, run 'snap help --all'.

$ snap list
No snaps are installed yet. Try 'snap install hello-world'.

$ sudo apt purge snapd
[sudo: authenticate] Password:        
REMOVING:                       
  snapd*  ubuntu-server-minimal*

Summary:
  Upgrading: 0, Installing: 0, Removing: 2, Not Upgrading: 0
  Freed space: 147 MB

Continue? [Y/n] Y
(Reading database ... 85143 files and directories currently installed.)
Removing ubuntu-server-minimal (1.570) ...
Removing snapd (2.74.1+ubuntu26.04.3) ...
Stopping 'snapd.service', but its triggering units are still active:
snapd.socket
Processing triggers for dbus (1.16.2-2ubuntu4) ...
(Reading database ... 85042 files and directories currently installed.)
Purging configuration files for snapd (2.74.1+ubuntu26.04.3) ...
rmdir: failed to remove '/etc/systemd/system/snapd.mounts.target.wants': No such file or directory
Discarding preserved snap namespaces
Final directory cleanup
Removing extra snap-confine apparmor rules
Removing snapd cache
Removing snapd state

$ sudo rm -rf /var/cache/snapd
$ ls /var/cache/snapd
ls: cannot access '/var/cache/snapd': No such file or directory

$ sudo apt-mark hold snapd
snapd set on hold.

$ snap
-bash: /usr/bin/snap: No such file or directory

コメント

このブログの人気の投稿

LinuxMint 22.3にdosbox-xを導入してWindows95/98のGameを動かしました

ubuntu 26.04 LTSのリリース発表があり、Daily Build版を導入しました

ubuntu desktop 26.04 LTSをKVM環境にDaily Build版を導入しました