NixOS on ARM: Difference between revisions

imported>Samueldr
m QEMU was salty that I didn't pepper it with non-breaking space :)
imported>Samueldr
Adds instructions to use the main partition as the boot partition.
Line 276: Line 276:
* Repartition and make sure to delete and then recreate the boot partition (fat32, primary, label: <code>NIXOS_BOOT</code>)
* Repartition and make sure to delete and then recreate the boot partition (fat32, primary, label: <code>NIXOS_BOOT</code>)
* Copy the files from the backup back to the new boot partition
* Copy the files from the backup back to the new boot partition
=== Disable use of <tt>/boot</tt> partition ===
{{note|The instructions as they are were tested on the PINE A64-LTS, though were written for the Raspberry Pi 3}}
The <tt>/boot</tt> partition is quite small on the NixOS on ARM images. This means that few generations can be kept, and <code>nixos-rebuild</code> can often fail due to lack of space.
Here are quick [https://github.com/NixOS/nixpkgs/issues/22014#issuecomment-290152982 instructions to disable use of the (small) <tt>/boot</tt> partition]. The disk used in the following example is <tt>/dev/mmcblk1</tt> which may differ depending on use of SD card and the particular device.
{{commands|<nowiki>
# umount /boot
</nowiki>}}
Comment out the fileSystems."/boot" entry from configuration.nix
{{commands|<nowiki>
# $EDITOR /etc/configuration.nix
</nowiki>}}
Use fdisk or cfdisk to remove the bootable flag from the FAT32 partition, and set it for the ext4 partition
{{commands|<nowiki>
$ fdisk -l /dev/mmcblk1
Disk /dev/mmcblk1: 58.2 GiB, 62537072640 bytes, 122142720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2178694e
Device        Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk1p1 *    16384    262143    245760  120M  b W95 FAT32
/dev/mmcblk1p2      262144 122142567 121880424 58.1G 83 Linux
$ echo -e 'a\n1\na\n2\nw' | sudo fdisk /dev/mmcblk1
Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): Partition number (1,2, default 2):
The bootable flag on partition 1 is disabled now.
Command (m for help): Partition number (1,2, default 2):
The bootable flag on partition 2 is enabled now.
Command (m for help): The partition table has been altered.
Syncing disks.
$ sudo fdisk -l /dev/mmcblk1
Disk /dev/mmcblk1: 58.2 GiB, 62537072640 bytes, 122142720 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x2178694e
Device        Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk1p1      16384    262143    245760  120M  b W95 FAT32
/dev/mmcblk1p2 *    262144 122142567 121880424 58.1G 83 Linux
</nowiki>}}
Then rebuild the system.
{{commands|<nowiki>
$ nixos-rebuild switch
</nowiki>}}
You may want to verify the presence of the <tt>/boot/extlinux/extlinux.conf</tt> file.


== Details about the boot process ==
== Details about the boot process ==