Aw snap.I can't pull any snaps

What happened

I’m working on a cloud server with ubuntu 18.04 My auto build script exited with 1

What included in the build config

  • The snap isn’t installed on this machine by default.So I need to manual download by running sudo apt install -y snapd everything goes fine and I’m trying to pull a snap.But this step returned 1

Output

➜  /path/to/my/repository git:(master) snap
zsh: command not found: snap
➜  /path/to/my/repository git:(master) apt install snapd   # we run as root
...(a lot of text)
Setting up snapd ...
➜  /path/to/my/repository git:(master) snap install space
error: cannot communicate with server: Get http://localhost/v2/snaps/space/conf?keys=: dial unix /run/snapd.socket: connect: no such file or directory
Error:1

:slightly_frowning_face:

Other things

But on my katacoda scenario,the snap works fine.I can pull snaps I want. https://katacoda.com/courses/ubuntu/playground1804 (…maybe this post is similar than mine:- Interface: unnamed sockets -)

1 Like

Can you say what cloud server provider you’re using? It seems likely that they are not providing a complete Ubuntu system, but rather some form of container running a subset of what you’d find on a full Linux system.

To help debug things, it would be useful to see the output of the following commands:

systemctl status snapd.socket
systemctl status snapd.service

Uh…

> # systemctl status snapd.socket                                                                                              [±master ✓]
systemctl status snapd.service
System has not been booted with systemd as init system (PID 1). Can't operate.
System has not been booted with systemd as init system (PID 1). Can't operate.
root@ws-vrretb-0 ~/RemoteWorking                                                                                                [10:38:01] 
> # snap version                                                                                                               [±master ✓]
snap    2.45.1+18.04.2
snapd   unavailable(I don't know why)
series  -

Seems this post contains the same problem than me

With those errors, this definitely doesn’t sound like a standard Ubuntu system. The following command should tell you what is running instead of systemd:

ps -p 1

It is unlikely that you’ll be able to get snapd running without systemd. It’s probably something you’ll have to take up with your hosting provider.

➜  RemoteWorking git:(master) ps -p 1
  PID TTY          TIME CMD
    1 ?        00:00:00 supervisord

(only this,Even there is no “zsh”(current running shell) in this list)

It’s normal that you’d only get one result: the command asks to list process ID 1. What is unusual is that process ID 1 is supervisord rather than systemd.

This is not something that snapd can work around, which is why I suggested getting in contact with your hosting provider. If they advertised that they were providing Ubuntu systems and this is what you got, then that also sounds like a problem.