If you are encountering the error message "OSError: [Errno 28] No space left on device /boot" while trying to boot your NixOS and Windows 10 dual-boot system, don't worry! This article will guide you through the steps to resolve this issue.
This error typically occurs when the /boot partition of your NixOS installation is running out of space. The /boot partition is where the boot loader and kernel files are stored.
To fix this issue, you will need to free up some space in the /boot partition. Here's how you can do it:
Step 1: Check the available space
First, let's check the current usage of the /boot partition. Open a terminal and run the following command:
df -h /boot
This command will display the disk usage of the /boot partition in a human-readable format. Make a note of the "Used" and "Available" values.
Step 2: Remove old kernel versions
Over time, multiple kernel versions can accumulate in the /boot partition, taking up valuable space. We will remove the old kernel versions to free up space.
List all installed kernel versions by running the following command:
ls /boot
Look for files with names starting with "vmlinuz" or "initrd" followed by a version number. For example, "vmlinuz-5.4.0" or "initrd-5.4.0".
Once you have identified the old kernel versions, you can remove them using the following command:
sudo rm /boot/vmlinuz-OLD_VERSION
Replace "OLD_VERSION" with the version number of the kernel you want to remove. Repeat this command for each old kernel version you wish to delete.
Step 3: Clean up boot loader entries
Next, we will clean up the boot loader entries to remove references to the old kernel versions we just deleted.
Open the boot loader configuration file in a text editor. The file is typically located at:
/boot/loader/entries/nixos-generation-XX.conf
Replace "XX" with the number corresponding to the latest NixOS generation. For example, if the latest generation is 20, the file name would be "nixos-generation-20.conf".
In the configuration file, look for lines starting with "initrd" or "linux". Remove the entries that correspond to the old kernel versions you deleted earlier.
Save the changes and exit the text editor.
Step 4: Rebuild the boot configuration
Now, we need to rebuild the boot configuration to reflect the changes we made.
Run the following command to regenerate the boot configuration:
sudo nixos-rebuild boot
This command will rebuild the boot configuration and update the boot loader entries.
Step 5: Verify the changes
Finally, let's verify that the changes we made have resolved the issue.
Run the command below to check the available space in the /boot partition:
df -h /boot
The "Used" value should be lower than before, indicating that we have successfully freed up space in the /boot partition.
Now, try rebooting your system and see if the error message "OSError: [Errno 28] No space left on device /boot" is no longer displayed.
If the error persists or if you encounter any other issues, it is recommended to seek further assistance from the NixOS community or consult a professional.
References:
| Source | Link |
|---|---|
| NixOS Manual | https://nixos.org/manual/nixos/stable/index.html#sec-troubleshooting-bootloader |
| Stack Exchange | https://unix.stackexchange.com/questions/253288/nixos-running-out-of-space-in-boot |