Control-C during `fly logs` command corrupted flyctl binary?

I ran two commands this evening with flyctl:

  1. fly deploy -i <path to img> – this ran fine, deploy finished
  2. fly logs – started streaming a bunch of logs, seemed fine

On the second command I hit Control-C to interrupt the logs streaming on the terminal before the command had finished. The logs were fine, I just wanted to exit the command early.

However, I can no longer run any fly/flyctl command. The executable will immediately exit with a Segmentation Fault regardless of command, even a fly --help will segfault. I believe the Control-C somehow corrupted the flyctl executable, maybe because it interrupted an automatic update?

Status of the flyctl binary:

$ ls -al ~/.fly/bin/flyctl
-rwxr-xr-x 1 mheffner mheffner 9666048 Jul 20 22:46 /home/mheffner/.fly/bin/flyctl
$ file ~/.fly/bin/flyctl
/home/mheffner/.fly/bin/flyctl: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, too large section header offset 28646656

I’m on Fedora Linux. Here’s the contents of ~/.fly/state.yml:

channel: latest
last_checked_at: 2023-07-20T22:45:46.557513705-04:00
    version: v0.1.63
    prerelease: false
    timestamp: 2023-07-20T16:19:10Z

Update: I reran the install command curl -L | sh and it appears I’m back and running fine. The flyctl binary is much larger now, which makes me think it was writing in place on top of the previous one when I interrupted it with Control-C:

$ ls -al ~/.fly/bin/flyctl 
-rwxr-xr-x 1 mheffner mheffner 57030357 Jul 20 12:14 /home/mheffner/.fly/bin/flyctl

I’m fine now, but it looks like there may be an edge case in the update scenario?

Hi @mheffner! I’m sorry that you ran into this, and I think you’re right about what happened!

There’s currently a flyctl PR to modify the install script so that it extracts the new binary into a temporary directory and then renames it into place, which should prevent this from happening again.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.