Closed tsuga closed 2 months ago
I can confirm the same issue. I can run it manually. So all the needed packages are there. I think the installation script is borked.
I think xtigervncserver needs -PasswordFile
instead of --passwd
This issue broke the workflow for several students on my team. In case it helps someone else, I added the script below to our repos as a temporary workaround. They can run the script and then continue working normally. Make sure to change the path in the instructions to your actual path.
# Temporary fix until https://github.com/devcontainers/features/issues/1085 is resolved.
#
# If your desktop is not showing up, follow these steps:
#
# 1. Open a terminal.
#
# 2. If your terminal is not already in the /workspaces/homework directory, navigate to
# that directory by typing:
#
# cd /workspaces/homework
#
# 3. Run this script by typing:
#
# ./tmp_fix_desktop.sh
#
# 4. After running the script, try to access the desktop again.
# Check and launch tigervncserver if not running
if ! pgrep -f "tigervncserver" > /dev/null; then
tigervncserver :1 -geometry 1440x768 -depth 16 -rfbport 5901 -dpi 96 -localhost \
-desktop fluxbox -passwd /usr/local/etc/vscode-dev-containers/vnc-passwd &
fi
# Check and launch noVNC if not running
if ! pgrep -f "launch.sh --listen 6080 --vnc localhost:5901" > /dev/null; then
/usr/local/novnc/noVNC*/utils/launch.sh --listen 6080 --vnc localhost:5901 &
fi
I don't see versioning for this feature other than latest and 1.0.8(last year). Why is that? I know it's a simple bash script, but by virtue of being interpreted bash scripts are easy to mess up, so I would argue any change should be a new version. A decent IDE/editor will give color clues that may help
Putting the whole path in double quotes is preferred
"/tmp/$1.log"
Workaround: change "ghcr.io/devcontainers/features/desktop-lite:1"
to "ghcr.io/devcontainers/features/desktop-lite:1.2.0"
in your devcontainer.json
(unless you need #945).
@samruddhikhandale @gauravsaini04 this issue seems to have been introduced by #1024.
Thanks for the nudge and apologies for the inconvenience.
We have merged in https://github.com/devcontainers/features/pull/1082 which should fix this. Can anyone let us know if that worked for you?
If not, @gauravsaini04 can you revert https://github.com/devcontainers/features/pull/1024 until we find the root cause.
Updating to 1.2.0 fixed the problem for me. Thanks!
I also confirm that updating to 1.2.0 fixed the problem. Thank you very much!
In Dev Container with image FROM mcr.microsoft.com/devcontainers/typescript-node:22-bullseye
this "ghcr.io/devcontainers/features/desktop-lite:1.1.0" works and noVNC is available on 6080 and 1.2.0 and 1.2.1 and 1.2.2 "ghcr.io/devcontainers/features/desktop-lite:1.2.2" does not work and noVNC is NOT available on 6080 port
Can anyone let us know if that worked for you?
@samruddhikhandale
Image "mcr.microsoft.com/devcontainers/python:1-3.12-bookworm"
feature version | VNC working | Notes |
---|---|---|
"ghcr.io/devcontainers/features/desktop-lite:1.1.0" | yes | |
"ghcr.io/devcontainers/features/desktop-lite:1.2.0" | yes | was not asked for password |
"ghcr.io/devcontainers/features/desktop-lite:1.2.1" | installed but not started | |
"ghcr.io/devcontainers/features/desktop-lite:1.2.2" | installed but not started | |
"ghcr.io/devcontainers/features/desktop-lite:1.2.3" | yes | was not asked for password |
Thanks for the details. I have reverted the commit which is the root cause of this issue, see https://github.com/devcontainers/features/pull/1088
Let us know if you are still facing issues with v1.2.3, thanks!
For me, v1.2.3 works as expected!
Would it be possible to add a test that spins up a container and checks that those processes are running?
Would it be possible to add a test that spins up a container and checks that those processes are running?
Definitely!
@gauravsaini04 Can you follow up on adding test coverage?
Hi, have added test cases for xtigervnc
and novnc
whether running on default ports assigned for them i.e. 5901
& 6080
respectively in the pr #1090
Let us know if you are still facing issues with v1.2.3, thanks!
VNC in v1.2.3 is working, but as with v1.2.0, I am able to access the desktop without provided the password.
I've updated the table above.
I installed desktop-lite feature. The build is successfully completed but Xtigervnc is not launched automatically.
I can see
/usr/local/share/desktop-init.sh
stopped or hanged up from the log:I confirmed that tigervnc and novnc are installed by manually starting them on Terminal and access from vnc client / browser. So I guess something went wrong in
desktop-init.sh.
Though not sure if this is relevant, I can see
$1.log
is created, which seems wired ($1 instead of Xtigervnc?).devcontainer.json
``` { "name": "Node.js & TypeScript", "image": "mcr.microsoft.com/devcontainers/typescript-node:1-22-bookworm", "features": { "ghcr.io/devcontainers/features/desktop-lite:1": {} }, "forwardPorts": [ 6080 ], "portsAttributes": { "6080": { "label": "Desktop Lite Web" } } } ```netstat -tulpn | grep LISTEN
``` $ netstat -tulpn | grep LISTEN (Not all processes could be identified, non-owned process info will not be shown, you would have to be root to see it all.) tcp 0 0 127.0.0.1:16634 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:16635 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.53:53 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:44093 0.0.0.0:* LISTEN 529/node tcp 0 0 127.0.0.1:40045 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:2000 0.0.0.0:* LISTEN - tcp6 0 0 :::2000 :::* LISTEN - tcp6 0 0 ::1:16635 :::* LISTEN - tcp6 0 0 ::1:16634 :::* LISTEN - ```/usr/local/share/desktop-init.sh
``` #!/bin/bash user_name="${USERNAME}" group_name="$(id -gn ${USERNAME})" LOG=/tmp/container-init.log export DBUS_SESSION_BUS_ADDRESS="${DBUS_SESSION_BUS_ADDRESS:-"autolaunch:"}" export DISPLAY="${DISPLAY:-:1}" export VNC_RESOLUTION="${VNC_RESOLUTION:-1440x768x16}" export LANG="${LANG:-"en_US.UTF-8"}" export LANGUAGE="${LANGUAGE:-"en_US.UTF-8"}" # Execute the command it not already running startInBackgroundIfNotRunning() { log "Starting $1." echo -e "\n** $(date) **" | sudoIf tee -a /tmp/\$1.log > /dev/null if ! pgrep -x $1 > /dev/null; then keepRunningInBackground "$@" while ! pgrep -x $1 > /dev/null; do sleep 1 done log "$1 started." else echo "$1 is already running." | sudoIf tee -a /tmp/\$1.log > /dev/null log "$1 is already running." fi } # Keep command running in background keepRunningInBackground() { ($2 bash -c "while :; do echo [\\$(date)] Process started.; $3; echo [\\$(date)] Process exited!; sleep 5; done 2>&1" | sudoIf tee -a /tmp/\$1.log > /dev/null & echo "\$!" | sudoIf tee /tmp/\$1.pid > /dev/null) } apt_get_update() { if [ "$(find /var/lib/apt/lists/* | wc -l)" = "0" ]; then echo "Running apt-get update..." apt-get update -y fi } check_packages() { if ! dpkg -s "$@" > /dev/null 2>&1; then apt_get_update apt-get -y install --no-install-recommends "$@" fi } # Use sudo to run as root when required sudoIf() { if [ "$(id -u)" -ne 0 ]; then check_packages sudo sudo "$@" else "$@" fi } # Use sudo to run as non-root user if not already running sudoUserIf() { if [ "$(id -u)" -eq 0 ] && [ "${user_name}" != "root" ]; then check_packages sudo sudo -u "${user_name}" "$@" else "$@" fi } # Log messages log() { echo -e "[$(date)] $@" | sudoIf tee -a $LOG > /dev/null } log "** SCRIPT START **" # Start dbus. log 'Running "/etc/init.d/dbus start".' if [ -f "/var/run/dbus/pid" ] && ! pgrep -x dbus-daemon > /dev/null; then sudoIf rm -f /var/run/dbus/pid fi sudoIf /etc/init.d/dbus start 2>&1 | sudoIf tee -a /tmp/dbus-daemon-system.log > /dev/null while ! pgrep -x dbus-daemon > /dev/null; do sleep 1 done # Startup tigervnc server and fluxbox sudoIf rm -rf /tmp/.X11-unix /tmp/.X*-lock mkdir -p /tmp/.X11-unix sudoIf chmod 1777 /tmp/.X11-unix sudoIf chown root:${group_name} /tmp/.X11-unix if [ "$(echo "${VNC_RESOLUTION}" | tr -cd 'x' | wc -c)" = "1" ]; then VNC_RESOLUTION=${VNC_RESOLUTION}x16; fi screen_geometry="${VNC_RESOLUTION%*x*}" screen_depth="${VNC_RESOLUTION##*x}" # Check if VNC_PASSWORD is set and use the appropriate command common_options="tigervncserver ${DISPLAY} -geometry ${screen_geometry} -depth ${screen_depth} -rfbport ${VNC_PORT} -dpi ${VNC_DPI:-96} -localhost -desktop fluxbox -fg" if [ -n "${VNC_PASSWORD+x}" ]; then startInBackgroundIfNotRunning "Xtigervnc" sudoUserIf "${common_options} -passwd /usr/local/etc/vscode-dev-containers/vnc-passwd" else startInBackgroundIfNotRunning "Xtigervnc" sudoUserIf "${common_options} -SecurityTypes None" fi # Spin up noVNC if installed and not running. if [ -d "/usr/local/novnc" ] && [ "$(ps -ef | grep /usr/local/novnc/noVNC*/utils/launch.sh | grep -v grep)" = "" ]; then keepRunningInBackground "noVNC" sudoIf "/usr/local/novnc/noVNC*/utils/launch.sh --listen ${NOVNC_PORT} --vnc localhost:${VNC_PORT}" log "noVNC started." else log "noVNC is already running or not installed." fi # Run whatever was passed in log "Executing "\$@\"." exec "$@" log "** SCRIPT EXIT **" ```