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

automatic update from 3.1.0 to 3.1.1 failed #1532

Closed
gregoryvanko opened this issue Apr 15, 2020 · 10 comments
Closed

automatic update from 3.1.0 to 3.1.1 failed #1532

gregoryvanko opened this issue Apr 15, 2020 · 10 comments
Labels
bug Something isn't working

Comments

@gregoryvanko
Copy link

Hello

  • I receive just now a message to apply update to 3.1.1
  • I click on apply
  • I receive a message "updated to 3.1.1"
  • a few minutes later, I receive the same message to apply update 3.1.1

After the "update to 3.1.1" message if I check my code-server version:
3.1.0 5aded14

if a restart the sytemctl service for code-server the version is the same (3.1.0) and I continue to receive the message "apply update to 3.1.1"

could you help me?
@code-asher

Thank you
Capture d’écran 2020-04-15 à 23 01 04
Capture d’écran 2020-04-15 à 23 01 12

@Troubadoure
Copy link

I'm getting the same error trying to update mine.

@code-asher
Copy link
Member

Hmm, I've been trying to replicate using the steps in #1513 (comment) (except I used 3.1.0 instead of 3.0.2) but it always works for me so far.

Do you see any output from code-server after applying the update? (If you're using systemd I imagine it'll be in the journal by default.)

According to that other issue you installed code-server in /var/www/code-server/ right? Do you see any other directories in there? It's supposed to rename the directory and then copy in the new files from the update so you should see something like code-server-3.1.0-linux-x86_64.1587056609700 which would be the old version.

@gregoryvanko
Copy link
Author

gregoryvanko commented Apr 16, 2020

thank you for the quick answer.
Hmm strange...
here is my complete config and installation:

My user is "gregoryweb" and my Home folder is "/var/www"
i create a folder "code-server" with "root" user in my Home directory

  gregoryweb@deb1:~$ ls -al
  -rw-------  1 gregoryweb gregoryweb 7278 avr 16 15:16 .bash_history
  drwxrwxrwx  4 gregoryweb gregoryweb 4096 avr  1 22:44 .cache
  drwxrwxrwx  4 root       root       4096 avr 15 23:35 code-server
  drwxrwxrwx  3 gregoryweb gregoryweb 4096 jan  3  2019 .config
  -rw-r--r--  1 gregoryweb gregoryweb   70 mar 21 14:10 .gitconfig
  -rw-------  1 gregoryweb gregoryweb   43 avr 15 23:46 .git-credentials
  drwxrwxrwx  3 root       root       4096 avr  2 21:08 .local
  drwxr-xr-x  6 gregoryweb gregoryweb 4096 avr 15 21:41 NodeJs
  drwxr-xr-x  6 gregoryweb gregoryweb 4096 avr 16 13:51 .npm
  -rw-------  1 gregoryweb gregoryweb   70 fév  3  2019 .npmrc
  drwx------  2 gregoryweb gregoryweb 4096 jan 28 20:10 .ssh
  -rw-r--r--  1 gregoryweb gregoryweb  376 avr  2 21:56 vscode_projects.json
  -rwxrwxrwx  1 gregoryweb gregoryweb  218 avr  2 20:52 .wget-hsts

I install "code-server 3-1-0" with "gregoryweb" user (download version and unzip) in "code-server" folder :

gregoryweb@deb1:~/code-server$ ls -al
total 16
drwxrwxrwx  4 root       root       4096 avr 15 23:35 .
drwxr-xr-x 15 gregoryweb gregoryweb 4096 avr 16 15:16 ..
drwxrwxrwx  7 gregoryweb gregoryweb 4096 avr  9 21:14 code-server-3.1.0-linux-x86_64
drwxr-xr-x  5 gregoryweb gregoryweb 4096 avr 15 23:51 code-server-data

here is the content of the folder "code-server-3.1.0-linux-x86_64":

gregoryweb@deb1:~/code-server/code-server-3.1.0-linux-x86_64$ ls -al
total 45056
drwxrwxrwx  7 gregoryweb gregoryweb     4096 avr  9 21:14 .
drwxrwxrwx  4 root       root           4096 avr 15 23:35 ..
-rwxrwxrwx  1 gregoryweb gregoryweb      189 avr  9 21:14 code-server
drwxrwxrwx  3 gregoryweb gregoryweb     4096 avr  9 21:13 dist
drwxrwxrwx  3 gregoryweb gregoryweb     4096 avr  9 21:12 lib
-rwxrwxrwx  1 gregoryweb gregoryweb     1084 avr  9 21:14 LICENSE.txt
-rwxrwxrwx  1 gregoryweb gregoryweb 45605784 avr  9 21:14 node
drwxrwxrwx 56 gregoryweb gregoryweb     4096 avr  9 21:14 node_modules
drwxrwxrwx  5 gregoryweb gregoryweb     4096 avr  9 21:13 out
-rwxrwxrwx  1 gregoryweb gregoryweb     2049 avr  9 21:14 package.json
-rwxrwxrwx  1 gregoryweb gregoryweb     1710 avr  9 21:14 README.md
drwxrwxrwx  5 gregoryweb gregoryweb     4096 avr  9 21:13 src
-rwxrwxrwx  1 gregoryweb gregoryweb   153148 avr  9 21:14 ThirdPartyNotices.txt
-rwxrwxrwx  1 gregoryweb gregoryweb   324598 avr  9 21:13 yarn.lock
gregoryweb@deb1:~/code-server/code-server-3.1.0-linux-x86_64$ 

