Skip to content

On update to a different version, check perms FS perms first and fail early #163

@placer14

Description

@placer14

As a user, I would like for filesystem/permissions to be checked at the beginning (by moving old binaries aside to validate RW privs, for example, which could be restored on failure or deleted on success).

IPNS/IPFS interactions are still slow and can be flaky. This would alleviate the long wait between IPNS/IPFS resolution and the attempt to interact with the FS and failing.

Interesting things to check:

  • repo path can be found
  • access to IPFS binary includes RW privs
  • repo lock can be set (validating the daemon is stopped)

UX to avoid

binary access failed

[12:19:22] $ ipfs-update install v0.13.0
fetching go-ipfs version v0.13.0
Error fetching: ipfs api shell not up
Fetching with HTTP: "https://ipfs.io/ipns/dist.ipfs.io/go-ipfs/v0.13.0/go-ipfs_v0.13.0_darwin-arm64.tar.gz"
Fetching with HTTP: "https://ipfs.io/ipns/dist.ipfs.io/go-ipfs/v0.13.0/go-ipfs_v0.13.0_darwin-arm64.tar.gz"
binary downloaded, verifying...
success! tests all passed.
stashing old binary
install failed, reverting changes...
ERROR: install failed: could not move old binary: remove /usr/local/bin/ipfs: permission denied

Repo lock acquisition

[12:22:43] $ sudo ipfs-update install v0.13.0
fetching go-ipfs version v0.13.0
Error fetching: ipfs api shell not up
Fetching with HTTP: "https://ipfs.io/ipns/dist.ipfs.io/go-ipfs/v0.13.0/go-ipfs_v0.13.0_darwin-arm64.tar.gz"
binary downloaded, verifying...
success! tests all passed.
checking if we should install in GOPATH: /Users/mg/go/bin
installing new binary to /Users/mg/go/bin/ipfs
checking if repo migration is needed...
  check complete, migration required.
Looking for suitable migration binaries.
Need 1 migrations, downloading.
Downloading migration: fs-repo-11-to-12...
Error fetching: ipfs api shell not up
Fetching with HTTP: "https://ipfs.io/ipns/dist.ipfs.io/fs-repo-11-to-12/versions"
Error fetching: ipfs api shell not up
Fetching with HTTP: "https://ipfs.io/ipns/dist.ipfs.io/fs-repo-11-to-12/v1.0.2/fs-repo-11-to-12_v1.0.2_darwin-arm64.tar.gz"
Downloaded and unpacked migration: /tmp/migrations2655223284/fs-repo-11-to-12 (v1.0.2)
Running migration fs-repo-11-to-12 ...
  => Running: /tmp/migrations2655223284/fs-repo-11-to-12 -path=/Users/mg/.ipfs -verbose=true
applying 11-to-12 repo migration
locking repo at "/Users/mg/.ipfs"
error: failed to acquire repo lock at /Users/mg/.ipfs/repo.lock
Is a daemon running? please stop it before running migration
ERROR: Migration Failed:  migration fs-repo-11-to-12 failed: exit status 1
install failed, reverting changes...
ERROR: install failed: migration fs-repo-11-to-12 failed: exit status 1

(this case also suggested migration failed, but v0.13.0 was left in place. This was confusing. Filed a separate issue at #164)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions