Showing posts with label Solved. Show all posts
Showing posts with label Solved. Show all posts

Monday, 13 July 2026

[Solved] CodeBuild "Internal Service Error" - Fix Region-Wide Provisioning Failures

AWS CodeBuild internal service error fix diagram

The error "Internal Service Error: CodeBuild is experiencing issues" can show up even when nothing in your own pipeline configuration has changed. This guide walks through how we diagnosed a region-wide CodeBuild failure and what actually fixed it.

The error "Internal Service Error: CodeBuild is experiencing issues" can show up even when nothing in your own pipeline configuration has changed. This guide walks through how we diagnosed a region-wide CodeBuild failure and what actually fixed it.

Internal Service Error: CodeBuild is experiencing issues

What Causes This Error?

This error typically occurs when:

  • A source credential (Bitbucket/GitHub/GitLab) connected to your account has become corrupted
  • The credential was re-imported or re-authorized multiple times in a short window
  • CodeBuild's provisioning step fails while validating account-level source connections
  • The issue is regional rather than tied to any single project

Step 1 - Rule Out Your Own Configuration First

Before assuming an AWS-side fault, check the usual suspects:

# Check recent changes to compute fleets
aws codebuild list-compute-fleets --region us-east-2

# Check recent changes to build images / VPC config on a project
aws codebuild batch-get-projects --names <project-name> --region us-east-2

If none of these have changed and the failure is affecting multiple unrelated projects at the same time, the issue is likely outside your project configuration.

Step 2 - Isolate With a Minimal Test Project

Create a brand-new CodeBuild project with no custom VPC, no custom image, and no dependencies — just the defaults:

aws codebuild create-project \
  --name test-region-diagnostic \
  --source type=NO_SOURCE \
  --artifacts type=NO_ARTIFACTS \
  --environment type=LINUX_CONTAINER,image=aws/codebuild/standard:7.0,computeType=BUILD_GENERAL1_SMALL \
  --service-role <role-arn> \
  --region us-east-2

If this minimal project fails with the same error, run the identical test in a different region:

aws codebuild create-project \
  --name test-region-diagnostic \
  --source type=NO_SOURCE \
  --artifacts type=NO_ARTIFACTS \
  --environment type=LINUX_CONTAINER,image=aws/codebuild/standard:7.0,computeType=BUILD_GENERAL1_SMALL \
  --service-role <role-arn> \
  --region us-east-1

If the same project succeeds in one region and fails in another, the problem is scoped to the account in that specific region — not your pipeline.

Step 3 - Check Source Credential History

Region-wide CodeBuild provisioning failures are often traced back to a corrupted source credential. Check how many times it's been re-imported recently:

aws codebuild list-source-credentials --region us-east-2

If a credential has been re-imported several times in a short window (especially across different auth types — OAuth, access token, basic auth), that repeated re-import can corrupt its internal storage and break provisioning for every project in the region, even ones that don't use that credential.

Step 4 - Fix: Delete and Re-Save the Credential

  1. Open the CodeBuild console
  2. Go to Settings → Source credentials
  3. Delete the corrupted credential
  4. Re-save a freshly generated access token for the same source provider

No redeploys or infrastructure changes are needed — this is purely an account-level credential fix.

Step 5 - Confirm the Fix

Check the FailedBuilds metric after the fix to confirm builds are succeeding again:

aws cloudwatch get-metric-statistics \
  --namespace AWS/CodeBuild \
  --metric-name FailedBuilds \
  --region us-east-2 \
  --start-time 2026-07-10T00:00:00Z \
  --end-time 2026-07-11T00:00:00Z \
  --period 3600 \
  --statistics Sum

A flat zero across the period confirms the region has recovered.

Quick Summary

StepCommand / Action
Check project configaws codebuild batch-get-projects --names <project>
Create minimal testaws codebuild create-project --source type=NO_SOURCE ...
Compare across regionsRun the same test project in a second region
Check credential historyaws codebuild list-source-credentials
FixConsole → Settings → Source credentials → delete & re-save token
Verifyaws cloudwatch get-metric-statistics --metric-name FailedBuilds

If you're seeing this error and none of your own configuration has changed, check your account's source credential import history before assuming it's a broader AWS outage — a single corrupted credential can silently break every CodeBuild project in a region.

Friday, 29 May 2026

[Solved] unit php8.1-fpm.service could not be found

unit php8.1-fpm.service could not be found fix

The error "unit php8.1-fpm.service could not be found" indicates that the systemd unit file for PHP-FPM version 8.1 is either missing or the service itself is not installed on your system. This guide walks you through troubleshooting and fixing the issue step by step.

What Causes This Error?

