Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
modify_the_system_while_it_s_running [2021/10/01 03:57] – updated inlinks atarimodify_the_system_while_it_s_running [2023/04/09 16:10] (current) – [Creating a Batocera filesystem overlay] maximumentropy
Line 1: Line 1:
-====== Overlays ======+====== Overlays (modify the live system) ======
  
-Batocera is like a firmware. It's a huge virtual filesystem image at ''/boot/boot/batocera'' (it has no extension in its filename) which expands into RAM at boot. You cannot modify it directly, and for most use cases, you shouldn't need to modify it. Most files in the ''/'' directory stem from this image. +Batocera is like a firmware. It's a huge filesystem image at ''/boot/boot/batocera'' (it has no extension in its filename) which is virtually mounted as the root of the drive in RAM at boot. You cannot modify the ''batocera'' file directly, and for most use cases, you shouldn'//need// to modify it. All folders except for ''userdata'' and ''boot'' in the ''/'' directory stem from this image.
- +
-The boot partition is mounted with read-only permissions at ''/boot/'', but can be [[:edit_boot_partition#editing_the_boot_partition_while_batocera_is_running|remounted with write permissions post-boot]]. All the user data is stored in a separate userdata partition, which is mounted with write permissions at the path ''/userdata/''.+
  
 {{batocera_drive_layout.png?1000|An illustration showing how the batocera system is laid out on a USB stick: the BATOCERA partition first, containing all the programs, and then the SHARE, containing all the userdata}} {{batocera_drive_layout.png?1000|An illustration showing how the batocera system is laid out on a USB stick: the BATOCERA partition first, containing all the programs, and then the SHARE, containing all the userdata}}
  
-That said, you can utilize overlays to "patch" certain files over the ''batocera'' virtual filesystem image at boot.+Under normal circumstances, this file cannot be written to, and any changes made to the filesystem mounted in RAM will be lost upon shutdown. That said, you can utilize overlays to "patch" certain files over the ''batocera'' filesystem image at boot.
  
-===== Editing system files =====+===== Creating a Batocera filesystem overlay =====
  
-If you need to edit files to assist in making Batocera boot or to set up external storage, refer to [[edit_boot_partition|editing the boot partition]]. +For modifications to the regular Batocera filesystem, you can directly edit the files in their directory using [[:built_file_manager|the built-in file manager]] while booted (for example if you want to play with the configgen scripts in ''/usr/lib/pythonX.X/site-packages/configgen/generators/'' or change the default platform parameters in ''/usr/share/batocera/configgen/configgen-defaults-arch.yml''or sign in [[:access_the_batocera_via_ssh|via SSH]] or [[:winscp|SCP/FTP]] to make those alterations. Once the modifications are done, you can save them with [[:access_the_batocera_via_ssh|the command]] ''batocera-save-overlay''. This command script creates a patch file at ''/boot/boot/overlay'' which stores the differences between the current mounted filesystem and the one stored in ''/boot/batocera''.
- +
-For modifications to the regular Batocera virtual file system, you can directly edit the files in their directory while booted (for example if you want to play with the configgen scripts in ''/usr/lib/python3.9/site-packages/configgen/generators/'' or change the default platform parameters in ''/usr/share/batocera/configgen/configgen-defaults-arch.yml''). Once the modifications are done, you can save them with [[:access_the_batocera_via_ssh|the command]] ''batocera-save-overlay''. This command script creates a patch file at ''/boot/boot/overlay'' which stores the differences between the current virtual file system and the one stored in ''/boot/batocera''.+
  
 <WRAP center round tip> <WRAP center round tip>
 Refer to [[:notable_files|the notable files/folders page]] for some more interesting files! Refer to [[:notable_files|the notable files/folders page]] for some more interesting files!
 </WRAP> </WRAP>
 +
 +By default, Batocera overlay files are limited to 100 MB. If your modifications are over 100 MB, you can specify the size of the overlay with the command. Keep always a bit of margin, the overlay will embed a few more files than those you were expecting (some system files created on-the-fly at boot time). For example, if you need to save 120 MB of data on the system, you can type ''batocera-save-overlay 125''.
  
 <WRAP center round important> <WRAP center round important>
Line 23: Line 21:
 </WRAP> </WRAP>
  
-Even if you don't use the ''batocera-save-overlay'' script you can still edit the files in ''/usr/''but any modification made will be lost on reboot. If you want to remove all your customizations after running ''batocera-save-overlay'', just remove the ''/boot/boot/overlay'' file.+<WRAP center round tip> 
 +To view the contents of the overlay independently from the underlying filesystemit can be mounted in a separate location:
  
-By default, Batocera overlay files are limited to 50 MB. If your modifications are over 50 MB, you can specify the size of the overlay with the command. Keep always a bit of margin, the overlay will embed a few more files than those you were expecting (some system files created on-the-fly at boot time). For example, if you need to save 120 MB of data on the system, you can type ''batocera-save-overlay 120''.+<code> 
 +mount /boot/boot/overlay /mnt 
 +find /mnt 
 +umount /mnt 
 +</code>
  
-<WRAP center round alert> 
-This cannot be done for the Batocera **v31** on the Odroid XU4 platform. 
 </WRAP> </WRAP>
 +
 +===== Removing the overlay =====
 +
 +Even if you don't use the ''batocera-save-overlay'' script you can still edit the files in any of the root folders, but any modification made outside of ''/userdata'' or ''/boot'' will be lost on reboot. If you want to remove all your overlay modifications made after running ''batocera-save-overlay'' previously, simply [[:edit_boot_partition#editing_the_boot_partition_while_batocera_is_running|remove]] the ''/boot/boot/overlay'' file.
  
 ===== Cases when you don't need to modify the system ===== ===== Cases when you don't need to modify the system =====
  
 Some best practices here: Some best practices here:
-  * You generally don't need to edit ''/etc/fstab'', use [[store_games_on_a_second_usb_sata_drive|configure your external storage]] or [[store_games_on_a_nas|configure your NAS]] instead. +  * You don't need to edit ''/etc/fstab'' to mount external drives, use [[:store_games_on_a_second_usb_sata_drive|configure your external storage]] or [[:store_games_on_a_nas|configure your NAS]] instead. 
-  * You should not modify ''/usr/share/emulationstation/es_systems.cfg''. Instead, follow the instructions at [[emulationstation:customize_systems|the customize systems page]].+  * You should not modify ''/usr/share/emulationstation/es_systems.cfg'' for altering the systems listed in EmulationStation. This is the base file updated with every release of Batocera. Instead, follow the instructions at [[emulationstation:customize_systems|the customize systems page]] to create a "patch" that's loaded on top of the base file, allowing for updates to the base file. 
 + 
 +===== I want to modify something in the boot folder though =====
  
 +The boot partition is mounted with read-only permissions at ''/boot/'', but can be [[:edit_boot_partition#editing_the_boot_partition_while_batocera_is_running|remounted with write permissions post-boot]]. You do not need to save an overlay for file edits made in the boot partition, as this is a physical partition where your edits are permanent (and because of that, any edits you make here are more dangerous and can result in a non-booting machine, always make backups before attempting this). All the user data is stored in a separate userdata partition, which is mounted with write permissions at the path ''/userdata/'' (like the boot partition, this is just your regular userdata storage partition, no need to save overlays for this either).
  
  • modify_the_system_while_it_s_running.1633053422.txt.gz
  • Last modified: 3 years ago
  • by atari