scaleway / docker-machine-driver-scaleway

:whale: Scaleway driver for Docker Machine
MIT License
249 stars 34 forks source link

Error running provisioning: Failed to obtain lock: Maximum number of retries (60) exceeded #108

Closed gregfr closed 4 years ago

gregfr commented 4 years ago

I'm trying to create instances with docker machine and I get this weird error:

# docker-machine create -d scaleway --scaleway-token=token --scaleway-organization=orgid --scaleway-commercial-type="DEV1-M" --scaleway-image="imageref" --scaleway-ip="ipref" --scaleway-name="name" name
Running pre-create checks...
Creating machine...
(name) Creating SSH key...
(name) Creating server...
(name) Starting server...
Waiting for machine to be running, this may take a few minutes...
Detecting operating system of created instance...
Waiting for SSH to be available...
Detecting the provisioner...
Provisioning with ubuntu(systemd)...
Error creating machine: Error running provisioning: Failed to obtain lock: Maximum number of retries (60) exceeded

This is instance is created noneless, however if I try to remove it:

# docker-machine rm name
About to remove name
WARNING: This action will delete both local reference and remote instance.
Are you sure? (y/n): y
Error removing host "name": unexpected end of JSON input

I thought maybe the installation what cut short, so I tried:

# docker-machine upgrade name

Waiting for SSH to be available...
Detecting the provisioner...
Upgrading docker...
Error running "DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y  docker-ce": ssh command error:
command : DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y  docker-ce
err     : exit status 100
output  : E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

So I connected via SSH and did what's asked:

# sudo dpkg --configure -a
( a lot of normal dpkg stuff)

and upgrade again:

# docker-machine upgrade name
Waiting for SSH to be available...
Detecting the provisioner...
Upgrading docker...
Error running "DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y  docker-ce": ssh command error:
command : DEBIAN_FRONTEND=noninteractive sudo -E apt-get install -y  docker-ce
err     : exit status 100
output  : Reading package lists...
Building dependency tree...
Reading state information...
docker-ce is already the newest version (5:18.09.0~3-0~ubuntu-xenial).
You might want to run 'apt-get -f install' to correct these:
The following packages have unmet dependencies:
 unattended-upgrades : Depends: powermgmt-base but it is not going to be installed
E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).

At that point I gave up and delete the instance from the GUI.

My system is:

Server Version: 19.03.3
Kernel Version: 5.0.0-38-generic
 Operating System: Ubuntu 19.04
gregfr commented 4 years ago

I time'd it:

real    6m14,533s
user    0m0,872s
sys 0m0,238s
gregfr commented 4 years ago

After the "create" process, I can ssh to it but cannot use docker via docker-machine (it's active):

# docker ps
unable to resolve docker endpoint: open /path/to/machines/name/ca.pem: no such file or directory
gregfr commented 4 years ago

So the problem was that the image used was too old. A process "unattended updates" is run just after the boot and is blocking docker-machine installation script. When using an updated image, everything is fine.