Snappy

From 太極
Revision as of 14:34, 21 September 2022 by Brb (talk | contribs) (→‎AppImage)
Jump to navigation Jump to search

Why choose Flatpaks and Snaps

6 Reasons Flatpaks and Snaps Are Great for Linux

  • You Get New Apps and Updates Right Away
  • Developers Can Easily Get Their Apps on Linux
  • Developers Ship to All Distros From One Place
  • Increased Security Through Sandboxing
  • Keep Your Apps When Upgrading Your Distro
  • Use the Latest Apps on an Old or LTS Distro

Snappy (package manager)

Does the Snap Store Use Too Much Memory, data

On my Ubuntu 20.04, snap-store uses about 300MB memory (number 1 according to the system monitor).

sudo snap remove snap-store && sudo apt install gnome-software

I find I still need to manually kill the existing process.

Some in my list

Default in Ubuntu 20.04

$ snap list
Name               Version             Rev    Tracking         Publisher   Notes
core18             20201210            1944   latest/stable    canonical✓  base
gnome-3-34-1804    0+git.3556cb3       60     latest/stable/…  canonical✓  -
gtk-common-themes  0.1-50-gf7627e4     1514   latest/stable/…  canonical✓  -
snap-store         3.38.0-59-g494f078  518    latest/stable/…  canonical✓  -
snapd              2.48.1              10492  latest/stable    canonical✓  snapd

Others:

  • glances
  • krop

How Snappy packages are different from Deb

An article from PCWorld. Skype, Spotify, Minecraft, JetBrains Dev Suite, MySQL Workbench, Blender.

  • Applications are no longer installed system-wide. The base Ubuntu operating system is kept securely isolated from applications you install later. Both the base system and Snappy packages are kept as read-only images.
  • Snappy packages can include all the libraries and files they need, so they don’t depend on other packages.
  • An update can never fail, as a package installation could potentially fail and become incomplete with typical Linux packages.
  • Snappy also supports “delta” updates, which means only the changed bits of the package need to be downloaded and installed.
  • Snappy-based Ubuntu systems might be standard.

Snap vs Flatpak vs AppImage

Snap vs. Flatpak vs. AppImage: Know The Differences, Which is Better

What are the differences between snaps, appimage, flatpak and others?

Flatpak vs Snap: Which one should I use?

  • The first big difference is that Snap is a project of Canonical that in the future intends that all Ubuntu programs will use this technology. While Flatpak is not associated with any Linux distribution and its goal is to improve the installation of the programs in Linux.
  • Snap supports IoT or network services technologies while Flatpak focuses on desktop applications
  • Flatpak applications can also be launched/searched from the Ubuntu desktop

Snap commands

Some snap commands

  1. snap help
  2. snap version
  3. snap list: see a list of installed snap app
  4. snap find queryname: find a snap app. For example snap find browser, snap find media.
  5. snap install appname: install snap apps
  6. snap remove appname: remove snap apps
  7. snap info appname: see more information about a snap app
  8. sudo snap refresh: update a snap app. You actually don't need it since snapd runs in the background and handles updates automatically
  9. snap changes: see a history of the changes made to your system

How to run the Snap applications: you can run snap applications just like any other application installed on your system.

6 Essential Ubuntu Snap Commands You Should Know

Update packages

# Update a package
sudo snap refresh <package>

# Update all packages
sudo snap refresh

How To Remove Old Snap Versions To Free Up Disk Space

$ du -sh /var/lib/snapd/snaps/
2.2G	/var/lib/snapd/snaps/
$ ls /var/lib/snapd/snaps/
anbox_167.snap             gnome-characters_206.snap
atom_222.snap              gnome-characters_254.snap
...
gnome-calculator_406.snap  sublime-text_58.snap
gnome-characters_139.snap
$ sudo snap set system refresh.retain=2   # Not useful
[sudo] password for brb: 
$ du -sh /var/lib/snapd/snaps/
2.2G	/var/lib/snapd/snaps/

$ nano remove-old-snaps
$ chmod +x remove-old-snaps
$ sudo ./remove-old-snaps
atom (revision 222) removed
atom (revision 223) removed
...
sublime-text (revision 51) removed
sublime-text (revision 44) removed
$ du -sh /var/lib/snapd/snaps/
1.1G	/var/lib/snapd/snaps/

Flatpak

# List apps
flatpak list --app

# List run-time libraries
flatpak list --runtime

# Install a flatpak package
flatpak install flathub de.haeckerfelix.Shortwave

# Uninstall a flatpak package
flatpak uninstall --delete-data de.haeckerfelix.Shortwave

# Removing flatpak apps WILL NOT remove the independent runtime libraries (QT, GNOME platforms)
# Run this command to get rid of them to free up disk space:
flatpak uninstall --unused

Consider the Gradio app.

$ flatpak install de.haeckerfelix.gradio.flatpakref # it will ask the password in a new window
$ flatpak uninstall de.haeckerfelix.gradio

Now we can launch the Gradio app from the Launch Menu.

Note: no 'sudo' is required.

Remove unused flatpak runtimes

How To Remove Unused Flatpak Runtimes To Free Up Disk Space

How to update a flatpak app

How to Install and Use Flatpak on Linux

flatpak list

sudo flatpak update org.gimp.GIMP

Where are the files

https://github.com/flatpak/flatpak/wiki/Filesystem

  • .local/share/flatpak
  • /var/lib/flatpak/app

AppImage & AppImageLauncher

http://appimage.org/ AppImage

We need to make the file executable before we can open it. Right click the file, Properties -> Permissions.

One advantage of the AppImage is portability. AppImages are usually faster than snaps or flatpaks and need less storage space. They are also easy to remove as you can delete AppImage files anytime you want without interrupting other system processes.

One problem of the AppImage files is they cannot be found in Ubuntu's launcher/search function. But check out this: Integrate AppImages To Application Menu Using AppImageLauncher.

What is an “AppImage”? How do I install it?

Some examples

Docker

I haven't found any tutorial yet!

Ova image

Sorry, I don't get the command line back. Booting stuck in the middle.

Beaglebone

http://beagleboard.org/snappy or http://www.ubuntu.com/things#try-beaglebone

Raspberry Pi 2

https://darrenjw2.wordpress.com/2015/02/07/getting-started-with-snappy-ubuntu-core-on-the-raspberry-pi-2/