lando / core

Current Lando v3 runtime
https://docs.lando.dev/core/v3
GNU General Public License v3.0
9 stars 22 forks source link

Docker autostart does not work anymore #110

Closed soleneggd closed 6 months ago

soleneggd commented 6 months ago

To fix this issue #105, I updated @lando/core with last version but now docker autostart no longer works. When a run lando start, lando asks me to "Enter computer password for [user] to start docker". But when I type my password and press Enter, the question just shows up again as if I made a mistake in my password. But I'm sure the problem is not my password because I did not change it after the update, and I even try to change it in case I was wrong but still the same issue.

I don't know if this is linked but the appareance of the question to autostart Docker has changed. Here is what I had before the update (when my password used to work) : 417833838_853323439892915_261596265678070364_n

Here is what I get now (when my password does not work) : Capture d'écran 2024-02-21 110536

And sometimes when I type 1 character and press Enter, I have additional information appearing but it disappear when I type other characters. Here is what I get : Capture d'écran 2024-02-21 113438

I am on WSL with Ubuntu, without Docker Desktop but Docker and Docker compose installed manually. Everything worked before the update.

soleneggd commented 6 months ago

Here is what I get when I run lando start --debug :

lando [STARTED] It seems Docker is not running, trying to start it up...  +16ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣  +17ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ *  +7998ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ **  +151ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ ***  +80ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ ****  +55ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ *****  +306ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ ******  +50ms
  lando running elevated command 'sudo' %o %o 0=--stdin, 1=--bell, 2=--, 3=echo, 4=hello there +11525ms
  lando 'sudo' stderr '[sudo] password for [user]:'  +15ms
  lando 'sudo' stdout 'hello there'  +44ms
  lando [PROMPT] ✔ Enter computer password for [user] to start docker · ******  +2913ms
  lando engine is down with error {}  +198ms
  lando running elevated command 'sudo' %o %o 0=--stdin, 1=--bell, 2=--, 3=systemctl, 4=start, 5=docker.service +1ms
  lando 'sudo' stderr "System has not been booted with systemd as init system (PID 1). Can't operate.\n" +
  'Failed to connect to bus: Host is down'  +14ms
  lando {"code":1}  +17ms
  lando [RETRY] It seems Docker is not running, trying to start it up... [1]  +1ms
  lando [FAILED] System has not been booted with systemd as init system (PID 1). Can't operate.
[FAILED] Failed to connect to bus: Host is down
  +1ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣  +1ms

(I replaced my username by [user])

soleneggd commented 6 months ago

It doesn't seem to work. There is a new error in debug now :


lando [STARTED] It seems Docker is not running, trying to start it up...  +11ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣  +13ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ *  +2118ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ **  +124ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ ***  +108ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ ****  +55ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ *****  +299ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣ ******  +62ms
  lando running elevated command 'sudo' %o %o 0=--stdin, 1=--bell, 2=--, 3=echo, 4=hello there +3136ms
  lando 'sudo' stderr '[sudo] password for [user]:'  +13ms
  lando 'sudo' stdout 'hello there'  +35ms
  lando [PROMPT] ✔ Enter computer password for [user] to start docker · ******  +396ms
  lando engine is down with error {}  +1779ms
  lando running elevated command 'sudo' %o %o 0=--stdin, 1=--bell, 2=--, 3=/home/[user]/.lando/scripts/docker-engine-start.sh +0ms
  lando 'sudo' stderr 'root is not in the sudoers file.  This incident will be reported.'  +22ms
                                                                                                  lando 'sudo' stderr 'root is not in the sudoers file.  This incident will be reported.'  +3ms
                                                                                                                                                                                                 lando {"code":1}  +28ms
  lando [RETRY] It seems Docker is not running, trying to start it up... [1]  +1ms
  lando [FAILED] root is not in the sudoers file.  This incident will be reported.
[FAILED] root is not in the sudoers file.  This incident will be reported.
  +1ms
  lando [PROMPT] ? Enter computer password for [user] to start docker ‣  +1ms
soleneggd commented 6 months ago

Ok it seems that sudo usermod -aG sudo root fixes the problem, but I don't know if it was the solution or there is something to change in lando.

pirog commented 6 months ago

@soleneggd makes sense but its weird that its trying to run as root instead of you, going to reopen this to investigate more

pirog commented 6 months ago

@soleneggd correctly pointed out in slack that we are running sudo inside a script that is already running elevated so that is why the user is "root"

roikedem commented 2 months ago

It happens to me too, I didn't understand why was the issue closed. I tried uninstalling docker and reinstalling it via the lando install script, but it didn't help. When I run with -vvv I get this:

