ssh: Connection refused loop #121

Closed
opened 2025-12-28 23:25:25 +01:00 by adam · 7 comments
Owner

Originally created by @shivangp76 on GitHub (Mar 10, 2021).

Hello,

When running the "Quick Start Large Pre-Made Image" headless version, after a couple of minutes, I see the CLI, so it works, but when I use the non-headless version, the following message repeats on loop. I also get the same message when running headless, but after a couple of minutes the CLI loads. I have tried running the non-headless command for 3+ hours and still the message loops.

Disk is being copied between layers. Repeating until able to copy SSH key into OSX...
/usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub"
ssh: connect to host 127.0.0.1 port 10022: Connection refused

Output to requested command:

Linux arch-desktop 5.11.4-arch1-1 #1 SMP PREEMPT Sun, 07 Mar 2021 18:00:49 +0000 x86_64 GNU/Linux
[sudo] password for shivang:
1
NAME="Arch Linux"
PRETTY_NAME="Arch Linux"
Filesystem Size Used Avail Use% Mounted on
/dev/sdb4 867G 192G 631G 24% /home
QEMU emulator version 5.2.0
Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers
libvirtd (libvirt) 7.0.0
total used free shared buff/cache available
Mem: 31Gi 1.6Gi 1.3Gi 352Mi 28Gi 28Gi
Swap: 9Gi 88Mi 9.9Gi
8
16
crw-rw-rw- 1 root kvm 10, 232 Mar 10 09:41 /dev/kvm
total 0
drwxrwxrwt 2 root root 60 Mar 10 08:47 .
drwxrwxrwt 13 root root 300 Mar 10 12:31 ..
srwxrwxrwx 1 shivang wheel 0 Mar 10 08:47 X0
root 1540 0.0 0.2 1898852 73808 ? Ssl 08:48 0:11 /usr/bin/dockerd -H fd://
shivang 416463 0.0 0.0 3172 812 pts/0 S+ 12:31 0:00 grep dockerd
kvm:x:992:
libvirt:x:972:
docker:x:971:shivang

Originally created by @shivangp76 on GitHub (Mar 10, 2021). Hello, When running the "Quick Start Large Pre-Made Image" headless version, after a couple of minutes, I see the CLI, so it works, but when I use the non-headless version, the following message repeats on loop. I also get the same message when running headless, but after a couple of minutes the CLI loads. I have tried running the non-headless command for 3+ hours and still the message loops. ``` Disk is being copied between layers. Repeating until able to copy SSH key into OSX... /usr/sbin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/arch/.ssh/id_docker_osx.pub" ssh: connect to host 127.0.0.1 port 10022: Connection refused ``` # Output to requested command: Linux arch-desktop 5.11.4-arch1-1 #1 SMP PREEMPT Sun, 07 Mar 2021 18:00:49 +0000 x86_64 GNU/Linux [sudo] password for shivang: 1 NAME="Arch Linux" PRETTY_NAME="Arch Linux" Filesystem Size Used Avail Use% Mounted on /dev/sdb4 867G 192G 631G 24% /home QEMU emulator version 5.2.0 Copyright (c) 2003-2020 Fabrice Bellard and the QEMU Project developers libvirtd (libvirt) 7.0.0 total used free shared buff/cache available Mem: 31Gi 1.6Gi 1.3Gi 352Mi 28Gi 28Gi Swap: 9Gi 88Mi 9.9Gi 8 16 crw-rw-rw- 1 root kvm 10, 232 Mar 10 09:41 /dev/kvm total 0 drwxrwxrwt 2 root root 60 Mar 10 08:47 . drwxrwxrwt 13 root root 300 Mar 10 12:31 .. srwxrwxrwx 1 shivang wheel 0 Mar 10 08:47 X0 root 1540 0.0 0.2 1898852 73808 ? Ssl 08:48 0:11 /usr/bin/dockerd -H fd:// shivang 416463 0.0 0.0 3172 812 pts/0 S+ 12:31 0:00 grep dockerd kvm:x:992: libvirt:x:972: docker:x:971:shivang
adam closed this issue 2025-12-28 23:25:25 +01:00
Author
Owner

