gvm icon indicating copy to clipboard operation
gvm copied to clipboard

ERROR: Couldn't remove pkgsets

Open chrisduong opened this issue 6 years ago • 6 comments

Hi,

I tried to remove old Go pkgsets, I get the Error.

❯ gvm uninstall go1.11.1
ERROR: Couldn't remove pkgsets

❯ \ls -G .gvm/gos/
go1.11.1 go1.11.4 system

chrisduong avatar Mar 14 '19 04:03 chrisduong

It can't remove pkgsets because new Go modules folder pkg is protected, so you have to be root to delete it. You need to first clean the mod cache by this sequence, then switch to your other Go version and try to uninstall again (make sure to do this outside of any Go source folder):

gvm use go1.11.1
go clean -modcache
gvm use go1.11.4
gvm uninstall go1.11.1

You could also use sudo to manually delete pkgset ~/.gvm/pkgsets/go1.11.1, then repeat command gvm uninstall go1.11.1.

nezorflame avatar Mar 15 '19 10:03 nezorflame

This step is something that gvm could reasonably be expected to automate on behalf of the user.

mcandre avatar Sep 19 '21 17:09 mcandre

go clean -modcache works for versions older than go1.17, but seem to fail on go1.17.6 and go1.17

gvm use go1.17
Now using version go1.17
go clean -modcache
gvm use go1.18      
Now using version go1.18
gvm uninstall go1.17  
ERROR: Couldn't remove pkgsets

manually deleting the packsets works in ~/.gvm/pkgsets/go1.17 and ~/.gvm/pkgsets/go1.17.6

austincunningham avatar Jul 14 '23 15:07 austincunningham

added this to my shell config so I don't have to revisit this issue every release

function update-go() {
  CURRENT_VERSION=$(go version | awk '{print $3}')
  LATEST_VERSION=$(curl -s https://golang.org/VERSION?m=text)
  if [ "$CURRENT_VERSION" = "$LATEST_VERSION" ]; then
    echo "You are already on the latest version"
    return
  fi
  go clean -modcache
  gvm install $LATEST_VERSION
  gvm use $LATEST_VERSION --default
  gvm uninstall $CURRENT_VERSION

  echo "Go updated from $CURRENT_VERSION to $LATEST_VERSION"
}

o-az avatar Jul 25 '23 09:07 o-az

@o-az I had to change latest to this instead:

LATEST_VERSION=$(curl -s https://go.dev/VERSION?m=text | head -n 1 | awk '{print $1}')

also, it's probably good to add a gvm update step before attempting to install the latest with gvm.

lucaspar avatar Dec 20 '23 09:12 lucaspar

I did chmod -R u+w ~/.gvm/pkgsets/go1.X and then gvm uninstall worked. No need for sudo this way (and no need to go clean either), although it's less clean, I guess it doesn't matter because we are uninstalling anyways...

netixx avatar Jan 25 '24 15:01 netixx