Skip to content
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

Error on restart: tail: can't open '/.devspace/screenlog.0': No such file or directory #2932

Open
CCOLLOT opened this issue Jan 21, 2025 · 2 comments
Labels
kind/bug Something isn't working

Comments

@CCOLLOT
Copy link

CCOLLOT commented Jan 21, 2025

What happened?

When running devspace dev for the first time, the logs are properly attached to the pod and I can see the application's output. When using the onUpload parameter to automatically restart the container, I see the following error after the all consequent restarts:
tail: can't open '/.devspace/screenlog.0': No such file or directory

 successfully shut down api      // <-- actual logs from the app                                                                                                                                                                      
 bye.                                           // <-- actual logs from the app                                                                                                                                 
                                                                                                                                                                                                                                                                                                                                                                                                      
 ############### Restart container ###############                                                                                                                                                          
                                                                                                                                                                                                      
 tail: can't open '/.devspace/screenlog.0': No such file or directory                                                                                                                                       
 tail: no files                                                                 

What did you expect to happen instead?

I expect the logs to be displayed in the pod log stream even after a restart

My devspace.yaml:

version: v2beta1
name: api

# This is a list of `pipelines` that DevSpace can execute (you can define your own)
pipelines:
  # This is the pipeline for the main command: `devspace dev` (or `devspace run-pipeline dev`)
  dev:
    run: |-
      run_dependencies --all       # 1. Deploy any projects this project needs (see "dependencies")
      ensure_pull_secrets --all    # 2. Ensure pull secrets
      create_deployments --all     # 3. Deploy Helm charts and manifests specfied as "deployments"
      start_dev app                # 4. Start dev mode "app" (see "dev" section)
  # You can run this pipeline via `devspace deploy` (or `devspace run-pipeline deploy`)
  deploy:
    run: |-
      run_dependencies --all                            # 1. Deploy any projects this project needs (see "dependencies")
      ensure_pull_secrets --all                         # 2. Ensure pull secrets
      build_images --all -t $(git describe --always)    # 3. Build, tag (git commit hash) and push all images (see "images")
      create_deployments --all                          # 4. Deploy Helm charts and manifests specfied as "deployments"

# This is a list of `images` that DevSpace can build for this project
# We recommend to skip image building during development (devspace dev) as much as possible
images:
  app:
    image: my-image-name:tag
    dockerfile: ./Dockerfile

# This is a list of `dev` containers that are based on the containers created by your deployments
dev:
  app:
    # Search for the container that runs this image
    labelSelector:
      app: API    
# Replace the container image with this dev-optimized image (allows to skip image building during development)
    restartHelper:
      inject: true
    devImage: ghcr.io/loft-sh/devspace-containers/go:1.23-alpine
    patches:
      - op: remove
        path: spec.securityContext
    # Sync files between the local filesystem and the development container
    sync:
      - path: ./:/app
        excludePaths:
          - .git/
          - /config/
        onUpload:
          restartContainer: true
    # Run the following command inside the development container:
    command:
      - go
      - run
      - main.go
      - start
    # Open a terminal and use the following command to start it
    terminal:
      command: ./devspace_start.sh
    # Inject a lightweight SSH server into the container (so your IDE can connect to the remote dev env)
    ssh:
      enabled: true
    # Make the following commands from my local machine available inside the dev container
    proxyCommands:
      - command: devspace
      - command: kubectl
      - command: helm
      - gitCredentials: true
    # Forward the following ports to be able access your application via localhost
    ports:
      - port: "2345"
      - port: "3000"
    # Open the following URLs once they return an HTTP status code other than 502 or 503
    open:
      - url: http://localhost:3000/healthz

# Define dependencies to other projects with a devspace.yaml
# dependencies:
#   api:
#     git: https://...  # Git-based dependencies
#     tag: v1.0.0
#   ui:
#     path: ./ui        # Path-based dependencies (for monorepos)

Local Environment:

  • DevSpace Version: 6.3.14
  • Operating System: mac
  • ARCH of the OS: ARM64

Kubernetes Cluster:

  • Cloud Provider: azure
  • Kubernetes Version: v1.30.6
@CCOLLOT CCOLLOT added the kind/bug Something isn't working label Jan 21, 2025
@CCOLLOT
Copy link
Author

CCOLLOT commented Jan 22, 2025

Loading the legacy restart helper instead of the default one seems to solve the issue.

REF:

const LegacyRestartHelperScript = `#!/bin/sh

@zerbitx
Copy link
Collaborator

zerbitx commented Jan 24, 2025

You can also configure the legacy restart. For reference see here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants