Laravel Sail won't build on Ubuntu 20.04 - groupadd: invalid group ID 'sail'
Stefan Bogdanescu
Founder & Senior Architect · 2026-06-29
If you are a Laravel developer using Docker for your projects, you might encounter an issue when running sail up, resulting in an error that reads "Invalid group ID 'sail'." This error can be quite frustrating but is easily resolved. Let's go through the steps to troubleshoot and fix this problem.
Detecting the issue: The groupadd command with invalid group ID results from a misconfiguration in your Laravel Sail installation or permissions issues on your Ubuntu system. It is essential to identify the root cause before proceeding further.
Step 1: Check the Group and User Identification
php
id -u www-data # check user ID
id -g www-data # check group IDStep 2: Check the Group Existence
php
ls -l /etc/group | grep sail # check if 'sail' group existsshell
sudo groupadd sail # creating a new group named 'sail'Step 3: Checking Group Associations
shell
groups # list all groups associated with the current user
sudo -u www-data groups # list all groups associated with 'www-data' user (assuming this is your web server)Step 4: Adding User to Group
shell
sudo echo "www-data:www-data:501:sail" >> /etc/group # update www-data with sail group and its ID
sudo chown -R www-data:www-data vendor/ # change ownership of the 'vendor' directory to www-data user (optional, depending on your system configuration)