@sickcodes commented on GitHub (Mar 10, 2021):

Does this image work?

# Catalina
docker run -it \
    --device /dev/kvm \
    -p 50922:10022 \
    -v /tmp/.X11-unix:/tmp/.X11-unix \
    -e "DISPLAY=${DISPLAY:-:0.0}" \
    sickcodes/docker-osx:latest

Please post the error, it's most likely related to root/userspace display:

srwxrwxrwx 1 shivang wheel 0 Mar 10 08:47 X0
Shivang is running the X server, but I have a feeling you're running docker using sudo?

If not, are you running as root? If not, then run docker run without root, because root doesn't have a desktop open. If you can't run without root, add yourself to kvm and libvirt groups are you're currently missing from them

@sickcodes commented on GitHub (Mar 10, 2021): Does this image work? ```bash # Catalina docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ sickcodes/docker-osx:latest ``` Please post the error, it's most likely related to root/userspace display: ` srwxrwxrwx 1 shivang wheel 0 Mar 10 08:47 X0` Shivang is running the X server, but I have a feeling you're running docker using `sudo`? If not, are you running as root? If not, then run docker run without root, because root doesn't have a desktop open. If you can't run without root, add yourself to kvm and libvirt groups are you're currently missing from them
Author
Owner

@sickcodes commented on GitHub (Mar 10, 2021):

Also, apologies for making you wait 3 hours.

I should write a lil shell script that calculates how much % based off of df as I don't believe there's a way to verbosely show layer copy progress

@sickcodes commented on GitHub (Mar 10, 2021): Also, apologies for making you wait 3 hours. I should write a lil shell script that calculates how much % based off of `df` as I don't believe there's a way to verbosely show layer copy progress
Author
Owner

@shivangp76 commented on GitHub (Mar 11, 2021):

Here's the error message:

touch: cannot touch '': No such file or directory
chown: cannot access '': No such file or directory
ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519
nohup: appending output to 'nohup.out'
No protocol specified
Unable to init server: Could not connect: Connection refused
QEMU 5.2.0 monitor - type 'help' for more information
(qemu) ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize DAC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `dac'
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
ALSA lib confmisc.c:767:(parse_card) cannot find card '0'
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory
ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory
ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name
ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory
ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default
alsa: Could not initialize ADC
alsa: Failed to open `default':
alsa: Reason: No such file or directory
audio: Failed to create voice `adc'
gtk initialization failed

Also, I'm not using sudo or running as root. I'm in the libvirt group, but I don't see a kvm group. Am I missing a package or something that would create the kvm group?

@shivangp76 commented on GitHub (Mar 11, 2021): Here's the error message: ``` touch: cannot touch '': No such file or directory chown: cannot access '': No such file or directory ssh-keygen: generating new host keys: RSA DSA ECDSA ED25519 nohup: appending output to 'nohup.out' No protocol specified Unable to init server: Could not connect: Connection refused QEMU 5.2.0 monitor - type 'help' for more information (qemu) ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize DAC alsa: Failed to open `default': alsa: Reason: No such file or directory ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize DAC alsa: Failed to open `default': alsa: Reason: No such file or directory audio: Failed to create voice `dac' ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize ADC alsa: Failed to open `default': alsa: Reason: No such file or directory ALSA lib confmisc.c:767:(parse_card) cannot find card '0' ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directory ALSA lib confmisc.c:392:(snd_func_concat) error evaluating strings ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_concat returned error: No such file or directory ALSA lib confmisc.c:1246:(snd_func_refer) error evaluating name ALSA lib conf.c:4745:(_snd_config_evaluate) function snd_func_refer returned error: No such file or directory ALSA lib conf.c:5233:(snd_config_expand) Evaluate error: No such file or directory ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM default alsa: Could not initialize ADC alsa: Failed to open `default': alsa: Reason: No such file or directory audio: Failed to create voice `adc' gtk initialization failed ``` Also, I'm not using ```sudo``` or running as root. I'm in the libvirt group, but I don't see a kvm group. Am I missing a package or something that would create the kvm group?
Author
Owner

@sickcodes commented on GitHub (Mar 11, 2021):

Should look something like this:

kvm:x:78:user,root
docker:x:970:user
libvirt:x:966:user,root
libvirtdbus:x:969:root,user

Anyway, it's probably this: /usr/bin/dockerd -H fd://

xhost +

echo ${DISPLAY}

What desktop environment are you using? Are you running NAS or anything?

@sickcodes commented on GitHub (Mar 11, 2021): Should look something like this: ``` kvm:x:78:user,root docker:x:970:user libvirt:x:966:user,root libvirtdbus:x:969:root,user ``` Anyway, it's probably this: `/usr/bin/dockerd -H fd://` `xhost +` `echo ${DISPLAY}` What desktop environment are you using? Are you running NAS or anything?
Author
Owner

