First steps with a snap device?

Hi all,

Proficient Linux user, but totally new to snaps.
I’ve prepared a RPi3 with snappy core, created keys, logged in remotely, all good so far.
Normally, on a new headless device, there are certain things I would do next - for example setup an autossh tunnel, execute some wget commands, maybe assign a static IP, and so on.

Those are just examples, my issue is much more general; how do I use my device to do the more ‘normal’ and mundane things? I’ve installed a simple snap with no issues (just as a test), but I must be missing some basic guide somewhere that demonstrates the very basic, non-snap related, things.

I understand dpkg used to be available on earlier snappy-core releases, but not now. Even if that was still available now, I’d still be wondering what the ‘proper’ way forward should be with this more trivial stuff.

Any pointers gratefully received.
Many thanks.

for autossh there is a snap :wink:

ogra@localhost:~$ snap find autossh
Name         Version  Developer  Notes  Summary
sup-autossh  1.0.3    supcik     -      Auto SSH
ogra@localhost:~$ snap info sup-autossh
name:      sup-autossh
summary:   Auto SSH
publisher: supcik
description: |
  Automatically restart SSH sessions and tunnels.
snap-id:     RY9pRMOg3jHlNBuHILgBWp6MqTg0ZRBO
  stable:    1.0.3 (4) 53kB -
  candidate: 1.0.3 (4) 53kB -
  beta:      1.0.3 (4) 53kB -
  edge:      1.0.3 (4) 53kB -
ogra@localhost:~$ snap install sup-autossh
sup-autossh 1.0.3 from 'supcik' installed
ogra@localhost:~$ sup-autossh.autossh 
usage: autossh [-V] [-M monitor_port[:echo_port]] [-f] [SSH_OPTIONS]

Not sure what wget commands you want to execute … while wget isnt installed, there is scp and you can always install the classic mode snap to have an environment with dpkg available.

To change the network configuration you can either re-run the setup tool with (note that you need to complete it, there is no exit option and ctrl-c is blocked):

sudo console-conf

or edit the netplan configuration directly in /etc/netplan/00-snapd-config.yaml and run netplan generate and netplan apply …

there has never been an executable dpkg or apt on any Ubuntu Core installs (there were some dpkg related tools left around in 15.04 but none of the package managers themselves).

i’d suggest you ask questions as you hit issues when wanting to do specific tasks, we do not really have a “first start guide” apart from … “if you are missing something, see if there is a snap to solve your problem, if not try building one or ask in the forum” :wink:

Thanks for the information.

If I’m understanding correctly, I need a snap for everything I want to do, right?

The sup-autossh looks like it will be useful but, at present, I can’t get it to work; my normal autossh command is failing and I can’t see why. When I add -V, it echoes “autossh 1.4e” to stdout and quits - but this probably isn’t the place to discuss individual snaps.

The classic mode snap looks very useful thank you, also the console-conf.

Strange that you say dpkg or apt has never been on Ubuntu Core. This is where I saw that but, as he says in the video, it’s not around now.

I use wget to pull something every hour, as you say SCP will do that. I normally put this command in a crontab to run hourly, but I’ve just failed at that too! When saving the crontab I get:

/var/spool/cron/: mkstemp: Read-only file system
crontab: edits left in /tmp/crontab.hEQqDj/crontab

I think there’s something fundamental I’m just not ‘getting’. At present I don’t know if it’s specific to snappy-core or snaps in general.

Thanks again.

well, we always shipped a replacement script for both of them in /usr/local (and still do) so you dont get a plain “command not found” but will get a helpful text printed that tells you to use the snap command instead…

ogra@nanopi-air:~$ apt
Ubuntu Core does not use apt-get, see 'snap --help'!

systemd comes with timer support for that, in the light of “no duplication” cron isnt used (now … you could build a cron snap that gives you full cron support, but simply using a timer will be easier :slight_smile: )

Ah, systemd - I’m aware of its existence. Now’s the time to learn more, I guess.
Thanks again for your help.