Spice connection refused on all VMs

tecman240

New Member
Mar 30, 2020
6
0
1
65
I have a proxmox stand-alone server that won't connect a spice console(from prox gui) to any VM. These guests are all windows-based and have run successfully in the past on this machine using spice. (I can connect to these VMs using proxmox NoVNC console)

I have a second machine running proxmox windows VMs with Spice successfully. From what I can tell, the two proxmox machines are configured identically.
Can someone give me some guidance on troubleshooting the:
"Unable to connect to the graphic server /...., Could not connect to proxy server ::1: Connection refused

thanks!
 
What kind of certificate did you used, is a custom certificate or default?

please check on your certificate, path is: /etc/pve/priv
 
i had the same problem as If you can't start a Spice session from the PVE Web gui,

i used this : spice.sh

Code:
nano spice.sh

Code:
#!/bin/bash

set -e

# needs pve-manager >= 3.1-44

usage() {
    echo "Usage: $0 [-u <string>] [-p <string>] vmid [node [proxy]]"
    echo
    echo "-u username. Default root@pam"
    echo "-p password. Default ''"
    echo
    echo "vmid: id for VM"
    echo "node: Proxmox cluster node name"
    echo "proxy: DNS or IP (use <node> as default)"
    exit 1
}

PASSWORD=""
USERNAME=""

while getopts ":u:p:" o; do
    case "${o}" in
        u)
            USERNAME="${OPTARG}"
            ;;
        p)
            PASSWORD="${OPTARG}"
            ;;
        *)
            usage
            ;;
    esac
done

shift $((OPTIND-1))

if [[ -z "$PASSWORD" ]]; then
    PASSWORD=""
fi
if [[ -z "$USERNAME" ]]; then
    USERNAME='root@pam'
fi

DEFAULTHOST="$(hostname -f)"

# select VM
[[ -z "$1" ]] && usage
VMID="$1"

#[[ -z "$2" ]] && usage
NODE="${2:-$DEFAULTHOST}"

if [[ -z "$3" ]]; then
    PROXY="$NODE"
else
    PROXY="$3"
fi

NODE="${NODE%%\.*}"

DATA="$(curl -f -s -S -k --data-urlencode "username=$USERNAME" --data-urlencode "password=$PASSWORD" "https://$PROXY:8006/api2/json/access/ticket")"

echo "AUTH OK"

TICKET="${DATA//\"/}"
TICKET="${TICKET##*ticket:}"
TICKET="${TICKET%%,*}"
TICKET="${TICKET%%\}*}"

CSRF="${DATA//\"/}"
CSRF="${CSRF##*CSRFPreventionToken:}"
CSRF="${CSRF%%,*}"
CSRF="${CSRF%%\}*}"

curl -f -s -S -k -b "PVEAuthCookie=$TICKET" -H "CSRFPreventionToken: $CSRF" "https://$PROXY:8006/api2/spiceconfig/nodes/$NODE/qemu/$VMID/spiceproxy" -d "proxy=$PROXY" > spiceproxy

exec remote-viewer spiceproxy

Code:
chmod +x spice.sh

Usage: ./spice.sh [-u <string>] [-p <string>] vmid [node [proxy]]

exemple
Code:
./spice.sh -u user1 -p password 100

https://pve.proxmox.com/wiki/SPICE
spice.sh : https://git.proxmox.com/?p=pve-manager.git;a=blob_plain;f=spice-example-sh;hb=HEAD
 
Last edited: