Skip to content

KasmVNC - Doesn't Start - Can't install dependencies #325

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
djarbz opened this issue Oct 19, 2024 · 0 comments · Fixed by #326
Closed

KasmVNC - Doesn't Start - Can't install dependencies #325

djarbz opened this issue Oct 19, 2024 · 0 comments · Fixed by #326
Labels
help wanted Extra attention is needed

Comments

@djarbz
Copy link
Contributor

djarbz commented Oct 19, 2024

Logs

cp: cannot stat '/etc/zsh/newuser.zshrc.recommended': No such file or directory
Detected Distribution: ubuntu
Detected Version: 24.04
Detected Architecture: x86_64
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100 2607k  100 2607k    0     0  4513k      0 --:--:-- --:--:-- --:--:-- 4513k
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 kasmvncserver : Depends: libgbm1 (>= 12.0.0~0) but it is not installable
                 Depends: libgl1 but it is not installable
                 Depends: libgomp1 (>= 6) but it is not installable
                 Depends: libxfont2 (>= 1:2.0.1) but it is not installable
                 Depends: libxshmfence1 but it is not installable
                 Depends: xauth but it is not installable
                 Depends: libswitch-perl but it is not installable
E: Unable to correct problems, you have held broken packages.
                 Depends: libyaml-tiny-perl but it is not installable
                 Depends: libhash-merge-simple-perl but it is not installable
                 Depends: liblist-moreutils-perl but it is not installable
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
info: Adding user `coder' to group `ssl-cert' ...
bash: line 1: /etc/kasmvnc/kasmvnc.yaml: No such file or directory
bash: line 173: vncpasswd: command not found
🚀 Starting KasmVNC server...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed

  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0

100 2607k  100 2607k    0     0  4513k      0 --:--:-- --:--:-- --:--:-- 4513k
Reading package lists...
Building dependency tree...
Reading state information...
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 kasmvncserver : Depends: libgbm1 (>= 12.0.0~0) but it is not installable
                 Depends: libgl1 but it is not installable
                 Depends: libgomp1 (>= 6) but it is not installable
                 Depends: libxfont2 (>= 1:2.0.1) but it is not installable
                 Depends: libxshmfence1 but it is not installable
                 Depends: xauth but it is not installable
                 Depends: libswitch-perl but it is not installable
E: Unable to correct problems, you have held broken packages.
                 Depends: libyaml-tiny-perl but it is not installable
                 Depends: libhash-merge-simple-perl but it is not installable
                 Depends: liblist-moreutils-perl but it is not installable
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
info: Adding user `coder' to group `ssl-cert' ...
bash: line 1: /etc/kasmvnc/kasmvnc.yaml: No such file or directory
bash: line 173: vncpasswd: command not found
🚀 Starting KasmVNC server...

Template

terraform {
  required_providers {
    coder = {
      source = "coder/coder"
    }
    # docker = {
    #   source = "kreuzwerker/docker"
    #   version = "~> 2.16.0"
    # }
    docker = {
      source = "bamhm182/docker"
    }
  }
}

#================================================================
## Variables
#================================================================

variable "socket" {
  type        = string
  description = <<-EOF
  The Unix socket that the Docker daemon listens on and how containers
  communicate with the Docker daemon.

  Either Unix or TCP
  e.g., unix:///var/run/docker.sock

  EOF
  default = "unix:///var/run/docker.sock"
}

#================================================================
## Providers
#================================================================

provider "coder" {
}

provider "docker" {
  host = var.socket
}

#================================================================
## Data Sources
#================================================================

# https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/provisioner
# Use this data source to get information about the Coder provisioner (READ ONLY).
data "coder_provisioner" "me" {}

# https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace
# Use this data source to get information for the active workspace build (READ ONLY).
data "coder_workspace" "me" {}

# https://registry.terraform.io/providers/coder/coder/latest/docs/data-sources/workspace_owner
# Use this data source to fetch information about the workspace owner (READ ONLY).
data "coder_workspace_owner" "me" {}

data "coder_parameter" "image" {
  name        = "Container Image"
  type        = "string"
  description = "What container image should we use for this environment?"
  default     = "docker.io/codercom/enterprise-desktop:ubuntu"
  mutable     = true
  icon        = "${data.coder_workspace.me.access_url}/icon/docker.svg" 
}

#================================================================
## Resources
#================================================================

# https://registry.terraform.io/providers/coder/coder/latest/docs/resources/agent
# Use this resource to associate an agent.
resource "coder_agent" "main" {
  arch                   = data.coder_provisioner.me.arch
  os                     = data.coder_provisioner.me.os
  # dir                    = local.root_dir
  order = 1
  startup_script = <<EOT
#!/bin/bash
set -euo pipefail

# Skip default shell config prompt.
cp /etc/zsh/newuser.zshrc.recommended $HOME/.zshrc

echo "Initializing Supervisor..."
nohup supervisord
  EOT

  metadata {
    display_name = "CPU Usage"
    key          = "cpu_usage"
    script       = "coder stat cpu"
    interval     = 10
    timeout      = 1
    order        = 1
  }
  metadata {
    display_name = "RAM Usage"
    key          = "ram_usage"
    script       = "coder stat mem"
    interval     = 10
    timeout      = 1
    order        = 2
  }
  metadata {
    display_name = "Disk Usage"
    key          = "disk_usage"
    script       = "coder stat disk"
    interval     = 60
    timeout      = 1
    order        = 3
  }
}

resource "docker_volume" "home_volume" {
  name = "coder-${data.coder_workspace.me.id}-home"
  # Protect the volume from being deleted due to changes in attributes.
  lifecycle {
    ignore_changes = all
  }
  # Add labels in Docker to keep track of orphan resources.
  labels {
    label = "coder.owner"
    value = data.coder_workspace_owner.me.name
  }
  labels {
    label = "coder.owner_id"
    value = data.coder_workspace_owner.me.id
  }
  labels {
    label = "coder.workspace_id"
    value = data.coder_workspace.me.id
  }
  # This field becomes outdated if the workspace is renamed but can
  # be useful for debugging or cleaning out dangling volumes.
  labels {
    label = "coder.workspace_name_at_creation"
    value = data.coder_workspace.me.name
  }
}

resource "docker_container" "workspace" {
  count = data.coder_workspace.me.start_count
  # image = docker_image.coder_image.latest
  image = data.coder_parameter.image.value
  # Uses lower() to avoid Docker restriction on container names.
  name = "coder-${data.coder_workspace_owner.me.name}-${lower(data.coder_workspace.me.name)}"
  # Hostname makes the shell more user friendly: coder@my-workspace:~$
  hostname = lower(data.coder_workspace.me.name)
  # dns      = ["1.1.1.1"]
  # Memory limit for the container in MBs. 0 is unrestricted.
  memory = 0
  # Use the docker gateway if the access URL is 127.0.0.1
  entrypoint = ["sh", "-c", replace(coder_agent.main.init_script, "/localhost|127\\.0\\.0\\.1/", "host.docker.internal")]
  # Use the docker gateway if the access URL is 127.0.0.1 
  command = ["sh", "-c", replace(coder_agent.main.init_script, "127.0.0.1", "host.docker.internal")]
  env     = ["CODER_AGENT_TOKEN=${coder_agent.main.token}"]
  host {
    host = "host.docker.internal"
    ip   = "host-gateway"
  }
  volumes {
    container_path = "/home/coder/"
    volume_name    = docker_volume.home_volume.name
    read_only      = false
  }
  # Add labels in Docker to keep track of orphan resources.
  labels {
    label = "coder.owner"
    value = data.coder_workspace_owner.me.name
  }
  labels {
    label = "coder.owner_id"
    value = data.coder_workspace_owner.me.id
  }
  labels {
    label = "coder.workspace_id"
    value = data.coder_workspace.me.id
  }
  labels {
    label = "coder.workspace_name"
    value = data.coder_workspace.me.name
  }
}

# Desktop
module "kasmvnc" {
  source              = "registry.coder.com/modules/kasmvnc/coder"
  version             = "1.0.21"
  agent_id            = coder_agent.main.id
  # "xfce", "kde", "gnome", "lxde", "lxqt"
  desktop_environment = "xfce"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant