How to install snap packages in Cubic?

Asked by Cubic PPA

Services such as snapd do not run in Cubic's Terminal page, so you can not install snap packages using the snap install command.

Considering this limitation, how can snap packages be installed in a custom OS using Cubic?

Question information

Language:
English Edit question
Status:
Solved
For:
Cubic Edit question
Assignee:
No assignee Edit question
Solved by:
Cubic PPA
Solved:
Last query:
Last reply:
Revision history for this message
Cubic PPA (cubic-wizard) said :
#1

You can "seed" snaps.

Here is an example seeding the Gnome Calculator snap package. I tested this approach on Xubuntu 20.04.

.

PREFORM THE FOLLOWING STEPS ON YOUR HOST COMPUTER...

1. Create the seed directory structure.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    mkdir seed
    cd seed
    mkdir snaps
    mkdir assertions
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

2. Download the snaps.

The following additional snaps are required to install Gnome Calculator:

• core
• core18
• gnome-3-34-1804
• gtk-common-themes

Identifying required snap packages can be a trial and error process (as explained in step 12, below).

The core snap package is required because it is used by the model and account assertions (in step 4, below).

Depending on the snap package you are installing, you may need core18 (Ubuntu 18.04) or core20 (Ubuntu 20.04) . Gnome Calculator requires core18.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    snap download core
    snap download core18
    snap download gnome-3-34-1804
    snap download gnome-calculator
    snap download gtk-common-themes
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

3. Move the downloaded files to the correct directories.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    mv *snap ./snaps
    mv *assert ./assertions
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

4. Create model and account assertions.

You only have to do this step once, even if you download additional snap packages.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    cd ./assertions
    snap known --remote model series=16 model=generic-classic brand-id=generic > generic-classic.model
    ACCOUNT_KEY=`awk '/sign-key-sha3-384/{print $2}' generic-classic.model`
    snap known --remote account-key public-key-sha3-384=${ACCOUNT_KEY} > generic.account-key
    snap known --remote account account-id=generic > generic.account
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

5. Create a seed.yaml file.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    cd ..
    touch ./seed.yaml
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

6. List the snaps so you can add them to the seed.yaml file.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    ls -1 snaps
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Here is the output for this example.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    core_11167.snap
    core18_2066.snap
    gnome-3-34-1804_72.snap
    gnome-calculator_884.snap
    gtk-common-themes_1515.snap
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

7. Open the new seed.yaml file in a text editor such as Gedit.

Add all of the snaps you had downloaded in step 2, using the following structure:

• The file starts with "snaps:"
• Each snap is separated by a line containing the dash (-) character
• The name is the part of the *.snap file before the underscore (_) character
• The channel should be stable (unless you downloaded from a different channel)
• The file is simply the full file name of the *.snap file

Here is the seed.yaml for this example.

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    snaps:
      -
        name: core
        channel: stable
        file: core_11167.snap
      -
        name: core18
        channel: stable
        file: core18_2066.snap
      -
        name: gnome-3-34-1804
        channel: stable
        file: gnome-3-34-1804_72.snap
      -
        name: gnome-calculator
        channel: stable
        file: gnome-calculator_884.snap
      -
        name: gtk-common-themes
        channel: stable
        file: gtk-common-themes_1515.snap
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

.

PREFORM THE FOLLOWING STEPS USING CUBIC...

8. Launch Cubic.

9. Navigate to the Terminal page.

Change the current directory.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    cd /var/lib/snapd
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

10. Copy the snap seed files.

Open a file browser such as Nautilus.

Drag and drop the seed directory you created in step 1 onto the Cubic window in order to copy it into the current directory /var/lib/snapd.

11. Finish generating the custom ISO and exit Cubic.

.

TESTING AND FINDING ERRORS...

12. Boot into your customized ISO.

Open a terminal.

Execute the following:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    snap warnings
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

If the snap packages were installed successfully, you will see the message No warnings. Otherwise, you will see a message explaining the issue. If the snap you tried to seed requires another snap package, the missing snap package will be listed. In that case, add the missing package, as shown in step 2.

In my test, the Gnome Calculator icon was not initially displayed in the Applications list. However, after I launched the application from the command line, using gnome-calculator, the launcher icon was then added to the Applications list.