Jose Jimenez
Jose Jimenez
Software Architect & Developer
> >

Temporary Fix for Laravel Homestead Provisioning Issue

Published in Laravel, Laravel Homestead on Mar 18, 2024

Laravel Homestead users may encounter a provisioning error that halts the setup process. This issue is especially prevalent when Homestead attempts to fetch packages from a repository that is either no longer signed or accessible. Below is an example of the error message users might see:

1homestead: Reading package lists...
2homestead: E: Failed to fetch https://ngrok-agent.s3.amazonaws.com/dists/buster/InRelease 403 Forbidden [IP: 52.218.246.75 443]
3homestead: E: The repository 'https://ngrok-agent.s3.amazonaws.com buster InRelease' is no longer signed.
4The SSH command responded with a non-zero exit status. Vagrant
5assumes that this means the command failed. The output for this command
6should be in the log above. Please read the output to determine what
7went wrong.

If you're facing this issue, don't worry. This article provides a temporary workaround that you can apply to continue using Laravel Homestead until the official team resolves the problem. This workaround involves a simple edit to the Homestead.yaml file and a shell script modification.

Prerequisites

Ensure you're familiar with basic terminal or command prompt usage, and you have access to edit the Homestead.yaml file and shell scripts.

Step 1: Edit Homestead.yaml

To begin, add a new key to your Homestead.yaml configuration to signify the application of this workaround.

  1. Open Homestead.yaml in a text editor.
  2. Insert the following key:
1in-flight-service: true

Step 2: Modify the Provisioning Script

Next, adjust the /scripts/in-flight-service.sh script to comment out the troublesome repository URL, thus preventing the error.

  1. Navigate to /scripts/in-flight-service.sh. Create this file if it does not exist.
  2. Append the script with the following content:
 1REPO_URL="ngrok-agent.s3.amazonaws.com"
 2 
3# Comment the repo in /etc/apt/sources.list
4echo "Processing /etc/apt/sources.list..."
5sudo sed -i "/$REPO_URL/s/^/#/" /etc/apt/sources.list
 6 
7# Comment the repo in /etc/apt/sources.list.d/
8echo "Processing /etc/apt/sources.list.d/..."
9for file in /etc/apt/sources.list.d/*.list; do
10 sudo sed -i "/$REPO_URL/s/^/#/" "$file"
11done

This script comments out lines containing REPO_URL in /etc/apt/sources.list and any .list files within /etc/apt/sources.list.d/.

Step 3: Run or Provision Vagrant

With the changes made, it's time to run or provision your Vagrant environment.

  • For initial setup or if Homestead is halted:
1vagrant up
  • To apply changes to an already running environment:
1vagrant up --provision

Or if already up:

1vagrant provision

Conclusion

This temporary workaround should help you bypass the Homestead provisioning error related to the ngrok-agent.s3.amazonaws.com repository. Remember, this fix disables ngrok functionality temporarily, and you should revert these changes once a permanent solution is available from the Laravel Homestead team. Stay tuned to the official Laravel Homestead documentation for the latest updates and fixes.