Skip to content

Installation script fails with tar/gzip errors #160

@iAziz786

Description

@iAziz786

The install.sh script fails during installation with the following errors:

Checking for existing installation...
Cleanup complete.
  % Total    Received % Xferd  Average Speed   Time     Time     Time Current                                Dload  Upload  Spent  Left  Pending
100     9  100     9  0     0     26      0 --:-- --:-- -- -- -- -- --    26
tar: This does not look like a tar archive
gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now
Moving binary to /usr/bin, password prompt might be required.
mv: cannot stat './hostlink': No such file or directory
Creating hostlink directories...
Directories created.
Creating environment configuration...
Environment file created at /etc/hostlink/hostlink.env
Installing systemd service...
cp: cannot stat './scripts/hostlink.service': No such file or directory
Failed to enable unit: Unit file hostlink.service does not exist.
Failed to start hostlink.service: Unit file hostlink.service not found.
Service started.
``"

## Root Cause Analysis

1. **Download/Extraction Failure**: The tar extraction fails because the downloaded file is only 9 bytes (just "Not Found" text), indicating the download URL returns a 404 or the version doesn't exist.

2. **Relative Path Issue**: Even if the download succeeds, the install script uses relative paths like `./scripts/hostlink.service` and `./hostlink`. When run after extracting the tar.gz, these paths may not resolve correctly depending on the working directory.

## Expected Behavior

- Installation should either succeed or provide clear error messages about what's failing
- Download URLs should be validated before attempting extraction
- The script should handle relative paths correctly

## Environment

- Linux (x86_64/arm64)
- Installation method: `curl -L -o install.sh https://raw.githubusercontent.com/selfhost-dev/hostlink/main/scripts/linux/install.sh && sudo bash install.sh` (or similar)

## Suggested Fixes

1. Add error handling for the download step to verify the file is a valid tar.gz before extraction
2. Use absolute paths based on the script's directory (`/bin`) instead of relative paths
3. Add validation that the download succeeded (check HTTP status code and file size)
4. Add a helpful error message if the version doesn't exist or download fails

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