This error typically occurs when:

  • PHP-FPM 8.1 is not installed on the system
  • The systemd unit file is missing or corrupted
  • A different PHP version is installed but you're referencing 8.1
  • The service was not set up correctly after installation
Failed to start php8.1-fpm.service: Unit php8.1-fpm.service could not be found.

Step 1 — Check PHP-FPM Installation

First verify whether PHP-FPM 8.1 is installed on your system:

sudo apt list --installed | grep php8.1-fpm

If nothing is returned, PHP-FPM 8.1 is not installed. Install it using:

# Add PHP repository first (if not already added)
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update

# Install PHP-FPM 8.1
sudo apt install php8.1-fpm -y

Step 2 — Check the Unit File

Verify that the PHP-FPM service unit file exists for version 8.1. Unit files are located in /lib/systemd/system/ or /etc/systemd/system/:

ls /lib/systemd/system/ | grep php8.1-fpm
ls /etc/systemd/system/ | grep php8.1-fpm

If no unit file is found, the service was either not installed properly or you are running a different PHP version.

Step 3 — Check the Correct Service Name

The service name may differ depending on your Linux distribution and PHP version. List all PHP-related services to find the correct name:

systemctl list-units --type=service | grep php

Common service name variations:

Distribution Service Name
Ubuntu/Debian php8.1-fpm
CentOS/RHEL php-fpm
Amazon Linux php-fpm

Step 4 — Check PHP Version Installed

Confirm which PHP version is currently active on your system:

php -v

Also check all installed PHP versions:

update-alternatives --list php

Step 5 — Reload Systemd and Start the Service

After installing PHP-FPM 8.1, reload systemd and start the service:

# Reload systemd daemon
sudo systemctl daemon-reload

# Start PHP-FPM 8.1
sudo systemctl start php8.1-fpm

# Enable on boot
sudo systemctl enable php8.1-fpm

# Check status
sudo systemctl status php8.1-fpm

Quick Summary

Step Command
Check if installed sudo apt list --installed | grep php8.1-fpm
Install PHP-FPM 8.1 sudo apt install php8.1-fpm -y
Check unit file ls /lib/systemd/system/ | grep php8.1-fpm
List PHP services systemctl list-units --type=service | grep php
Start service sudo systemctl start php8.1-fpm
Enable on boot sudo systemctl enable php8.1-fpm

If you're still encountering the issue after these steps, check your Linux distribution's documentation or verify whether PHP 8.1 is supported on your current OS version.

[Solved] Drupal Drush Forced Module Uninstall

Drupal Drush forced module uninstall error and fix

When working on a Drupal site, you may encounter situations where a module simply refuses to uninstall — either through the Drupal admin UI or via Drush. This guide shows you how to force uninstall a module using Drush and recover your site.

Quick Fix — Drush Forced Module Uninstall

Use the following Drush command to forcefully remove a module from Drupal's core extension configuration:

drush cdel core.extension module.your_module_name

Replace your_module_name with the actual machine name of the module. For example, to force uninstall CiviCRM:

drush cdel core.extension module.civicrm

After running the command, clear the cache:

drush cr

Why Does This Issue Occur?

There are several reasons why a module cannot be uninstalled through normal methods:

  • Module upgrade failure — An upgrade left the module in a broken state with unexpected dependencies
  • Residual configurations — Leftover config from a previously uninstalled module causes conflicts when re-enabled
  • Misconfiguration in settings.php — The module is referenced incorrectly in the settings file
  • Module enabled but not configured — The module is active in the database but missing its required settings
  • Missing settings file — For example, CiviCRM is enabled but civicrm.settings.php is not present

What Happens When This Occurs?

When a module gets stuck in this state:

  • Running drush pmu module_name throws an error
  • The Drupal Extend page shows an error or the uninstall button is greyed out
  • The entire site may go down with an unexpected error

The error from Drush typically looks like:

The module cannot be uninstalled due to [reason]

Step-by-Step Recovery Process

Step 1 — Force Uninstall the Module

drush cdel core.extension module.your_module_name

Step 2 — Clear Drupal Cache

drush cr

Step 3 — Check Site Status

drush status

Step 4 — Check Logs for Root Cause

# Check Drupal watchdog logs
drush ws --count=20

# Check PHP error logs
tail -f /var/log/php/error.log

Quick Summary

Step Command
Force uninstall module drush cdel core.extension module.module_name
Clear cache drush cr
Check site status drush status
View recent logs drush ws --count=20

This command directly removes the module entry from Drupal's configuration, bypassing the normal uninstall hooks. It gives you immediate relief to bring the site back online, after which you can investigate the root cause through Drupal logs, PHP error logs, and your configuration settings.