aandrew-me / tgpt

AI Chatbots in terminal without needing API keys

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

tgpt -u doesn't work

aindriu80 opened this issue · comments

Hi,

I can't seem to update tgpt with the tgpt -u command, it retrieves the files however there is a permissions error -

Updating...
Download location: /usr/local/bin/tgpt
Operating System: linux
Processor Architecture: amd64

Downloading...

######################################################################## 100.0%
mv: cannot move '/tmp/tgpt' to '/usr/local/bin/tgpt': Permission denied
Failed to update. Error: exit status 1
Successfully updated.

It says that it successfully updated but it couldn't copy the file over to the bin folder... i tried running the update with sudo but it doesn't work either.... i think the code needs to change to perform the mv command

There are a few people who faced this problem. I dont know why. You can instead manually copy paste the installation command to update

I believe this is a permission error with the default installation location.

By default /usr/local/bin is owned by the root user so tgpt which is run by your user does not have the ability to write in that directory. If the tgpt binary is located somewhere inside your user directory such as ~/.local/bin/ you should not experience this problem.

I think this is the best solution as changing permissions in global system folders isn't encouraged.

Make sure you add that local folder earlier in your PATH so your prompt selects the right binary (would also be a good idea to remove the other bin in /usr/local/bin). If you are unsure which one is called from your prompt use which tgpt

@aindriu80
@aandrew-me
give sudo permessions ;

Try this

sudo tgpt -u

@aindriu80 @aandrew-me give sudo permessions ;

Try this

sudo tgpt -u

I personally don't face this problem

You have to delete /tmp/tgpt

:~$ sudo tgpt -u
[sudo] password for phantombot:
Updating...
Download location: /usr/local/bin/tgpt
Operating System: linux
Processor Architecture: amd64

Downloading...

Warning: Failed to create the file /tmp/tgpt: Permission denied
                                                                           0.0%c                                 url: (23) Failed writing body (0 != 848)

Failed to update. Error: exit status 23
Successfully updated.

Fix it with:

:~$ sudo rm /tmp/tgpt

:~$ sudo tgpt -u
Updating...
Download location: /usr/local/bin/tgpt
Operating System: linux
Processor Architecture: amd64

Downloading...

######################################################################## 100.0%
Installed Successfully

Make sure your file is in PATH
Run tgpt -h for help
Successfully updated.

@sinuso Interesting, @aindriu80 try

But you don't need to use sudo to remove from /tmp

That doesn't seem to work for me, here is some of the output. (current version installed tgpt 2.0.4, version on github tgpt 2.0.5)

tgpt -u
Updating...
Download location: /usr/local/bin/tgpt
Operating System: linux
Processor Architecture: amd64

Downloading...

######################################################################## 100.0%
mv: cannot move '/tmp/tgpt' to '/usr/local/bin/tgpt': Permission denied
Failed to update. Error: exit status 1
Successfully updated.

tgpt -v
tgpt 2.0.4

Tried the following:-

rm /tmp/tgpt
tgpt -u
tgpt -v
tgpt 2.0.4

I also tried

sudo tgpt -u
tgpt -v
tgpt 2.0.4

It seems to be a write issue

(23) Failure writing output to destination

Failed to update. Error: exit status 23

The update function just executes the install script. It works fine in many devices. Maybe permissions are configured differently on your device. You can install the program to a directory where you have enough permissions and which is already in path.

Using sudo or running programs as su as a workaround sometimes creates permissions problems (it depends on the application). Instead of workarounds I would advise you to learn further about permissions and ownership on linux so that you can manage your environment without copy and pasting stuff that you believe is right. This way you will be able to troubleshoot and fix many problems that could arise due to different linux distros (or variants) default configurations or personal configuration (but then you would be in control and hopefully know what you are doing).

It seems to be working now, I didn't change any permission but it worked

sudo tgpt -u
[sudo] password for :
Updating...
Download location: /usr/local/bin/tgpt
Operating System: linux
Processor Architecture: amd64
Downloading...

######################################################################## 100.0%
Installed Successfully

Make sure your file is in PATH
Run tgpt -h for help
Successfully updated.

tgpt -v
tgpt 2.0.5

thanks everyone!