I've been customising my Ubuntu Live ISO by installing various packages through the chroot environment in Cubic. Installing through apt appears to be working just fine but I just can't seem to be able to install through snap. Here's the error I get when I try "snap install vlc"
error: cannot communicate with server: Post dial unix /run/snapd.socket: connect: no such file or directoryHow do I fix this?
1 Answer
Services such as snapd do not run in Cubic's Terminal page, so you can not install snap packages using the snap install command.
However, you can "seed" snaps.
Here is an example seeding the Gnome Calculator snap package. I tested this approach on Xubuntu 20.04. These instructions are adapted from this blog post.
Preform the following steps on your host computer...
Create the seed directory structure.
mkdir seed cd seed mkdir snaps mkdir assertionsDownload 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
coresnap 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) orcore20(Ubuntu 20.04) . See this answer for a good explanation of what thecoresnap packages are and why you may need them. Gnome Calculator requirescore18.snap download core snap download core18 snap download gnome-3-34-1804 snap download gnome-calculator snap download gtk-common-themesMove the downloaded files to the correct directories.
mv *snap ./snaps mv *assert ./assertionsCreate model and account assertions.
You only have to do this step once, even if you download additional snap packages.
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.accountCreate a
seed.yamlfile.cd .. touch ./seed.yamlList the snaps so you can add them to the
seed.yamlfile.ls -1 snapsHere 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.snapOpen the new
seed.yamlfile 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
nameis the part of the*.snapfile before the underscore (_) character - The
channelshould bestable(unless you downloaded from a different channel) - The
fileis simply the full file name of the*.snapfile
Here is the
seed.yamlfor 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- The file starts with
Preform the following steps using Cubic...
Launch Cubic.
Navigate to the Terminal page.
Change the current directory:
cd /var/lib/snapdCopy the snap seed files.
Open a file browser such as Nautilus.
Drag and drop the
seeddirectory you created in step 1 onto the Cubic window in order to copy it into the current directory/var/lib/snapd.Finish generating the custom ISO and exit Cubic.
Testing and finding errors...
Boot into your customized ISO.
Open a terminal and execute:
snap warningsIf 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.