lando [STARTED] It seems Docker is not running, trying to start it up... +4ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ +4ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ +22920ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ +266ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ +390ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ +129ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ * +96ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ **** +94ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ * +122ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ **** +131ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ ***** +93ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ ** +83ms lando running elevated command 'sudo' %o %o 0=--stdin, 1=--bell, 2=--, 3=echo, 4=hello there +24489ms lando 'sudo' stdout 'hello there' +5ms lando elevated command [ '--stdin', '--bell', '--', 'echo', 'hello there', length: 5 ] done with code %o 0 +1ms lando [PROMPT] ✔ Enter computer password for roi to start docker · ** +164ms lando engine is down with error WARNING: Plugin "/usr/local/lib/docker/cli-plugins/docker-compose" is not valid: failed to fetch metadata: fork/exec /usr/local/lib/docker/cli-plugins/docker-compose: no such file or directory WARNING: Plugin "/usr/local/lib/docker/cli-plugins/docker-scan" is not valid: failed to fetch metadata: fork/exec /usr/local/lib/docker/cli-plugins/docker-scan: no such file or directory ERROR: Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running? errors pretty printing info +80ms lando running elevated command 'sudo' %o %o 0=--stdin, 1=--bell, 2=--, 3=/home/roi/.lando/scripts/docker-engine-start.sh +0ms lando 'sudo' stderr "System has not been booted with systemd as init system (PID 1). Can't operate.\n" + 'Failed to connect to bus: Host is down' +4ms lando 'sudo' stderr '/etc/init.d/docker: 62: ulimit: error setting limit (Invalid argument)' +4ms lando elevated command [ '--stdin', '--bell', '--', '/home/roi/.lando/scripts/docker-engine-start.sh',

] done with code 2 +1ms lando {"code":2} +10ms lando [RETRY] It seems Docker is not running, trying to start it up... [1] +1ms lando [FAILED] System has not been booted with systemd as init system (PID 1). Can't operate. [FAILED] Failed to connect to bus: Host is down [FAILED] /etc/init.d/docker: 62: ulimit: error setting limit (Invalid argument) +0ms lando [PAUSED] It seems Docker is not running, trying to start it up... +0ms lando [PROMPT] ? Enter computer password for roi to start docker ‣ +1003ms

reynoldsalec commented 2 months ago

@roikedem it looks like there's an issue with your installation of Docker/Docker Compose. Are you running Lando in a WSL2 environment? Looking at some of these errors makes me wonder if you're possible running an older version of WSL (see https://askubuntu.com/questions/1379425/system-has-not-been-booted-with-systemd-as-init-system-pid-1-cant-operate)... if that's the case @AaronFeledy might have some insights since he is the Duke of Windows 👑.

roikedem commented 2 months ago

Hi, thanks @reynoldsalec - yes WSL2, Ubuntu, Lando, Drupal. @AaronFeledy do you think you can help? Everything used to work OK for some years now, until last week (I think Windows booted itself for update but I am not sure) when I got 3 problems (related?):

  1. Some issues with xdebug (doesn't come through from docker to my Windows)
  2. Proxy issues (I get "Lando was not able to start the proxy" on lando rebuild)
  3. Docker problem (I get "Enter computer password for [user] to start docker" as in this issue repeatedly unless I run docker with sudo in advance). Running docker with "sudo systemctl start docker" doesn't work (I get "System has not been booted with systemd as init system (PID 1). Can't operate. \ \ Failed to connect to bus: Host is down") So I run it with sudo dockerd or service docker start on a separate terminal When I run "lando rebuild -y" I see this error on the docker output terminal:
    ERRO[2024-06-25T11:50:09.273358216+03:00] Handler for POST /networks/lando_bridge_network/disconnect returned error: container c63e2632ebe487716f0b43c6d7d0e9d81e3d87b157f6093bac281e297a4fda7b is not connected to network lando_bridge_network  spanID=45a0f4ba974d752e traceID=70150bd56f4a5543004df9e198763024

By the way:

PS C:\Users\roike> wsl.exe --version
WSL version: 2.2.4.0
Kernel version: 5.15.153.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5326
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.26091.1-240325-1447.ge-release
Windows version: 10.0.22631.3737

I tried to uninstall docker

sudo apt-get autoremove -y --purge docker-ce docker-ce-cli docker-ce-rootless-extras docker-compose  docker-compose-plugin  docker-scan-plugin

and reinstall it using lando's install script

/bin/bash` -c "$(curl -fsSL https://get.lando.dev/setup-lando.sh)"

the install script was apparently successful but it outputted this:


this script is about to:
.
.
.
? Enter computer password for undefined to add them to docker group ‣

Which doesn't seem right

reynoldsalec commented 2 months ago

@roikedem if you've been running Lando on WSL for several years and are having these errors, then I'm guessing reading through the top answer on that AskUbuntu thread I linked may be the best thing to do; it sounds like you may need to "upgrade" to the more modern WSL2 "application" version they mention.

AaronFeledy commented 2 months ago

You won't have systemd enabled by default in Ubuntu. That's expected and you don't need it for Docker or Lando, so you don't need to enable it unless you know you need it for something else.

What do you get when you enter docker version?

AaronFeledy commented 2 months ago

@roikedem There's a good chance that you have this issue: #181

roikedem commented 2 months ago

I gave up and installed another Ubuntu on the WSL (24.04) and things are solved. Now it's just about moving my files to the new machine. Regarding xdebug not being able to communicate - I found that my .lando and php.ini files had wrong IP for accessing from docker, but somehow it worked for the last 2 years until last week. thanks for the help, and I hope this issue is solved because I guess I am not the only one who got their ubuntu useless, and people are choosing between lando and competitors all the time

kaushalyap commented 1 month ago

I'm experiencing something similar, lando start keeps asking for user password continuously to start docker even with correct password, BTW current user is also in docker group, docker daemon is enabled and running.

Taiger commented 3 weeks ago

I noticed that I get this issue after a restart. If I start WSL by entering "WSL" in a cmd window, then go back and try "lando start", then Lando starts up without issue.

Ideally, you can make WSL start every time you restart your laptop. However, if you have a Corporate laptop, you may not have permission to use the Task Scheduler.

Here are the instructions: https://learn.microsoft.com/en-us/answers/questions/1163405/automatically-starting-a-service-when-a-wsl-instan