@shivangp76 commented on GitHub (Mar 11, 2021):

Ah, I did cat /etc/group and realized the kvm group was there, but I just wasn't in it, so I added myself. FYI the permissions for the groups are

$ cat /etc/group | grep -e kvm -e docker -e libvirt
kvm:x:992:shivang
libvirt:x:972:shivang
docker:x:971:shivang

So now the Catalina image command you sent works and launches. There are still all of those alsa errors, but I can at least boot into Catalina and it works perfectly. However, I'm still getting the same error message for the original image I tried. What does this do exactly: /usr/bin/dockerd -H fd://? I couldn't get it to run, but I'll look more into it.

Also

$ xhost +
access control disabled, clients can connect from any host
$ echo ${DISPLAY}
:0

I'm not using a desktop environment - just a window manager (dwm in case you were wondering). Not running NAS.

@shivangp76 commented on GitHub (Mar 11, 2021): Ah, I did ```cat /etc/group``` and realized the kvm group was there, but I just wasn't in it, so I added myself. FYI the permissions for the groups are ``` $ cat /etc/group | grep -e kvm -e docker -e libvirt kvm:x:992:shivang libvirt:x:972:shivang docker:x:971:shivang ``` So now the Catalina image command you sent works and launches. There are still all of those alsa errors, but I can at least boot into Catalina and it works perfectly. However, I'm still getting the same error message for the original image I tried. What does this do exactly: ```/usr/bin/dockerd -H fd://```? I couldn't get it to run, but I'll look more into it. Also ``` $ xhost + access control disabled, clients can connect from any host $ echo ${DISPLAY} :0 ``` I'm not using a desktop environment - just a window manager (dwm in case you were wondering). Not running NAS.
Author
Owner

@sickcodes commented on GitHub (Mar 11, 2021):

Everything is fine, Alsa errors are normal

@sickcodes commented on GitHub (Mar 11, 2021): Everything is fine, Alsa errors are normal
Author
Owner

@shivangp76 commented on GitHub (Mar 11, 2021):

So I still couldn't get Pre-Made Non-Headless Image working (docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ sickcodes/docker-osx:auto), but the catalina and big-sur images work, so I guess I'll just make do with that. Thank you so much for the help!

@shivangp76 commented on GitHub (Mar 11, 2021): So I still couldn't get Pre-Made Non-Headless Image working (```docker run -it \ --device /dev/kvm \ -p 50922:10022 \ -v /tmp/.X11-unix:/tmp/.X11-unix \ -e "DISPLAY=${DISPLAY:-:0.0}" \ sickcodes/docker-osx:auto```), but the catalina and big-sur images work, so I guess I'll just make do with that. Thank you so much for the help!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/Docker-OSX#121