I change the permissions to the code-server : chmod -R 777 ~/code-server
with the user "root" i create a "systemctl service file" : nano /lib/systemd/system/code-server.service

the content of this file is :

[Unit]
Description=code-server
After=nginx.service

[Service]
Type=simple
Environment=PASSWORD=xxx
ExecStart=/var/www/code-server/code-server-3.1.0-linux-x86_64/code-server --user-data-dir /var/www/code-server/code-server-data --auth password
Restart=always
User=gregoryweb

[Install]
WantedBy=multi-user.target

special attention to the path of "ExecStart" = /var/www/code-server/code-server-3.1.0-linux-x86_64/code-server
special attention to "User" = gregoryweb
(Maybe this path and this user are problems for update...???)

Finally I change the config in Nginx to make a reverse proxy:

server {

        #listen 80 default_server;
        #listen [::]:80 default_server;

        # SSL configuration
        #
        listen 443 ssl;
        listen [::]:443 ssl;
        ssl_certificate /etc/letsencrypt/live/code.gregvanko.com/fullchain.pem;
        ssl_certificate_key /etc/letsencrypt/live/code.gregvanko.com/privkey.pem;

        # Add index.php to the list if you are using PHP
        index index.html index.htm index.nginx-debian.html;

        server_name code.aaaaaaaaaaa.com;

        resolver 192.168.1.1;

        location / {
                set $target "http://localhost:8080";
                proxy_set_header Host $host;
                proxy_pass $target;
                proxy_set_header Upgrade $http_upgrade;
                proxy_set_header Connection upgrade;
                proxy_set_header Accept-Encoding gzip;
        }
        location ~ /\.ht {
                deny all;
        }
}

@code-asher where is my mistake?
Thank you very much for your help, I really appreciate to work with code-server

@nhooyr nhooyr added bug Something isn't working needs-investigation labels Apr 17, 2020
@gregoryvanko
Copy link
Author

Hi,
solution found :-)
=> folder /tmp/code-server was not accessible by the code-server user (permission dined)... :-(
I changed the permission to the temp folder and after that code-server was able to update to 3.1.1

thank you

@code-asher
Copy link
Member

Ahhhh, /tmp is where it downloads and extracts the update. I'm glad you figured it out! I'll make a fix so it properly gives a good error message when that happens.

@Troubadoure
Copy link

I'm still having getting 'update failed'. Have sudo chown -R coder:users /tmp The update seems to start running but ultimately failed. Are there any other directories that the update uses that might have the incorrect permissions?

@code-asher
Copy link
Member

Are you updating from 3.1.0 or a different version?

@Troubadoure
Copy link

I'm not sure. I'm using a docker build and in Help -> About it shows:

Version: 1.43.2
Commit: e480f65
Date: 2020-04-01T23:37:57.354Z
Browser: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15

@code-asher
Copy link
Member

In the Docker container code-server is installed in /usr/local/lib so the coder user would need permissions there.

3.0.2 has a bug where it'll say update failed even though the update succeeded, but it should ask you to refresh the window and after that if you run code-server --version in the terminal you should see 3.1.1.

@Troubadoure
Copy link

Troubadoure commented Apr 17, 2020

Can confirm ran sudo chown -R coder:users /usr/local/lib ran the update and after a little while got shown the 'Updated failed' message box then shortly after it asked me to refresh the page. Upon doing so ran code-server --version and was given 3.1.1. Thanks for the speedy response!

code-asher added a commit that referenced this issue Apr 17, 2020
See #1532 for more context.

- Errored JSON requests will get back the error in JSON instead of using
  the status text. This seems better to me because it seems more correct
  to utilize the response body over hijacking the status text. The
  caller is expecting JSON anyway. Worst of all I never actually set the
  status text like I thought I did so it wasn't working to begin with.
- Allow the update error to propagate for JSON update requests. It was
  caught to show the error inline instead of an error page when using
  the update page but for JSON requests it meant there was no error and
  no error code so it looked like it succeeded.
- Make errors for failed requests to GitHub less incomprehensible.
  Previously they would just be the code which is no context at all.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants