<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.opensourceecology.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Andrewusu</id>
	<title>Open Source Ecology - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.opensourceecology.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Andrewusu"/>
	<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/wiki/Special:Contributions/Andrewusu"/>
	<updated>2026-04-15T03:42:40Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.39.13</generator>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263940</id>
		<title>How to:Write Image to SD Card</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263940"/>
		<updated>2021-12-14T16:31:02Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will explain how to write an Image to an external drive, like a SD card or a USB Stick. The SD card will be created on the OSE Linux Distribution (Ubuntu). The SD card will be used in a Raspberry Pi as an operating system. The Raspberry Pi will run the OSE 3D Print Cluster Software. This software will run up to 12 (and eventually 100) 3D printers -from a single Raspberry PI.&lt;br /&gt;
For now, the Image can be Found here [https://octopi.octoprint.org/ Octopi Image]&lt;br /&gt;
&lt;br /&gt;
=What is an Image file?=&lt;br /&gt;
&lt;br /&gt;
An Image file is an exact copy of a partition or an entire hard drive. It&#039;s imagined best as a backup of a storage device, like a HDD or a stick. Writing an image to a medium is therefore very similar to restoring a backup. The Raspberry Pi Images are of course no backup but the source of the operating system, but it&#039;s helpful to understand that there is no installation ongoing like we&#039;re used to it, instead it&#039;s just copying an out of the box working version of the operating system onto the SD Card.&lt;br /&gt;
&lt;br /&gt;
=Using Disk Image Writer=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: This process will delete all data from the SD card or USB Stick. Backup any data beforehand!!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you should assure that the external drive has enough space. When no other information is given, a minimum of 4 Gigabyte should be appropriate. &lt;br /&gt;
&lt;br /&gt;
After Downloading the image, the Image will probably be zipped. To unzip it, right click and &amp;quot;extract it&amp;quot;&lt;br /&gt;
[[File:Extract_Folder.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Downloading the image, right click on it and choose &amp;quot;Open with&amp;quot; -&amp;gt; &amp;quot;Disk Image Writer&amp;quot;&lt;br /&gt;
[[File:Disk_Image_Writer_Choosing.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a window with a pop-up to choose the drive upon which the image should be written.&lt;br /&gt;
[[File:Disk_Image_writer_Interface.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this Scenario, the SD Card reader gets selected. After clicking restore the process will begin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;And you&#039;re done!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After this, there may be some kind of customization to make, however this is very specific and should always be handeled with care.&lt;br /&gt;
In the case of the OSE 3dPrint Cluster Software, you can put in your wifi credentials so the Raspberry Pi will automatically connect to your network.&lt;br /&gt;
For achieving that, we have to modify a textfile. Go to the external partition called &#039;boot&#039; and open the &#039;&#039;&#039;octopi-network.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Cluster-Wifi.jpg | 800 px]]&lt;br /&gt;
&lt;br /&gt;
Now you have to customize depending on the network, there are three options here: WPA/WPA2, WEP and unsecured. &lt;br /&gt;
Uncomment the lines (meaning: remove the #) marked in the picture for your kind of network authentification (which is probably and hopefully WPA2) and fill in your SSID (this means the name of your WIFI when you see it on a computer or smartphone) and the WIFI password inside the &amp;quot;&amp;quot;. Don&#039;t forget to save the file.&lt;br /&gt;
&lt;br /&gt;
After that the SD Card should be ready. Test on your PI and turn it on!&lt;br /&gt;
&lt;br /&gt;
=Test Flash Media=&lt;br /&gt;
&lt;br /&gt;
If you encounter problems, consider testing to see if the flash media is counterfeit.&lt;br /&gt;
&lt;br /&gt;
The market seems to be saturated with counterfeit SD cards and USB flash memory. It is good practice to test for a counterfeit after purchase, even from a reputable seller, and especially so from eBay/Amazon. Install `f3 - Fight Flash Fraud` and test on the media. This test will delete any existing partitioning and destroy data on the disk so be sure to call it on the correct /dev/sd# disk.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install f3&lt;br /&gt;
sudo f3probe --destructive --time-ops /dev/sd#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will report interesting characteristics of the flash media, such as how much DRAM cache there is, read/write performance, and if it is a counterfeit.&lt;br /&gt;
&lt;br /&gt;
Counterfeit flash memory often results in data being corrupted that was written to it, without warning, and that data is lost forever. It has a small amount of poor quality but working flash memory which is enough to deceive you, your computer, and most all software into thinking it is what it claims to be. In addition there is the professionally sealed branded packaging and a deceptively good cosmetic appearance, which all makes you think it is a legitimate product.&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263939</id>
		<title>How to:Write Image to SD Card</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263939"/>
		<updated>2021-12-14T15:57:28Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will explain how to write an Image to an external drive, like a SD card or a USB Stick. The SD card will be created on the OSE Linux Distribution (Ubuntu). The SD card will be used in a Raspberry Pi as an operating system. The Raspberry Pi will run the OSE 3D Print Cluster Software. This software will run up to 12 (and eventually 100) 3D printers -from a single Raspberry PI.&lt;br /&gt;
For now, the Image can be Found here [https://octopi.octoprint.org/ Octopi Image]&lt;br /&gt;
&lt;br /&gt;
=What is an Image file?=&lt;br /&gt;
&lt;br /&gt;
An Image file is an exact copy of a partition or an entire hard drive. It&#039;s imagined best as a backup of a storage device, like a HDD or a stick. Writing an image to a medium is therefore very similar to restoring a backup. The Raspberry Pi Images are of course no backup but the source of the operating system, but it&#039;s helpful to understand that there is no installation ongoing like we&#039;re used to it, instead it&#039;s just copying an out of the box working version of the operating system onto the SD Card.&lt;br /&gt;
&lt;br /&gt;
=Using Disk Image Writer=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: This process will delete all data from the SD card or USB Stick. Backup any data beforehand!!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you should assure that the external drive has enough space. When no other information is given, a minimum of 4 Gigabyte should be appropriate. &lt;br /&gt;
&lt;br /&gt;
After Downloading the image, the Image will probably be zipped. To unzip it, right click and &amp;quot;extract it&amp;quot;&lt;br /&gt;
[[File:Extract_Folder.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Downloading the image, right click on it and choose &amp;quot;Open with&amp;quot; -&amp;gt; &amp;quot;Disk Image Writer&amp;quot;&lt;br /&gt;
[[File:Disk_Image_Writer_Choosing.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a window with a pop-up to choose the drive upon which the image should be written.&lt;br /&gt;
[[File:Disk_Image_writer_Interface.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this Scenario, the SD Card reader gets selected. After clicking restore the process will begin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;And you&#039;re done!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After this, there may be some kind of customization to make, however this is very specific and should always be handeled with care.&lt;br /&gt;
In the case of the OSE 3dPrint Cluster Software, you can put in your wifi credentials so the Raspberry Pi will automatically connect to your network.&lt;br /&gt;
For achieving that, we have to modify a textfile. Go to the external partition called &#039;boot&#039; and open the &#039;&#039;&#039;octopi-network.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Cluster-Wifi.jpg | 800 px]]&lt;br /&gt;
&lt;br /&gt;
Now you have to customize depending on the network, there are three options here: WPA/WPA2, WEP and unsecured. &lt;br /&gt;
Uncomment the lines (meaning: remove the #) marked in the picture for your kind of network authentification (which is probably and hopefully WPA2) and fill in your SSID (this means the name of your WIFI when you see it on a computer or smartphone) and the WIFI password inside the &amp;quot;&amp;quot;. Don&#039;t forget to save the file.&lt;br /&gt;
&lt;br /&gt;
After that the SD Card should be ready. Test on your PI and turn it on!&lt;br /&gt;
&lt;br /&gt;
=Test Flash Media=&lt;br /&gt;
&lt;br /&gt;
If you encounter problems, consider testing to see if the flash media is counterfeit.&lt;br /&gt;
&lt;br /&gt;
The market seems to be saturated with counterfeit SD cards and USB flash memory. It is good practice to test for a counterfeit after purchase, even from a reputable seller, and especially so from eBay/Amazon. Install `f3 - Fight Flash Fraud` and test on the media. This test will delete any existing partitioning and destroy data on the disk so be sure to call it on the correct /dev/sd# disk.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install f3&lt;br /&gt;
sudo f3probe --destructive --time-ops /dev/sd#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will report interesting characteristics of the flash media, such as how much DRAM cache there is, read/write performance, and if it is a counterfeit. Counterfeit flash memory often results in data being corrupted that was written to it, without warning, and that data is lost forever. It has a small amount of poor quality but working flash memory which is enough to deceive you, your computer, and most all software into thinking it is what it claims to be. In addition there is the professionally sealed branded packaging and a deceptively good cosmetic appearance, which all makes you think it is a legitimate product.&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263938</id>
		<title>How to:Write Image to SD Card</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263938"/>
		<updated>2021-12-14T15:54:22Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will explain how to write an Image to an external drive, like a SD card or a USB Stick. The SD card will be created on the OSE Linux Distribution (Ubuntu). The SD card will be used in a Raspberry Pi as an operating system. The Raspberry Pi will run the OSE 3D Print Cluster Software. This software will run up to 12 (and eventually 100) 3D printers -from a single Raspberry PI.&lt;br /&gt;
For now, the Image can be Found here [https://octopi.octoprint.org/ Octopi Image]&lt;br /&gt;
&lt;br /&gt;
=What is an Image file?=&lt;br /&gt;
&lt;br /&gt;
An Image file is an exact copy of a partition or an entire hard drive. It&#039;s imagined best as a backup of a storage device, like a HDD or a stick. Writing an image to a medium is therefore very similar to restoring a backup. The Raspberry Pi Images are of course no backup but the source of the operating system, but it&#039;s helpful to understand that there is no installation ongoing like we&#039;re used to it, instead it&#039;s just copying an out of the box working version of the operating system onto the SD Card.&lt;br /&gt;
&lt;br /&gt;
=Using Disk Image Writer=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: This process will delete all data from the SD card or USB Stick. Backup any data beforehand!!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you should assure that the external drive has enough space. When no other information is given, a minimum of 4 Gigabyte should be appropriate. &lt;br /&gt;
&lt;br /&gt;
After Downloading the image, the Image will probably be zipped. To unzip it, right click and &amp;quot;extract it&amp;quot;&lt;br /&gt;
[[File:Extract_Folder.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Downloading the image, right click on it and choose &amp;quot;Open with&amp;quot; -&amp;gt; &amp;quot;Disk Image Writer&amp;quot;&lt;br /&gt;
[[File:Disk_Image_Writer_Choosing.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a window with a pop-up to choose the drive upon which the image should be written.&lt;br /&gt;
[[File:Disk_Image_writer_Interface.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this Scenario, the SD Card reader gets selected. After clicking restore the process will begin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;And you&#039;re done!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After this, there may be some kind of customization to make, however this is very specific and should always be handeled with care.&lt;br /&gt;
In the case of the OSE 3dPrint Cluster Software, you can put in your wifi credentials so the Raspberry Pi will automatically connect to your network.&lt;br /&gt;
For achieving that, we have to modify a textfile. Go to the external partition called &#039;boot&#039; and open the &#039;&#039;&#039;octopi-network.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Cluster-Wifi.jpg | 800 px]]&lt;br /&gt;
&lt;br /&gt;
Now you have to customize depending on the network, there are three options here: WPA/WPA2, WEP and unsecured. &lt;br /&gt;
Uncomment the lines (meaning: remove the #) marked in the picture for your kind of network authentification (which is probably and hopefully WPA2) and fill in your SSID (this means the name of your WIFI when you see it on a computer or smartphone) and the WIFI password inside the &amp;quot;&amp;quot;. Don&#039;t forget to save the file.&lt;br /&gt;
&lt;br /&gt;
After that the SD Card should be ready. Test on your PI and turn it on!&lt;br /&gt;
&lt;br /&gt;
=Test Flash Media=&lt;br /&gt;
&lt;br /&gt;
If you encounter problems, consider testing to see if the flash media is counterfeit.&lt;br /&gt;
&lt;br /&gt;
The market seems to be saturated with counterfeit SD cards and USB flash memory. It is good practice to test for a counterfeit after purchase, even from a reputable seller, and especially so from eBay/Amazon. Install `f3 - Fight Flash Fraud` and test on the media. This test will delete any existing partitioning and destroy data on the disk so be sure to call it on the correct /dev/sd# disk.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install f3&lt;br /&gt;
sudo f3probe --destructive --time-ops /dev/sd#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will report interesting characteristics of the flash media, such as how much DRAM cache there is, read/write performance, and if it is a counterfeit. Counterfeit flash memory often results in data being corrupted that was written to it, without warning, and that data is lost forever. It has a small amount of valid flash memory which is enough to deceive you, your computer, and most all software into thinking it is legitimate. In addition there is the professionally sealed branded packaging and a deceptively good cosmetic appearance, which all makes you think it is a legitimate product.&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263937</id>
		<title>How to:Write Image to SD Card</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263937"/>
		<updated>2021-12-14T15:39:45Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will explain how to write an Image to an external drive, like a SD card or a USB Stick. The SD card will be created on the OSE Linux Distribution (Ubuntu). The SD card will be used in a Raspberry Pi as an operating system. The Raspberry Pi will run the OSE 3D Print Cluster Software. This software will run up to 12 (and eventually 100) 3D printers -from a single Raspberry PI.&lt;br /&gt;
For now, the Image can be Found here [https://octopi.octoprint.org/ Octopi Image]&lt;br /&gt;
&lt;br /&gt;
=What is an Image file?=&lt;br /&gt;
&lt;br /&gt;
An Image file is an exact copy of a partition or an entire hard drive. It&#039;s imagined best as a backup of a storage device, like a HDD or a stick. Writing an image to a medium is therefore very similar to restoring a backup. The Raspberry Pi Images are of course no backup but the source of the operating system, but it&#039;s helpful to understand that there is no installation ongoing like we&#039;re used to it, instead it&#039;s just copying an out of the box working version of the operating system onto the SD Card.&lt;br /&gt;
&lt;br /&gt;
=Test Flash Media=&lt;br /&gt;
&lt;br /&gt;
The market seems to be saturated with counterfeit SD cards and USB flash memory. It is good practice to test for a counterfeit after purchase, even from a reputable seller, and especially so from eBay/Amazon. Install `f3 - Fight Flash Fraud` and test on the media. This test will delete any existing partitioning and destroy data on the disk so be sure to call it on the correct /dev/sd# disk.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install f3&lt;br /&gt;
sudo f3probe --destructive --time-ops /dev/sd#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will report interesting characteristics of the flash media, such as how much DRAM cache there is, read/write performance, and if it is a counterfeit. Counterfeit flash memory often results in data being corrupted that was written to it, without warning, and that data is lost forever. It has a small amount of valid flash memory which is enough to deceive you, your computer, and most all software into thinking it is legitimate. In addition there is the professionally sealed packaging and good cosmetic appearance.&lt;br /&gt;
&lt;br /&gt;
=Using Disk Image Writer=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: This process will delete all data from the SD card or USB Stick. Backup any data beforehand!!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you should assure that the external drive has enough space. When no other information is given, a minimum of 4 Gigabyte should be appropriate. &lt;br /&gt;
&lt;br /&gt;
After Downloading the image, the Image will probably be zipped. To unzip it, right click and &amp;quot;extract it&amp;quot;&lt;br /&gt;
[[File:Extract_Folder.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Downloading the image, right click on it and choose &amp;quot;Open with&amp;quot; -&amp;gt; &amp;quot;Disk Image Writer&amp;quot;&lt;br /&gt;
[[File:Disk_Image_Writer_Choosing.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a window with a pop-up to choose the drive upon which the image should be written.&lt;br /&gt;
[[File:Disk_Image_writer_Interface.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this Scenario, the SD Card reader gets selected. After clicking restore the process will begin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;And you&#039;re done!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After this, there may be some kind of customization to make, however this is very specific and should always be handeled with care.&lt;br /&gt;
In the case of the OSE 3dPrint Cluster Software, you can put in your wifi credentials so the Raspberry Pi will automatically connect to your network.&lt;br /&gt;
For achieving that, we have to modify a textfile. Go to the external partition called &#039;boot&#039; and open the &#039;&#039;&#039;octopi-network.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Cluster-Wifi.jpg | 800 px]]&lt;br /&gt;
&lt;br /&gt;
Now you have to customize depending on the network, there are three options here: WPA/WPA2, WEP and unsecured. &lt;br /&gt;
Uncomment the lines (meaning: remove the #) marked in the picture for your kind of network authentification (which is probably and hopefully WPA2) and fill in your SSID (this means the name of your WIFI when you see it on a computer or smartphone) and the WIFI password inside the &amp;quot;&amp;quot;. Don&#039;t forget to save the file.&lt;br /&gt;
&lt;br /&gt;
After that the SD Card should be ready. Test on your PI and turn it on!&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263936</id>
		<title>How to:Write Image to SD Card</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=How_to:Write_Image_to_SD_Card&amp;diff=263936"/>
		<updated>2021-12-14T15:39:10Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Counterfeit awarenesss&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;This page will explain how to write an Image to an external drive, like a SD card or a USB Stick. The SD card will be created on the OSE Linux Distribution (Ubuntu). The SD card will be used in a Raspberry Pi as an operating system. The Raspberry Pi will run the OSE 3D Print Cluster Software. This software will run up to 12 (and eventually 100) 3D printers -from a single Raspberry PI.&lt;br /&gt;
For now, the Image can be Found here [https://octopi.octoprint.org/ Octopi Image]&lt;br /&gt;
&lt;br /&gt;
=What is an Image file?=&lt;br /&gt;
&lt;br /&gt;
An Image file is an exact copy of a partition or an entire hard drive. It&#039;s imagined best as a backup of a storage device, like a HDD or a stick. Writing an image to a medium is therefore very similar to restoring a backup. The Raspberry Pi Images are of course no backup but the source of the operating system, but it&#039;s helpful to understand that there is no installation ongoing like we&#039;re used to it, instead it&#039;s just copying an out of the box working version of the operating system onto the SD Card.&lt;br /&gt;
&lt;br /&gt;
=Test Flash Media=&lt;br /&gt;
&lt;br /&gt;
The market seems to be saturated with counterfeit SD cards and USB flash memory. It is good practice to test for a counterfeit after purchase, even from a reputable seller, and especially so from eBay/Amazon. Install `f3 - Fight Flash Fraud` and test on the media. This test will delete any existing partitioning and destroy data on the disk so be sure to call it on the correct /dev/sd# disk.\&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo apt-get install f3&lt;br /&gt;
sudo f3probe --destructive --time-ops /dev/sd#&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
It will report interesting characteristics of the flash media, such as how much DRAM cache there is, read/write performance, and if it is a counterfeit. Counterfeit flash memory often results in data being corrupted that was written to it, without warning, and that data is lost forever. It has a small amount of valid flash memory which is enough to deceive you, your computer, and most all software into thinking it is legitimate. In addition there is the professionally sealed packaging and good cosmetic appearance.&lt;br /&gt;
&lt;br /&gt;
=Using Disk Image Writer=&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;WARNING: This process will delete all data from the SD card or USB Stick. Backup any data beforehand!!!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
First you should assure that the external drive has enough space. When no other information is given, a minimum of 4 Gigabyte should be appropriate. &lt;br /&gt;
&lt;br /&gt;
After Downloading the image, the Image will probably be zipped. To unzip it, right click and &amp;quot;extract it&amp;quot;&lt;br /&gt;
[[File:Extract_Folder.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After Downloading the image, right click on it and choose &amp;quot;Open with&amp;quot; -&amp;gt; &amp;quot;Disk Image Writer&amp;quot;&lt;br /&gt;
[[File:Disk_Image_Writer_Choosing.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This will open a window with a pop-up to choose the drive upon which the image should be written.&lt;br /&gt;
[[File:Disk_Image_writer_Interface.png | 800px]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For this Scenario, the SD Card reader gets selected. After clicking restore the process will begin.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;And you&#039;re done!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
After this, there may be some kind of customization to make, however this is very specific and should always be handeled with care.&lt;br /&gt;
In the case of the OSE 3dPrint Cluster Software, you can put in your wifi credentials so the Raspberry Pi will automatically connect to your network.&lt;br /&gt;
For achieving that, we have to modify a textfile. Go to the external partition called &#039;boot&#039; and open the &#039;&#039;&#039;octopi-network.txt&#039;&#039;&#039;.&lt;br /&gt;
&lt;br /&gt;
[[File:Cluster-Wifi.jpg | 800 px]]&lt;br /&gt;
&lt;br /&gt;
Now you have to customize depending on the network, there are three options here: WPA/WPA2, WEP and unsecured. &lt;br /&gt;
Uncomment the lines (meaning: remove the #) marked in the picture for your kind of network authentification (which is probably and hopefully WPA2) and fill in your SSID (this means the name of your WIFI when you see it on a computer or smartphone) and the WIFI password inside the &amp;quot;&amp;quot;. Don&#039;t forget to save the file.&lt;br /&gt;
&lt;br /&gt;
After that the SD Card should be ready. Test on your PI and turn it on!&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263874</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263874"/>
		<updated>2021-12-12T16:48:36Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.18 and newer (or v0.19 and newer?) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==FreeCAD Sync==&lt;br /&gt;
&lt;br /&gt;
It should be possible to translate individual user edits on a particular file/assembly into git commits, transparently and without user-intervention. Microtransactions. This is different than the traditional use of git, where the end-user manually versions a worktree, writes a commit message, and pushes/pulls/merges.&lt;br /&gt;
&lt;br /&gt;
===Microtransactions===&lt;br /&gt;
These microtransactions will be sent to a configured repository, such as on GitHub/GitLab, an OSE server, a peer or peers, or just the local filesystem. Others concurrently working on the same assembly would see the assembly being updated as the microtransactions are pulled in. As opposed to git polling the remote repo and subrepos at some interval (other than on launch), it would be ideal to have a subscription service set up to tell subscribers to update, over UPnP would be less secure than a cloud or OSE server.&lt;br /&gt;
&lt;br /&gt;
The use of a custom XML merge driver, with underlying knowledge of the FCStd file format, should mitigate the event of a merge conflict from occurring. Were a merge conflict to occur, be it online or offline, I hope to present a suitable interface for the end-user to make a decision, such as to branch their conflicting microtransaction or be presented with a diff of the XML element? Paired with FreeCAD being patched to not store BREP data in the persistent layer and only store it in memory, regenerating it on demand. realthunder may have already done this in his branch.&lt;br /&gt;
&lt;br /&gt;
===Sub-assemblies===&lt;br /&gt;
Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that sub-assembly without changing the original parent assembly.&lt;br /&gt;
&lt;br /&gt;
===Transparent Git features===&lt;br /&gt;
The use of git as a protocol for synchronization also allows for re-use of existing features. Such as a version history and other git features.&lt;br /&gt;
&lt;br /&gt;
At intervals the end-user may elect to version/tag their progress, entering in a commit message into a FreeCAD GUI explaining their changes.&lt;br /&gt;
&lt;br /&gt;
Some of the below plumbing in support of synchronization of FreeCAD data requires custom user configuration, such as the re-zip tools. I anticipate the FreeCAD Module would hide everything git behind the scenes, where the user does not interact with git at all. The Module would allow for visually browsing the version history, automatically generating thumbnails (maybe the caching should only be done here).&lt;br /&gt;
&lt;br /&gt;
===Contrast to present OSE Merge Workflow===&lt;br /&gt;
&lt;br /&gt;
This proposal is my intuition of what is possible. My impression of the present [[Merge_Workflow]] is that it is optimized for the existing constraints/limitations of FreeCAD in the spirit of mass collaboration. But it does impose additional steps on end-users [[Talk:Merge_Workflow#False%20Dichotomy]].&lt;br /&gt;
&lt;br /&gt;
The memory FreeCAD requires for sub-assemblies in large assemblies is a problem&lt;br /&gt;
that the OSE Merge Workflow mitigates in the procedure of deleting the part history. But that should be do-able from within FreeCAD, leaving that data on the persistent layer and dynamically loading it into memory on demand. Less data-management overhead were this to be implemented in FreeCAD. Easiest way to do implement this feature would be to script the procedure within FreeCAD as sub-assemblies are loaded: load full model, then prune. I need to look at internals.&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Plumbing in support of Sync==&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to [https://doc.qt.io/qt-5/model-view-programming.html use a proper model-view separation]. This change would also allow [https://forum.freecadweb.org/viewtopic.php?f=3&amp;amp;t=35316 the ability to reorder items easily in the TreeView], something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files. I&#039;m unsure how what the performance or implementation constraints are at present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ickby&#039;s Colaborative Addon===&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=57028 ickby created an collaborative addon in 2021]. Supports v0.18 and v0.19. Doesn&#039;t use git for sync plumbing. Doesn&#039;t support true concurrency at present. Certainly an interesting approach to the problem though.&lt;br /&gt;
&lt;br /&gt;
Looks like it doesn&#039;t use UPnP at a glance, and doesn&#039;t handle NAT? [https://github.com/OpenCollaborationPlatform/OCP/blob/master/utils/Config.go Listens on port 7000, has a bootstrap server]. Unsure what function the bootstrap server has, maybe it is a data proxy mitigating the need for forwarding firewall port 7000 from 0.0.0.0...? That&#039;s going to be attacked.&lt;br /&gt;
&lt;br /&gt;
I suppose that deserves some thought, what the most secure architecture would be. I suppose I&#039;d only use key-based ssh on a centralized server, or perhaps there is a secure peer-to-peer library that meets my expectations out there somewhere... not worth the effort, the subscription notifications I envision in my proposal will be low bandwidth and will be fine centralized, just JSON sent to subscribers, [https://stackoverflow.com/a/6430706 triggered via a git hook], that URL would be to the centralized server, which would send that JSON to on-the-fly subscribers. Certainly a bazillion IoT libraries out there that do this.&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master). Assign a GUID to that sub-assembly on creation and have that be the branch name?&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly&#039;s repo.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
==Annotated Visual History==&lt;br /&gt;
An optimal way to implement the plumbing behind [[Annotated_Visual_History]].&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without said cache, will interact with the module as the module iterates through git revisions, to cache each revision. In the background async, or scheduled when idle, so as to not interfere with the user&#039;s work. In-memory would be quick. Might be best to do this only when the user attempts to view the history so as to not slow down their other work.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 256x256 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and present these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
[[Merge_Workflow]]&lt;br /&gt;
[[Microfactory_Boot_Camp_-_Every_Hardware_Build_is_a_Fork]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263873</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263873"/>
		<updated>2021-12-12T16:35:05Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Contrast to present OSE Merge Workflow */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==FreeCAD Sync==&lt;br /&gt;
&lt;br /&gt;
It should be possible to translate individual user edits on a particular file/assembly into git commits, transparently and without user-intervention. Microtransactions. This is different than the traditional use of git, where the end-user manually versions a worktree, writes a commit message, and pushes/pulls/merges.&lt;br /&gt;
&lt;br /&gt;
===Microtransactions===&lt;br /&gt;
These microtransactions will be sent to a configured repository, such as on GitHub/GitLab, an OSE server, a peer or peers, or just the local filesystem. Others concurrently working on the same assembly would see the assembly being updated as the microtransactions are pulled in. As opposed to git polling the remote repo and subrepos at some interval (other than on launch), it would be ideal to have a subscription service set up to tell subscribers to update, over UPnP would be less secure than a cloud or OSE server.&lt;br /&gt;
&lt;br /&gt;
The use of a custom XML merge driver, with underlying knowledge of the FCStd file format, should mitigate the event of a merge conflict from occurring. Were a merge conflict to occur, be it online or offline, I hope to present a suitable interface for the end-user to make a decision, such as to branch their conflicting microtransaction or be presented with a diff of the XML element? Paired with FreeCAD being patched to not store BREP data in the persistent layer and only store it in memory, regenerating it on demand. realthunder may have already done this in his branch.&lt;br /&gt;
&lt;br /&gt;
===Sub-assemblies===&lt;br /&gt;
Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that sub-assembly without changing the original parent assembly.&lt;br /&gt;
&lt;br /&gt;
===Transparent Git features===&lt;br /&gt;
The use of git as a protocol for synchronization also allows for re-use of existing features. Such as a version history and other git features.&lt;br /&gt;
&lt;br /&gt;
At intervals the end-user may elect to version/tag their progress, entering in a commit message into a FreeCAD GUI explaining their changes.&lt;br /&gt;
&lt;br /&gt;
Some of the below plumbing in support of synchronization of FreeCAD data requires custom user configuration, such as the re-zip tools. I anticipate the FreeCAD Module would hide everything git behind the scenes, where the user does not interact with git at all. The Module would allow for visually browsing the version history, automatically generating thumbnails (maybe the caching should only be done here).&lt;br /&gt;
&lt;br /&gt;
===Contrast to present OSE Merge Workflow===&lt;br /&gt;
&lt;br /&gt;
This proposal is my intuition of what is possible. My impression of the present [[Merge_Workflow]] is that it is optimized for the existing constraints/limitations of FreeCAD in the spirit of mass collaboration. But it does impose additional steps on end-users [[Talk:Merge_Workflow#False%20Dichotomy]].&lt;br /&gt;
&lt;br /&gt;
The memory FreeCAD requires for sub-assemblies in large assemblies is a problem&lt;br /&gt;
that the OSE Merge Workflow mitigates in the procedure of deleting the part history. But that should be do-able from within FreeCAD, leaving that data on the persistent layer and dynamically loading it into memory on demand. Less data-management overhead were this to be implemented in FreeCAD. Easiest way to do implement this feature would be to script the procedure within FreeCAD as sub-assemblies are loaded: load full model, then prune. I need to look at internals.&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Plumbing in support of Sync==&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files. I&#039;m unsure how what the performance or implementation constraints are at present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ickby&#039;s Colaborative Addon===&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=57028 ickby created an collaborative addon in 2021]. Supports v0.18 and v0.19. Doesn&#039;t use git for sync plumbing. Doesn&#039;t support true concurrency at present. Certainly an interesting approach to the problem though.&lt;br /&gt;
&lt;br /&gt;
Looks like it doesn&#039;t use UPnP at a glance, and doesn&#039;t handle NAT? [https://github.com/OpenCollaborationPlatform/OCP/blob/master/utils/Config.go Listens on port 7000, has a bootstrap server]. Unsure what function the bootstrap server has, maybe it is a data proxy mitigating the need for forwarding firewall port 7000 from 0.0.0.0...? That&#039;s going to be attacked.&lt;br /&gt;
&lt;br /&gt;
I suppose that deserves some thought, what the most secure architecture would be. I suppose I&#039;d only use key-based ssh on a centralized server, or perhaps there is a secure peer-to-peer library that meets my expectations out there somewhere... not worth the effort, the subscription notifications I envision in my proposal will be low bandwidth and will be fine centralized, just JSON sent to subscribers, [https://stackoverflow.com/a/6430706 triggered via a git hook], that URL would be to the centralized server, which would send that JSON to on-the-fly subscribers. Certainly a bazillion IoT libraries out there that do this.&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master). Assign a GUID to that sub-assembly on creation and have that be the branch name?&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly&#039;s repo.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
==Annotated Visual History==&lt;br /&gt;
An optimal way to implement the plumbing behind [[Annotated_Visual_History]].&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without said cache, will interact with the module as the module iterates through git revisions, to cache each revision. In the background async, or scheduled when idle, so as to not interfere with the user&#039;s work. In-memory would be quick. Might be best to do this only when the user attempts to view the history so as to not slow down their other work.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 256x256 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and present these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
[[Merge_Workflow]]&lt;br /&gt;
[[Microfactory_Boot_Camp_-_Every_Hardware_Build_is_a_Fork]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263872</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263872"/>
		<updated>2021-12-12T16:25:55Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* ickby&amp;#039;s Colaborative Addon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==FreeCAD Sync==&lt;br /&gt;
&lt;br /&gt;
It should be possible to translate individual user edits on a particular file/assembly into git commits, transparently and without user-intervention. Microtransactions. This is different than the traditional use of git, where the end-user manually versions a worktree, writes a commit message, and pushes/pulls/merges.&lt;br /&gt;
&lt;br /&gt;
===Microtransactions===&lt;br /&gt;
These microtransactions will be sent to a configured repository, such as on GitHub/GitLab, an OSE server, a peer or peers, or just the local filesystem. Others concurrently working on the same assembly would see the assembly being updated as the microtransactions are pulled in. As opposed to git polling the remote repo and subrepos at some interval (other than on launch), it would be ideal to have a subscription service set up to tell subscribers to update, over UPnP would be less secure than a cloud or OSE server.&lt;br /&gt;
&lt;br /&gt;
The use of a custom XML merge driver, with underlying knowledge of the FCStd file format, should mitigate the event of a merge conflict from occurring. Were a merge conflict to occur, be it online or offline, I hope to present a suitable interface for the end-user to make a decision, such as to branch their conflicting microtransaction or be presented with a diff of the XML element? Paired with FreeCAD being patched to not store BREP data in the persistent layer and only store it in memory, regenerating it on demand. realthunder may have already done this in his branch.&lt;br /&gt;
&lt;br /&gt;
===Sub-assemblies===&lt;br /&gt;
Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that sub-assembly without changing the original parent assembly.&lt;br /&gt;
&lt;br /&gt;
===Transparent Git features===&lt;br /&gt;
The use of git as a protocol for synchronization also allows for re-use of existing features. Such as a version history and other git features.&lt;br /&gt;
&lt;br /&gt;
At intervals the end-user may elect to version/tag their progress, entering in a commit message into a FreeCAD GUI explaining their changes.&lt;br /&gt;
&lt;br /&gt;
Some of the below plumbing in support of synchronization of FreeCAD data requires custom user configuration, such as the re-zip tools. I anticipate the FreeCAD Module would hide everything git behind the scenes, where the user does not interact with git at all. The Module would allow for visually browsing the version history, automatically generating thumbnails (maybe the caching should only be done here).&lt;br /&gt;
&lt;br /&gt;
===Contrast to present OSE Merge Workflow===&lt;br /&gt;
&lt;br /&gt;
This proposal is my intuition of what is possible. My impression of the present [[Merge_Workflow]] is that it is optimized for the existing constraints/limitations of FreeCAD in the spirit of mass collaboration. But it does impose additional steps on end-users [[Talk:Merge_Workflow#False%20Dichotomy]].&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Plumbing in support of Sync==&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files. I&#039;m unsure how what the performance or implementation constraints are at present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ickby&#039;s Colaborative Addon===&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=57028 ickby created an collaborative addon in 2021]. Supports v0.18 and v0.19. Doesn&#039;t use git for sync plumbing. Doesn&#039;t support true concurrency at present. Certainly an interesting approach to the problem though.&lt;br /&gt;
&lt;br /&gt;
Looks like it doesn&#039;t use UPnP at a glance, and doesn&#039;t handle NAT? [https://github.com/OpenCollaborationPlatform/OCP/blob/master/utils/Config.go Listens on port 7000, has a bootstrap server]. Unsure what function the bootstrap server has, maybe it is a data proxy mitigating the need for forwarding firewall port 7000 from 0.0.0.0...? That&#039;s going to be attacked.&lt;br /&gt;
&lt;br /&gt;
I suppose that deserves some thought, what the most secure architecture would be. I suppose I&#039;d only use key-based ssh on a centralized server, or perhaps there is a secure peer-to-peer library that meets my expectations out there somewhere... not worth the effort, the subscription notifications I envision in my proposal will be low bandwidth and will be fine centralized, just JSON sent to subscribers, [https://stackoverflow.com/a/6430706 triggered via a git hook], that URL would be to the centralized server, which would send that JSON to on-the-fly subscribers. Certainly a bazillion IoT libraries out there that do this.&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master). Assign a GUID to that sub-assembly on creation and have that be the branch name?&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly&#039;s repo.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
==Annotated Visual History==&lt;br /&gt;
An optimal way to implement the plumbing behind [[Annotated_Visual_History]].&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without said cache, will interact with the module as the module iterates through git revisions, to cache each revision. In the background async, or scheduled when idle, so as to not interfere with the user&#039;s work. In-memory would be quick. Might be best to do this only when the user attempts to view the history so as to not slow down their other work.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 256x256 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and present these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
[[Merge_Workflow]]&lt;br /&gt;
[[Microfactory_Boot_Camp_-_Every_Hardware_Build_is_a_Fork]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263871</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263871"/>
		<updated>2021-12-12T15:57:30Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* ickby&amp;#039;s Colaborative Addon */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==FreeCAD Sync==&lt;br /&gt;
&lt;br /&gt;
It should be possible to translate individual user edits on a particular file/assembly into git commits, transparently and without user-intervention. Microtransactions. This is different than the traditional use of git, where the end-user manually versions a worktree, writes a commit message, and pushes/pulls/merges.&lt;br /&gt;
&lt;br /&gt;
===Microtransactions===&lt;br /&gt;
These microtransactions will be sent to a configured repository, such as on GitHub/GitLab, an OSE server, a peer or peers, or just the local filesystem. Others concurrently working on the same assembly would see the assembly being updated as the microtransactions are pulled in. As opposed to git polling the remote repo and subrepos at some interval (other than on launch), it would be ideal to have a subscription service set up to tell subscribers to update, over UPnP would be less secure than a cloud or OSE server.&lt;br /&gt;
&lt;br /&gt;
The use of a custom XML merge driver, with underlying knowledge of the FCStd file format, should mitigate the event of a merge conflict from occurring. Were a merge conflict to occur, be it online or offline, I hope to present a suitable interface for the end-user to make a decision, such as to branch their conflicting microtransaction or be presented with a diff of the XML element? Paired with FreeCAD being patched to not store BREP data in the persistent layer and only store it in memory, regenerating it on demand. realthunder may have already done this in his branch.&lt;br /&gt;
&lt;br /&gt;
===Sub-assemblies===&lt;br /&gt;
Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that sub-assembly without changing the original parent assembly.&lt;br /&gt;
&lt;br /&gt;
===Transparent Git features===&lt;br /&gt;
The use of git as a protocol for synchronization also allows for re-use of existing features. Such as a version history and other git features.&lt;br /&gt;
&lt;br /&gt;
At intervals the end-user may elect to version/tag their progress, entering in a commit message into a FreeCAD GUI explaining their changes.&lt;br /&gt;
&lt;br /&gt;
Some of the below plumbing in support of synchronization of FreeCAD data requires custom user configuration, such as the re-zip tools. I anticipate the FreeCAD Module would hide everything git behind the scenes, where the user does not interact with git at all. The Module would allow for visually browsing the version history, automatically generating thumbnails (maybe the caching should only be done here).&lt;br /&gt;
&lt;br /&gt;
===Contrast to present OSE Merge Workflow===&lt;br /&gt;
&lt;br /&gt;
This proposal is my intuition of what is possible. My impression of the present [[Merge_Workflow]] is that it is optimized for the existing constraints/limitations of FreeCAD in the spirit of mass collaboration. But it does impose additional steps on end-users [[Talk:Merge_Workflow#False%20Dichotomy]].&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Plumbing in support of Sync==&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files. I&#039;m unsure how what the performance or implementation constraints are at present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ickby&#039;s Colaborative Addon===&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=57028 ickby created an collaborative addon in 2021]. Supports v0.18 and v0.19. Doesn&#039;t use git for sync plumbing. Doesn&#039;t support true concurrency at present. Certainly an interesting approach to the problem though.&lt;br /&gt;
&lt;br /&gt;
Looks like it doesn&#039;t use UPnP at a glance, and doesn&#039;t handle NAT? [https://github.com/OpenCollaborationPlatform/OCP/blob/master/utils/Config.go Listens on port 7000, has a bootstrap server]. Unsure what function the bootstrap server has, maybe it is a data proxy mitigating the need for forwarding firewall port 7000 from 0.0.0.0...? That&#039;s going to be attacked.&lt;br /&gt;
&lt;br /&gt;
I suppose that deserves some thought, what the most secure architecture would be. I suppose I&#039;d only use key-based ssh on a centralized server, or perhaps there is a secure peer-to-peer library that meets my expectations out there somewhere... not worth the effort, the subscription notifications I envision in my proposal will be low bandwidth and will be fine centralized, just JSON sent to subscribers, [https://stackoverflow.com/a/6430706 via a git hook], that URL would be to the centralized server, which would send that json to on-the-fly subscribers. Maybe there is a library out there that does this.&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master). Assign a GUID to that sub-assembly on creation and have that be the branch name?&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly&#039;s repo.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
==Annotated Visual History==&lt;br /&gt;
An optimal way to implement the plumbing behind [[Annotated_Visual_History]].&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without said cache, will interact with the module as the module iterates through git revisions, to cache each revision. In the background async, or scheduled when idle, so as to not interfere with the user&#039;s work. In-memory would be quick. Might be best to do this only when the user attempts to view the history so as to not slow down their other work.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 256x256 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and present these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
[[Merge_Workflow]]&lt;br /&gt;
[[Microfactory_Boot_Camp_-_Every_Hardware_Build_is_a_Fork]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263870</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263870"/>
		<updated>2021-12-12T15:25:09Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==FreeCAD Sync==&lt;br /&gt;
&lt;br /&gt;
It should be possible to translate individual user edits on a particular file/assembly into git commits, transparently and without user-intervention. Microtransactions. This is different than the traditional use of git, where the end-user manually versions a worktree, writes a commit message, and pushes/pulls/merges.&lt;br /&gt;
&lt;br /&gt;
===Microtransactions===&lt;br /&gt;
These microtransactions will be sent to a configured repository, such as on GitHub/GitLab, an OSE server, a peer or peers, or just the local filesystem. Others concurrently working on the same assembly would see the assembly being updated as the microtransactions are pulled in. As opposed to git polling the remote repo and subrepos at some interval (other than on launch), it would be ideal to have a subscription service set up to tell subscribers to update, over UPnP would be less secure than a cloud or OSE server.&lt;br /&gt;
&lt;br /&gt;
The use of a custom XML merge driver, with underlying knowledge of the FCStd file format, should mitigate the event of a merge conflict from occurring. Were a merge conflict to occur, be it online or offline, I hope to present a suitable interface for the end-user to make a decision, such as to branch their conflicting microtransaction or be presented with a diff of the XML element? Paired with FreeCAD being patched to not store BREP data in the persistent layer and only store it in memory, regenerating it on demand. realthunder may have already done this in his branch.&lt;br /&gt;
&lt;br /&gt;
===Sub-assemblies===&lt;br /&gt;
Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that sub-assembly without changing the original parent assembly.&lt;br /&gt;
&lt;br /&gt;
===Transparent Git features===&lt;br /&gt;
The use of git as a protocol for synchronization also allows for re-use of existing features. Such as a version history and other git features.&lt;br /&gt;
&lt;br /&gt;
At intervals the end-user may elect to version/tag their progress, entering in a commit message into a FreeCAD GUI explaining their changes.&lt;br /&gt;
&lt;br /&gt;
Some of the below plumbing in support of synchronization of FreeCAD data requires custom user configuration, such as the re-zip tools. I anticipate the FreeCAD Module would hide everything git behind the scenes, where the user does not interact with git at all. The Module would allow for visually browsing the version history, automatically generating thumbnails (maybe the caching should only be done here).&lt;br /&gt;
&lt;br /&gt;
===Contrast to present OSE Merge Workflow===&lt;br /&gt;
&lt;br /&gt;
This proposal is my intuition of what is possible. My impression of the present [[Merge_Workflow]] is that it is optimized for the existing constraints/limitations of FreeCAD in the spirit of mass collaboration. But it does impose additional steps on end-users [[Talk:Merge_Workflow#False%20Dichotomy]].&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Plumbing in support of Sync==&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files. I&#039;m unsure how what the performance or implementation constraints are at present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ickby&#039;s Colaborative Addon===&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=57028 ickby created an collaborative addon in 2021]. Supports v0.18 and v0.19. Appears to use an insecure UPnP library not production ready, and would rely on at least one or all users to punch a hole in their firewall. Doesn&#039;t use git for sync plumbing. Doesn&#039;t support true concurrency at present. Certainly an interesting approach to the problem though.&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master). Assign a GUID to that sub-assembly on creation and have that be the branch name?&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly&#039;s repo.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
==Annotated Visual History==&lt;br /&gt;
An optimal way to implement the plumbing behind [[Annotated_Visual_History]].&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without said cache, will interact with the module as the module iterates through git revisions, to cache each revision. In the background async, or scheduled when idle, so as to not interfere with the user&#039;s work. In-memory would be quick. Might be best to do this only when the user attempts to view the history so as to not slow down their other work.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 256x256 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and present these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
[[Merge_Workflow]]&lt;br /&gt;
[[Microfactory_Boot_Camp_-_Every_Hardware_Build_is_a_Fork]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263869</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263869"/>
		<updated>2021-12-12T15:09:35Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Microtransactions */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==FreeCAD Sync==&lt;br /&gt;
&lt;br /&gt;
It should be possible to translate individual user edits on a particular file/assembly into git commits, transparently and without user-intervention. Microtransactions. This is different than the traditional use of git, where the end-user manually versions a worktree, writes a commit message, and pushes/pulls/merges.&lt;br /&gt;
&lt;br /&gt;
===Microtransactions===&lt;br /&gt;
These microtransactions will be sent to a configured repository, such as on GitHub/GitLab, an OSE server, a peer or peers, or just the local filesystem. Others concurrently working on the same assembly would see the assembly being updated as the microtransactions are pulled in. As opposed to git polling the remote repo and subrepos at some interval (other than on launch), it would be ideal to have a subscription service set up to tell subscribers to update, over UPnP would be less secure than a cloud or OSE server.&lt;br /&gt;
&lt;br /&gt;
The use of a custom XML merge driver, with underlying knowledge of the FCStd file format, should mitigate the event of a merge conflict from occurring. Were a merge conflict to occur, be it online or offline, I hope to present a suitable interface for the end-user to make a decision, such as to branch their conflicting microtransaction or be presented with a diff of the XML element? Paired with FreeCAD being patched to not store BREP data in the persistent layer and only store it in memory, regenerating it on demand. realthunder may have already done this in his branch.&lt;br /&gt;
&lt;br /&gt;
===Sub-assemblies===&lt;br /&gt;
Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that sub-assembly without changing the original parent assembly.&lt;br /&gt;
&lt;br /&gt;
===Transparent Git features===&lt;br /&gt;
The use of git as a protocol for synchronization also allows for re-use of existing features. Such as a version history and other git features.&lt;br /&gt;
&lt;br /&gt;
At intervals the end-user may elect to version/tag their progress, entering in a commit message into a FreeCAD GUI explaining their changes.&lt;br /&gt;
&lt;br /&gt;
Some of the below plumbing in support of synchronization of FreeCAD data requires custom user configuration, such as the re-zip tools. I anticipate the FreeCAD Module would hide everything git behind the scenes, where the user does not interact with git at all. The Module would allow for visually browsing the version history, automatically generating thumbnails (maybe the caching should only be done here).&lt;br /&gt;
&lt;br /&gt;
===Contrast to present OSE Merge Workflow===&lt;br /&gt;
&lt;br /&gt;
This proposal is my intuition of what is possible. My impression of the present [[Merge_Workflow]] is that it is optimized for the existing constraints/limitations of FreeCAD in the spirit of mass collaboration. But it does impose additional steps on end-users [[Talk:Merge_Workflow#False%20Dichotomy]].&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Plumbing in support of Sync==&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files. I&#039;m unsure how what the performance or implementation constraints are at present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ickby&#039;s Colaborative Addon===&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=57028 ickby created an collaborative addon in 2021]. Supports v0.18 and v0.19. Appears to use an insecure UPnP library not production ready, and would rely on at least one or all users to punch a hole in their firewall. Doesn&#039;t use git for sync plumbing. Doesn&#039;t support true concurrency at present. Certainly an interesting approach to the problem though.&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master). Assign a GUID to that sub-assembly on creation and have that be the branch name?&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly&#039;s repo.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
==Annotated Visual History==&lt;br /&gt;
An optimal way to implement the plumbing behind [[Annotated_Visual_History]].&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without said cache, will interact with the module as the module iterates through git revisions, to cache each revision. In the background async, or scheduled when idle, so as to not interfere with the user&#039;s work. In-memory would be quick. Might be best to do this only when the user attempts to view the history so as to not slow down their other work.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 256x256 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and present these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
[[Merge_Workflow]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263868</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263868"/>
		<updated>2021-12-12T15:07:59Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Some revisions&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==FreeCAD Sync==&lt;br /&gt;
&lt;br /&gt;
It should be possible to translate individual user edits on a particular file/assembly into git commits, transparently and without user-intervention. Microtransactions. This is different than the traditional use of git, where the end-user manually versions a worktree, writes a commit message, and pushes/pulls/merges.&lt;br /&gt;
&lt;br /&gt;
===Microtransactions===&lt;br /&gt;
These microtransactions will be sent to a configured repository, such as on GitHub/GitLab, an OSE server, a peer or peers, or just the local filesystem. Others concurrently working on the same assembly would see the assembly being updated as the microtransactions are pulled in. As opposed to git polling the remote repo and subrepos at some interval (other than on launch), it would be ideal to have a subscription service set up to tell subscribers to update, over UPnP would be less secure than a cloud or OSE server.&lt;br /&gt;
&lt;br /&gt;
The use of a custom XML merge driver, with underlying knowledge of the FCstd file format, should mitigate the event of a merge conflict from occurring. Were a merge conflict to occur, be it online or offline, I hope to present a suitable interface for the end-user to make a decision, such as to branch their conflicting microtransaction or be presented with a diff of the XML element? Paired with FreeCAD being patched to not store BREP data in the persistent layer and only store it in memory, regenerating it on demand. realthunder may have already done this in his branch.&lt;br /&gt;
&lt;br /&gt;
===Sub-assemblies===&lt;br /&gt;
Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that sub-assembly without changing the original parent assembly.&lt;br /&gt;
&lt;br /&gt;
===Transparent Git features===&lt;br /&gt;
The use of git as a protocol for synchronization also allows for re-use of existing features. Such as a version history and other git features.&lt;br /&gt;
&lt;br /&gt;
At intervals the end-user may elect to version/tag their progress, entering in a commit message into a FreeCAD GUI explaining their changes.&lt;br /&gt;
&lt;br /&gt;
Some of the below plumbing in support of synchronization of FreeCAD data requires custom user configuration, such as the re-zip tools. I anticipate the FreeCAD Module would hide everything git behind the scenes, where the user does not interact with git at all. The Module would allow for visually browsing the version history, automatically generating thumbnails (maybe the caching should only be done here).&lt;br /&gt;
&lt;br /&gt;
===Contrast to present OSE Merge Workflow===&lt;br /&gt;
&lt;br /&gt;
This proposal is my intuition of what is possible. My impression of the present [[Merge_Workflow]] is that it is optimized for the existing constraints/limitations of FreeCAD in the spirit of mass collaboration. But it does impose additional steps on end-users [[Talk:Merge_Workflow#False%20Dichotomy]].&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Plumbing in support of Sync==&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files. I&#039;m unsure how what the performance or implementation constraints are at present.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===ickby&#039;s Colaborative Addon===&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=57028 ickby created an collaborative addon in 2021]. Supports v0.18 and v0.19. Appears to use an insecure UPnP library not production ready, and would rely on at least one or all users to punch a hole in their firewall. Doesn&#039;t use git for sync plumbing. Doesn&#039;t support true concurrency at present. Certainly an interesting approach to the problem though.&lt;br /&gt;
&lt;br /&gt;
==Discussion==&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master). Assign a GUID to that sub-assembly on creation and have that be the branch name?&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly&#039;s repo.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
==Annotated Visual History==&lt;br /&gt;
An optimal way to implement the plumbing behind [[Annotated_Visual_History]].&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without said cache, will interact with the module as the module iterates through git revisions, to cache each revision. In the background async, or scheduled when idle, so as to not interfere with the user&#039;s work. In-memory would be quick. Might be best to do this only when the user attempts to view the history so as to not slow down their other work.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 256x256 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and present these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
[[Merge_Workflow]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=263867</id>
		<title>Talk:OSE Linux Persistence</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=263867"/>
		<updated>2021-12-12T13:40:24Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Update&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://en.m.wikipedia.org/wiki/UNetbootin claims to have a persistence option for ubuntu distros. I couldn&#039;t get it to work. --[[User:Dorkmo|Dorkmo]] ([[User talk:Dorkmo|talk]]) 19:33, 14 July 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==Andrewusu&#039;s Thoughts==&lt;br /&gt;
I&#039;ve used persistence on USB for over 10 years now as my primary system (4+ hours/day) and will share some thoughts. Way back with USB2 I spent a lot of time investigating performance, ways to speed up boot time and system responsiveness. Keep in mind benchmarks of any flash memory device, where sequential reading is [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 10-20x] faster than non-sequential reads (possibly more depending on the device). By following this setup I describe below you take advantage of those fast reads for a quick boot and a very responsive OS.&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/JdnA6LblqOE Here] is a video of a minimal Debian distro on a live-boot persistence USB booting. By 35s system uptime I have launched both the terminal and filesystem browser.&lt;br /&gt;
&lt;br /&gt;
It has been great, I can move my programs, data, and OS from workstation to workstation with a breeze. From a desktop to a laptop, a library computer, or computer at work at times even. I&#039;ll never going back to installing Linux on a HDD. I use HDDs on workstations for storing data, or even making a ~8GB swap file if I need more system memory for some big task (e.g. big FreeCAD model).&lt;br /&gt;
&lt;br /&gt;
I don&#039;t use unetbootin, ISOs, or any other setups, just [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#547 Debian&#039;s live-boot]  and a &#039;persistence&#039; partition.&lt;br /&gt;
&lt;br /&gt;
On Ubuntu an alternative to live-boot is casper, which supports more options I believe. The [https://manpages.debian.org/buster/live-boot-doc/live-boot.7.en.html &#039;boot=live&#039;] kernel parameter results in live-boot being used, while the [http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html &#039;boot=casper&#039;] kernel parameter results in casper being used. With casper the default labeling of the persistence partition is &#039;casper-rw&#039; instead of &#039;persistence&#039; with live-boot.&lt;br /&gt;
&lt;br /&gt;
It is very simple, you have the second partition labeled &#039;persistence&#039; with a configuration file, and Debian&#039;s live-boot scripts handle everything.&lt;br /&gt;
&lt;br /&gt;
===live-boot Squashfs/Persistence===&lt;br /&gt;
[[File:LinuxUSBPersistencePartitions.png]]&lt;br /&gt;
* &#039;live&#039; partition contains the squashfs, initrd and vmlinuz in /live. Can only be mounted ro unless &#039;toram&#039; kernel parameter used.&lt;br /&gt;
* &#039;persistence&#039; partition is mounted rw.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;&lt;br /&gt;
# With a squashfs/persistence install instead of a full install to USB, you&#039;ll see a much faster boot, because the &#039;live&#039; partition is compressed ([https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html squashfs]) and is thus sequentially read into memory faster compared to random reads of various uncompressed files from the USB as they&#039;re needed during the boot process. Mine boots within 20 or so seconds.&lt;br /&gt;
# When running the system with day to day tasks, the performance and responsiveness of a squashfs/persistence setup is better than a full install, because the squashfs may be loaded to memory ([https://manpages.debian.org/jessie/live-boot-doc/live-boot.7.en.html toram]) occupying around 600-800MB RAM, and is thus not a bottleneck on reads/writes to the USB slowing the system down like you&#039;d see in a full install to USB. This translates into better framerate playing games like Starcraft 2, which I&#039;ve run from this flash drive, and a more responsive system in general (to mouse clicks, key presses, etc).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Limitations:&#039;&#039;&#039;&lt;br /&gt;
# A 64-bit install won&#039;t work on a 32-bit machine&lt;br /&gt;
# A USB with /etc/X11/xorg.conf set to use an NVIDIA GPU driver won&#039;t be as mobile:&lt;br /&gt;
## e.g. Will not boot graphically on an Intel GPU system but to a [https://en.wikipedia.org/wiki/Virtual_console virtual console].&lt;br /&gt;
## This can be mitigated by editing xorg.conf while on the Intel system&#039;s virtual console and rebooting to get the graphical interface. Or possibily without rebooting with some wizardry like rmmod and then startx, but I don&#039;t recall off the top of my head. And you have to redo this in reverse going back to the NVIDIA system. Maybe this is just a limitation of proprietary GPU drivers.&lt;br /&gt;
# Copy-on-write [https://superuser.com/questions/833576/differences-of-aufs-unionfs-and-overlayfs-from-each-other aufs/overlayfs] (whetever distro has chosen) has some limitations:&lt;br /&gt;
## Read-only &#039;live&#039; partition needs to be updated whenever libc or linux-image are updated, or the system won&#039;t boot. So it needs to be mounted read-write and in order to do so &#039;toram&#039; kernal boot parameter must be used. I work around this problem manually via inspecting apt output before installing anything, but this chore can be mitigated via an apt hook which I&#039;ve not written yet.&lt;br /&gt;
## &#039;live&#039; partition containing the squashfs should only have packages which are not updated often, being core packages, and not something like firefox which is updated often. This will minimize the size of the squashfs.&lt;br /&gt;
## When Debian stable is updated to the next revision, the linux-image must be updated, and the squashfs recompressed. To do this, all non-core packages must be removed, the distro upgraded, the squashfs recompressed, and then non-core packages reinstalled. This can also be scripted and I have some non-robust helper scripts I&#039;ve written.&lt;br /&gt;
# Flash memory has limitations, where sequential writes are [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 5000x-10000x] faster than random writes. Due to this, there should always be at least 2GB free on the &#039;persistence&#039; filesystem, or else risk files becoming fragmented and the any application blocking on reads/writes will &#039;&#039;&#039;hang&#039;&#039;&#039; from &#039;&#039;&#039;very slow&#039;&#039;&#039; reading and writing. In this circumstance it may be a number of minutes before such applications respond again, but you&#039;re free to use this time to do other things with already opened applications, like use the web browser or read opened documents.&lt;br /&gt;
&lt;br /&gt;
I personally use a lightweight Debian distro (not Ubuntu!) to minimize RAM footprint, minimize squashfs size, and maximize responsiveness. It is all instantaneous on USB3 (was a bit sluggish on USB2 on an older 4GB stick when I first started). I recommend at least a 32GB stick.&lt;br /&gt;
&lt;br /&gt;
Once the apt hook is implemented and distro-upgrade script polished, this should be a very nice option for interested users.&lt;br /&gt;
&lt;br /&gt;
There are tons of persistence guides, which unfairly dismiss this live-boot squashfs/persistence setup because they don&#039;t know how to mitigate/handle the upgrade problem as I do, because making a squashfs is not something well known which requires a lot of plumbing. Or they suggest other unnecessarily complex setups or make suggestions without having investigated performance implications (e.g. suggesting a full install to USB).&lt;br /&gt;
&lt;br /&gt;
I do not recommend modern Samsung, Sandisk, or any other cheap off-brands for this &amp;quot;heavy&amp;quot; use. Good chance they&#039;ll fail within a year and be too hot to touch. &#039;&#039;&#039;Buy from Toshiba/Kioxia&#039;&#039;&#039;, the inventors of flash memory. Yes their [https://www.amazon.com/Toshiba-TransMemory-U364-USB3-0-THN-U364W0320A4/dp/B078NPLXGC#customerReviews performance] as shown in benchmarks isn&#039;t as good, nor are they inexpensive, but they are reliable and will last years. &#039;&#039;&#039;Do not&#039;&#039;&#039; skimp to save a few $ buying a Sandisk/Samsung on a sale for this use-case, I&#039;m speaking from experience!&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&#039;&#039;&#039;Pros:&#039;&#039;&#039;&lt;br /&gt;
# Sure it may be useful if for example, you forget the drive in an internet cafe or library. Or have something you don&#039;t want to turn up in investigation.&lt;br /&gt;
&#039;&#039;&#039;Cons:&#039;&#039;&#039;&lt;br /&gt;
# It costs additional CPU &amp;amp; energy usage.&lt;br /&gt;
# Encryption offers zero &amp;quot;online&amp;quot;/mounted protection, e.g. encryption does not protect against a web browser vulnerability allowing disk access. Mental energy would be better spent on [https://wiki.archlinux.org/index.php/security &#039;hardening&#039;] the system.&lt;br /&gt;
# Harder to recover data when things break. &#039;&#039;Big&#039;&#039; headache.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 20:40, 4 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I will write more thoughts, I see this is an ongoing need/interest [[OSE_Linux_Log]]. Today I have ordered two Toshiba USB flash drives. I will write a guide here for preparing any Debian distro for USB persistence with optimal performance (squashfs &amp;amp; persistence partition) for interested readers.&lt;br /&gt;
&lt;br /&gt;
==GUIDE==&lt;br /&gt;
This guide will first make a live USB stick persistent.&lt;br /&gt;
&lt;br /&gt;
In the appendix will be additional knowledge and procedures to make it perform better.&lt;br /&gt;
&lt;br /&gt;
Brief steps:&lt;br /&gt;
#Make live USB&lt;br /&gt;
##Partition the USB.&lt;br /&gt;
##Mount the ISO, and copy select files to the USB&#039;s live partition.&lt;br /&gt;
##Install grub.&lt;br /&gt;
#Make the live USB a persistent USB&lt;br /&gt;
##Boot to live USB &amp;amp; Setup persistence.&lt;br /&gt;
&lt;br /&gt;
===Make live USB===&lt;br /&gt;
You can follow a different guide and then run the command `live-persistence`. Then when it comes time to upgrade libc or the kernel you can run `live-toram`, then follow the squash guide below.&lt;br /&gt;
&lt;br /&gt;
But here is the way I&#039;d do it.&lt;br /&gt;
====Partition the USB====&lt;br /&gt;
Use gparted. Make a GPT partition, with 16MB unused.&lt;br /&gt;
&lt;br /&gt;
Make live partition 1GB is fine. Big enough to fit the squashfs, vmlinuz, and initrd files from the ISO. Label it &#039;live&#039;, or whatever you want.&lt;br /&gt;
&lt;br /&gt;
Make persistence partition filling up the remainder. Label it &#039;peristence&#039;, or whatever you want, but you&#039;ll have to use the label you use in the grub.cfg later.&lt;br /&gt;
&lt;br /&gt;
Now make a small partition at least 1MB big into the 16MB unused space at the start. Don&#039;t format it with a filesystem, leave it unformatted. This is where GRUB installs stuff into.&lt;br /&gt;
====Mount the ISO, and copy select files to the USB&#039;s live partition====&lt;br /&gt;
Yep, copy the squashfs, vmlinuz, and initrd to /live on the live partition, e.g. /media/live/live&lt;br /&gt;
Easy peasy.&lt;br /&gt;
====Install grub====&lt;br /&gt;
Should go to /media/live/grub&lt;br /&gt;
&lt;br /&gt;
See appendix: [[Talk:OSE_Linux_Persistence#Prepare_GRUB_on_the_live_partition_and_USB_device]]&lt;br /&gt;
&lt;br /&gt;
Boot to the USB! It is live!&lt;br /&gt;
&lt;br /&gt;
===Make the live USB a persistent USB===&lt;br /&gt;
While you&#039;re booted to the live USB, mount the persistence partition, and put a peristence.conf file on it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; | sudo tee /media/peristence/persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, read the short manual on live-tools. And type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
man live-tools&lt;br /&gt;
live-peristence&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Neat, all your files you&#039;re using in the live USB, are now saved to the persistence partition. Though, we have to write a few changes to grub.cfg in order to load that stuff on next boot.&lt;br /&gt;
====Edit grub.cfg====&lt;br /&gt;
&lt;br /&gt;
See appendix: [[Talk:OSE_Linux_Persistence#Either_.281.29_Handcraft_grub.cfg]]&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
This guide seeks a USB stick with optimal performance, which requires a minimal squashfs.&lt;br /&gt;
&lt;br /&gt;
If USB space and performance are not concerns for you, you&#039;re welcome to modify an existing live USB, name a 2nd partition &amp;quot;persistence&amp;quot;, add suitable kernel parameters including &amp;quot;persistence&amp;quot;, and write a persistence.conf file containing &amp;quot;/ union&amp;quot; in the persistence partition. You can understand necessary details by understanding the guide below. Boot time may take a minute or longer, and applications may be slow and hang due to limitations of flash media which this guide seeks to minimize.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s proceed with making the USB with optimal performance.&lt;br /&gt;
&lt;br /&gt;
===Some notes on flash media===&lt;br /&gt;
The first partition should start after some multiple of the medium&#039;s [https://lwn.net/Articles/428584/ erase block]. The erase block size might be published by the manufacturer, or reasoned about via [https://github.com/bradfa/flashbench benchmarking]. However SSDs and modern USB sticks use more sophisticated controllers so flashbench [https://lists.linaro.org/pipermail/flashbench-results/2016-December/000599.html won&#039;t provide the necessary insights]. So starting the first partition at a 16MiB or 32MiB offset would be a reasonable choice, being some multiple of the erase block.&lt;br /&gt;
&lt;br /&gt;
When considering the [https://superuser.com/questions/379074/how-to-correctly-partition-usb-flash-drive-and-which-filesystem-to-choose-consid stride and stripe-width] parameters I&#039;m not sure it makes a difference anymore with more sophisticated controllers.&lt;br /&gt;
&lt;br /&gt;
On the flash media, writing is slow, so modern ones typically have a faster volatile cache, which is then written to the non-volatile flash memory. So when you write a large file to the medium, and it appears to finish via the command completing, but in reality it won&#039;t be done for some time. This is why writing speed appears to slow down in benchmarking the longer the write goes, from say 20MB/s to 4MB/s, this is due to the volatile cache filling up. ext4 when writing the journal uses a &amp;quot;barrier&amp;quot; somehow implemented, and usually implemented by the USB driver/device where the command blocks until the write is actually written to non-volatile memory, but I think this feature isn&#039;t exposed by ext4 for use in benchmarking. This is something to be cautious about before shutting down the system, leave the system idle for about 30-60 seconds after shutting down the browser or other write activity before powering down the system, as it is possible the write is still transferring from the volatile cache to non-volatile memory, and the OS doesn&#039;t know better, as we&#039;d disabled ext4 journalling for performance and longevity reasons, and it has been my experience that linux doesn&#039;t wait for the non-volatile write to finish anyway on shutdown, printing write errors on shutdown if this is the case. If this happens, then run a fsck on next boot, we&#039;ll make the Grub entry later to make running fsck convenient to best fix the consistency problems.&lt;br /&gt;
&lt;br /&gt;
===Partitioning===&lt;br /&gt;
A GPT partition table is fine, as is an MBR partition table.&lt;br /&gt;
&lt;br /&gt;
If doing GPT then make a small unformatted partition in the 16MiB or 32MiB offset before the live partition. It only needs to be 1MiB, but can be larger. Set the &#039;boot_grub&#039; flag on it in gparted. Grub will install to it later in this guide.&lt;br /&gt;
&lt;br /&gt;
Here is my example command of how I made the ext4 filesystem for the live partition. The option ^has_journal disables the journal, important for flash memory longevity. Determine which partition to run mkfs.ext4 on, mine is /dev/sdd1 and /dev/sdd2.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -N 2048 -L live -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;yourpartition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to do an EFI system partition (ESP), then have this also be the live partition, which we use as our &amp;quot;/boot&amp;quot; partition. This must be FAT32 instead of ext4 unfortunately. Set the &#039;esp&#039; flag on the live partition in gparted. When we install GRUB later, it will install EFI files to the live partition.&lt;br /&gt;
&lt;br /&gt;
And for the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -L persistence -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;your partition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare squashfs===&lt;br /&gt;
Download ISO of desired debian distro (e.g. OSE Linux). Put it at /tmp/&lt;br /&gt;
&lt;br /&gt;
chroot just uses your current Kernel. That&#039;s just how it works. Because of this it is best if the kernel of the system you&#039;re running to be the most recent available for the distro release of the ISO (e.g. for me [https://packages.debian.org/buster/linux-image-amd64 linux-image-4.19.0-13-amd64] as of this writing). If this isn&#039;t possible, boot to the ISO and skip to the [[Talk:OSE_Linux_Persistence#Remove_non-core_packages]] instructions without doing the chroot. You can do this all on a single USB stick if you do it correctly. Or you could use [https://help.ubuntu.com/community/DebootstrapChroot] or virtualization, lots of possibilities outside the scope of this guide.&lt;br /&gt;
&lt;br /&gt;
Actually now that I think about it writing the guide following the live USB installation without doing the chroot may be best, being more generalized and perhaps easier. I will rewrite this guide that way in the future, but for now, here are the chroot directions.&lt;br /&gt;
&lt;br /&gt;
====prepare chroot filesystem====&lt;br /&gt;
Let us continue with the chroot assuming we&#039;re running the same distro/kernel. Mount the ISO, and look for filesystem.squashfs, initrd.img, vmlinuz on it. Also note the location of config, System.map and filesystem.packages.xz, we&#039;ll copy or make these to follow convention.&lt;br /&gt;
&lt;br /&gt;
Make temporary directories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir /media/filesystem.squashfs /media/iso /media/overlay /media/myadditions /media/myadditions/rw /media/myadditions/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -o loop /tmp/debian-distro-i386.iso /media/iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount filesystem.squashfs on the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t squashfs /media/iso/live/filesystem.squashfs /media/filesystem.squashfs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount an in-memory filesystem to hold temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t tmpfs -o size=1024m none /media/myadditions&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prepare the union filesystem, so that we&#039;re able to edit the squashfs on the iso and compress the result. We can use either [https://wiki.archlinux.org/index.php/Overlay_filesystem overlayfs] or aufs. Here is the overlayfs command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t overlay overlay -o lowerdir=/media/filesystem.squashfs,upperdir=/media/myadditions/rw,workdir=/media/myadditions/work /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or afus. overlayfs hasn&#039;t been widely available until kernel 3.18, and aufs is available on earlier kernels (from [https://sourceforge.net/p/aufs/aufs3-standalone/ci/f88513f985e153aaf3e2950622c2a2329c3c3f8f/log/ kernel 3.9 late 2014 aufs supports xattr]) via aufs-tools, and their may be some differences I&#039;m not aware of but I think the concensus is that overlayfs is better. Hopefully aufs supports extended attributes (xattr) good enough to not loose said attributes, which are important for hardening the system (extended attributes are I believe where [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities] are stored/configured).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t aufs -o br=/media/myadditions=rw -o br=/media/filesystem.squashfs=ro -o udba=reval none /media/overlay/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====chroot====&lt;br /&gt;
Prepare the chroot, so that we can run apt within it and remove packages. resolv.conf and mount binds are to remove error/warning messages when installing packages with apt.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp /etc/resolv.conf /media/overlay/etc/resolv.conf&lt;br /&gt;
sudo mount --bind /dev/ /media/overlay/dev/&lt;br /&gt;
sudo mount --bind /dev/pts /media/overlay/dev/pts #https://wiki.debian.org/chroot#A.2Fdev.2Fpts&lt;br /&gt;
sudo mount --bind /proc /media/overlay/proc&lt;br /&gt;
sudo mount --bind /sys /media/overlay/sys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now chroot into the squashfs so we can use apt within it to remove packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chroot --userspec root:root /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the locale, you&#039;ll get many warning messages in apt otherwise. You probably want to select UTF-8 for your country/language, for example I picked en_US.UTF-8. Press space bar to toggle each locale you want generated, then press enter to proceed. Then it asks if you want the locales you chose to be applied systemwide, forcing your selection on each user, which may be desired for desktop software which starts up before the user-specific ~/.profile is read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure locales&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And set the timezone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure tzdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If /boot exists, then back it up, we&#039;re replacing /boot with a symlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /boot /boot.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must make a symlink so that as we work with apt-get, it may call `live-update-initramfs -u`, and we need those updates to /boot to go to the proper location, the &#039;live&#039; partition&#039;s /live:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /lib/live/mount/medium/live /boot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve not yet made the live partition, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If already have the live partition ready, or like me are updating an existing live partition&#039;s squashfs, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
mkdir /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have to do the above steps to work around update-initramfs&#039;s logic and assumptions regarding a read/write test that this works around. If you ever run into problems with update-initramfs while using apt-get, this is what you run once the problem is fixed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg --configure initramfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we remove packages, such at btrfs-progs, update-initramfs will be triggered which should update /boot/vmlinuz and /boot/initrd, these files are not compressed into the filesystem.squashfs and we need those files within /live of the live partition to boot.&lt;br /&gt;
&lt;br /&gt;
`man live-boot` is a useful reference, ensure live-boot-doc is installed. Also the [https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html Debian live-manual] is a useful reference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install live-boot-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Remove non-core packages====&lt;br /&gt;
&lt;br /&gt;
Now we gut the filesystem.squashfs from the iso of packages that:&lt;br /&gt;
* We don&#039;t want.&lt;br /&gt;
* Are frequently updated (e.g. web browser).&lt;br /&gt;
* With particular scrutiny of packages that are large.&lt;br /&gt;
* Are not necessary to boot to a desktop.&lt;br /&gt;
All of those can they can go onto persistence partition. We remove them now, and install them after the squashfs has been made, or as needed. Examples of what should be considered &amp;quot;core&amp;quot; packages necessary to boot are: linux-image (this is the kernel), firmware, GPU driver, and X11 server. This way the USB will:&lt;br /&gt;
* Boot fast,&lt;br /&gt;
* The OS running from it will be maximally responsive,&lt;br /&gt;
* Will have minimal memory footprint,&lt;br /&gt;
* And be persistent!&lt;br /&gt;
&lt;br /&gt;
Run this to see packages installed ordered by size, then apt-get remove or purge stuff, and ignore anything beginning with &amp;quot;lib&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W -f &#039;${Installed-Size}\t${Package}\n&#039; | sort -n | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To understand what a package is, you can search [https://packages.debian.org/buster/os-prober packages.debian.org]. If the description there isn&#039;t informative enough, you can try clicking the links on the right hand side such as a project homepage, or looking through the files of the package. Ignore or don&#039;t pay much attention to any package beginning with &amp;quot;lib&amp;quot;, with the exception of things like libc6, but apt will probably warn you about doing something silly like that with the prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
You are about to do something potentially harmful.&lt;br /&gt;
To continue type in the phrase &#039;Yes, do as I say!&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example of stuff I removed from a different Debian distro (BunsenLabs), but I removed some firmware packages so that reduces portability:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get remove -y firefox-esr libjsoncpp1&lt;br /&gt;
apt-get remove -y libreoffice-core libreoffice-common coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1 libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-locale1.67.0 libboost-thread1.67.0 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data libgpgmepp6 liblangtag-common liblangtag1 libmhash2 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libnumbertext-data libodfgen-0.1-1 liborcus-0.14-0 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 libstaroffice-0.0-0 libsuitesparseconfig5 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure&lt;br /&gt;
apt-get remove -y firmware-atheros firmware-netronome firmware-iwlwifi firmware-brcm80211 firmware-qlogic firmware-ti-connectivity firmware-myricom firmware-intelwimax firmware-libertas dahdi-firmware-nonfree atmel-firmware firmware-cavium firmware-bnx2x firmware-qcom-media firmware-netxen firmware-samsung firmware-ipw2x00 firmware-siano firmware-ivtv firmware-bnx2&lt;br /&gt;
apt-get remove -y samba-libs libavahi-glib1 libcdio-cdda2 libcdio-paranoia2 libgd3 libgdata-common libgdata22 libgoa-1.0-0b libgoa-1.0-common libgphoto2-6 libgphoto2-port12 libldb1 liblmdb0 liboauth0 libpython2.7 libtalloc2 libtevent0 libwbclient0 python-talloc&lt;br /&gt;
apt-get remove -y fonts-noto-core fonts-noto-cjk papirus-icon-theme bunsen-papirus-icon-theme gnome-icon-theme gdebi-core gir1.2-vte-2.91 python3-apt python3-chardet python3-debian python3-pkg-resources&lt;br /&gt;
rm -r /usr/share/gdebi/GDebi /usr/lib/python3/dist-packages/aptsources /usr/lib/python3/dist-packages/apt/progress /usr/lib/python3/dist-packages/debian_bundle /usr/lib/python3/dist-packages/debian /usr/lib/python3/dist-packages/chardet/cli /usr/lib/python3/dist-packages/pkg_resources/extern /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging&lt;br /&gt;
apt-get remove -y evince synaptic bubblewrap evince-common gnome-desktop3-data libbrotli1 libdjvulibre-text libdjvulibre21 libept1.5.0 libevdocument3-4 libevview3-3 libgnome-desktop-3-17 libgspell-1-1 libgspell-1-common libgxps2 libharfbuzz-icu0 libhyphen0 libjavascriptcoregtk-4.0-18 libkpathsea6 libspectre1 libsynctex2 libwebkit2gtk-4.0-37 libwebpdemux2 libwoff1 xdg-dbus-proxy zenity zenity-common&lt;br /&gt;
apt-get remove -y vlc libaribb24-0 libbasicusageenvironment1 libcddb2 libdvbpsi10 libebml4v5 libgles2 libgroupsock8 libixml10 liblirc-client0 liblivemedia64 liblua5.2-0 libmad0 libmatroska6v5 libmtp-common libmtp9 libnfs12 libopenmpt-modplug1 libplacebo7 libprotobuf-lite17 libqt5x11extras5 libresid-builder0c2a libsdl-image1.2 libsdl1.2debian libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libxcb-xv0 vlc-bin vlc-data vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output vlc-plugin-notify libvlccore9&lt;br /&gt;
apt-get remove -y file-roller p7zip-full p7zip libarchive13 libnautilus-extension1a xfburn libburn4 libexo-1-0 libisofs6 libjte1 unar gnustep-base-common gnustep-base-runtime gnustep-common libgnustep-base1.26 libobjc4&lt;br /&gt;
apt-get remove -y transmission-gtk libevent-2.1-6 libminiupnpc17 libnatpmp1 transmission-common filezilla filezilla-common libfilezilla0 libpugixml1v5 libwxbase3.0-0v5 libwxgtk3.0-0v5 yudit-common feh&lt;br /&gt;
apt-get remove -y libpython2.7-stdlib libblas3 libgfortran5 libkeybinder0 liblapack3 libpython2.7-minimal libsodium23 lua-bit32 lua-expat lua-penlight lua-posix lua-socket lua5.2 python-apt-common python-minimal python2-minimal python2.7-minimal libavformat58 libmysofa0 libnorm1 libpgm-5.2-0 libpostproc55 librubberband2 libssh-gcrypt-4 libswscale5 libvidstab1.1&lt;br /&gt;
apt-get remove -y aptitude aptitude-common libboost-iostreams1.67.0 libboost-system1.67.0 libcwidget3v5 libxapian30 ristretto file libmagic-mgc libmagic1 hexchat-common&lt;br /&gt;
apt-get install wpasupplicant network-manager --no-install-recommends&lt;br /&gt;
#modem support&lt;br /&gt;
apt-get remove -y modemmanager libmbim-glib4 libmbim-proxy libqmi-glib5 libqmi-proxy openssh-client libxatracker2 nitrogen libgtkmm-2.4-1v5 lvm2 dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 nano geany geany-common ghostscript poppler-data libcupsimage2 libgs9-common libijs-0.35 libjbig2dec0 libpaper1 pcmciautils vdpau-va-driver arandr&lt;br /&gt;
apt-get remove -y intel-microcode iucode-tool va-driver-all i965-va-driver xserver-xorg-video-intel libxvmc1 intel-media-va-driver libigdgmm5 xserver-xorg-video-qxl btrfs-progs cryptsetup-initramfs cryptsetup-bin cryptsetup-run&lt;br /&gt;
apt-get remove -y python3.7-minimal dconf-cli distro-info-data gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-pango-1.0 libfm-extra4 libgirepository-1.0-1 libmenu-cache-bin libmenu-cache3 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libxslt1.1 mime-support wmctrl&lt;br /&gt;
rm -r /usr/lib/python3&lt;br /&gt;
apt-get remove -y iso-codes liba52-0.7.4 libaa1 libass9 libatomic1 libavc1394-0 libavfilter7 libavformat58 libbs2b0 libcaca0 libcdio18 libcdparanoia0 libchromaprint1 libdc1394-22 libdca0 libde265-0 libdv4 libdvdnav4 libdvdread4 libfaad2 libfftw3-double3 libflite1 libfluidsynth1 libgme0 libgssdp-1.0-3 libgstreamer1.0-0 libgupnp-1.0-4 libgupnp-igd-1.0-4 libiec61883-0 libilmbase23 libkate1 liblilv-0-0 libmjpegutils-2.1-0 libmms0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa0 libnice10 libnorm1 libofa0 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr23 libopenmpt0 libpgm-5.2-0 libpoppler-glib8 libpoppler82 libpostproc55 libraw1394-11 librubberband2 libsbc1 libserd-0-0 libshout3 libsidplay1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libspandsp2 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libswscale5 libtumbler-1-0 libv4l-0 libv4lconvert0 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvulkan1 libwildmidi2 libzbar0 libzmq5 tumbler-common&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, much of what was removed can be installed again after persistence is set up. These packages are conveniently listed as removed within dpkg utilities, I&#039;ll illustrate how to conveniently reinstall them later.&lt;br /&gt;
&lt;br /&gt;
====Misc setup tips====&lt;br /&gt;
&lt;br /&gt;
[https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#521 One important consideration is that the live user is created by live-boot at boot time]. We need to ensure the live user is set up. Inspect the contents of /etc/live/ for any configuration files. If there is none in your distribution then let&#039;s make it, and feel free to customize this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/config.conf.d/10-user-setup.conf&lt;br /&gt;
LIVE_HOSTNAME=debian-persistence&lt;br /&gt;
LIVE_USERNAME=user&lt;br /&gt;
LIVE_USER_FULLNAME=&amp;quot;Debian LiveUser&amp;quot;&lt;br /&gt;
LIVE_USER_DEFAULT_GROUPS=&amp;quot;cdrom floppy audio dip video plugdev fuse bluetooth netdev scanner staff&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These options to live-boot will minimize the generated initramfs size:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/boot.conf&lt;br /&gt;
#man live-boot&lt;br /&gt;
#see /usr/share/initramfs-tools/hooks/live, might make initrd smaller&lt;br /&gt;
DISABLE_CDROM=true&lt;br /&gt;
DISABLE_FAT=true&lt;br /&gt;
DISABLE_FUSE=true&lt;br /&gt;
DISABLE_NTFS=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Performance tips====&lt;br /&gt;
&lt;br /&gt;
USB sticks use flash memory, and to maximize performance with it we can [https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler change the IO scheduler for such devices].&lt;br /&gt;
&lt;br /&gt;
BFQ looks like a nice scheduler. Quote:&lt;br /&gt;
&amp;quot;Regardless of the actual background workload, BFQ guarantees that, for interactive tasks, the storage device is virtually as responsive as if it was idle. [...] As a comparison, with CFQ, NOOP or DEADLINE, and in the same conditions, applications experience high latencies, or even become unresponsive until the background workload terminates (also on SSDs).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mq_deadline is fine while the system is booting. The scheduler in use can also be [https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers tuned], but I need to do more research before giving advice on tuning in this context. To [https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler setup/enable]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/modules-load.d/bfq.conf&lt;br /&gt;
bfq&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set bfq scheduler during startup. Alternatives include mq_deadline and none, either might be faster than bfq during startup when GUI application responsiveness isn&#039;t important, but I&#039;d need to do some research/experiments.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/udev/rules.d/60-ssd-scheduler.rules&lt;br /&gt;
# set bfq scheduler for non-rotating disks during startup&lt;br /&gt;
ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;sd[a-z]&amp;quot;, ATTR{queue/rotational}==&amp;quot;0&amp;quot;, ATTR{queue/scheduler}=&amp;quot;bfq&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use [https://wiki.archlinux.org/index.php/profile-sync-daemon profile-sync-daemon] to enhance performance of the browser, and minimize flash memory writes (maximize longevity).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install profile-sync-damon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For SD card longevity, consider mounting a tmpfs on /var/log. But perhaps only after you&#039;ve booted to the system a few times and verify the system is stable, as putting log files in RAM means they can&#039;t be read offline to diagnose a problem. So disable this feature if needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /var/log tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/tmpfiles.d/varlog.conf&lt;br /&gt;
d /var/log/apt 755 root root&lt;br /&gt;
d /var/log/lightdm 711 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vlc&#039;s default lookahead is too short, leads to music cutting out. &#039;Tools-&amp;gt;Preferences&#039;, toggle &#039;Show all settings&#039;, click &#039;Input/Codecs&#039; in tree view, scroll down to &#039;Advanced&#039; section and look at caching settings. Increase them to at least 600ms. This should largely mitigate problems with music/video stopping momentarily due to I/O delays.&lt;br /&gt;
&lt;br /&gt;
====Pruning tips====&lt;br /&gt;
Install deborphan and localepurge to help clean stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install deborphan localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you&#039;re done pruning things, run deborphan and remove things it tells you to as you desire. Deborphan helps you find &amp;quot;orphan&amp;quot; packages not needed by anything else, which take up space. Such orphaned packages may have been necessary by a previously installed package.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
deborphan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next run localepurge to remove space consuming files for locales you&#039;ll never use, I removed 160MB from my system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, clear out apt temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get autoremove&lt;br /&gt;
apt-get clean&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend vim.tiny over vim, vim.tiny much smaller, also install whatever else your heart desires that is small and infrequently updated. Such small utilities will be available in &#039;live&#039; mode (if installed when in &#039;persistence&#039; mode, it won&#039;t be available in plain &#039;live&#039; mode):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install vim-tiny&lt;br /&gt;
echo &amp;quot;set nocp&amp;quot; &amp;gt;&amp;gt; /etc/vim/vimrc.tiny #Allows arrow keys to work, and vim.tiny to act like vim instead of vi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Hardening tips====&lt;br /&gt;
&lt;br /&gt;
I think it is best for /tmp to be mounted noexec, but many applications have bugs regarding this&lt;br /&gt;
Double check the /etc/fstab file with a text editor after editing /etc/fstab:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /tmp tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mount /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often apt packages during installation will require the ability to execute temporary files on /tmp, this is how we allow this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/apt/apt.conf.d/50remount&lt;br /&gt;
DPkg::Pre-Install-Pkgs {&amp;quot;mount -o remount,exec /tmp&amp;quot;;};&lt;br /&gt;
DPkg::Post-Invoke {&amp;quot;mount -o remount /tmp&amp;quot;;};&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A common thing people do, is charge their android phone, or other USB device via a USB port on the computer. Realize that this is physical access, which a compromised device may use to log in to Linux via root. I suspect I had fallen victim to in the past, a keylogger following a pattern I&#039;d seen exhibited in the news, which I believe came after I&#039;d plugged in a new android I had run questionable rooting software on, to my computer. I suggest both setting a root password, and disallowing this access, by editing /etc/securetty and commenting out root access via UART serial ports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# UART serial ports&lt;br /&gt;
#ttyS0&lt;br /&gt;
#ttyS1&lt;br /&gt;
#ttyS2&lt;br /&gt;
#ttyS3&lt;br /&gt;
#ttyS4&lt;br /&gt;
#ttyS5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the [https://www.debian.org/doc/manuals/securing-debian-manual/ch03s04.en.html root password]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What has piqued my interest lately is [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities]. Debian distributions should include both [https://packages.debian.org/buster/libcap2 libcap2] and [https://packages.debian.org/buster/libcap-ng0 libcap-ng0 (RedHat&#039;s fork)]. And I&#039;m looking for a more convenient open-source means of administration. What has me interested in the idea of a [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html proactive defense against root-kits] by removing module loading capabilities (CAP_SYS_MODULE) even for the root user, after the system had booted. It appears that lcap is no longer functional, it and many capabilities articles detail a system-wide capability bounding set in pre-2.6.25 kernels, but since kernel 2.6.25 capability bounding sets are now per-thread. The [http://people.redhat.com/sgrubb/libcap-ng/ images here] may help visually explain capabilities and their inheritance. What I have in mind may be within a custom /etc/init.d/ script calling [https://man7.org/linux/man-pages/man2/capset.2.html setcap] on init (pid 1) to remove the CAP_SYS_MODULE capability from the bounding set system-wide. The capabilities on any process can be viewed with `cat /proc/&amp;lt;pid&amp;gt;/status`.&lt;br /&gt;
&lt;br /&gt;
Something else that can be done is use of more than one account, for example an account dedicated to web browsing with minimal privileges, and an account with administration privileges (sudo, member of staff,adm groups).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser browser&lt;br /&gt;
dm-tool switch-to-user browser #with LightDM desktop manager: https://wiki.ubuntu.com/LightDM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files downloaded with the browser can be transfered to other users via /tmp, which is a good place to set as the default location to download files in the browser settings anyway.&lt;br /&gt;
&lt;br /&gt;
With this separation of user privileges, if malware managed to gained the privileges of the browser account (no privilege escalation), and escaped the browser sandbox, the worst it could do is keylog, delete or encrypt/ransom the browser account&#039;s files. Since the browser account is running on a difference X11 server than an administration account, I think [https://security.stackexchange.com/questions/4641/why-are-people-saying-that-the-x-window-system-is-not-secure/4646 risks] are reduced.&lt;br /&gt;
&lt;br /&gt;
Switching between the administration account and browser account X11 servers can be done with ctrl+alt+F7 or F8 (or F1/F2 or whatever).&lt;br /&gt;
&lt;br /&gt;
Or just have the desktop load with the browser account instead of the administrative account, and do administrative tasks on a virtual terminal (ctrl+alt+F1 through F6).&lt;br /&gt;
&lt;br /&gt;
Set up the [https://www.debian.org/doc/manuals/securing-debian-manual/ch04s11.en.html#id-1.5.14.17 shell history file], .bash_history better. An easy way a bad actor can circumvent the stock configuration from logging his evil deeds is to proceed those evil things with a space, this guide will fix that!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lsattr /home/browser/.bash_history  #See what attributes are set&lt;br /&gt;
sudo chattr +a /home/browser/.bash_history   #Only root user can chattr&lt;br /&gt;
sudo chattr +a /home/user/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Make filesystem.packages and filesystem.squashfs====&lt;br /&gt;
Now that we have a set of &amp;quot;core&amp;quot; packages to go in the squashfs, of minimal size, on the &#039;live&#039; partition, we must make our new squashfs!&lt;br /&gt;
&lt;br /&gt;
Print out a list of &amp;quot;core&amp;quot; packages we have, we&#039;ll need them for reference later. Lets put them in filesystem.packages.xz:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W --showformat=&#039;${Package}\t${Version}\n&#039; | xz &amp;gt; /tmp/filesystem.packages.xz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get -y install squashfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exclude stuff we don&#039;t want in the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXCLUDES=&#039;.wh* dev live-persistence.conf live lost+found media mnt proc .pulse* run home selinux sys tmp* lib/live/mount usr/lib/live/mount var/cache/apt var/cache/apt-xapian-index var/lib/apt/lists var/tmp&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Directives to squashfs-tools to make pseudofiles, necessary to boot. Linux will make many pseudofiles in /dev when it boots, but not all, and through experimentation and observations I&#039;ve come up with this list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /tmp/mksquashfs.pf&lt;br /&gt;
dev d 755 root root&lt;br /&gt;
dev/console c 662 root tty 5 1&lt;br /&gt;
dev/full c 666 root root 1 7&lt;br /&gt;
dev/kmem c 640 root kmem 1 2&lt;br /&gt;
dev/kmsg c 644 root root 1 11&lt;br /&gt;
dev/loop0 b 660 root disk 7 0&lt;br /&gt;
dev/loop1 b 660 root disk 7 1&lt;br /&gt;
dev/loop2 b 660 root disk 7 2&lt;br /&gt;
dev/loop3 b 660 root disk 7 3&lt;br /&gt;
dev/loop4 b 660 root disk 7 4&lt;br /&gt;
dev/loop5 b 660 root disk 7 5&lt;br /&gt;
dev/loop6 b 660 root disk 7 6&lt;br /&gt;
dev/loop7 b 660 root disk 7 7&lt;br /&gt;
dev/mem c 640 root kmem 1 1&lt;br /&gt;
dev/null c 666 root root 1 3&lt;br /&gt;
dev/port c 640 root kmem 1 4&lt;br /&gt;
dev/ptmx c 666 root tty 5 2&lt;br /&gt;
dev/pts d 755 root root&lt;br /&gt;
dev/ram0 b 640 root disk 1 0&lt;br /&gt;
dev/ram1 b 640 root disk 1 1&lt;br /&gt;
dev/ram2 b 640 root disk 1 2&lt;br /&gt;
dev/ram3 b 640 root disk 1 3&lt;br /&gt;
dev/ram4 b 640 root disk 1 4&lt;br /&gt;
dev/ram5 b 640 root disk 1 5&lt;br /&gt;
dev/ram6 b 640 root disk 1 6&lt;br /&gt;
dev/ram7 b 640 root disk 1 7&lt;br /&gt;
dev/ram8 b 640 root disk 1 8&lt;br /&gt;
dev/ram9 b 640 root disk 1 9&lt;br /&gt;
dev/ram10 b 640 root disk 1 10&lt;br /&gt;
dev/ram11 b 640 root disk 1 11&lt;br /&gt;
dev/ram12 b 640 root disk 1 12&lt;br /&gt;
dev/ram13 b 640 root disk 1 13&lt;br /&gt;
dev/ram14 b 640 root disk 1 14&lt;br /&gt;
dev/ram15 b 640 root disk 1 15&lt;br /&gt;
dev/ram16 b 640 root disk 1 16&lt;br /&gt;
dev/random c 644 root root 1 8&lt;br /&gt;
dev/shm d 755 root root&lt;br /&gt;
dev/tty c 662 root tty 5 0&lt;br /&gt;
dev/tty0 c 600 root tty 4 0&lt;br /&gt;
dev/urandom c 644 root root 1 9&lt;br /&gt;
dev/zero c 644 root root 1 5&lt;br /&gt;
home d 755 root root&lt;br /&gt;
media d 755 root root&lt;br /&gt;
mnt d 755 root root&lt;br /&gt;
proc d 755 root root&lt;br /&gt;
run d 755 root root&lt;br /&gt;
run/lock d 1777 root root&lt;br /&gt;
sys d 755 root root&lt;br /&gt;
tmp d 1777 root root&lt;br /&gt;
var/cache/apt d 755 root root&lt;br /&gt;
var/cache/apt/partial d 755 root root&lt;br /&gt;
var/cache/apt/lock f 640 root root echo &amp;quot;&amp;quot;&lt;br /&gt;
var/lib/apt/lists d 755 root root&lt;br /&gt;
var/lib/apt/lists/partial d 755 root root&lt;br /&gt;
var/tmp d 1777 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now make the squashfs, it is compressed with xz compression:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mksquashfs / /tmp/filesystem.squashfs -comp xz -info -always-use-fragments -noappend -wildcards -pf /tmp/mksquashfs.pf -e ${EXCLUDES} &amp;gt; /tmp/mksquashfs.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/tmp/mksquashfs.log will contain interesting details, such as the filesystem is now roughly 30% of its uncompressed size.&lt;br /&gt;
&lt;br /&gt;
Hopefully the squashfs you made is around 800MB or less, mine for a different Debian distribution was about 300MB. Let us say your flash drive has 100MB/s sequential read speed, and your &amp;quot;core&amp;quot; filesystem was squashed down to 300MB, which will take 3 seconds to read into memory. How long do you think yours will take to boot?&lt;br /&gt;
&lt;br /&gt;
===Prepare the live partition===&lt;br /&gt;
If you hadn&#039;t yet mounted the live partition to /lib/live/mount/medium earlier in the guide, we need to move files off, then mount it, and move vmlinuz, initrd, and etc onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /lib/live/mount/medium /tmp/&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
cd /lib/live/mount/medium&lt;br /&gt;
mkdir live&lt;br /&gt;
mv /tmp/medium/boot/vmlinuz* live/&lt;br /&gt;
mv /tmp/medium/boot/initrd* live/&lt;br /&gt;
mv /tmp/filesystem.squashfs live/&lt;br /&gt;
mv /tmp/filesystem.packages.xz live/&lt;br /&gt;
#update-initramfs or something else pointed at live/ incorrectly puts grub/unicode.pf2 here, this symlink fixes that:&lt;br /&gt;
ln -s ../boot/grub/ live/grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also copy files like System.map-4.19.0-9-amd64 and config-4.19.0-9-amd64 to /lib/live/mount/medium/live, they should be in /media/overlay/boot.bak and/or /media/iso/live/ (outside the chroot). Or if the kernel is updated then you&#039;ll get these files, corresponding to the new kernel, automatically put in there anyway.&lt;br /&gt;
&lt;br /&gt;
The file named config is a nice reference, it says what flags the kernel was built with, there are a vast number of options.&lt;br /&gt;
This System.map file, stored on the read-only live partition may be useful, for example, finding if your system had been [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html compromised with a rootkit].&lt;br /&gt;
&lt;br /&gt;
===Prepare GRUB on the live partition and USB device===&lt;br /&gt;
&lt;br /&gt;
The introduction of UEFI hardware complicates things. You&#039;re welcome to modify the instructions below if you desire to support UEFI functionality on such consumer hardware. The instructions below handles computers with [https://wiki.archlinux.org/index.php/GRUB#BIOS_systems traditional BIOS], with a [https://wiki.archlinux.org/index.php/Partitioning#Master_Boot_Record traditional MBR], as well as UEFI hardware which supports such &amp;quot;legacy&amp;quot; standards. &lt;br /&gt;
&lt;br /&gt;
From within the chroot, install non-uefi grub (grub-pc), and --no-install-recommends will result in os-prober not being installed. I think os-prober is workstation-specific and not useful to configure a USB device which may move between workstations. grub-pc will ask two questions, don&#039;t select anything and enter on Ok on the first, and press enter on Yes on the next to continue without --exclude.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install grub-pc --no-install-recommends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find your live partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -l /dev/disk/by-label/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say it is /dev/sdd1. Then we use the device /dev/sdd in the command below.&lt;br /&gt;
&lt;br /&gt;
Install grub, to both the USB device and the live partition on the USB device. Where /dev/sdd below is the USB device (not a partition), and /lib/live/mount/medium is where the live partition is mounted:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-install --target=i386-pc --root-directory=/lib/live/mount/medium /dev/sdd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now grub needs a configuration file. We can either craft one by hand or use grub-mkconfig, but grub-mkconfig doesn&#039;t really support this use-case.&lt;br /&gt;
&lt;br /&gt;
====Either (1) Handcraft grub.cfg====&lt;br /&gt;
What follows is my legacy grub.cfg, which should work but I hope to make something workable within the newer /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Make sure to fill in this template /lib/live/mount/medium/boot/grub/grub.cfg on &#039;live&#039; partition with your appropriate UUIDs. The partitions you made will have unique UUIDs. You can determine which is which on your system by comparing `ls -l /dev/disk/by-uuid/` and ls -l `/dev/disk/by-label/`.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;LABELorGPTname&amp;quot; to the label or GPT name of your persistence partition. I labeled mine &amp;quot;u365-persistence&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Fill in the template with how your vmlinuz and initrd.img are named, which may not have a suffix of &amp;quot;-4.19.0-9-amd64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make note of the kernel parameters used here, such as &#039;toram&#039; and &#039;persistence&#039;. I&#039;m not sure if elevator=as is the optimal choice, feel free to read about it.&lt;br /&gt;
&lt;br /&gt;
You can customize the [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#530 locale, language, and keyboard layout] here via kernel parameters here such as `locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variants=bepo keyboard-model=tm2030usb`, but I think the console-setup package may be required (installed before the squashfs is made), and perhaps these things are fine configured elsewhere.&lt;br /&gt;
&lt;br /&gt;
You can see other things configurable via kernel parameters such as tzdata, and initial username by looking at /lib/live/config/*. But be aware many things are only configured once via /var/lib/live/config/ (remove the relevant file to allow reconfiguration).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
#Enter the UUID of your boot partition (this is where grub and your kernel reside)&lt;br /&gt;
set uuid_grub_boot=dc434800-22ac-4fd4-b6cb-603da325d5d0&lt;br /&gt;
#Enter the UUID of the persistence partition.&lt;br /&gt;
set uuid_os_root=858d963f-8718-4520-83dd-fb89a842e9bd&lt;br /&gt;
#Here we set the grub &amp;quot;root&amp;quot; variable by locating the uuid of the root partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_os_root --set=root&lt;br /&gt;
#Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot&lt;br /&gt;
#Here&#039;s the magic. We test to see if the boot and root partitions have the same UUID.&lt;br /&gt;
#If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.&lt;br /&gt;
if [ $uuid_grub_boot == $uuid_os_root ] ; then&lt;br /&gt;
  set grub_boot=$grub_boot/boot&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
set kernel_parameters_common=&amp;quot;boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot usbcore.autosuspend=-1&amp;quot;&lt;br /&gt;
set kernel_parameters_persistence=&amp;quot;persistence persistence-storage=filesystem persistence-label=LABELorGPTname&amp;quot;&lt;br /&gt;
set myversion=4.19.0-13-amd64&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#With an unsafe shutdown or powerloss the persistence filesystem will have errors,&lt;br /&gt;
#since it has no journaling, we want to run fsck on it once&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence fsck&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence forcefsck&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Live&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Or (2) Generate grub.cfg with grub-mkconfig====&lt;br /&gt;
Again, using the handcrafted grub.cfg above is probably fine, but here are details on how to get grub-mkconfig to work, which geterates grub.cfg from directives in /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Now, /usr/sbin/grub-mkconfig is not robust line 142 &amp;amp; 146 in our context of chroot usage, assumes we&#039;re installing to / device and /boot, and offers no way to configure around the problem, so we change line 142 &amp;amp; 146:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Line 142:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium`&amp;quot;&lt;br /&gt;
# Line 146:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /boot`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium/boot`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy by hand the legacy grub.cfg menu entries I have, with your disk UUIDs into [https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file /etc/grub.d/40_custom].&lt;br /&gt;
&lt;br /&gt;
Now run grub-mkconfig, from within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-mkconfig -o /lib/live/mount/medium/boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmount /lib/live/mount/medium:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unmount /lib/live/mount/medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare the persistence partition===&lt;br /&gt;
And don&#039;t forget to make the persistence.conf file &#039;/ union&#039; on the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#cd to wherever you have mounted your persistence partition, e.g. /media/persistence&lt;br /&gt;
cd /media/persistence&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; &amp;gt; persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From /media/overlay/home grab the OSE Linux stuff in there, and put in /media/persistence/home:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /media/overlay/home /media/persistence/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There may also be other OSE Linux specific things removed by prior purges of non-&amp;quot;core&amp;quot; packages, e.g. in /etc/&lt;br /&gt;
I suppose there may be a way to &amp;quot;diff&amp;quot; those out, and re-add them to the persistence partition after the packages are installed anew. Maybe there is a convenient dpkg way of doing that... diffing and saving the configuration file changes from stock packages instead of purging them? Or is that the difference between apt-get remove and apt-get purge where apt-get remove will only remove stock configuration files leaving modified ones intact? Yes I think that may be right.&lt;br /&gt;
&lt;br /&gt;
===Cleanup===&lt;br /&gt;
Cleanup!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo umount /media/overlay/dev/pts&lt;br /&gt;
sudo umount /media/overlay/dev/&lt;br /&gt;
sudo umount /media/overlay/proc&lt;br /&gt;
sudo umount /media/overlay/sys&lt;br /&gt;
sudo umount /media/overlay/tmp&lt;br /&gt;
sudo umount /media/overlay&lt;br /&gt;
sudo umount /media/filesystem.squashfs&lt;br /&gt;
sudo umount /media/iso&lt;br /&gt;
sudo umount /media/myadditions&lt;br /&gt;
sudo rmdir /media/iso /media/filesystem.squashfs /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You now have an Linux OS on your USB with persistence that will boot within seconds and reliably outperforms the competition!&lt;br /&gt;
&lt;br /&gt;
==Further Details==&lt;br /&gt;
===Upgrading===&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when linux-image (the package containing the kernel) is upgraded?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; apt will want to update /boot/vmlinuz and /boot/initrd.img. So we need to do things in order to allow this to happen. We must boot with &#039;toram&#039; and also remount &#039;live&#039; as rw before running apt-get update.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#TODO, I wrote this elsewhere need to copy here, something along these lines:&lt;br /&gt;
mount -o remount,rw /lib/live/mount/medium /dev/disk/by-label/live&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this upgrade process apt might rename vmlinuz to say vmlinuz-3.16.0-4-amd64, and initrd similarly. It didn&#039;t always do this. But, you must match the names of those files with what is listed in grub.cfg! Either use &#039;vmlinuz&#039; or whatever name the apt script renamed them to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when libc is upgraded? Be it a security update, or when Debian Stable advances every couple years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; We will want to do a resquash:&lt;br /&gt;
# We need to to the same as above, &#039;toram&#039; and remount &#039;live&#039; as rw.&lt;br /&gt;
# dpkq-query our currently installed packages, and compare to /boot/filesystem.packages.xz we made earlier.&lt;br /&gt;
# Remove all non &amp;quot;core&amp;quot; packages, they should be cached in /var/cache/apt/archives/ so they don&#039;t need to be downloaded again, just reinstalled after we do the resquash.&lt;br /&gt;
# apt-get update&lt;br /&gt;
# Resquash, reboot to verify things working, in &#039;live&#039; mode remove squashed stuff from persistance partition.&lt;br /&gt;
## squash script https://gist.github.com/AndrewSmart/90eb186aea08db8f1426&lt;br /&gt;
## cleanup script https://gist.github.com/AndrewSmart/2f67f79f6f1922c4556f&lt;br /&gt;
# Reinstall packages removed prior to resquash from /var/cache/apt/archives&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; That looks like a lot to deal with.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I agree. I&#039;m looking at using dpkg triggers or /etc/apt/apt.conf.d/ hooks to manage this upgrade process. I hope to have something sufficient soon.&lt;br /&gt;
&lt;br /&gt;
I hope to also make a smaller guide that is not optimal in performance, but has way less steps, so the end user can test out the persistence and take the time to &amp;quot;upgrade&amp;quot; the performance later if so inclined.&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
Keep in mind with the USB we can still boot either in &#039;live&#039; mode, or &#039;persistence&#039; mode depending on the GRUB entry we choose. This is useful in case something breaks in &#039;persistence&#039; mode, like libc was upgraded in &#039;persistence&#039; but libc on &#039;live&#039; is still old! This will result in segmentation faults... a kernel panic, or whatever, it won&#039;t boot. We can access all of the software in the squashfs in &#039;live mode&#039;. Eventually I&#039;d like to write an apt hook to prevent the update of libc unless the system is prepared (&#039;toram&#039;, and &#039;live&#039; partition is mounted rw, the hook won&#039;t trigger unless &#039;persistence&#039; kernel parameter is used).&lt;br /&gt;
&lt;br /&gt;
Debian&#039;s live-boot scripts will put stuff in /lib/live/, and /lib/live/mount is of particularly good use in troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Ubuntu is a bit of a can of worms from my perspective as a fan of vanilla Debian. So... hopefully things will go smoothly... I highly recommend a lighter-weight environment for USB persistence, but I understand everyone has their preferences.&lt;br /&gt;
&lt;br /&gt;
Since &#039;toram&#039; puts the squashfs into memory, lets say you have 8GB RAM and an 800MB squashfs, that is fine, but say you move to a workstation with only 2GB RAM, you will probably want to remove the &#039;toram&#039; kernel parameter, things will be slower but the memory footprint used by the OS will be less, and only use &#039;toram&#039; when updating the &#039;live&#039; partition as detailed above. Perhaps consider 2 additional GRUB entries, in addition to the two I have listed above, where the 2 additional entries are live and persistence mode without &#039;toram&#039; kernel parameter, and when booting select the entry depending on the amount of RAM the system has.&lt;br /&gt;
&lt;br /&gt;
In the event of a power outage, kernel panic, unsafe shutdown or whatever, the filesystem may have problems you&#039;re warned about on next boot. In this setup, the &#039;live&#039; partition was mounted ro, so it is not possible to have filesystem errors there, but with the &#039;persistence&#039; partition there will likely be errors. So, on next boot we select the &#039;live&#039; mode in grub, and run fsck.ext4 -p /dev/disk/by-label/persistence, and all problems are fixed!&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 06:43, 5 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
Works well. I hope to make this more user friendly, to write an apt hook which handles live partition and resquashing where appropriate. Also a systemd service which cleans up that which was resquashed, which runs prior to the overlayfs mount at boot, intelligently regenerates /var/cache components, and handles tmpfs bells and whistles. I wrote part of the apt hook. With those things done then there will be no burden on the end-user, but until then this squashfs persistence technique is not production ready.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 13:39, 12 December 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Andrewusu_Log&amp;diff=263866</id>
		<title>Andrewusu Log</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Andrewusu_Log&amp;diff=263866"/>
		<updated>2021-12-12T13:16:57Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Log creation&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{RightTOC}}&lt;br /&gt;
&lt;br /&gt;
Welcome to the log for Andrewusu ([https://wiki.opensourceecology.org/wiki/User:Andrewusu Andrewusu])&lt;br /&gt;
&lt;br /&gt;
=2021=&lt;br /&gt;
[[FreeCAD_Sync_Proposal]] Research on real-time FreeCAD collaborative editing using git for low-level sync plumbing.&lt;br /&gt;
&lt;br /&gt;
=2020=&lt;br /&gt;
[[Talk:OSE_Linux_Persistence]] Research on LiveUSB with persistence.&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=263865</id>
		<title>User talk:Andrewusu</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=263865"/>
		<updated>2021-12-12T13:15:09Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Changed link to sync proposal&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hint|Andrew, email me so we can coordinate more on wiki editing.-MJ}}&lt;br /&gt;
&lt;br /&gt;
=Wiki=&lt;br /&gt;
[[Wiki_instructions]]&lt;br /&gt;
[[mediawikiwiki:Help:Formatting]]&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Reorganization_2011]]&lt;br /&gt;
&lt;br /&gt;
Perhaps better categorization of pages into the taxonomy would help enhance navigation of this wiki: [https://wiki.opensourceecology.org/index.php?title=Special%3ACategoryTree&amp;amp;target=main&amp;amp;mode=categories CategoryTree].&lt;br /&gt;
&lt;br /&gt;
With the tree navigable from the wiki sidebar via this MediaWiki plugin: [[mediawikiwiki:Extension:TreeAndMenu]]. Or how Appropedia has theirs set up: [[Appropedia:Appropedia:CategoryTree]].&lt;br /&gt;
&lt;br /&gt;
=Worker Cooperative=&lt;br /&gt;
&lt;br /&gt;
I am interested in worker owned companies. Trying to compile resources to assist in their formation.&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=8G1-SYMatNc Laura Flanders] and Professor Richard D. Wolff speak a lot about worker coops on YouTube.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* http://www.usworker.coop/home/ $100+ annual membership dues to access their database and technical assistance.&lt;br /&gt;
* https://solidarityeconomy.us/ Neat visual interface&lt;br /&gt;
* https://cooperationworks.coop/&lt;br /&gt;
* https://www.ncb.coop/&lt;br /&gt;
* More to add/read...&lt;br /&gt;
&lt;br /&gt;
=Software Tools=&lt;br /&gt;
==FreeCAD Real Time Collaboration==&lt;br /&gt;
From my brief analysis:&lt;br /&gt;
* Store the [https://www.freecadweb.org/wiki/File_Format_FCStd FCStd] file in git uncompressed (in own directory).&lt;br /&gt;
* Use libgit2 with [https://stackoverflow.com/questions/37849771/can-git-be-made-to-mostly-auto-merge-xml-order-insensitive-files custom XML merge driver].&lt;br /&gt;
* Make new workbench or augment existing ones with new drop down menu entries to handle git operations (push/pull).&lt;br /&gt;
* At some interval check for updates to origin.&lt;br /&gt;
* Handle real time transactions on top of that (e.g. real time cursor/updates you see in google-docs):&lt;br /&gt;
** Could make cloud service to handle real time data transfer if neither network supports UPNP. Or only support UPNP compliance.&lt;br /&gt;
** Handle locking/unlocking of essentially unmergable assets (e.g. 3D mesh). As well as visual representation changes to others with same file open.&lt;br /&gt;
** Other features as needed.&lt;br /&gt;
Analysis of existing solutions and future work:&lt;br /&gt;
[[FreeCAD_Sync_Proposal]]&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Snapping of off the shelf parts like [[Vention]]==&lt;br /&gt;
From a very brief look:&lt;br /&gt;
* Use constraints and solver from FreeCAD&#039;s [https://github.com/realthunder/FreeCAD_assembly3 Assembly3].&lt;br /&gt;
* Use FreeCAD&#039;s [https://github.com/FreeCAD/FreeCAD-library/ part library]. Augment with &#039;snap point&#039; and parametric resizing data somehow, somewhere.&lt;br /&gt;
* Overload/script somewhere within FreeCAD to handle the snapping/resizing functionality, perhaps within Assembly3 workbench?&lt;br /&gt;
&lt;br /&gt;
==OSE Supply Chain Interface==&lt;br /&gt;
*Interface for customers.&lt;br /&gt;
*I think this would help with adaptation/feasibility of many OSE concepts... distribution of the means of production, minimize shipping emissions/cost, etc.&lt;br /&gt;
&lt;br /&gt;
=Adobe Brick=&lt;br /&gt;
Have adobe brick building built around 1870ish. Brick wall is about 14&#039; tall at highest on the crest of roof. Interesting sand/rock foundation and sandy mortar. Original builder couldn&#039;t believe it was still standing after he left and came back a number of years later. His journal is online. Still standing 150 years later.&lt;br /&gt;
&lt;br /&gt;
Clay has no organic content. Clay deposits were deposited from [https://en.wikipedia.org/wiki/Lake_Bonneville Lake Bonneville]. Lots of local limestone. I&#039;m confused as kiln industry didn&#039;t start up till a decade or so later in this valley, so I&#039;m not sure how these bricks are stabilized (water doesn&#039;t permeate more than a few mm, even after a 24 hour submersion). Maybe additive carted from 80+ miles away? Or something intrinsic to the clay?&lt;br /&gt;
&lt;br /&gt;
The sandy mortar seems to help quickly drain water, but the issue is the sandy mortar liquefies if it gets too wet. I didn&#039;t know it was adobe and left a rainbird that hit a wall for a couple days... caused some damage.&lt;br /&gt;
&lt;br /&gt;
Could look into [https://techxplore.com/news/2020-08-energy-red-bricks.html storing electricity in the bricks]. I suppose there may be a lot of leakage current when damp, but I&#039;d imagine it&#039;d be superfluous energy stored in the bricks anyway.&lt;br /&gt;
&lt;br /&gt;
=Power Electronics=&lt;br /&gt;
[https://techxplore.com/news/2020-07-hybrid-inverter-energy-resources-smart.html This] looks like a good, feature rich platform, [https://volttron.org/about-volttron Volttron]. Would be interesting to see if there is a hardware reference implementation available to the public in their DOE Data Management Plan (couldn&#039;t find at a glance elsewhere).&lt;br /&gt;
[https://stackoverflow.com/questions/38465267/is-there-a-good-overview-of-the-volttron-platform-that-describes-how-it-works Volttron Overview]&lt;br /&gt;
[https://stackoverflow.com/questions/51034666/scale-capability-of-volttron Volttron Scalability]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;&#039;Welcome to &#039;&#039;Open Source Ecology&#039;&#039;!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Thank you for registering on the Open Source Ecology wiki.&lt;br /&gt;
&lt;br /&gt;
*We suggest that you review our [[Crash Course]] for an overview of our work. Our current goal is finishing the [[Global Village Construction Set]] by 2028, at which point we begin focus on human development - of [[Integrated Humans]].&lt;br /&gt;
*To join our dedicated development team, see [[OSE Developers]]&lt;br /&gt;
*To join OSE full time - we are offering our first ever [[Immersion Program]] in 2008. [[User:Marcin|Marcin]] ([[User talk:Marcin|talk]]) 10:14, 22 November 2019 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263864</id>
		<title>FreeCAD Sync Proposal</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=FreeCAD_Sync_Proposal&amp;diff=263864"/>
		<updated>2021-12-12T13:09:15Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Moved FreeCAD sync proposal here&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Module will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the module as the module iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=263863</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=263863"/>
		<updated>2021-12-12T11:21:09Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Moving to separate page&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=243177</id>
		<title>Talk:OSE Linux Persistence</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=243177"/>
		<updated>2021-01-29T18:29:34Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Install grub */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://en.m.wikipedia.org/wiki/UNetbootin claims to have a persistence option for ubuntu distros. I couldn&#039;t get it to work. --[[User:Dorkmo|Dorkmo]] ([[User talk:Dorkmo|talk]]) 19:33, 14 July 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==Andrewusu&#039;s Thoughts==&lt;br /&gt;
I&#039;ve used persistence on USB for over 10 years now as my primary system (4+ hours/day) and will share some thoughts. Way back with USB2 I spent a lot of time investigating performance, ways to speed up boot time and system responsiveness. Keep in mind benchmarks of any flash memory device, where sequential reading is [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 10-20x] faster than non-sequential reads (possibly more depending on the device). By following this setup I describe below you take advantage of those fast reads for a quick boot and a very responsive OS.&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/JdnA6LblqOE Here] is a video of a minimal Debian distro on a live-boot persistence USB booting. By 35s system uptime I have launched both the terminal and filesystem browser.&lt;br /&gt;
&lt;br /&gt;
It has been great, I can move my programs, data, and OS from workstation to workstation with a breeze. From a desktop to a laptop, a library computer, or computer at work at times even. I&#039;ll never going back to installing Linux on a HDD. I use HDDs on workstations for storing data, or even making a ~8GB swap file if I need more system memory for some big task (e.g. big FreeCAD model).&lt;br /&gt;
&lt;br /&gt;
I don&#039;t use unetbootin, ISOs, or any other setups, just [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#547 Debian&#039;s live-boot]  and a &#039;persistence&#039; partition.&lt;br /&gt;
&lt;br /&gt;
On Ubuntu an alternative to live-boot is casper, which supports more options I believe. The [https://manpages.debian.org/buster/live-boot-doc/live-boot.7.en.html &#039;boot=live&#039;] kernel parameter results in live-boot being used, while the [http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html &#039;boot=casper&#039;] kernel parameter results in casper being used. With casper the default labeling of the persistence partition is &#039;casper-rw&#039; instead of &#039;persistence&#039; with live-boot.&lt;br /&gt;
&lt;br /&gt;
It is very simple, you have the second partition labeled &#039;persistence&#039; with a configuration file, and Debian&#039;s live-boot scripts handle everything.&lt;br /&gt;
&lt;br /&gt;
===live-boot Squashfs/Persistence===&lt;br /&gt;
[[File:LinuxUSBPersistencePartitions.png]]&lt;br /&gt;
* &#039;live&#039; partition contains the squashfs, initrd and vmlinuz in /live. Can only be mounted ro unless &#039;toram&#039; kernel parameter used.&lt;br /&gt;
* &#039;persistence&#039; partition is mounted rw.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;&lt;br /&gt;
# With a squashfs/persistence install instead of a full install to USB, you&#039;ll see a much faster boot, because the &#039;live&#039; partition is compressed ([https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html squashfs]) and is thus sequentially read into memory faster compared to random reads of various uncompressed files from the USB as they&#039;re needed during the boot process. Mine boots within 20 or so seconds.&lt;br /&gt;
# When running the system with day to day tasks, the performance and responsiveness of a squashfs/persistence setup is better than a full install, because the squashfs may be loaded to memory ([https://manpages.debian.org/jessie/live-boot-doc/live-boot.7.en.html toram]) occupying around 600-800MB RAM, and is thus not a bottleneck on reads/writes to the USB slowing the system down like you&#039;d see in a full install to USB. This translates into better framerate playing games like Starcraft 2, which I&#039;ve run from this flash drive, and a more responsive system in general (to mouse clicks, key presses, etc).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Limitations:&#039;&#039;&#039;&lt;br /&gt;
# A 64-bit install won&#039;t work on a 32-bit machine&lt;br /&gt;
# A USB with /etc/X11/xorg.conf set to use an NVIDIA GPU driver won&#039;t be as mobile:&lt;br /&gt;
## e.g. Will not boot graphically on an Intel GPU system but to a [https://en.wikipedia.org/wiki/Virtual_console virtual console].&lt;br /&gt;
## This can be mitigated by editing xorg.conf while on the Intel system&#039;s virtual console and rebooting to get the graphical interface. Or possibily without rebooting with some wizardry like rmmod and then startx, but I don&#039;t recall off the top of my head. And you have to redo this in reverse going back to the NVIDIA system. Maybe this is just a limitation of proprietary GPU drivers.&lt;br /&gt;
# Copy-on-write [https://superuser.com/questions/833576/differences-of-aufs-unionfs-and-overlayfs-from-each-other aufs/overlayfs] (whetever distro has chosen) has some limitations:&lt;br /&gt;
## Read-only &#039;live&#039; partition needs to be updated whenever libc or linux-image are updated, or the system won&#039;t boot. So it needs to be mounted read-write and in order to do so &#039;toram&#039; kernal boot parameter must be used. I work around this problem manually via inspecting apt output before installing anything, but this chore can be mitigated via an apt hook which I&#039;ve not written yet.&lt;br /&gt;
## &#039;live&#039; partition containing the squashfs should only have packages which are not updated often, being core packages, and not something like firefox which is updated often. This will minimize the size of the squashfs.&lt;br /&gt;
## When Debian stable is updated to the next revision, the linux-image must be updated, and the squashfs recompressed. To do this, all non-core packages must be removed, the distro upgraded, the squashfs recompressed, and then non-core packages reinstalled. This can also be scripted and I have some non-robust helper scripts I&#039;ve written.&lt;br /&gt;
# Flash memory has limitations, where sequential writes are [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 5000x-10000x] faster than random writes. Due to this, there should always be at least 2GB free on the &#039;persistence&#039; filesystem, or else risk files becoming fragmented and the any application blocking on reads/writes will &#039;&#039;&#039;hang&#039;&#039;&#039; from &#039;&#039;&#039;very slow&#039;&#039;&#039; reading and writing. In this circumstance it may be a number of minutes before such applications respond again, but you&#039;re free to use this time to do other things with already opened applications, like use the web browser or read opened documents.&lt;br /&gt;
&lt;br /&gt;
I personally use a lightweight Debian distro (not Ubuntu!) to minimize RAM footprint, minimize squashfs size, and maximize responsiveness. It is all instantaneous on USB3 (was a bit sluggish on USB2 on an older 4GB stick when I first started). I recommend at least a 32GB stick.&lt;br /&gt;
&lt;br /&gt;
Once the apt hook is implemented and distro-upgrade script polished, this should be a very nice option for interested users.&lt;br /&gt;
&lt;br /&gt;
There are tons of persistence guides, which unfairly dismiss this live-boot squashfs/persistence setup because they don&#039;t know how to mitigate/handle the upgrade problem as I do, because making a squashfs is not something well known which requires a lot of plumbing. Or they suggest other unnecessarily complex setups or make suggestions without having investigated performance implications (e.g. suggesting a full install to USB).&lt;br /&gt;
&lt;br /&gt;
I do not recommend modern Samsung, Sandisk, or any other cheap off-brands for this &amp;quot;heavy&amp;quot; use. Good chance they&#039;ll fail within a year and be too hot to touch. &#039;&#039;&#039;Buy from Toshiba/Kioxia&#039;&#039;&#039;, the inventors of flash memory. Yes their [https://www.amazon.com/Toshiba-TransMemory-U364-USB3-0-THN-U364W0320A4/dp/B078NPLXGC#customerReviews performance] as shown in benchmarks isn&#039;t as good, nor are they inexpensive, but they are reliable and will last years. &#039;&#039;&#039;Do not&#039;&#039;&#039; skimp to save a few $ buying a Sandisk/Samsung on a sale for this use-case, I&#039;m speaking from experience!&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&#039;&#039;&#039;Pros:&#039;&#039;&#039;&lt;br /&gt;
# Sure it may be useful if for example, you forget the drive in an internet cafe or library. Or have something you don&#039;t want to turn up in investigation.&lt;br /&gt;
&#039;&#039;&#039;Cons:&#039;&#039;&#039;&lt;br /&gt;
# It costs additional CPU &amp;amp; energy usage.&lt;br /&gt;
# Encryption offers zero &amp;quot;online&amp;quot;/mounted protection, e.g. encryption does not protect against a web browser vulnerability allowing disk access. Mental energy would be better spent on [https://wiki.archlinux.org/index.php/security &#039;hardening&#039;] the system.&lt;br /&gt;
# Harder to recover data when things break. &#039;&#039;Big&#039;&#039; headache.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 20:40, 4 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I will write more thoughts, I see this is an ongoing need/interest [[OSE_Linux_Log]]. Today I have ordered two Toshiba USB flash drives. I will write a guide here for preparing any Debian distro for USB persistence with optimal performance (squashfs &amp;amp; persistence partition) for interested readers.&lt;br /&gt;
&lt;br /&gt;
==GUIDE==&lt;br /&gt;
This guide will first make a live USB stick persistent.&lt;br /&gt;
&lt;br /&gt;
In the appendix will be additional knowledge and procedures to make it perform better.&lt;br /&gt;
&lt;br /&gt;
Brief steps:&lt;br /&gt;
#Make live USB&lt;br /&gt;
##Partition the USB.&lt;br /&gt;
##Mount the ISO, and copy select files to the USB&#039;s live partition.&lt;br /&gt;
##Install grub.&lt;br /&gt;
#Make the live USB a persistent USB&lt;br /&gt;
##Boot to live USB &amp;amp; Setup persistence.&lt;br /&gt;
&lt;br /&gt;
===Make live USB===&lt;br /&gt;
You can follow a different guide and then run the command `live-persistence`. Then when it comes time to upgrade libc or the kernel you can run `live-toram`, then follow the squash guide below.&lt;br /&gt;
&lt;br /&gt;
But here is the way I&#039;d do it.&lt;br /&gt;
====Partition the USB====&lt;br /&gt;
Use gparted. Make a GPT partition, with 16MB unused.&lt;br /&gt;
&lt;br /&gt;
Make live partition 1GB is fine. Big enough to fit the squashfs, vmlinuz, and initrd files from the ISO. Label it &#039;live&#039;, or whatever you want.&lt;br /&gt;
&lt;br /&gt;
Make persistence partition filling up the remainder. Label it &#039;peristence&#039;, or whatever you want, but you&#039;ll have to use the label you use in the grub.cfg later.&lt;br /&gt;
&lt;br /&gt;
Now make a small partition at least 1MB big into the 16MB unused space at the start. Don&#039;t format it with a filesystem, leave it unformatted. This is where GRUB installs stuff into.&lt;br /&gt;
====Mount the ISO, and copy select files to the USB&#039;s live partition====&lt;br /&gt;
Yep, copy the squashfs, vmlinuz, and initrd to /live on the live partition, e.g. /media/live/live&lt;br /&gt;
Easy peasy.&lt;br /&gt;
====Install grub====&lt;br /&gt;
Should go to /media/live/grub&lt;br /&gt;
&lt;br /&gt;
See appendix: [[Talk:OSE_Linux_Persistence#Prepare_GRUB_on_the_live_partition_and_USB_device]]&lt;br /&gt;
&lt;br /&gt;
Boot to the USB! It is live!&lt;br /&gt;
&lt;br /&gt;
===Make the live USB a persistent USB===&lt;br /&gt;
While you&#039;re booted to the live USB, mount the persistence partition, and put a peristence.conf file on it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; | sudo tee /media/peristence/persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, read the short manual on live-tools. And type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
man live-tools&lt;br /&gt;
live-peristence&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Neat, all your files you&#039;re using in the live USB, are now saved to the persistence partition. Though, we have to write a few changes to grub.cfg in order to load that stuff on next boot.&lt;br /&gt;
====Edit grub.cfg====&lt;br /&gt;
&lt;br /&gt;
See appendix: [[Talk:OSE_Linux_Persistence#Either_.281.29_Handcraft_grub.cfg]]&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
This guide seeks a USB stick with optimal performance, which requires a minimal squashfs.&lt;br /&gt;
&lt;br /&gt;
If USB space and performance are not concerns for you, you&#039;re welcome to modify an existing live USB, name a 2nd partition &amp;quot;persistence&amp;quot;, add suitable kernel parameters including &amp;quot;persistence&amp;quot;, and write a persistence.conf file containing &amp;quot;/ union&amp;quot; in the persistence partition. You can understand necessary details by understanding the guide below. Boot time may take a minute or longer, and applications may be slow and hang due to limitations of flash media which this guide seeks to minimize.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s proceed with making the USB with optimal performance.&lt;br /&gt;
&lt;br /&gt;
===Some notes on flash media===&lt;br /&gt;
The first partition should start after some multiple of the medium&#039;s [https://lwn.net/Articles/428584/ erase block]. The erase block size might be published by the manufacturer, or reasoned about via [https://github.com/bradfa/flashbench benchmarking]. However SSDs and modern USB sticks use more sophisticated controllers so flashbench [https://lists.linaro.org/pipermail/flashbench-results/2016-December/000599.html won&#039;t provide the necessary insights]. So starting the first partition at a 16MiB or 32MiB offset would be a reasonable choice, being some multiple of the erase block.&lt;br /&gt;
&lt;br /&gt;
When considering the [https://superuser.com/questions/379074/how-to-correctly-partition-usb-flash-drive-and-which-filesystem-to-choose-consid stride and stripe-width] parameters I&#039;m not sure it makes a difference anymore with more sophisticated controllers.&lt;br /&gt;
&lt;br /&gt;
On the flash media, writing is slow, so modern ones typically have a faster volatile cache, which is then written to the non-volatile flash memory. So when you write a large file to the medium, and it appears to finish via the command completing, but in reality it won&#039;t be done for some time. This is why writing speed appears to slow down in benchmarking the longer the write goes, from say 20MB/s to 4MB/s, this is due to the volatile cache filling up. ext4 when writing the journal uses a &amp;quot;barrier&amp;quot; somehow implemented, and usually implemented by the USB driver/device where the command blocks until the write is actually written to non-volatile memory, but I think this feature isn&#039;t exposed by ext4 for use in benchmarking. This is something to be cautious about before shutting down the system, leave the system idle for about 30-60 seconds after shutting down the browser or other write activity before powering down the system, as it is possible the write is still transferring from the volatile cache to non-volatile memory, and the OS doesn&#039;t know better, as we&#039;d disabled ext4 journalling for performance and longevity reasons, and it has been my experience that linux doesn&#039;t wait for the non-volatile write to finish anyway on shutdown, printing write errors on shutdown if this is the case. If this happens, then run a fsck on next boot, we&#039;ll make the Grub entry later to make running fsck convenient to best fix the consistency problems.&lt;br /&gt;
&lt;br /&gt;
===Partitioning===&lt;br /&gt;
A GPT partition table is fine, as is an MBR partition table.&lt;br /&gt;
&lt;br /&gt;
If doing GPT then make a small unformatted partition in the 16MiB or 32MiB offset before the live partition. It only needs to be 1MiB, but can be larger. Set the &#039;boot_grub&#039; flag on it in gparted. Grub will install to it later in this guide.&lt;br /&gt;
&lt;br /&gt;
Here is my example command of how I made the ext4 filesystem for the live partition. The option ^has_journal disables the journal, important for flash memory longevity. Determine which partition to run mkfs.ext4 on, mine is /dev/sdd1 and /dev/sdd2.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -N 2048 -L live -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;yourpartition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to do an EFI system partition (ESP), then have this also be the live partition, which we use as our &amp;quot;/boot&amp;quot; partition. This must be FAT32 instead of ext4 unfortunately. Set the &#039;esp&#039; flag on the live partition in gparted. When we install GRUB later, it will install EFI files to the live partition.&lt;br /&gt;
&lt;br /&gt;
And for the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -L persistence -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;your partition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare squashfs===&lt;br /&gt;
Download ISO of desired debian distro (e.g. OSE Linux). Put it at /tmp/&lt;br /&gt;
&lt;br /&gt;
chroot just uses your current Kernel. That&#039;s just how it works. Because of this it is best if the kernel of the system you&#039;re running to be the most recent available for the distro release of the ISO (e.g. for me [https://packages.debian.org/buster/linux-image-amd64 linux-image-4.19.0-13-amd64] as of this writing). If this isn&#039;t possible, boot to the ISO and skip to the [[Talk:OSE_Linux_Persistence#Remove_non-core_packages]] instructions without doing the chroot. You can do this all on a single USB stick if you do it correctly. Or you could use [https://help.ubuntu.com/community/DebootstrapChroot] or virtualization, lots of possibilities outside the scope of this guide.&lt;br /&gt;
&lt;br /&gt;
Actually now that I think about it writing the guide following the live USB installation without doing the chroot may be best, being more generalized and perhaps easier. I will rewrite this guide that way in the future, but for now, here are the chroot directions.&lt;br /&gt;
&lt;br /&gt;
====prepare chroot filesystem====&lt;br /&gt;
Let us continue with the chroot assuming we&#039;re running the same distro/kernel. Mount the ISO, and look for filesystem.squashfs, initrd.img, vmlinuz on it. Also note the location of config, System.map and filesystem.packages.xz, we&#039;ll copy or make these to follow convention.&lt;br /&gt;
&lt;br /&gt;
Make temporary directories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir /media/filesystem.squashfs /media/iso /media/overlay /media/myadditions /media/myadditions/rw /media/myadditions/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -o loop /tmp/debian-distro-i386.iso /media/iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount filesystem.squashfs on the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t squashfs /media/iso/live/filesystem.squashfs /media/filesystem.squashfs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount an in-memory filesystem to hold temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t tmpfs -o size=1024m none /media/myadditions&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prepare the union filesystem, so that we&#039;re able to edit the squashfs on the iso and compress the result. We can use either [https://wiki.archlinux.org/index.php/Overlay_filesystem overlayfs] or aufs. Here is the overlayfs command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t overlay overlay -o lowerdir=/media/filesystem.squashfs,upperdir=/media/myadditions/rw,workdir=/media/myadditions/work /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or afus. overlayfs hasn&#039;t been widely available until kernel 3.18, and aufs is available on earlier kernels (from [https://sourceforge.net/p/aufs/aufs3-standalone/ci/f88513f985e153aaf3e2950622c2a2329c3c3f8f/log/ kernel 3.9 late 2014 aufs supports xattr]) via aufs-tools, and their may be some differences I&#039;m not aware of but I think the concensus is that overlayfs is better. Hopefully aufs supports extended attributes (xattr) good enough to not loose said attributes, which are important for hardening the system (extended attributes are I believe where [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities] are stored/configured).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t aufs -o br=/media/myadditions=rw -o br=/media/filesystem.squashfs=ro -o udba=reval none /media/overlay/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====chroot====&lt;br /&gt;
Prepare the chroot, so that we can run apt within it and remove packages. resolv.conf and mount binds are to remove error/warning messages when installing packages with apt.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp /etc/resolv.conf /media/overlay/etc/resolv.conf&lt;br /&gt;
sudo mount --bind /dev/ /media/overlay/dev/&lt;br /&gt;
sudo mount --bind /dev/pts /media/overlay/dev/pts #https://wiki.debian.org/chroot#A.2Fdev.2Fpts&lt;br /&gt;
sudo mount --bind /proc /media/overlay/proc&lt;br /&gt;
sudo mount --bind /sys /media/overlay/sys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now chroot into the squashfs so we can use apt within it to remove packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chroot --userspec root:root /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the locale, you&#039;ll get many warning messages in apt otherwise. You probably want to select UTF-8 for your country/language, for example I picked en_US.UTF-8. Press space bar to toggle each locale you want generated, then press enter to proceed. Then it asks if you want the locales you chose to be applied systemwide, forcing your selection on each user, which may be desired for desktop software which starts up before the user-specific ~/.profile is read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure locales&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And set the timezone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure tzdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If /boot exists, then back it up, we&#039;re replacing /boot with a symlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /boot /boot.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must make a symlink so that as we work with apt-get, it may call `live-update-initramfs -u`, and we need those updates to /boot to go to the proper location, the &#039;live&#039; partition&#039;s /live:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /lib/live/mount/medium/live /boot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve not yet made the live partition, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If already have the live partition ready, or like me are updating an existing live partition&#039;s squashfs, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
mkdir /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have to do the above steps to work around update-initramfs&#039;s logic and assumptions regarding a read/write test that this works around. If you ever run into problems with update-initramfs while using apt-get, this is what you run once the problem is fixed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg --configure initramfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we remove packages, such at btrfs-progs, update-initramfs will be triggered which should update /boot/vmlinuz and /boot/initrd, these files are not compressed into the filesystem.squashfs and we need those files within /live of the live partition to boot.&lt;br /&gt;
&lt;br /&gt;
`man live-boot` is a useful reference, ensure live-boot-doc is installed. Also the [https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html Debian live-manual] is a useful reference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install live-boot-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Remove non-core packages====&lt;br /&gt;
&lt;br /&gt;
Now we gut the filesystem.squashfs from the iso of packages that:&lt;br /&gt;
* We don&#039;t want.&lt;br /&gt;
* Are frequently updated (e.g. web browser).&lt;br /&gt;
* With particular scrutiny of packages that are large.&lt;br /&gt;
* Are not necessary to boot to a desktop.&lt;br /&gt;
All of those can they can go onto persistence partition. We remove them now, and install them after the squashfs has been made, or as needed. Examples of what should be considered &amp;quot;core&amp;quot; packages necessary to boot are: linux-image (this is the kernel), firmware, GPU driver, and X11 server. This way the USB will:&lt;br /&gt;
* Boot fast,&lt;br /&gt;
* The OS running from it will be maximally responsive,&lt;br /&gt;
* Will have minimal memory footprint,&lt;br /&gt;
* And be persistent!&lt;br /&gt;
&lt;br /&gt;
Run this to see packages installed ordered by size, then apt-get remove or purge stuff, and ignore anything beginning with &amp;quot;lib&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W -f &#039;${Installed-Size}\t${Package}\n&#039; | sort -n | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To understand what a package is, you can search [https://packages.debian.org/buster/os-prober packages.debian.org]. If the description there isn&#039;t informative enough, you can try clicking the links on the right hand side such as a project homepage, or looking through the files of the package. Ignore or don&#039;t pay much attention to any package beginning with &amp;quot;lib&amp;quot;, with the exception of things like libc6, but apt will probably warn you about doing something silly like that with the prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
You are about to do something potentially harmful.&lt;br /&gt;
To continue type in the phrase &#039;Yes, do as I say!&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example of stuff I removed from a different Debian distro (BunsenLabs), but I removed some firmware packages so that reduces portability:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get remove -y firefox-esr libjsoncpp1&lt;br /&gt;
apt-get remove -y libreoffice-core libreoffice-common coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1 libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-locale1.67.0 libboost-thread1.67.0 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data libgpgmepp6 liblangtag-common liblangtag1 libmhash2 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libnumbertext-data libodfgen-0.1-1 liborcus-0.14-0 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 libstaroffice-0.0-0 libsuitesparseconfig5 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure&lt;br /&gt;
apt-get remove -y firmware-atheros firmware-netronome firmware-iwlwifi firmware-brcm80211 firmware-qlogic firmware-ti-connectivity firmware-myricom firmware-intelwimax firmware-libertas dahdi-firmware-nonfree atmel-firmware firmware-cavium firmware-bnx2x firmware-qcom-media firmware-netxen firmware-samsung firmware-ipw2x00 firmware-siano firmware-ivtv firmware-bnx2&lt;br /&gt;
apt-get remove -y samba-libs libavahi-glib1 libcdio-cdda2 libcdio-paranoia2 libgd3 libgdata-common libgdata22 libgoa-1.0-0b libgoa-1.0-common libgphoto2-6 libgphoto2-port12 libldb1 liblmdb0 liboauth0 libpython2.7 libtalloc2 libtevent0 libwbclient0 python-talloc&lt;br /&gt;
apt-get remove -y fonts-noto-core fonts-noto-cjk papirus-icon-theme bunsen-papirus-icon-theme gnome-icon-theme gdebi-core gir1.2-vte-2.91 python3-apt python3-chardet python3-debian python3-pkg-resources&lt;br /&gt;
rm -r /usr/share/gdebi/GDebi /usr/lib/python3/dist-packages/aptsources /usr/lib/python3/dist-packages/apt/progress /usr/lib/python3/dist-packages/debian_bundle /usr/lib/python3/dist-packages/debian /usr/lib/python3/dist-packages/chardet/cli /usr/lib/python3/dist-packages/pkg_resources/extern /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging&lt;br /&gt;
apt-get remove -y evince synaptic bubblewrap evince-common gnome-desktop3-data libbrotli1 libdjvulibre-text libdjvulibre21 libept1.5.0 libevdocument3-4 libevview3-3 libgnome-desktop-3-17 libgspell-1-1 libgspell-1-common libgxps2 libharfbuzz-icu0 libhyphen0 libjavascriptcoregtk-4.0-18 libkpathsea6 libspectre1 libsynctex2 libwebkit2gtk-4.0-37 libwebpdemux2 libwoff1 xdg-dbus-proxy zenity zenity-common&lt;br /&gt;
apt-get remove -y vlc libaribb24-0 libbasicusageenvironment1 libcddb2 libdvbpsi10 libebml4v5 libgles2 libgroupsock8 libixml10 liblirc-client0 liblivemedia64 liblua5.2-0 libmad0 libmatroska6v5 libmtp-common libmtp9 libnfs12 libopenmpt-modplug1 libplacebo7 libprotobuf-lite17 libqt5x11extras5 libresid-builder0c2a libsdl-image1.2 libsdl1.2debian libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libxcb-xv0 vlc-bin vlc-data vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output vlc-plugin-notify libvlccore9&lt;br /&gt;
apt-get remove -y file-roller p7zip-full p7zip libarchive13 libnautilus-extension1a xfburn libburn4 libexo-1-0 libisofs6 libjte1 unar gnustep-base-common gnustep-base-runtime gnustep-common libgnustep-base1.26 libobjc4&lt;br /&gt;
apt-get remove -y transmission-gtk libevent-2.1-6 libminiupnpc17 libnatpmp1 transmission-common filezilla filezilla-common libfilezilla0 libpugixml1v5 libwxbase3.0-0v5 libwxgtk3.0-0v5 yudit-common feh&lt;br /&gt;
apt-get remove -y libpython2.7-stdlib libblas3 libgfortran5 libkeybinder0 liblapack3 libpython2.7-minimal libsodium23 lua-bit32 lua-expat lua-penlight lua-posix lua-socket lua5.2 python-apt-common python-minimal python2-minimal python2.7-minimal libavformat58 libmysofa0 libnorm1 libpgm-5.2-0 libpostproc55 librubberband2 libssh-gcrypt-4 libswscale5 libvidstab1.1&lt;br /&gt;
apt-get remove -y aptitude aptitude-common libboost-iostreams1.67.0 libboost-system1.67.0 libcwidget3v5 libxapian30 ristretto file libmagic-mgc libmagic1 hexchat-common&lt;br /&gt;
apt-get install wpasupplicant network-manager --no-install-recommends&lt;br /&gt;
#modem support&lt;br /&gt;
apt-get remove -y modemmanager libmbim-glib4 libmbim-proxy libqmi-glib5 libqmi-proxy openssh-client libxatracker2 nitrogen libgtkmm-2.4-1v5 lvm2 dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 nano geany geany-common ghostscript poppler-data libcupsimage2 libgs9-common libijs-0.35 libjbig2dec0 libpaper1 pcmciautils vdpau-va-driver arandr&lt;br /&gt;
apt-get remove -y intel-microcode iucode-tool va-driver-all i965-va-driver xserver-xorg-video-intel libxvmc1 intel-media-va-driver libigdgmm5 xserver-xorg-video-qxl btrfs-progs cryptsetup-initramfs cryptsetup-bin cryptsetup-run&lt;br /&gt;
apt-get remove -y python3.7-minimal dconf-cli distro-info-data gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-pango-1.0 libfm-extra4 libgirepository-1.0-1 libmenu-cache-bin libmenu-cache3 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libxslt1.1 mime-support wmctrl&lt;br /&gt;
rm -r /usr/lib/python3&lt;br /&gt;
apt-get remove -y iso-codes liba52-0.7.4 libaa1 libass9 libatomic1 libavc1394-0 libavfilter7 libavformat58 libbs2b0 libcaca0 libcdio18 libcdparanoia0 libchromaprint1 libdc1394-22 libdca0 libde265-0 libdv4 libdvdnav4 libdvdread4 libfaad2 libfftw3-double3 libflite1 libfluidsynth1 libgme0 libgssdp-1.0-3 libgstreamer1.0-0 libgupnp-1.0-4 libgupnp-igd-1.0-4 libiec61883-0 libilmbase23 libkate1 liblilv-0-0 libmjpegutils-2.1-0 libmms0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa0 libnice10 libnorm1 libofa0 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr23 libopenmpt0 libpgm-5.2-0 libpoppler-glib8 libpoppler82 libpostproc55 libraw1394-11 librubberband2 libsbc1 libserd-0-0 libshout3 libsidplay1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libspandsp2 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libswscale5 libtumbler-1-0 libv4l-0 libv4lconvert0 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvulkan1 libwildmidi2 libzbar0 libzmq5 tumbler-common&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, much of what was removed can be installed again after persistence is set up. These packages are conveniently listed as removed within dpkg utilities, I&#039;ll illustrate how to conveniently reinstall them later.&lt;br /&gt;
&lt;br /&gt;
====Misc setup tips====&lt;br /&gt;
&lt;br /&gt;
[https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#521 One important consideration is that the live user is created by live-boot at boot time]. We need to ensure the live user is set up. Inspect the contents of /etc/live/ for any configuration files. If there is none in your distribution then let&#039;s make it, and feel free to customize this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/config.conf.d/10-user-setup.conf&lt;br /&gt;
LIVE_HOSTNAME=debian-persistence&lt;br /&gt;
LIVE_USERNAME=user&lt;br /&gt;
LIVE_USER_FULLNAME=&amp;quot;Debian LiveUser&amp;quot;&lt;br /&gt;
LIVE_USER_DEFAULT_GROUPS=&amp;quot;cdrom floppy audio dip video plugdev fuse bluetooth netdev scanner staff&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These options to live-boot will minimize the generated initramfs size:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/boot.conf&lt;br /&gt;
#man live-boot&lt;br /&gt;
#see /usr/share/initramfs-tools/hooks/live, might make initrd smaller&lt;br /&gt;
DISABLE_CDROM=true&lt;br /&gt;
DISABLE_FAT=true&lt;br /&gt;
DISABLE_FUSE=true&lt;br /&gt;
DISABLE_NTFS=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Performance tips====&lt;br /&gt;
&lt;br /&gt;
USB sticks use flash memory, and to maximize performance with it we can [https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler change the IO scheduler for such devices].&lt;br /&gt;
&lt;br /&gt;
BFQ looks like a nice scheduler. Quote:&lt;br /&gt;
&amp;quot;Regardless of the actual background workload, BFQ guarantees that, for interactive tasks, the storage device is virtually as responsive as if it was idle. [...] As a comparison, with CFQ, NOOP or DEADLINE, and in the same conditions, applications experience high latencies, or even become unresponsive until the background workload terminates (also on SSDs).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mq_deadline is fine while the system is booting. The scheduler in use can also be [https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers tuned], but I need to do more research before giving advice on tuning in this context. To [https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler setup/enable]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/modules-load.d/bfq.conf&lt;br /&gt;
bfq&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set bfq scheduler during startup. Alternatives include mq_deadline and none, either might be faster than bfq during startup when GUI application responsiveness isn&#039;t important, but I&#039;d need to do some research/experiments.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/udev/rules.d/60-ssd-scheduler.rules&lt;br /&gt;
# set bfq scheduler for non-rotating disks during startup&lt;br /&gt;
ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;sd[a-z]&amp;quot;, ATTR{queue/rotational}==&amp;quot;0&amp;quot;, ATTR{queue/scheduler}=&amp;quot;bfq&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use [https://wiki.archlinux.org/index.php/profile-sync-daemon profile-sync-daemon] to enhance performance of the browser, and minimize flash memory writes (maximize longevity).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install profile-sync-damon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For SD card longevity, consider mounting a tmpfs on /var/log. But perhaps only after you&#039;ve booted to the system a few times and verify the system is stable, as putting log files in RAM means they can&#039;t be read offline to diagnose a problem. So disable this feature if needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /var/log tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/tmpfiles.d/varlog.conf&lt;br /&gt;
d /var/log/apt 755 root root&lt;br /&gt;
d /var/log/lightdm 711 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vlc&#039;s default lookahead is too short, leads to music cutting out. &#039;Tools-&amp;gt;Preferences&#039;, toggle &#039;Show all settings&#039;, click &#039;Input/Codecs&#039; in tree view, scroll down to &#039;Advanced&#039; section and look at caching settings. Increase them to at least 600ms. This should largely mitigate problems with music/video stopping momentarily due to I/O delays.&lt;br /&gt;
&lt;br /&gt;
====Pruning tips====&lt;br /&gt;
Install deborphan and localepurge to help clean stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install deborphan localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you&#039;re done pruning things, run deborphan and remove things it tells you to as you desire. Deborphan helps you find &amp;quot;orphan&amp;quot; packages not needed by anything else, which take up space. Such orphaned packages may have been necessary by a previously installed package.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
deborphan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next run localepurge to remove space consuming files for locales you&#039;ll never use, I removed 160MB from my system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, clear out apt temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get autoremove&lt;br /&gt;
apt-get clean&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend vim.tiny over vim, vim.tiny much smaller, also install whatever else your heart desires that is small and infrequently updated. Such small utilities will be available in &#039;live&#039; mode (if installed when in &#039;persistence&#039; mode, it won&#039;t be available in plain &#039;live&#039; mode):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install vim-tiny&lt;br /&gt;
echo &amp;quot;set nocp&amp;quot; &amp;gt;&amp;gt; /etc/vim/vimrc.tiny #Allows arrow keys to work, and vim.tiny to act like vim instead of vi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Hardening tips====&lt;br /&gt;
&lt;br /&gt;
I think it is best for /tmp to be mounted noexec, but many applications have bugs regarding this&lt;br /&gt;
Double check the /etc/fstab file with a text editor after editing /etc/fstab:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /tmp tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mount /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often apt packages during installation will require the ability to execute temporary files on /tmp, this is how we allow this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/apt/apt.conf.d/50remount&lt;br /&gt;
DPkg::Pre-Install-Pkgs {&amp;quot;mount -o remount,exec /tmp&amp;quot;;};&lt;br /&gt;
DPkg::Post-Invoke {&amp;quot;mount -o remount /tmp&amp;quot;;};&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A common thing people do, is charge their android phone, or other USB device via a USB port on the computer. Realize that this is physical access, which a compromised device may use to log in to Linux via root. I suspect I had fallen victim to in the past, a keylogger following a pattern I&#039;d seen exhibited in the news, which I believe came after I&#039;d plugged in a new android I had run questionable rooting software on, to my computer. I suggest both setting a root password, and disallowing this access, by editing /etc/securetty and commenting out root access via UART serial ports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# UART serial ports&lt;br /&gt;
#ttyS0&lt;br /&gt;
#ttyS1&lt;br /&gt;
#ttyS2&lt;br /&gt;
#ttyS3&lt;br /&gt;
#ttyS4&lt;br /&gt;
#ttyS5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the [https://www.debian.org/doc/manuals/securing-debian-manual/ch03s04.en.html root password]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What has piqued my interest lately is [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities]. Debian distributions should include both [https://packages.debian.org/buster/libcap2 libcap2] and [https://packages.debian.org/buster/libcap-ng0 libcap-ng0 (RedHat&#039;s fork)]. And I&#039;m looking for a more convenient open-source means of administration. What has me interested in the idea of a [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html proactive defense against root-kits] by removing module loading capabilities (CAP_SYS_MODULE) even for the root user, after the system had booted. It appears that lcap is no longer functional, it and many capabilities articles detail a system-wide capability bounding set in pre-2.6.25 kernels, but since kernel 2.6.25 capability bounding sets are now per-thread. The [http://people.redhat.com/sgrubb/libcap-ng/ images here] may help visually explain capabilities and their inheritance. What I have in mind may be within a custom /etc/init.d/ script calling [https://man7.org/linux/man-pages/man2/capset.2.html setcap] on init (pid 1) to remove the CAP_SYS_MODULE capability from the bounding set system-wide. The capabilities on any process can be viewed with `cat /proc/&amp;lt;pid&amp;gt;/status`.&lt;br /&gt;
&lt;br /&gt;
Something else that can be done is use of more than one account, for example an account dedicated to web browsing with minimal privileges, and an account with administration privileges (sudo, member of staff,adm groups).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser browser&lt;br /&gt;
dm-tool switch-to-user browser #with LightDM desktop manager: https://wiki.ubuntu.com/LightDM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files downloaded with the browser can be transfered to other users via /tmp, which is a good place to set as the default location to download files in the browser settings anyway.&lt;br /&gt;
&lt;br /&gt;
With this separation of user privileges, if malware managed to gained the privileges of the browser account (no privilege escalation), and escaped the browser sandbox, the worst it could do is keylog, delete or encrypt/ransom the browser account&#039;s files. Since the browser account is running on a difference X11 server than an administration account, I think [https://security.stackexchange.com/questions/4641/why-are-people-saying-that-the-x-window-system-is-not-secure/4646 risks] are reduced.&lt;br /&gt;
&lt;br /&gt;
Switching between the administration account and browser account X11 servers can be done with ctrl+alt+F7 or F8 (or F1/F2 or whatever).&lt;br /&gt;
&lt;br /&gt;
Or just have the desktop load with the browser account instead of the administrative account, and do administrative tasks on a virtual terminal (ctrl+alt+F1 through F6).&lt;br /&gt;
&lt;br /&gt;
Set up the [https://www.debian.org/doc/manuals/securing-debian-manual/ch04s11.en.html#id-1.5.14.17 shell history file], .bash_history better. An easy way a bad actor can circumvent the stock configuration from logging his evil deeds is to proceed those evil things with a space, this guide will fix that!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lsattr /home/browser/.bash_history  #See what attributes are set&lt;br /&gt;
sudo chattr +a /home/browser/.bash_history   #Only root user can chattr&lt;br /&gt;
sudo chattr +a /home/user/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Make filesystem.packages and filesystem.squashfs====&lt;br /&gt;
Now that we have a set of &amp;quot;core&amp;quot; packages to go in the squashfs, of minimal size, on the &#039;live&#039; partition, we must make our new squashfs!&lt;br /&gt;
&lt;br /&gt;
Print out a list of &amp;quot;core&amp;quot; packages we have, we&#039;ll need them for reference later. Lets put them in filesystem.packages.xz:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W --showformat=&#039;${Package}\t${Version}\n&#039; | xz &amp;gt; /tmp/filesystem.packages.xz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get -y install squashfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exclude stuff we don&#039;t want in the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXCLUDES=&#039;.wh* dev live-persistence.conf live lost+found media mnt proc .pulse* run home selinux sys tmp* lib/live/mount usr/lib/live/mount var/cache/apt var/cache/apt-xapian-index var/lib/apt/lists var/tmp&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Directives to squashfs-tools to make pseudofiles, necessary to boot. Linux will make many pseudofiles in /dev when it boots, but not all, and through experimentation and observations I&#039;ve come up with this list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /tmp/mksquashfs.pf&lt;br /&gt;
dev d 755 root root&lt;br /&gt;
dev/console c 662 root tty 5 1&lt;br /&gt;
dev/full c 666 root root 1 7&lt;br /&gt;
dev/kmem c 640 root kmem 1 2&lt;br /&gt;
dev/kmsg c 644 root root 1 11&lt;br /&gt;
dev/loop0 b 660 root disk 7 0&lt;br /&gt;
dev/loop1 b 660 root disk 7 1&lt;br /&gt;
dev/loop2 b 660 root disk 7 2&lt;br /&gt;
dev/loop3 b 660 root disk 7 3&lt;br /&gt;
dev/loop4 b 660 root disk 7 4&lt;br /&gt;
dev/loop5 b 660 root disk 7 5&lt;br /&gt;
dev/loop6 b 660 root disk 7 6&lt;br /&gt;
dev/loop7 b 660 root disk 7 7&lt;br /&gt;
dev/mem c 640 root kmem 1 1&lt;br /&gt;
dev/null c 666 root root 1 3&lt;br /&gt;
dev/port c 640 root kmem 1 4&lt;br /&gt;
dev/ptmx c 666 root tty 5 2&lt;br /&gt;
dev/pts d 755 root root&lt;br /&gt;
dev/ram0 b 640 root disk 1 0&lt;br /&gt;
dev/ram1 b 640 root disk 1 1&lt;br /&gt;
dev/ram2 b 640 root disk 1 2&lt;br /&gt;
dev/ram3 b 640 root disk 1 3&lt;br /&gt;
dev/ram4 b 640 root disk 1 4&lt;br /&gt;
dev/ram5 b 640 root disk 1 5&lt;br /&gt;
dev/ram6 b 640 root disk 1 6&lt;br /&gt;
dev/ram7 b 640 root disk 1 7&lt;br /&gt;
dev/ram8 b 640 root disk 1 8&lt;br /&gt;
dev/ram9 b 640 root disk 1 9&lt;br /&gt;
dev/ram10 b 640 root disk 1 10&lt;br /&gt;
dev/ram11 b 640 root disk 1 11&lt;br /&gt;
dev/ram12 b 640 root disk 1 12&lt;br /&gt;
dev/ram13 b 640 root disk 1 13&lt;br /&gt;
dev/ram14 b 640 root disk 1 14&lt;br /&gt;
dev/ram15 b 640 root disk 1 15&lt;br /&gt;
dev/ram16 b 640 root disk 1 16&lt;br /&gt;
dev/random c 644 root root 1 8&lt;br /&gt;
dev/shm d 755 root root&lt;br /&gt;
dev/tty c 662 root tty 5 0&lt;br /&gt;
dev/tty0 c 600 root tty 4 0&lt;br /&gt;
dev/urandom c 644 root root 1 9&lt;br /&gt;
dev/zero c 644 root root 1 5&lt;br /&gt;
home d 755 root root&lt;br /&gt;
media d 755 root root&lt;br /&gt;
mnt d 755 root root&lt;br /&gt;
proc d 755 root root&lt;br /&gt;
run d 755 root root&lt;br /&gt;
run/lock d 1777 root root&lt;br /&gt;
sys d 755 root root&lt;br /&gt;
tmp d 1777 root root&lt;br /&gt;
var/cache/apt d 755 root root&lt;br /&gt;
var/cache/apt/partial d 755 root root&lt;br /&gt;
var/cache/apt/lock f 640 root root echo &amp;quot;&amp;quot;&lt;br /&gt;
var/lib/apt/lists d 755 root root&lt;br /&gt;
var/lib/apt/lists/partial d 755 root root&lt;br /&gt;
var/tmp d 1777 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now make the squashfs, it is compressed with xz compression:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mksquashfs / /tmp/filesystem.squashfs -comp xz -info -always-use-fragments -noappend -wildcards -pf /tmp/mksquashfs.pf -e ${EXCLUDES} &amp;gt; /tmp/mksquashfs.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/tmp/mksquashfs.log will contain interesting details, such as the filesystem is now roughly 30% of its uncompressed size.&lt;br /&gt;
&lt;br /&gt;
Hopefully the squashfs you made is around 800MB or less, mine for a different Debian distribution was about 300MB. Let us say your flash drive has 100MB/s sequential read speed, and your &amp;quot;core&amp;quot; filesystem was squashed down to 300MB, which will take 3 seconds to read into memory. How long do you think yours will take to boot?&lt;br /&gt;
&lt;br /&gt;
===Prepare the live partition===&lt;br /&gt;
If you hadn&#039;t yet mounted the live partition to /lib/live/mount/medium earlier in the guide, we need to move files off, then mount it, and move vmlinuz, initrd, and etc onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /lib/live/mount/medium /tmp/&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
cd /lib/live/mount/medium&lt;br /&gt;
mkdir live&lt;br /&gt;
mv /tmp/medium/boot/vmlinuz* live/&lt;br /&gt;
mv /tmp/medium/boot/initrd* live/&lt;br /&gt;
mv /tmp/filesystem.squashfs live/&lt;br /&gt;
mv /tmp/filesystem.packages.xz live/&lt;br /&gt;
#update-initramfs or something else pointed at live/ incorrectly puts grub/unicode.pf2 here, this symlink fixes that:&lt;br /&gt;
ln -s ../boot/grub/ live/grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also copy files like System.map-4.19.0-9-amd64 and config-4.19.0-9-amd64 to /lib/live/mount/medium/live, they should be in /media/overlay/boot.bak and/or /media/iso/live/ (outside the chroot). Or if the kernel is updated then you&#039;ll get these files, corresponding to the new kernel, automatically put in there anyway.&lt;br /&gt;
&lt;br /&gt;
The file named config is a nice reference, it says what flags the kernel was built with, there are a vast number of options.&lt;br /&gt;
This System.map file, stored on the read-only live partition may be useful, for example, finding if your system had been [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html compromised with a rootkit].&lt;br /&gt;
&lt;br /&gt;
===Prepare GRUB on the live partition and USB device===&lt;br /&gt;
&lt;br /&gt;
The introduction of UEFI hardware complicates things. You&#039;re welcome to modify the instructions below if you desire to support UEFI functionality on such consumer hardware. The instructions below handles computers with [https://wiki.archlinux.org/index.php/GRUB#BIOS_systems traditional BIOS], with a [https://wiki.archlinux.org/index.php/Partitioning#Master_Boot_Record traditional MBR], as well as UEFI hardware which supports such &amp;quot;legacy&amp;quot; standards. &lt;br /&gt;
&lt;br /&gt;
From within the chroot, install non-uefi grub (grub-pc), and --no-install-recommends will result in os-prober not being installed. I think os-prober is workstation-specific and not useful to configure a USB device which may move between workstations. grub-pc will ask two questions, don&#039;t select anything and enter on Ok on the first, and press enter on Yes on the next to continue without --exclude.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install grub-pc --no-install-recommends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find your live partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -l /dev/disk/by-label/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say it is /dev/sdd1. Then we use the device /dev/sdd in the command below.&lt;br /&gt;
&lt;br /&gt;
Install grub, to both the USB device and the live partition on the USB device. Where /dev/sdd below is the USB device (not a partition), and /lib/live/mount/medium is where the live partition is mounted:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-install --target=i386-pc --root-directory=/lib/live/mount/medium /dev/sdd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now grub needs a configuration file. We can either craft one by hand or use grub-mkconfig, but grub-mkconfig doesn&#039;t really support this use-case.&lt;br /&gt;
&lt;br /&gt;
====Either (1) Handcraft grub.cfg====&lt;br /&gt;
What follows is my legacy grub.cfg, which should work but I hope to make something workable within the newer /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Make sure to fill in this template /lib/live/mount/medium/boot/grub/grub.cfg on &#039;live&#039; partition with your appropriate UUIDs. The partitions you made will have unique UUIDs. You can determine which is which on your system by comparing `ls -l /dev/disk/by-uuid/` and ls -l `/dev/disk/by-label/`.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;LABELorGPTname&amp;quot; to the label or GPT name of your persistence partition. I labeled mine &amp;quot;u365-persistence&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Fill in the template with how your vmlinuz and initrd.img are named, which may not have a suffix of &amp;quot;-4.19.0-9-amd64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make note of the kernel parameters used here, such as &#039;toram&#039; and &#039;persistence&#039;. I&#039;m not sure if elevator=as is the optimal choice, feel free to read about it.&lt;br /&gt;
&lt;br /&gt;
You can customize the [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#530 locale, language, and keyboard layout] here via kernel parameters here such as `locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variants=bepo keyboard-model=tm2030usb`, but I think the console-setup package may be required (installed before the squashfs is made), and perhaps these things are fine configured elsewhere.&lt;br /&gt;
&lt;br /&gt;
You can see other things configurable via kernel parameters such as tzdata, and initial username by looking at /lib/live/config/*. But be aware many things are only configured once via /var/lib/live/config/ (remove the relevant file to allow reconfiguration).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
#Enter the UUID of your boot partition (this is where grub and your kernel reside)&lt;br /&gt;
set uuid_grub_boot=dc434800-22ac-4fd4-b6cb-603da325d5d0&lt;br /&gt;
#Enter the UUID of the persistence partition.&lt;br /&gt;
set uuid_os_root=858d963f-8718-4520-83dd-fb89a842e9bd&lt;br /&gt;
#Here we set the grub &amp;quot;root&amp;quot; variable by locating the uuid of the root partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_os_root --set=root&lt;br /&gt;
#Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot&lt;br /&gt;
#Here&#039;s the magic. We test to see if the boot and root partitions have the same UUID.&lt;br /&gt;
#If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.&lt;br /&gt;
if [ $uuid_grub_boot == $uuid_os_root ] ; then&lt;br /&gt;
  set grub_boot=$grub_boot/boot&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
set kernel_parameters_common=&amp;quot;boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot usbcore.autosuspend=-1&amp;quot;&lt;br /&gt;
set kernel_parameters_persistence=&amp;quot;persistence persistence-storage=filesystem persistence-label=LABELorGPTname&amp;quot;&lt;br /&gt;
set myversion=4.19.0-13-amd64&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#With an unsafe shutdown or powerloss the persistence filesystem will have errors,&lt;br /&gt;
#since it has no journaling, we want to run fsck on it once&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence fsck&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence forcefsck&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Live&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Or (2) Generate grub.cfg with grub-mkconfig====&lt;br /&gt;
Again, using the handcrafted grub.cfg above is probably fine, but here are details on how to get grub-mkconfig to work, which geterates grub.cfg from directives in /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Now, /usr/sbin/grub-mkconfig is not robust line 142 &amp;amp; 146 in our context of chroot usage, assumes we&#039;re installing to / device and /boot, and offers no way to configure around the problem, so we change line 142 &amp;amp; 146:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Line 142:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium`&amp;quot;&lt;br /&gt;
# Line 146:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /boot`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium/boot`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy by hand the legacy grub.cfg menu entries I have, with your disk UUIDs into [https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file /etc/grub.d/40_custom].&lt;br /&gt;
&lt;br /&gt;
Now run grub-mkconfig, from within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-mkconfig -o /lib/live/mount/medium/boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmount /lib/live/mount/medium:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unmount /lib/live/mount/medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare the persistence partition===&lt;br /&gt;
And don&#039;t forget to make the persistence.conf file &#039;/ union&#039; on the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#cd to wherever you have mounted your persistence partition, e.g. /media/persistence&lt;br /&gt;
cd /media/persistence&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; &amp;gt; persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From /media/overlay/home grab the OSE Linux stuff in there, and put in /media/persistence/home:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /media/overlay/home /media/persistence/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There may also be other OSE Linux specific things removed by prior purges of non-&amp;quot;core&amp;quot; packages, e.g. in /etc/&lt;br /&gt;
I suppose there may be a way to &amp;quot;diff&amp;quot; those out, and re-add them to the persistence partition after the packages are installed anew. Maybe there is a convenient dpkg way of doing that... diffing and saving the configuration file changes from stock packages instead of purging them? Or is that the difference between apt-get remove and apt-get purge where apt-get remove will only remove stock configuration files leaving modified ones intact? Yes I think that may be right.&lt;br /&gt;
&lt;br /&gt;
===Cleanup===&lt;br /&gt;
Cleanup!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo umount /media/overlay/dev/pts&lt;br /&gt;
sudo umount /media/overlay/dev/&lt;br /&gt;
sudo umount /media/overlay/proc&lt;br /&gt;
sudo umount /media/overlay/sys&lt;br /&gt;
sudo umount /media/overlay/tmp&lt;br /&gt;
sudo umount /media/overlay&lt;br /&gt;
sudo umount /media/filesystem.squashfs&lt;br /&gt;
sudo umount /media/iso&lt;br /&gt;
sudo umount /media/myadditions&lt;br /&gt;
sudo rmdir /media/iso /media/filesystem.squashfs /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You now have an Linux OS on your USB with persistence that will boot within seconds and reliably outperforms the competition!&lt;br /&gt;
&lt;br /&gt;
==Further Details==&lt;br /&gt;
===Upgrading===&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when linux-image (the package containing the kernel) is upgraded?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; apt will want to update /boot/vmlinuz and /boot/initrd.img. So we need to do things in order to allow this to happen. We must boot with &#039;toram&#039; and also remount &#039;live&#039; as rw before running apt-get update.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#TODO, I wrote this elsewhere need to copy here, something along these lines:&lt;br /&gt;
mount -o remount,rw /lib/live/mount/medium /dev/disk/by-label/live&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this upgrade process apt might rename vmlinuz to say vmlinuz-3.16.0-4-amd64, and initrd similarly. It didn&#039;t always do this. But, you must match the names of those files with what is listed in grub.cfg! Either use &#039;vmlinuz&#039; or whatever name the apt script renamed them to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when libc is upgraded? Be it a security update, or when Debian Stable advances every couple years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; We will want to do a resquash:&lt;br /&gt;
# We need to to the same as above, &#039;toram&#039; and remount &#039;live&#039; as rw.&lt;br /&gt;
# dpkq-query our currently installed packages, and compare to /boot/filesystem.packages.xz we made earlier.&lt;br /&gt;
# Remove all non &amp;quot;core&amp;quot; packages, they should be cached in /var/cache/apt/archives/ so they don&#039;t need to be downloaded again, just reinstalled after we do the resquash.&lt;br /&gt;
# apt-get update&lt;br /&gt;
# Resquash, reboot to verify things working, in &#039;live&#039; mode remove squashed stuff from persistance partition.&lt;br /&gt;
## squash script https://gist.github.com/AndrewSmart/90eb186aea08db8f1426&lt;br /&gt;
## cleanup script https://gist.github.com/AndrewSmart/2f67f79f6f1922c4556f&lt;br /&gt;
# Reinstall packages removed prior to resquash from /var/cache/apt/archives&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; That looks like a lot to deal with.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I agree. I&#039;m looking at using dpkg triggers or /etc/apt/apt.conf.d/ hooks to manage this upgrade process. I hope to have something sufficient soon.&lt;br /&gt;
&lt;br /&gt;
I hope to also make a smaller guide that is not optimal in performance, but has way less steps, so the end user can test out the persistence and take the time to &amp;quot;upgrade&amp;quot; the performance later if so inclined.&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
Keep in mind with the USB we can still boot either in &#039;live&#039; mode, or &#039;persistence&#039; mode depending on the GRUB entry we choose. This is useful in case something breaks in &#039;persistence&#039; mode, like libc was upgraded in &#039;persistence&#039; but libc on &#039;live&#039; is still old! This will result in segmentation faults... a kernel panic, or whatever, it won&#039;t boot. We can access all of the software in the squashfs in &#039;live mode&#039;. Eventually I&#039;d like to write an apt hook to prevent the update of libc unless the system is prepared (&#039;toram&#039;, and &#039;live&#039; partition is mounted rw, the hook won&#039;t trigger unless &#039;persistence&#039; kernel parameter is used).&lt;br /&gt;
&lt;br /&gt;
Debian&#039;s live-boot scripts will put stuff in /lib/live/, and /lib/live/mount is of particularly good use in troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Ubuntu is a bit of a can of worms from my perspective as a fan of vanilla Debian. So... hopefully things will go smoothly... I highly recommend a lighter-weight environment for USB persistence, but I understand everyone has their preferences.&lt;br /&gt;
&lt;br /&gt;
Since &#039;toram&#039; puts the squashfs into memory, lets say you have 8GB RAM and an 800MB squashfs, that is fine, but say you move to a workstation with only 2GB RAM, you will probably want to remove the &#039;toram&#039; kernel parameter, things will be slower but the memory footprint used by the OS will be less, and only use &#039;toram&#039; when updating the &#039;live&#039; partition as detailed above. Perhaps consider 2 additional GRUB entries, in addition to the two I have listed above, where the 2 additional entries are live and persistence mode without &#039;toram&#039; kernel parameter, and when booting select the entry depending on the amount of RAM the system has.&lt;br /&gt;
&lt;br /&gt;
In the event of a power outage, kernel panic, unsafe shutdown or whatever, the filesystem may have problems you&#039;re warned about on next boot. In this setup, the &#039;live&#039; partition was mounted ro, so it is not possible to have filesystem errors there, but with the &#039;persistence&#039; partition there will likely be errors. So, on next boot we select the &#039;live&#039; mode in grub, and run fsck.ext4 -p /dev/disk/by-label/persistence, and all problems are fixed!&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 06:43, 5 November 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=243176</id>
		<title>Talk:OSE Linux Persistence</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=243176"/>
		<updated>2021-01-29T18:27:54Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Edit grub.cfg */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://en.m.wikipedia.org/wiki/UNetbootin claims to have a persistence option for ubuntu distros. I couldn&#039;t get it to work. --[[User:Dorkmo|Dorkmo]] ([[User talk:Dorkmo|talk]]) 19:33, 14 July 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==Andrewusu&#039;s Thoughts==&lt;br /&gt;
I&#039;ve used persistence on USB for over 10 years now as my primary system (4+ hours/day) and will share some thoughts. Way back with USB2 I spent a lot of time investigating performance, ways to speed up boot time and system responsiveness. Keep in mind benchmarks of any flash memory device, where sequential reading is [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 10-20x] faster than non-sequential reads (possibly more depending on the device). By following this setup I describe below you take advantage of those fast reads for a quick boot and a very responsive OS.&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/JdnA6LblqOE Here] is a video of a minimal Debian distro on a live-boot persistence USB booting. By 35s system uptime I have launched both the terminal and filesystem browser.&lt;br /&gt;
&lt;br /&gt;
It has been great, I can move my programs, data, and OS from workstation to workstation with a breeze. From a desktop to a laptop, a library computer, or computer at work at times even. I&#039;ll never going back to installing Linux on a HDD. I use HDDs on workstations for storing data, or even making a ~8GB swap file if I need more system memory for some big task (e.g. big FreeCAD model).&lt;br /&gt;
&lt;br /&gt;
I don&#039;t use unetbootin, ISOs, or any other setups, just [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#547 Debian&#039;s live-boot]  and a &#039;persistence&#039; partition.&lt;br /&gt;
&lt;br /&gt;
On Ubuntu an alternative to live-boot is casper, which supports more options I believe. The [https://manpages.debian.org/buster/live-boot-doc/live-boot.7.en.html &#039;boot=live&#039;] kernel parameter results in live-boot being used, while the [http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html &#039;boot=casper&#039;] kernel parameter results in casper being used. With casper the default labeling of the persistence partition is &#039;casper-rw&#039; instead of &#039;persistence&#039; with live-boot.&lt;br /&gt;
&lt;br /&gt;
It is very simple, you have the second partition labeled &#039;persistence&#039; with a configuration file, and Debian&#039;s live-boot scripts handle everything.&lt;br /&gt;
&lt;br /&gt;
===live-boot Squashfs/Persistence===&lt;br /&gt;
[[File:LinuxUSBPersistencePartitions.png]]&lt;br /&gt;
* &#039;live&#039; partition contains the squashfs, initrd and vmlinuz in /live. Can only be mounted ro unless &#039;toram&#039; kernel parameter used.&lt;br /&gt;
* &#039;persistence&#039; partition is mounted rw.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;&lt;br /&gt;
# With a squashfs/persistence install instead of a full install to USB, you&#039;ll see a much faster boot, because the &#039;live&#039; partition is compressed ([https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html squashfs]) and is thus sequentially read into memory faster compared to random reads of various uncompressed files from the USB as they&#039;re needed during the boot process. Mine boots within 20 or so seconds.&lt;br /&gt;
# When running the system with day to day tasks, the performance and responsiveness of a squashfs/persistence setup is better than a full install, because the squashfs may be loaded to memory ([https://manpages.debian.org/jessie/live-boot-doc/live-boot.7.en.html toram]) occupying around 600-800MB RAM, and is thus not a bottleneck on reads/writes to the USB slowing the system down like you&#039;d see in a full install to USB. This translates into better framerate playing games like Starcraft 2, which I&#039;ve run from this flash drive, and a more responsive system in general (to mouse clicks, key presses, etc).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Limitations:&#039;&#039;&#039;&lt;br /&gt;
# A 64-bit install won&#039;t work on a 32-bit machine&lt;br /&gt;
# A USB with /etc/X11/xorg.conf set to use an NVIDIA GPU driver won&#039;t be as mobile:&lt;br /&gt;
## e.g. Will not boot graphically on an Intel GPU system but to a [https://en.wikipedia.org/wiki/Virtual_console virtual console].&lt;br /&gt;
## This can be mitigated by editing xorg.conf while on the Intel system&#039;s virtual console and rebooting to get the graphical interface. Or possibily without rebooting with some wizardry like rmmod and then startx, but I don&#039;t recall off the top of my head. And you have to redo this in reverse going back to the NVIDIA system. Maybe this is just a limitation of proprietary GPU drivers.&lt;br /&gt;
# Copy-on-write [https://superuser.com/questions/833576/differences-of-aufs-unionfs-and-overlayfs-from-each-other aufs/overlayfs] (whetever distro has chosen) has some limitations:&lt;br /&gt;
## Read-only &#039;live&#039; partition needs to be updated whenever libc or linux-image are updated, or the system won&#039;t boot. So it needs to be mounted read-write and in order to do so &#039;toram&#039; kernal boot parameter must be used. I work around this problem manually via inspecting apt output before installing anything, but this chore can be mitigated via an apt hook which I&#039;ve not written yet.&lt;br /&gt;
## &#039;live&#039; partition containing the squashfs should only have packages which are not updated often, being core packages, and not something like firefox which is updated often. This will minimize the size of the squashfs.&lt;br /&gt;
## When Debian stable is updated to the next revision, the linux-image must be updated, and the squashfs recompressed. To do this, all non-core packages must be removed, the distro upgraded, the squashfs recompressed, and then non-core packages reinstalled. This can also be scripted and I have some non-robust helper scripts I&#039;ve written.&lt;br /&gt;
# Flash memory has limitations, where sequential writes are [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 5000x-10000x] faster than random writes. Due to this, there should always be at least 2GB free on the &#039;persistence&#039; filesystem, or else risk files becoming fragmented and the any application blocking on reads/writes will &#039;&#039;&#039;hang&#039;&#039;&#039; from &#039;&#039;&#039;very slow&#039;&#039;&#039; reading and writing. In this circumstance it may be a number of minutes before such applications respond again, but you&#039;re free to use this time to do other things with already opened applications, like use the web browser or read opened documents.&lt;br /&gt;
&lt;br /&gt;
I personally use a lightweight Debian distro (not Ubuntu!) to minimize RAM footprint, minimize squashfs size, and maximize responsiveness. It is all instantaneous on USB3 (was a bit sluggish on USB2 on an older 4GB stick when I first started). I recommend at least a 32GB stick.&lt;br /&gt;
&lt;br /&gt;
Once the apt hook is implemented and distro-upgrade script polished, this should be a very nice option for interested users.&lt;br /&gt;
&lt;br /&gt;
There are tons of persistence guides, which unfairly dismiss this live-boot squashfs/persistence setup because they don&#039;t know how to mitigate/handle the upgrade problem as I do, because making a squashfs is not something well known which requires a lot of plumbing. Or they suggest other unnecessarily complex setups or make suggestions without having investigated performance implications (e.g. suggesting a full install to USB).&lt;br /&gt;
&lt;br /&gt;
I do not recommend modern Samsung, Sandisk, or any other cheap off-brands for this &amp;quot;heavy&amp;quot; use. Good chance they&#039;ll fail within a year and be too hot to touch. &#039;&#039;&#039;Buy from Toshiba/Kioxia&#039;&#039;&#039;, the inventors of flash memory. Yes their [https://www.amazon.com/Toshiba-TransMemory-U364-USB3-0-THN-U364W0320A4/dp/B078NPLXGC#customerReviews performance] as shown in benchmarks isn&#039;t as good, nor are they inexpensive, but they are reliable and will last years. &#039;&#039;&#039;Do not&#039;&#039;&#039; skimp to save a few $ buying a Sandisk/Samsung on a sale for this use-case, I&#039;m speaking from experience!&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&#039;&#039;&#039;Pros:&#039;&#039;&#039;&lt;br /&gt;
# Sure it may be useful if for example, you forget the drive in an internet cafe or library. Or have something you don&#039;t want to turn up in investigation.&lt;br /&gt;
&#039;&#039;&#039;Cons:&#039;&#039;&#039;&lt;br /&gt;
# It costs additional CPU &amp;amp; energy usage.&lt;br /&gt;
# Encryption offers zero &amp;quot;online&amp;quot;/mounted protection, e.g. encryption does not protect against a web browser vulnerability allowing disk access. Mental energy would be better spent on [https://wiki.archlinux.org/index.php/security &#039;hardening&#039;] the system.&lt;br /&gt;
# Harder to recover data when things break. &#039;&#039;Big&#039;&#039; headache.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 20:40, 4 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I will write more thoughts, I see this is an ongoing need/interest [[OSE_Linux_Log]]. Today I have ordered two Toshiba USB flash drives. I will write a guide here for preparing any Debian distro for USB persistence with optimal performance (squashfs &amp;amp; persistence partition) for interested readers.&lt;br /&gt;
&lt;br /&gt;
==GUIDE==&lt;br /&gt;
This guide will first make a live USB stick persistent.&lt;br /&gt;
&lt;br /&gt;
In the appendix will be additional knowledge and procedures to make it perform better.&lt;br /&gt;
&lt;br /&gt;
Brief steps:&lt;br /&gt;
#Make live USB&lt;br /&gt;
##Partition the USB.&lt;br /&gt;
##Mount the ISO, and copy select files to the USB&#039;s live partition.&lt;br /&gt;
##Install grub.&lt;br /&gt;
#Make the live USB a persistent USB&lt;br /&gt;
##Boot to live USB &amp;amp; Setup persistence.&lt;br /&gt;
&lt;br /&gt;
===Make live USB===&lt;br /&gt;
You can follow a different guide and then run the command `live-persistence`. Then when it comes time to upgrade libc or the kernel you can run `live-toram`, then follow the squash guide below.&lt;br /&gt;
&lt;br /&gt;
But here is the way I&#039;d do it.&lt;br /&gt;
====Partition the USB====&lt;br /&gt;
Use gparted. Make a GPT partition, with 16MB unused.&lt;br /&gt;
&lt;br /&gt;
Make live partition 1GB is fine. Big enough to fit the squashfs, vmlinuz, and initrd files from the ISO. Label it &#039;live&#039;, or whatever you want.&lt;br /&gt;
&lt;br /&gt;
Make persistence partition filling up the remainder. Label it &#039;peristence&#039;, or whatever you want, but you&#039;ll have to use the label you use in the grub.cfg later.&lt;br /&gt;
&lt;br /&gt;
Now make a small partition at least 1MB big into the 16MB unused space at the start. Don&#039;t format it with a filesystem, leave it unformatted. This is where GRUB installs stuff into.&lt;br /&gt;
====Mount the ISO, and copy select files to the USB&#039;s live partition====&lt;br /&gt;
Yep, copy the squashfs, vmlinuz, and initrd to /live on the live partition, e.g. /media/live/live&lt;br /&gt;
Easy peasy.&lt;br /&gt;
====Install grub====&lt;br /&gt;
Should go to /media/live/grub&lt;br /&gt;
&lt;br /&gt;
Boot to the USB! It is live!&lt;br /&gt;
===Make the live USB a persistent USB===&lt;br /&gt;
While you&#039;re booted to the live USB, mount the persistence partition, and put a peristence.conf file on it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; | sudo tee /media/peristence/persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, read the short manual on live-tools. And type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
man live-tools&lt;br /&gt;
live-peristence&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Neat, all your files you&#039;re using in the live USB, are now saved to the persistence partition. Though, we have to write a few changes to grub.cfg in order to load that stuff on next boot.&lt;br /&gt;
====Edit grub.cfg====&lt;br /&gt;
&lt;br /&gt;
See appendix: [[Talk:OSE_Linux_Persistence#Either_.281.29_Handcraft_grub.cfg]]&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
This guide seeks a USB stick with optimal performance, which requires a minimal squashfs.&lt;br /&gt;
&lt;br /&gt;
If USB space and performance are not concerns for you, you&#039;re welcome to modify an existing live USB, name a 2nd partition &amp;quot;persistence&amp;quot;, add suitable kernel parameters including &amp;quot;persistence&amp;quot;, and write a persistence.conf file containing &amp;quot;/ union&amp;quot; in the persistence partition. You can understand necessary details by understanding the guide below. Boot time may take a minute or longer, and applications may be slow and hang due to limitations of flash media which this guide seeks to minimize.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s proceed with making the USB with optimal performance.&lt;br /&gt;
&lt;br /&gt;
===Some notes on flash media===&lt;br /&gt;
The first partition should start after some multiple of the medium&#039;s [https://lwn.net/Articles/428584/ erase block]. The erase block size might be published by the manufacturer, or reasoned about via [https://github.com/bradfa/flashbench benchmarking]. However SSDs and modern USB sticks use more sophisticated controllers so flashbench [https://lists.linaro.org/pipermail/flashbench-results/2016-December/000599.html won&#039;t provide the necessary insights]. So starting the first partition at a 16MiB or 32MiB offset would be a reasonable choice, being some multiple of the erase block.&lt;br /&gt;
&lt;br /&gt;
When considering the [https://superuser.com/questions/379074/how-to-correctly-partition-usb-flash-drive-and-which-filesystem-to-choose-consid stride and stripe-width] parameters I&#039;m not sure it makes a difference anymore with more sophisticated controllers.&lt;br /&gt;
&lt;br /&gt;
On the flash media, writing is slow, so modern ones typically have a faster volatile cache, which is then written to the non-volatile flash memory. So when you write a large file to the medium, and it appears to finish via the command completing, but in reality it won&#039;t be done for some time. This is why writing speed appears to slow down in benchmarking the longer the write goes, from say 20MB/s to 4MB/s, this is due to the volatile cache filling up. ext4 when writing the journal uses a &amp;quot;barrier&amp;quot; somehow implemented, and usually implemented by the USB driver/device where the command blocks until the write is actually written to non-volatile memory, but I think this feature isn&#039;t exposed by ext4 for use in benchmarking. This is something to be cautious about before shutting down the system, leave the system idle for about 30-60 seconds after shutting down the browser or other write activity before powering down the system, as it is possible the write is still transferring from the volatile cache to non-volatile memory, and the OS doesn&#039;t know better, as we&#039;d disabled ext4 journalling for performance and longevity reasons, and it has been my experience that linux doesn&#039;t wait for the non-volatile write to finish anyway on shutdown, printing write errors on shutdown if this is the case. If this happens, then run a fsck on next boot, we&#039;ll make the Grub entry later to make running fsck convenient to best fix the consistency problems.&lt;br /&gt;
&lt;br /&gt;
===Partitioning===&lt;br /&gt;
A GPT partition table is fine, as is an MBR partition table.&lt;br /&gt;
&lt;br /&gt;
If doing GPT then make a small unformatted partition in the 16MiB or 32MiB offset before the live partition. It only needs to be 1MiB, but can be larger. Set the &#039;boot_grub&#039; flag on it in gparted. Grub will install to it later in this guide.&lt;br /&gt;
&lt;br /&gt;
Here is my example command of how I made the ext4 filesystem for the live partition. The option ^has_journal disables the journal, important for flash memory longevity. Determine which partition to run mkfs.ext4 on, mine is /dev/sdd1 and /dev/sdd2.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -N 2048 -L live -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;yourpartition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to do an EFI system partition (ESP), then have this also be the live partition, which we use as our &amp;quot;/boot&amp;quot; partition. This must be FAT32 instead of ext4 unfortunately. Set the &#039;esp&#039; flag on the live partition in gparted. When we install GRUB later, it will install EFI files to the live partition.&lt;br /&gt;
&lt;br /&gt;
And for the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -L persistence -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;your partition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare squashfs===&lt;br /&gt;
Download ISO of desired debian distro (e.g. OSE Linux). Put it at /tmp/&lt;br /&gt;
&lt;br /&gt;
chroot just uses your current Kernel. That&#039;s just how it works. Because of this it is best if the kernel of the system you&#039;re running to be the most recent available for the distro release of the ISO (e.g. for me [https://packages.debian.org/buster/linux-image-amd64 linux-image-4.19.0-13-amd64] as of this writing). If this isn&#039;t possible, boot to the ISO and skip to the [[Talk:OSE_Linux_Persistence#Remove_non-core_packages]] instructions without doing the chroot. You can do this all on a single USB stick if you do it correctly. Or you could use [https://help.ubuntu.com/community/DebootstrapChroot] or virtualization, lots of possibilities outside the scope of this guide.&lt;br /&gt;
&lt;br /&gt;
Actually now that I think about it writing the guide following the live USB installation without doing the chroot may be best, being more generalized and perhaps easier. I will rewrite this guide that way in the future, but for now, here are the chroot directions.&lt;br /&gt;
&lt;br /&gt;
====prepare chroot filesystem====&lt;br /&gt;
Let us continue with the chroot assuming we&#039;re running the same distro/kernel. Mount the ISO, and look for filesystem.squashfs, initrd.img, vmlinuz on it. Also note the location of config, System.map and filesystem.packages.xz, we&#039;ll copy or make these to follow convention.&lt;br /&gt;
&lt;br /&gt;
Make temporary directories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir /media/filesystem.squashfs /media/iso /media/overlay /media/myadditions /media/myadditions/rw /media/myadditions/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -o loop /tmp/debian-distro-i386.iso /media/iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount filesystem.squashfs on the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t squashfs /media/iso/live/filesystem.squashfs /media/filesystem.squashfs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount an in-memory filesystem to hold temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t tmpfs -o size=1024m none /media/myadditions&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prepare the union filesystem, so that we&#039;re able to edit the squashfs on the iso and compress the result. We can use either [https://wiki.archlinux.org/index.php/Overlay_filesystem overlayfs] or aufs. Here is the overlayfs command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t overlay overlay -o lowerdir=/media/filesystem.squashfs,upperdir=/media/myadditions/rw,workdir=/media/myadditions/work /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or afus. overlayfs hasn&#039;t been widely available until kernel 3.18, and aufs is available on earlier kernels (from [https://sourceforge.net/p/aufs/aufs3-standalone/ci/f88513f985e153aaf3e2950622c2a2329c3c3f8f/log/ kernel 3.9 late 2014 aufs supports xattr]) via aufs-tools, and their may be some differences I&#039;m not aware of but I think the concensus is that overlayfs is better. Hopefully aufs supports extended attributes (xattr) good enough to not loose said attributes, which are important for hardening the system (extended attributes are I believe where [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities] are stored/configured).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t aufs -o br=/media/myadditions=rw -o br=/media/filesystem.squashfs=ro -o udba=reval none /media/overlay/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====chroot====&lt;br /&gt;
Prepare the chroot, so that we can run apt within it and remove packages. resolv.conf and mount binds are to remove error/warning messages when installing packages with apt.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp /etc/resolv.conf /media/overlay/etc/resolv.conf&lt;br /&gt;
sudo mount --bind /dev/ /media/overlay/dev/&lt;br /&gt;
sudo mount --bind /dev/pts /media/overlay/dev/pts #https://wiki.debian.org/chroot#A.2Fdev.2Fpts&lt;br /&gt;
sudo mount --bind /proc /media/overlay/proc&lt;br /&gt;
sudo mount --bind /sys /media/overlay/sys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now chroot into the squashfs so we can use apt within it to remove packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chroot --userspec root:root /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the locale, you&#039;ll get many warning messages in apt otherwise. You probably want to select UTF-8 for your country/language, for example I picked en_US.UTF-8. Press space bar to toggle each locale you want generated, then press enter to proceed. Then it asks if you want the locales you chose to be applied systemwide, forcing your selection on each user, which may be desired for desktop software which starts up before the user-specific ~/.profile is read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure locales&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And set the timezone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure tzdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If /boot exists, then back it up, we&#039;re replacing /boot with a symlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /boot /boot.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must make a symlink so that as we work with apt-get, it may call `live-update-initramfs -u`, and we need those updates to /boot to go to the proper location, the &#039;live&#039; partition&#039;s /live:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /lib/live/mount/medium/live /boot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve not yet made the live partition, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If already have the live partition ready, or like me are updating an existing live partition&#039;s squashfs, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
mkdir /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have to do the above steps to work around update-initramfs&#039;s logic and assumptions regarding a read/write test that this works around. If you ever run into problems with update-initramfs while using apt-get, this is what you run once the problem is fixed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg --configure initramfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we remove packages, such at btrfs-progs, update-initramfs will be triggered which should update /boot/vmlinuz and /boot/initrd, these files are not compressed into the filesystem.squashfs and we need those files within /live of the live partition to boot.&lt;br /&gt;
&lt;br /&gt;
`man live-boot` is a useful reference, ensure live-boot-doc is installed. Also the [https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html Debian live-manual] is a useful reference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install live-boot-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Remove non-core packages====&lt;br /&gt;
&lt;br /&gt;
Now we gut the filesystem.squashfs from the iso of packages that:&lt;br /&gt;
* We don&#039;t want.&lt;br /&gt;
* Are frequently updated (e.g. web browser).&lt;br /&gt;
* With particular scrutiny of packages that are large.&lt;br /&gt;
* Are not necessary to boot to a desktop.&lt;br /&gt;
All of those can they can go onto persistence partition. We remove them now, and install them after the squashfs has been made, or as needed. Examples of what should be considered &amp;quot;core&amp;quot; packages necessary to boot are: linux-image (this is the kernel), firmware, GPU driver, and X11 server. This way the USB will:&lt;br /&gt;
* Boot fast,&lt;br /&gt;
* The OS running from it will be maximally responsive,&lt;br /&gt;
* Will have minimal memory footprint,&lt;br /&gt;
* And be persistent!&lt;br /&gt;
&lt;br /&gt;
Run this to see packages installed ordered by size, then apt-get remove or purge stuff, and ignore anything beginning with &amp;quot;lib&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W -f &#039;${Installed-Size}\t${Package}\n&#039; | sort -n | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To understand what a package is, you can search [https://packages.debian.org/buster/os-prober packages.debian.org]. If the description there isn&#039;t informative enough, you can try clicking the links on the right hand side such as a project homepage, or looking through the files of the package. Ignore or don&#039;t pay much attention to any package beginning with &amp;quot;lib&amp;quot;, with the exception of things like libc6, but apt will probably warn you about doing something silly like that with the prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
You are about to do something potentially harmful.&lt;br /&gt;
To continue type in the phrase &#039;Yes, do as I say!&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example of stuff I removed from a different Debian distro (BunsenLabs), but I removed some firmware packages so that reduces portability:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get remove -y firefox-esr libjsoncpp1&lt;br /&gt;
apt-get remove -y libreoffice-core libreoffice-common coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1 libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-locale1.67.0 libboost-thread1.67.0 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data libgpgmepp6 liblangtag-common liblangtag1 libmhash2 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libnumbertext-data libodfgen-0.1-1 liborcus-0.14-0 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 libstaroffice-0.0-0 libsuitesparseconfig5 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure&lt;br /&gt;
apt-get remove -y firmware-atheros firmware-netronome firmware-iwlwifi firmware-brcm80211 firmware-qlogic firmware-ti-connectivity firmware-myricom firmware-intelwimax firmware-libertas dahdi-firmware-nonfree atmel-firmware firmware-cavium firmware-bnx2x firmware-qcom-media firmware-netxen firmware-samsung firmware-ipw2x00 firmware-siano firmware-ivtv firmware-bnx2&lt;br /&gt;
apt-get remove -y samba-libs libavahi-glib1 libcdio-cdda2 libcdio-paranoia2 libgd3 libgdata-common libgdata22 libgoa-1.0-0b libgoa-1.0-common libgphoto2-6 libgphoto2-port12 libldb1 liblmdb0 liboauth0 libpython2.7 libtalloc2 libtevent0 libwbclient0 python-talloc&lt;br /&gt;
apt-get remove -y fonts-noto-core fonts-noto-cjk papirus-icon-theme bunsen-papirus-icon-theme gnome-icon-theme gdebi-core gir1.2-vte-2.91 python3-apt python3-chardet python3-debian python3-pkg-resources&lt;br /&gt;
rm -r /usr/share/gdebi/GDebi /usr/lib/python3/dist-packages/aptsources /usr/lib/python3/dist-packages/apt/progress /usr/lib/python3/dist-packages/debian_bundle /usr/lib/python3/dist-packages/debian /usr/lib/python3/dist-packages/chardet/cli /usr/lib/python3/dist-packages/pkg_resources/extern /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging&lt;br /&gt;
apt-get remove -y evince synaptic bubblewrap evince-common gnome-desktop3-data libbrotli1 libdjvulibre-text libdjvulibre21 libept1.5.0 libevdocument3-4 libevview3-3 libgnome-desktop-3-17 libgspell-1-1 libgspell-1-common libgxps2 libharfbuzz-icu0 libhyphen0 libjavascriptcoregtk-4.0-18 libkpathsea6 libspectre1 libsynctex2 libwebkit2gtk-4.0-37 libwebpdemux2 libwoff1 xdg-dbus-proxy zenity zenity-common&lt;br /&gt;
apt-get remove -y vlc libaribb24-0 libbasicusageenvironment1 libcddb2 libdvbpsi10 libebml4v5 libgles2 libgroupsock8 libixml10 liblirc-client0 liblivemedia64 liblua5.2-0 libmad0 libmatroska6v5 libmtp-common libmtp9 libnfs12 libopenmpt-modplug1 libplacebo7 libprotobuf-lite17 libqt5x11extras5 libresid-builder0c2a libsdl-image1.2 libsdl1.2debian libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libxcb-xv0 vlc-bin vlc-data vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output vlc-plugin-notify libvlccore9&lt;br /&gt;
apt-get remove -y file-roller p7zip-full p7zip libarchive13 libnautilus-extension1a xfburn libburn4 libexo-1-0 libisofs6 libjte1 unar gnustep-base-common gnustep-base-runtime gnustep-common libgnustep-base1.26 libobjc4&lt;br /&gt;
apt-get remove -y transmission-gtk libevent-2.1-6 libminiupnpc17 libnatpmp1 transmission-common filezilla filezilla-common libfilezilla0 libpugixml1v5 libwxbase3.0-0v5 libwxgtk3.0-0v5 yudit-common feh&lt;br /&gt;
apt-get remove -y libpython2.7-stdlib libblas3 libgfortran5 libkeybinder0 liblapack3 libpython2.7-minimal libsodium23 lua-bit32 lua-expat lua-penlight lua-posix lua-socket lua5.2 python-apt-common python-minimal python2-minimal python2.7-minimal libavformat58 libmysofa0 libnorm1 libpgm-5.2-0 libpostproc55 librubberband2 libssh-gcrypt-4 libswscale5 libvidstab1.1&lt;br /&gt;
apt-get remove -y aptitude aptitude-common libboost-iostreams1.67.0 libboost-system1.67.0 libcwidget3v5 libxapian30 ristretto file libmagic-mgc libmagic1 hexchat-common&lt;br /&gt;
apt-get install wpasupplicant network-manager --no-install-recommends&lt;br /&gt;
#modem support&lt;br /&gt;
apt-get remove -y modemmanager libmbim-glib4 libmbim-proxy libqmi-glib5 libqmi-proxy openssh-client libxatracker2 nitrogen libgtkmm-2.4-1v5 lvm2 dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 nano geany geany-common ghostscript poppler-data libcupsimage2 libgs9-common libijs-0.35 libjbig2dec0 libpaper1 pcmciautils vdpau-va-driver arandr&lt;br /&gt;
apt-get remove -y intel-microcode iucode-tool va-driver-all i965-va-driver xserver-xorg-video-intel libxvmc1 intel-media-va-driver libigdgmm5 xserver-xorg-video-qxl btrfs-progs cryptsetup-initramfs cryptsetup-bin cryptsetup-run&lt;br /&gt;
apt-get remove -y python3.7-minimal dconf-cli distro-info-data gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-pango-1.0 libfm-extra4 libgirepository-1.0-1 libmenu-cache-bin libmenu-cache3 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libxslt1.1 mime-support wmctrl&lt;br /&gt;
rm -r /usr/lib/python3&lt;br /&gt;
apt-get remove -y iso-codes liba52-0.7.4 libaa1 libass9 libatomic1 libavc1394-0 libavfilter7 libavformat58 libbs2b0 libcaca0 libcdio18 libcdparanoia0 libchromaprint1 libdc1394-22 libdca0 libde265-0 libdv4 libdvdnav4 libdvdread4 libfaad2 libfftw3-double3 libflite1 libfluidsynth1 libgme0 libgssdp-1.0-3 libgstreamer1.0-0 libgupnp-1.0-4 libgupnp-igd-1.0-4 libiec61883-0 libilmbase23 libkate1 liblilv-0-0 libmjpegutils-2.1-0 libmms0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa0 libnice10 libnorm1 libofa0 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr23 libopenmpt0 libpgm-5.2-0 libpoppler-glib8 libpoppler82 libpostproc55 libraw1394-11 librubberband2 libsbc1 libserd-0-0 libshout3 libsidplay1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libspandsp2 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libswscale5 libtumbler-1-0 libv4l-0 libv4lconvert0 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvulkan1 libwildmidi2 libzbar0 libzmq5 tumbler-common&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, much of what was removed can be installed again after persistence is set up. These packages are conveniently listed as removed within dpkg utilities, I&#039;ll illustrate how to conveniently reinstall them later.&lt;br /&gt;
&lt;br /&gt;
====Misc setup tips====&lt;br /&gt;
&lt;br /&gt;
[https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#521 One important consideration is that the live user is created by live-boot at boot time]. We need to ensure the live user is set up. Inspect the contents of /etc/live/ for any configuration files. If there is none in your distribution then let&#039;s make it, and feel free to customize this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/config.conf.d/10-user-setup.conf&lt;br /&gt;
LIVE_HOSTNAME=debian-persistence&lt;br /&gt;
LIVE_USERNAME=user&lt;br /&gt;
LIVE_USER_FULLNAME=&amp;quot;Debian LiveUser&amp;quot;&lt;br /&gt;
LIVE_USER_DEFAULT_GROUPS=&amp;quot;cdrom floppy audio dip video plugdev fuse bluetooth netdev scanner staff&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These options to live-boot will minimize the generated initramfs size:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/boot.conf&lt;br /&gt;
#man live-boot&lt;br /&gt;
#see /usr/share/initramfs-tools/hooks/live, might make initrd smaller&lt;br /&gt;
DISABLE_CDROM=true&lt;br /&gt;
DISABLE_FAT=true&lt;br /&gt;
DISABLE_FUSE=true&lt;br /&gt;
DISABLE_NTFS=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Performance tips====&lt;br /&gt;
&lt;br /&gt;
USB sticks use flash memory, and to maximize performance with it we can [https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler change the IO scheduler for such devices].&lt;br /&gt;
&lt;br /&gt;
BFQ looks like a nice scheduler. Quote:&lt;br /&gt;
&amp;quot;Regardless of the actual background workload, BFQ guarantees that, for interactive tasks, the storage device is virtually as responsive as if it was idle. [...] As a comparison, with CFQ, NOOP or DEADLINE, and in the same conditions, applications experience high latencies, or even become unresponsive until the background workload terminates (also on SSDs).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mq_deadline is fine while the system is booting. The scheduler in use can also be [https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers tuned], but I need to do more research before giving advice on tuning in this context. To [https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler setup/enable]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/modules-load.d/bfq.conf&lt;br /&gt;
bfq&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set bfq scheduler during startup. Alternatives include mq_deadline and none, either might be faster than bfq during startup when GUI application responsiveness isn&#039;t important, but I&#039;d need to do some research/experiments.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/udev/rules.d/60-ssd-scheduler.rules&lt;br /&gt;
# set bfq scheduler for non-rotating disks during startup&lt;br /&gt;
ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;sd[a-z]&amp;quot;, ATTR{queue/rotational}==&amp;quot;0&amp;quot;, ATTR{queue/scheduler}=&amp;quot;bfq&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use [https://wiki.archlinux.org/index.php/profile-sync-daemon profile-sync-daemon] to enhance performance of the browser, and minimize flash memory writes (maximize longevity).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install profile-sync-damon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For SD card longevity, consider mounting a tmpfs on /var/log. But perhaps only after you&#039;ve booted to the system a few times and verify the system is stable, as putting log files in RAM means they can&#039;t be read offline to diagnose a problem. So disable this feature if needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /var/log tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/tmpfiles.d/varlog.conf&lt;br /&gt;
d /var/log/apt 755 root root&lt;br /&gt;
d /var/log/lightdm 711 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vlc&#039;s default lookahead is too short, leads to music cutting out. &#039;Tools-&amp;gt;Preferences&#039;, toggle &#039;Show all settings&#039;, click &#039;Input/Codecs&#039; in tree view, scroll down to &#039;Advanced&#039; section and look at caching settings. Increase them to at least 600ms. This should largely mitigate problems with music/video stopping momentarily due to I/O delays.&lt;br /&gt;
&lt;br /&gt;
====Pruning tips====&lt;br /&gt;
Install deborphan and localepurge to help clean stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install deborphan localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you&#039;re done pruning things, run deborphan and remove things it tells you to as you desire. Deborphan helps you find &amp;quot;orphan&amp;quot; packages not needed by anything else, which take up space. Such orphaned packages may have been necessary by a previously installed package.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
deborphan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next run localepurge to remove space consuming files for locales you&#039;ll never use, I removed 160MB from my system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, clear out apt temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get autoremove&lt;br /&gt;
apt-get clean&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend vim.tiny over vim, vim.tiny much smaller, also install whatever else your heart desires that is small and infrequently updated. Such small utilities will be available in &#039;live&#039; mode (if installed when in &#039;persistence&#039; mode, it won&#039;t be available in plain &#039;live&#039; mode):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install vim-tiny&lt;br /&gt;
echo &amp;quot;set nocp&amp;quot; &amp;gt;&amp;gt; /etc/vim/vimrc.tiny #Allows arrow keys to work, and vim.tiny to act like vim instead of vi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Hardening tips====&lt;br /&gt;
&lt;br /&gt;
I think it is best for /tmp to be mounted noexec, but many applications have bugs regarding this&lt;br /&gt;
Double check the /etc/fstab file with a text editor after editing /etc/fstab:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /tmp tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mount /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often apt packages during installation will require the ability to execute temporary files on /tmp, this is how we allow this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/apt/apt.conf.d/50remount&lt;br /&gt;
DPkg::Pre-Install-Pkgs {&amp;quot;mount -o remount,exec /tmp&amp;quot;;};&lt;br /&gt;
DPkg::Post-Invoke {&amp;quot;mount -o remount /tmp&amp;quot;;};&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A common thing people do, is charge their android phone, or other USB device via a USB port on the computer. Realize that this is physical access, which a compromised device may use to log in to Linux via root. I suspect I had fallen victim to in the past, a keylogger following a pattern I&#039;d seen exhibited in the news, which I believe came after I&#039;d plugged in a new android I had run questionable rooting software on, to my computer. I suggest both setting a root password, and disallowing this access, by editing /etc/securetty and commenting out root access via UART serial ports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# UART serial ports&lt;br /&gt;
#ttyS0&lt;br /&gt;
#ttyS1&lt;br /&gt;
#ttyS2&lt;br /&gt;
#ttyS3&lt;br /&gt;
#ttyS4&lt;br /&gt;
#ttyS5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the [https://www.debian.org/doc/manuals/securing-debian-manual/ch03s04.en.html root password]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What has piqued my interest lately is [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities]. Debian distributions should include both [https://packages.debian.org/buster/libcap2 libcap2] and [https://packages.debian.org/buster/libcap-ng0 libcap-ng0 (RedHat&#039;s fork)]. And I&#039;m looking for a more convenient open-source means of administration. What has me interested in the idea of a [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html proactive defense against root-kits] by removing module loading capabilities (CAP_SYS_MODULE) even for the root user, after the system had booted. It appears that lcap is no longer functional, it and many capabilities articles detail a system-wide capability bounding set in pre-2.6.25 kernels, but since kernel 2.6.25 capability bounding sets are now per-thread. The [http://people.redhat.com/sgrubb/libcap-ng/ images here] may help visually explain capabilities and their inheritance. What I have in mind may be within a custom /etc/init.d/ script calling [https://man7.org/linux/man-pages/man2/capset.2.html setcap] on init (pid 1) to remove the CAP_SYS_MODULE capability from the bounding set system-wide. The capabilities on any process can be viewed with `cat /proc/&amp;lt;pid&amp;gt;/status`.&lt;br /&gt;
&lt;br /&gt;
Something else that can be done is use of more than one account, for example an account dedicated to web browsing with minimal privileges, and an account with administration privileges (sudo, member of staff,adm groups).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser browser&lt;br /&gt;
dm-tool switch-to-user browser #with LightDM desktop manager: https://wiki.ubuntu.com/LightDM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files downloaded with the browser can be transfered to other users via /tmp, which is a good place to set as the default location to download files in the browser settings anyway.&lt;br /&gt;
&lt;br /&gt;
With this separation of user privileges, if malware managed to gained the privileges of the browser account (no privilege escalation), and escaped the browser sandbox, the worst it could do is keylog, delete or encrypt/ransom the browser account&#039;s files. Since the browser account is running on a difference X11 server than an administration account, I think [https://security.stackexchange.com/questions/4641/why-are-people-saying-that-the-x-window-system-is-not-secure/4646 risks] are reduced.&lt;br /&gt;
&lt;br /&gt;
Switching between the administration account and browser account X11 servers can be done with ctrl+alt+F7 or F8 (or F1/F2 or whatever).&lt;br /&gt;
&lt;br /&gt;
Or just have the desktop load with the browser account instead of the administrative account, and do administrative tasks on a virtual terminal (ctrl+alt+F1 through F6).&lt;br /&gt;
&lt;br /&gt;
Set up the [https://www.debian.org/doc/manuals/securing-debian-manual/ch04s11.en.html#id-1.5.14.17 shell history file], .bash_history better. An easy way a bad actor can circumvent the stock configuration from logging his evil deeds is to proceed those evil things with a space, this guide will fix that!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lsattr /home/browser/.bash_history  #See what attributes are set&lt;br /&gt;
sudo chattr +a /home/browser/.bash_history   #Only root user can chattr&lt;br /&gt;
sudo chattr +a /home/user/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Make filesystem.packages and filesystem.squashfs====&lt;br /&gt;
Now that we have a set of &amp;quot;core&amp;quot; packages to go in the squashfs, of minimal size, on the &#039;live&#039; partition, we must make our new squashfs!&lt;br /&gt;
&lt;br /&gt;
Print out a list of &amp;quot;core&amp;quot; packages we have, we&#039;ll need them for reference later. Lets put them in filesystem.packages.xz:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W --showformat=&#039;${Package}\t${Version}\n&#039; | xz &amp;gt; /tmp/filesystem.packages.xz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get -y install squashfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exclude stuff we don&#039;t want in the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXCLUDES=&#039;.wh* dev live-persistence.conf live lost+found media mnt proc .pulse* run home selinux sys tmp* lib/live/mount usr/lib/live/mount var/cache/apt var/cache/apt-xapian-index var/lib/apt/lists var/tmp&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Directives to squashfs-tools to make pseudofiles, necessary to boot. Linux will make many pseudofiles in /dev when it boots, but not all, and through experimentation and observations I&#039;ve come up with this list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /tmp/mksquashfs.pf&lt;br /&gt;
dev d 755 root root&lt;br /&gt;
dev/console c 662 root tty 5 1&lt;br /&gt;
dev/full c 666 root root 1 7&lt;br /&gt;
dev/kmem c 640 root kmem 1 2&lt;br /&gt;
dev/kmsg c 644 root root 1 11&lt;br /&gt;
dev/loop0 b 660 root disk 7 0&lt;br /&gt;
dev/loop1 b 660 root disk 7 1&lt;br /&gt;
dev/loop2 b 660 root disk 7 2&lt;br /&gt;
dev/loop3 b 660 root disk 7 3&lt;br /&gt;
dev/loop4 b 660 root disk 7 4&lt;br /&gt;
dev/loop5 b 660 root disk 7 5&lt;br /&gt;
dev/loop6 b 660 root disk 7 6&lt;br /&gt;
dev/loop7 b 660 root disk 7 7&lt;br /&gt;
dev/mem c 640 root kmem 1 1&lt;br /&gt;
dev/null c 666 root root 1 3&lt;br /&gt;
dev/port c 640 root kmem 1 4&lt;br /&gt;
dev/ptmx c 666 root tty 5 2&lt;br /&gt;
dev/pts d 755 root root&lt;br /&gt;
dev/ram0 b 640 root disk 1 0&lt;br /&gt;
dev/ram1 b 640 root disk 1 1&lt;br /&gt;
dev/ram2 b 640 root disk 1 2&lt;br /&gt;
dev/ram3 b 640 root disk 1 3&lt;br /&gt;
dev/ram4 b 640 root disk 1 4&lt;br /&gt;
dev/ram5 b 640 root disk 1 5&lt;br /&gt;
dev/ram6 b 640 root disk 1 6&lt;br /&gt;
dev/ram7 b 640 root disk 1 7&lt;br /&gt;
dev/ram8 b 640 root disk 1 8&lt;br /&gt;
dev/ram9 b 640 root disk 1 9&lt;br /&gt;
dev/ram10 b 640 root disk 1 10&lt;br /&gt;
dev/ram11 b 640 root disk 1 11&lt;br /&gt;
dev/ram12 b 640 root disk 1 12&lt;br /&gt;
dev/ram13 b 640 root disk 1 13&lt;br /&gt;
dev/ram14 b 640 root disk 1 14&lt;br /&gt;
dev/ram15 b 640 root disk 1 15&lt;br /&gt;
dev/ram16 b 640 root disk 1 16&lt;br /&gt;
dev/random c 644 root root 1 8&lt;br /&gt;
dev/shm d 755 root root&lt;br /&gt;
dev/tty c 662 root tty 5 0&lt;br /&gt;
dev/tty0 c 600 root tty 4 0&lt;br /&gt;
dev/urandom c 644 root root 1 9&lt;br /&gt;
dev/zero c 644 root root 1 5&lt;br /&gt;
home d 755 root root&lt;br /&gt;
media d 755 root root&lt;br /&gt;
mnt d 755 root root&lt;br /&gt;
proc d 755 root root&lt;br /&gt;
run d 755 root root&lt;br /&gt;
run/lock d 1777 root root&lt;br /&gt;
sys d 755 root root&lt;br /&gt;
tmp d 1777 root root&lt;br /&gt;
var/cache/apt d 755 root root&lt;br /&gt;
var/cache/apt/partial d 755 root root&lt;br /&gt;
var/cache/apt/lock f 640 root root echo &amp;quot;&amp;quot;&lt;br /&gt;
var/lib/apt/lists d 755 root root&lt;br /&gt;
var/lib/apt/lists/partial d 755 root root&lt;br /&gt;
var/tmp d 1777 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now make the squashfs, it is compressed with xz compression:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mksquashfs / /tmp/filesystem.squashfs -comp xz -info -always-use-fragments -noappend -wildcards -pf /tmp/mksquashfs.pf -e ${EXCLUDES} &amp;gt; /tmp/mksquashfs.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/tmp/mksquashfs.log will contain interesting details, such as the filesystem is now roughly 30% of its uncompressed size.&lt;br /&gt;
&lt;br /&gt;
Hopefully the squashfs you made is around 800MB or less, mine for a different Debian distribution was about 300MB. Let us say your flash drive has 100MB/s sequential read speed, and your &amp;quot;core&amp;quot; filesystem was squashed down to 300MB, which will take 3 seconds to read into memory. How long do you think yours will take to boot?&lt;br /&gt;
&lt;br /&gt;
===Prepare the live partition===&lt;br /&gt;
If you hadn&#039;t yet mounted the live partition to /lib/live/mount/medium earlier in the guide, we need to move files off, then mount it, and move vmlinuz, initrd, and etc onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /lib/live/mount/medium /tmp/&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
cd /lib/live/mount/medium&lt;br /&gt;
mkdir live&lt;br /&gt;
mv /tmp/medium/boot/vmlinuz* live/&lt;br /&gt;
mv /tmp/medium/boot/initrd* live/&lt;br /&gt;
mv /tmp/filesystem.squashfs live/&lt;br /&gt;
mv /tmp/filesystem.packages.xz live/&lt;br /&gt;
#update-initramfs or something else pointed at live/ incorrectly puts grub/unicode.pf2 here, this symlink fixes that:&lt;br /&gt;
ln -s ../boot/grub/ live/grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also copy files like System.map-4.19.0-9-amd64 and config-4.19.0-9-amd64 to /lib/live/mount/medium/live, they should be in /media/overlay/boot.bak and/or /media/iso/live/ (outside the chroot). Or if the kernel is updated then you&#039;ll get these files, corresponding to the new kernel, automatically put in there anyway.&lt;br /&gt;
&lt;br /&gt;
The file named config is a nice reference, it says what flags the kernel was built with, there are a vast number of options.&lt;br /&gt;
This System.map file, stored on the read-only live partition may be useful, for example, finding if your system had been [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html compromised with a rootkit].&lt;br /&gt;
&lt;br /&gt;
===Prepare GRUB on the live partition and USB device===&lt;br /&gt;
&lt;br /&gt;
The introduction of UEFI hardware complicates things. You&#039;re welcome to modify the instructions below if you desire to support UEFI functionality on such consumer hardware. The instructions below handles computers with [https://wiki.archlinux.org/index.php/GRUB#BIOS_systems traditional BIOS], with a [https://wiki.archlinux.org/index.php/Partitioning#Master_Boot_Record traditional MBR], as well as UEFI hardware which supports such &amp;quot;legacy&amp;quot; standards. &lt;br /&gt;
&lt;br /&gt;
From within the chroot, install non-uefi grub (grub-pc), and --no-install-recommends will result in os-prober not being installed. I think os-prober is workstation-specific and not useful to configure a USB device which may move between workstations. grub-pc will ask two questions, don&#039;t select anything and enter on Ok on the first, and press enter on Yes on the next to continue without --exclude.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install grub-pc --no-install-recommends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find your live partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -l /dev/disk/by-label/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say it is /dev/sdd1. Then we use the device /dev/sdd in the command below.&lt;br /&gt;
&lt;br /&gt;
Install grub, to both the USB device and the live partition on the USB device. Where /dev/sdd below is the USB device (not a partition), and /lib/live/mount/medium is where the live partition is mounted:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-install --target=i386-pc --root-directory=/lib/live/mount/medium /dev/sdd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now grub needs a configuration file. We can either craft one by hand or use grub-mkconfig, but grub-mkconfig doesn&#039;t really support this use-case.&lt;br /&gt;
&lt;br /&gt;
====Either (1) Handcraft grub.cfg====&lt;br /&gt;
What follows is my legacy grub.cfg, which should work but I hope to make something workable within the newer /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Make sure to fill in this template /lib/live/mount/medium/boot/grub/grub.cfg on &#039;live&#039; partition with your appropriate UUIDs. The partitions you made will have unique UUIDs. You can determine which is which on your system by comparing `ls -l /dev/disk/by-uuid/` and ls -l `/dev/disk/by-label/`.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;LABELorGPTname&amp;quot; to the label or GPT name of your persistence partition. I labeled mine &amp;quot;u365-persistence&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Fill in the template with how your vmlinuz and initrd.img are named, which may not have a suffix of &amp;quot;-4.19.0-9-amd64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make note of the kernel parameters used here, such as &#039;toram&#039; and &#039;persistence&#039;. I&#039;m not sure if elevator=as is the optimal choice, feel free to read about it.&lt;br /&gt;
&lt;br /&gt;
You can customize the [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#530 locale, language, and keyboard layout] here via kernel parameters here such as `locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variants=bepo keyboard-model=tm2030usb`, but I think the console-setup package may be required (installed before the squashfs is made), and perhaps these things are fine configured elsewhere.&lt;br /&gt;
&lt;br /&gt;
You can see other things configurable via kernel parameters such as tzdata, and initial username by looking at /lib/live/config/*. But be aware many things are only configured once via /var/lib/live/config/ (remove the relevant file to allow reconfiguration).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
#Enter the UUID of your boot partition (this is where grub and your kernel reside)&lt;br /&gt;
set uuid_grub_boot=dc434800-22ac-4fd4-b6cb-603da325d5d0&lt;br /&gt;
#Enter the UUID of the persistence partition.&lt;br /&gt;
set uuid_os_root=858d963f-8718-4520-83dd-fb89a842e9bd&lt;br /&gt;
#Here we set the grub &amp;quot;root&amp;quot; variable by locating the uuid of the root partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_os_root --set=root&lt;br /&gt;
#Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot&lt;br /&gt;
#Here&#039;s the magic. We test to see if the boot and root partitions have the same UUID.&lt;br /&gt;
#If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.&lt;br /&gt;
if [ $uuid_grub_boot == $uuid_os_root ] ; then&lt;br /&gt;
  set grub_boot=$grub_boot/boot&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
set kernel_parameters_common=&amp;quot;boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot usbcore.autosuspend=-1&amp;quot;&lt;br /&gt;
set kernel_parameters_persistence=&amp;quot;persistence persistence-storage=filesystem persistence-label=LABELorGPTname&amp;quot;&lt;br /&gt;
set myversion=4.19.0-13-amd64&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#With an unsafe shutdown or powerloss the persistence filesystem will have errors,&lt;br /&gt;
#since it has no journaling, we want to run fsck on it once&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence fsck&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence forcefsck&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Live&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Or (2) Generate grub.cfg with grub-mkconfig====&lt;br /&gt;
Again, using the handcrafted grub.cfg above is probably fine, but here are details on how to get grub-mkconfig to work, which geterates grub.cfg from directives in /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Now, /usr/sbin/grub-mkconfig is not robust line 142 &amp;amp; 146 in our context of chroot usage, assumes we&#039;re installing to / device and /boot, and offers no way to configure around the problem, so we change line 142 &amp;amp; 146:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Line 142:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium`&amp;quot;&lt;br /&gt;
# Line 146:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /boot`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium/boot`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy by hand the legacy grub.cfg menu entries I have, with your disk UUIDs into [https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file /etc/grub.d/40_custom].&lt;br /&gt;
&lt;br /&gt;
Now run grub-mkconfig, from within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-mkconfig -o /lib/live/mount/medium/boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmount /lib/live/mount/medium:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unmount /lib/live/mount/medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare the persistence partition===&lt;br /&gt;
And don&#039;t forget to make the persistence.conf file &#039;/ union&#039; on the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#cd to wherever you have mounted your persistence partition, e.g. /media/persistence&lt;br /&gt;
cd /media/persistence&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; &amp;gt; persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From /media/overlay/home grab the OSE Linux stuff in there, and put in /media/persistence/home:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /media/overlay/home /media/persistence/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There may also be other OSE Linux specific things removed by prior purges of non-&amp;quot;core&amp;quot; packages, e.g. in /etc/&lt;br /&gt;
I suppose there may be a way to &amp;quot;diff&amp;quot; those out, and re-add them to the persistence partition after the packages are installed anew. Maybe there is a convenient dpkg way of doing that... diffing and saving the configuration file changes from stock packages instead of purging them? Or is that the difference between apt-get remove and apt-get purge where apt-get remove will only remove stock configuration files leaving modified ones intact? Yes I think that may be right.&lt;br /&gt;
&lt;br /&gt;
===Cleanup===&lt;br /&gt;
Cleanup!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo umount /media/overlay/dev/pts&lt;br /&gt;
sudo umount /media/overlay/dev/&lt;br /&gt;
sudo umount /media/overlay/proc&lt;br /&gt;
sudo umount /media/overlay/sys&lt;br /&gt;
sudo umount /media/overlay/tmp&lt;br /&gt;
sudo umount /media/overlay&lt;br /&gt;
sudo umount /media/filesystem.squashfs&lt;br /&gt;
sudo umount /media/iso&lt;br /&gt;
sudo umount /media/myadditions&lt;br /&gt;
sudo rmdir /media/iso /media/filesystem.squashfs /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You now have an Linux OS on your USB with persistence that will boot within seconds and reliably outperforms the competition!&lt;br /&gt;
&lt;br /&gt;
==Further Details==&lt;br /&gt;
===Upgrading===&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when linux-image (the package containing the kernel) is upgraded?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; apt will want to update /boot/vmlinuz and /boot/initrd.img. So we need to do things in order to allow this to happen. We must boot with &#039;toram&#039; and also remount &#039;live&#039; as rw before running apt-get update.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#TODO, I wrote this elsewhere need to copy here, something along these lines:&lt;br /&gt;
mount -o remount,rw /lib/live/mount/medium /dev/disk/by-label/live&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this upgrade process apt might rename vmlinuz to say vmlinuz-3.16.0-4-amd64, and initrd similarly. It didn&#039;t always do this. But, you must match the names of those files with what is listed in grub.cfg! Either use &#039;vmlinuz&#039; or whatever name the apt script renamed them to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when libc is upgraded? Be it a security update, or when Debian Stable advances every couple years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; We will want to do a resquash:&lt;br /&gt;
# We need to to the same as above, &#039;toram&#039; and remount &#039;live&#039; as rw.&lt;br /&gt;
# dpkq-query our currently installed packages, and compare to /boot/filesystem.packages.xz we made earlier.&lt;br /&gt;
# Remove all non &amp;quot;core&amp;quot; packages, they should be cached in /var/cache/apt/archives/ so they don&#039;t need to be downloaded again, just reinstalled after we do the resquash.&lt;br /&gt;
# apt-get update&lt;br /&gt;
# Resquash, reboot to verify things working, in &#039;live&#039; mode remove squashed stuff from persistance partition.&lt;br /&gt;
## squash script https://gist.github.com/AndrewSmart/90eb186aea08db8f1426&lt;br /&gt;
## cleanup script https://gist.github.com/AndrewSmart/2f67f79f6f1922c4556f&lt;br /&gt;
# Reinstall packages removed prior to resquash from /var/cache/apt/archives&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; That looks like a lot to deal with.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I agree. I&#039;m looking at using dpkg triggers or /etc/apt/apt.conf.d/ hooks to manage this upgrade process. I hope to have something sufficient soon.&lt;br /&gt;
&lt;br /&gt;
I hope to also make a smaller guide that is not optimal in performance, but has way less steps, so the end user can test out the persistence and take the time to &amp;quot;upgrade&amp;quot; the performance later if so inclined.&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
Keep in mind with the USB we can still boot either in &#039;live&#039; mode, or &#039;persistence&#039; mode depending on the GRUB entry we choose. This is useful in case something breaks in &#039;persistence&#039; mode, like libc was upgraded in &#039;persistence&#039; but libc on &#039;live&#039; is still old! This will result in segmentation faults... a kernel panic, or whatever, it won&#039;t boot. We can access all of the software in the squashfs in &#039;live mode&#039;. Eventually I&#039;d like to write an apt hook to prevent the update of libc unless the system is prepared (&#039;toram&#039;, and &#039;live&#039; partition is mounted rw, the hook won&#039;t trigger unless &#039;persistence&#039; kernel parameter is used).&lt;br /&gt;
&lt;br /&gt;
Debian&#039;s live-boot scripts will put stuff in /lib/live/, and /lib/live/mount is of particularly good use in troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Ubuntu is a bit of a can of worms from my perspective as a fan of vanilla Debian. So... hopefully things will go smoothly... I highly recommend a lighter-weight environment for USB persistence, but I understand everyone has their preferences.&lt;br /&gt;
&lt;br /&gt;
Since &#039;toram&#039; puts the squashfs into memory, lets say you have 8GB RAM and an 800MB squashfs, that is fine, but say you move to a workstation with only 2GB RAM, you will probably want to remove the &#039;toram&#039; kernel parameter, things will be slower but the memory footprint used by the OS will be less, and only use &#039;toram&#039; when updating the &#039;live&#039; partition as detailed above. Perhaps consider 2 additional GRUB entries, in addition to the two I have listed above, where the 2 additional entries are live and persistence mode without &#039;toram&#039; kernel parameter, and when booting select the entry depending on the amount of RAM the system has.&lt;br /&gt;
&lt;br /&gt;
In the event of a power outage, kernel panic, unsafe shutdown or whatever, the filesystem may have problems you&#039;re warned about on next boot. In this setup, the &#039;live&#039; partition was mounted ro, so it is not possible to have filesystem errors there, but with the &#039;persistence&#039; partition there will likely be errors. So, on next boot we select the &#039;live&#039; mode in grub, and run fsck.ext4 -p /dev/disk/by-label/persistence, and all problems are fixed!&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 06:43, 5 November 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243175</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243175"/>
		<updated>2021-01-29T14:00:50Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time. While Zippy is a bit different than the rezip tools... I&#039;m not sure at a glance the implications of using it.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Module will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the module as the module iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243174</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243174"/>
		<updated>2021-01-29T12:21:47Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches, criticism of Zippey is in one of their write-ups. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
If a user hadn&#039;t properly set up a rezip tool and pushes their changes, then there won&#039;t be any problems other than a size increase. Which I suppose can be manually fixed later, but that is a headache.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Module will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the module as the module iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243173</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243173"/>
		<updated>2021-01-29T12:19:23Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches, criticism of Zippey is in one of their write-ups. Zippey uses a different strategy than the other two so isn&#039;t compatible with them.&lt;br /&gt;
&lt;br /&gt;
The rezip tools essentially re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes. I expect any user can use either they want, as long as they have the global git config filter set up for the tool they have, and that filter name matches what is in the repo&#039;s .gitattributes&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Module will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the module as the module iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243158</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=243158"/>
		<updated>2021-01-29T11:29:29Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.18 and newer (or v0.19 and newer?) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
All these tools do essentially, is re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers- which would entail changing the TreeView to use a proper model-view separation. This change would also allow the ability to reorder items easily in the TreeView, something others would like to see implemented anyway.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Module will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the module as the module iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=243157</id>
		<title>User talk:Andrewusu</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=243157"/>
		<updated>2021-01-29T11:25:56Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD Real Time Collaboration */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hint|Andrew, email me so we can coordinate more on wiki editing.-MJ}}&lt;br /&gt;
&lt;br /&gt;
=Wiki=&lt;br /&gt;
[[Wiki_instructions]]&lt;br /&gt;
[[mediawikiwiki:Help:Formatting]]&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Reorganization_2011]]&lt;br /&gt;
&lt;br /&gt;
Perhaps better categorization of pages into the taxonomy would help enhance navigation of this wiki: [https://wiki.opensourceecology.org/index.php?title=Special%3ACategoryTree&amp;amp;target=main&amp;amp;mode=categories CategoryTree].&lt;br /&gt;
&lt;br /&gt;
With the tree navigable from the wiki sidebar via this MediaWiki plugin: [[mediawikiwiki:Extension:TreeAndMenu]]. Or how Appropedia has theirs set up: [[Appropedia:Appropedia:CategoryTree]].&lt;br /&gt;
&lt;br /&gt;
=Worker Cooperative=&lt;br /&gt;
&lt;br /&gt;
I am interested in worker owned companies. Trying to compile resources to assist in their formation.&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=8G1-SYMatNc Laura Flanders] and Professor Richard D. Wolff speak a lot about worker coops on YouTube.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* http://www.usworker.coop/home/ $100+ annual membership dues to access their database and technical assistance.&lt;br /&gt;
* https://solidarityeconomy.us/ Neat visual interface&lt;br /&gt;
* https://cooperationworks.coop/&lt;br /&gt;
* https://www.ncb.coop/&lt;br /&gt;
* More to add/read...&lt;br /&gt;
&lt;br /&gt;
=Software Tools=&lt;br /&gt;
==FreeCAD Real Time Collaboration==&lt;br /&gt;
From my brief analysis:&lt;br /&gt;
* Store the [https://www.freecadweb.org/wiki/File_Format_FCStd FCStd] file in git uncompressed (in own directory).&lt;br /&gt;
* Use libgit2 with [https://stackoverflow.com/questions/37849771/can-git-be-made-to-mostly-auto-merge-xml-order-insensitive-files custom XML merge driver].&lt;br /&gt;
* Make new workbench or augment existing ones with new drop down menu entries to handle git operations (push/pull).&lt;br /&gt;
* At some interval check for updates to origin.&lt;br /&gt;
* Handle real time transactions on top of that (e.g. real time cursor/updates you see in google-docs):&lt;br /&gt;
** Could make cloud service to handle real time data transfer if neither network supports UPNP. Or only support UPNP compliance.&lt;br /&gt;
** Handle locking/unlocking of essentially unmergable assets (e.g. 3D mesh). As well as visual representation changes to others with same file open.&lt;br /&gt;
** Other features as needed.&lt;br /&gt;
Analysis of existing solutions and future work:&lt;br /&gt;
[[Talk:OSE_Collaboration_Protocol]]&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Snapping of off the shelf parts like [[Vention]]==&lt;br /&gt;
From a very brief look:&lt;br /&gt;
* Use constraints and solver from FreeCAD&#039;s [https://github.com/realthunder/FreeCAD_assembly3 Assembly3].&lt;br /&gt;
* Use FreeCAD&#039;s [https://github.com/FreeCAD/FreeCAD-library/ part library]. Augment with &#039;snap point&#039; and parametric resizing data somehow, somewhere.&lt;br /&gt;
* Overload/script somewhere within FreeCAD to handle the snapping/resizing functionality, perhaps within Assembly3 workbench?&lt;br /&gt;
&lt;br /&gt;
==OSE Supply Chain Interface==&lt;br /&gt;
*Interface for customers.&lt;br /&gt;
*I think this would help with adaptation/feasibility of many OSE concepts... distribution of the means of production, minimize shipping emissions/cost, etc.&lt;br /&gt;
&lt;br /&gt;
=Adobe Brick=&lt;br /&gt;
Have adobe brick building built around 1870ish. Brick wall is about 14&#039; tall at highest on the crest of roof. Interesting sand/rock foundation and sandy mortar. Original builder couldn&#039;t believe it was still standing after he left and came back a number of years later. His journal is online. Still standing 150 years later.&lt;br /&gt;
&lt;br /&gt;
Clay has no organic content. Clay deposits were deposited from [https://en.wikipedia.org/wiki/Lake_Bonneville Lake Bonneville]. Lots of local limestone. I&#039;m confused as kiln industry didn&#039;t start up till a decade or so later in this valley, so I&#039;m not sure how these bricks are stabilized (water doesn&#039;t permeate more than a few mm, even after a 24 hour submersion). Maybe additive carted from 80+ miles away? Or something intrinsic to the clay?&lt;br /&gt;
&lt;br /&gt;
The sandy mortar seems to help quickly drain water, but the issue is the sandy mortar liquefies if it gets too wet. I didn&#039;t know it was adobe and left a rainbird that hit a wall for a couple days... caused some damage.&lt;br /&gt;
&lt;br /&gt;
Could look into [https://techxplore.com/news/2020-08-energy-red-bricks.html storing electricity in the bricks]. I suppose there may be a lot of leakage current when damp, but I&#039;d imagine it&#039;d be superfluous energy stored in the bricks anyway.&lt;br /&gt;
&lt;br /&gt;
=Power Electronics=&lt;br /&gt;
[https://techxplore.com/news/2020-07-hybrid-inverter-energy-resources-smart.html This] looks like a good, feature rich platform, [https://volttron.org/about-volttron Volttron]. Would be interesting to see if there is a hardware reference implementation available to the public in their DOE Data Management Plan (couldn&#039;t find at a glance elsewhere).&lt;br /&gt;
[https://stackoverflow.com/questions/38465267/is-there-a-good-overview-of-the-volttron-platform-that-describes-how-it-works Volttron Overview]&lt;br /&gt;
[https://stackoverflow.com/questions/51034666/scale-capability-of-volttron Volttron Scalability]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;&#039;Welcome to &#039;&#039;Open Source Ecology&#039;&#039;!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Thank you for registering on the Open Source Ecology wiki.&lt;br /&gt;
&lt;br /&gt;
*We suggest that you review our [[Crash Course]] for an overview of our work. Our current goal is finishing the [[Global Village Construction Set]] by 2028, at which point we begin focus on human development - of [[Integrated Humans]].&lt;br /&gt;
*To join our dedicated development team, see [[OSE Developers]]&lt;br /&gt;
*To join OSE full time - we are offering our first ever [[Immersion Program]] in 2008. [[User:Marcin|Marcin]] ([[User talk:Marcin|talk]]) 10:14, 22 November 2019 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=243156</id>
		<title>User talk:Andrewusu</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=243156"/>
		<updated>2021-01-29T11:23:23Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Power Electronics */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Hint|Andrew, email me so we can coordinate more on wiki editing.-MJ}}&lt;br /&gt;
&lt;br /&gt;
=Wiki=&lt;br /&gt;
[[Wiki_instructions]]&lt;br /&gt;
[[mediawikiwiki:Help:Formatting]]&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Reorganization_2011]]&lt;br /&gt;
&lt;br /&gt;
Perhaps better categorization of pages into the taxonomy would help enhance navigation of this wiki: [https://wiki.opensourceecology.org/index.php?title=Special%3ACategoryTree&amp;amp;target=main&amp;amp;mode=categories CategoryTree].&lt;br /&gt;
&lt;br /&gt;
With the tree navigable from the wiki sidebar via this MediaWiki plugin: [[mediawikiwiki:Extension:TreeAndMenu]]. Or how Appropedia has theirs set up: [[Appropedia:Appropedia:CategoryTree]].&lt;br /&gt;
&lt;br /&gt;
=Worker Cooperative=&lt;br /&gt;
&lt;br /&gt;
I am interested in worker owned companies. Trying to compile resources to assist in their formation.&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=8G1-SYMatNc Laura Flanders] and Professor Richard D. Wolff speak a lot about worker coops on YouTube.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* http://www.usworker.coop/home/ $100+ annual membership dues to access their database and technical assistance.&lt;br /&gt;
* https://solidarityeconomy.us/ Neat visual interface&lt;br /&gt;
* https://cooperationworks.coop/&lt;br /&gt;
* https://www.ncb.coop/&lt;br /&gt;
* More to add/read...&lt;br /&gt;
&lt;br /&gt;
=Software Tools=&lt;br /&gt;
==FreeCAD Real Time Collaboration==&lt;br /&gt;
From my brief analysis:&lt;br /&gt;
* Store the [https://www.freecadweb.org/wiki/File_Format_FCStd FCStd] file in git uncompressed (in own directory).&lt;br /&gt;
* Use libgit2 with [https://stackoverflow.com/questions/37849771/can-git-be-made-to-mostly-auto-merge-xml-order-insensitive-files custom XML merge driver].&lt;br /&gt;
* Make new workbench or augment existing ones with new drop down menu entries to handle git operations (push/pull).&lt;br /&gt;
* At some interval check for updates to origin.&lt;br /&gt;
* Handle real time transactions on top of that (e.g. real time cursor/updates you see in google-docs):&lt;br /&gt;
** Could make cloud service to handle real time data transfer if neither network supports UPNP. Or only support UPNP compliance.&lt;br /&gt;
** Handle locking/unlocking of essentially unmergable assets (e.g. 3D mesh). As well as visual representation changes to others with same file open.&lt;br /&gt;
** Other features as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Snapping of off the shelf parts like [[Vention]]==&lt;br /&gt;
From a very brief look:&lt;br /&gt;
* Use constraints and solver from FreeCAD&#039;s [https://github.com/realthunder/FreeCAD_assembly3 Assembly3].&lt;br /&gt;
* Use FreeCAD&#039;s [https://github.com/FreeCAD/FreeCAD-library/ part library]. Augment with &#039;snap point&#039; and parametric resizing data somehow, somewhere.&lt;br /&gt;
* Overload/script somewhere within FreeCAD to handle the snapping/resizing functionality, perhaps within Assembly3 workbench?&lt;br /&gt;
&lt;br /&gt;
==OSE Supply Chain Interface==&lt;br /&gt;
*Interface for customers.&lt;br /&gt;
*I think this would help with adaptation/feasibility of many OSE concepts... distribution of the means of production, minimize shipping emissions/cost, etc.&lt;br /&gt;
&lt;br /&gt;
=Adobe Brick=&lt;br /&gt;
Have adobe brick building built around 1870ish. Brick wall is about 14&#039; tall at highest on the crest of roof. Interesting sand/rock foundation and sandy mortar. Original builder couldn&#039;t believe it was still standing after he left and came back a number of years later. His journal is online. Still standing 150 years later.&lt;br /&gt;
&lt;br /&gt;
Clay has no organic content. Clay deposits were deposited from [https://en.wikipedia.org/wiki/Lake_Bonneville Lake Bonneville]. Lots of local limestone. I&#039;m confused as kiln industry didn&#039;t start up till a decade or so later in this valley, so I&#039;m not sure how these bricks are stabilized (water doesn&#039;t permeate more than a few mm, even after a 24 hour submersion). Maybe additive carted from 80+ miles away? Or something intrinsic to the clay?&lt;br /&gt;
&lt;br /&gt;
The sandy mortar seems to help quickly drain water, but the issue is the sandy mortar liquefies if it gets too wet. I didn&#039;t know it was adobe and left a rainbird that hit a wall for a couple days... caused some damage.&lt;br /&gt;
&lt;br /&gt;
Could look into [https://techxplore.com/news/2020-08-energy-red-bricks.html storing electricity in the bricks]. I suppose there may be a lot of leakage current when damp, but I&#039;d imagine it&#039;d be superfluous energy stored in the bricks anyway.&lt;br /&gt;
&lt;br /&gt;
=Power Electronics=&lt;br /&gt;
[https://techxplore.com/news/2020-07-hybrid-inverter-energy-resources-smart.html This] looks like a good, feature rich platform, [https://volttron.org/about-volttron Volttron]. Would be interesting to see if there is a hardware reference implementation available to the public in their DOE Data Management Plan (couldn&#039;t find at a glance elsewhere).&lt;br /&gt;
[https://stackoverflow.com/questions/38465267/is-there-a-good-overview-of-the-volttron-platform-that-describes-how-it-works Volttron Overview]&lt;br /&gt;
[https://stackoverflow.com/questions/51034666/scale-capability-of-volttron Volttron Scalability]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;&#039;Welcome to &#039;&#039;Open Source Ecology&#039;&#039;!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Thank you for registering on the Open Source Ecology wiki.&lt;br /&gt;
&lt;br /&gt;
*We suggest that you review our [[Crash Course]] for an overview of our work. Our current goal is finishing the [[Global Village Construction Set]] by 2028, at which point we begin focus on human development - of [[Integrated Humans]].&lt;br /&gt;
*To join our dedicated development team, see [[OSE Developers]]&lt;br /&gt;
*To join OSE full time - we are offering our first ever [[Immersion Program]] in 2008. [[User:Marcin|Marcin]] ([[User talk:Marcin|talk]]) 10:14, 22 November 2019 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=242905</id>
		<title>Talk:OSE Linux Persistence</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=242905"/>
		<updated>2021-01-26T14:57:41Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Andrewusu&amp;#039;s Thoughts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://en.m.wikipedia.org/wiki/UNetbootin claims to have a persistence option for ubuntu distros. I couldn&#039;t get it to work. --[[User:Dorkmo|Dorkmo]] ([[User talk:Dorkmo|talk]]) 19:33, 14 July 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==Andrewusu&#039;s Thoughts==&lt;br /&gt;
I&#039;ve used persistence on USB for over 10 years now as my primary system (4+ hours/day) and will share some thoughts. Way back with USB2 I spent a lot of time investigating performance, ways to speed up boot time and system responsiveness. Keep in mind benchmarks of any flash memory device, where sequential reading is [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 10-20x] faster than non-sequential reads (possibly more depending on the device). By following this setup I describe below you take advantage of those fast reads for a quick boot and a very responsive OS.&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/JdnA6LblqOE Here] is a video of a minimal Debian distro on a live-boot persistence USB booting. By 35s system uptime I have launched both the terminal and filesystem browser.&lt;br /&gt;
&lt;br /&gt;
It has been great, I can move my programs, data, and OS from workstation to workstation with a breeze. From a desktop to a laptop, a library computer, or computer at work at times even. I&#039;ll never going back to installing Linux on a HDD. I use HDDs on workstations for storing data, or even making a ~8GB swap file if I need more system memory for some big task (e.g. big FreeCAD model).&lt;br /&gt;
&lt;br /&gt;
I don&#039;t use unetbootin, ISOs, or any other setups, just [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#547 Debian&#039;s live-boot]  and a &#039;persistence&#039; partition.&lt;br /&gt;
&lt;br /&gt;
On Ubuntu an alternative to live-boot is casper, which supports more options I believe. The [https://manpages.debian.org/buster/live-boot-doc/live-boot.7.en.html &#039;boot=live&#039;] kernel parameter results in live-boot being used, while the [http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html &#039;boot=casper&#039;] kernel parameter results in casper being used. With casper the default labeling of the persistence partition is &#039;casper-rw&#039; instead of &#039;persistence&#039; with live-boot.&lt;br /&gt;
&lt;br /&gt;
It is very simple, you have the second partition labeled &#039;persistence&#039; with a configuration file, and Debian&#039;s live-boot scripts handle everything.&lt;br /&gt;
&lt;br /&gt;
===live-boot Squashfs/Persistence===&lt;br /&gt;
[[File:LinuxUSBPersistencePartitions.png]]&lt;br /&gt;
* &#039;live&#039; partition contains the squashfs, initrd and vmlinuz in /live. Can only be mounted ro unless &#039;toram&#039; kernel parameter used.&lt;br /&gt;
* &#039;persistence&#039; partition is mounted rw.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;&lt;br /&gt;
# With a squashfs/persistence install instead of a full install to USB, you&#039;ll see a much faster boot, because the &#039;live&#039; partition is compressed ([https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html squashfs]) and is thus sequentially read into memory faster compared to random reads of various uncompressed files from the USB as they&#039;re needed during the boot process. Mine boots within 20 or so seconds.&lt;br /&gt;
# When running the system with day to day tasks, the performance and responsiveness of a squashfs/persistence setup is better than a full install, because the squashfs may be loaded to memory ([https://manpages.debian.org/jessie/live-boot-doc/live-boot.7.en.html toram]) occupying around 600-800MB RAM, and is thus not a bottleneck on reads/writes to the USB slowing the system down like you&#039;d see in a full install to USB. This translates into better framerate playing games like Starcraft 2, which I&#039;ve run from this flash drive, and a more responsive system in general (to mouse clicks, key presses, etc).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Limitations:&#039;&#039;&#039;&lt;br /&gt;
# A 64-bit install won&#039;t work on a 32-bit machine&lt;br /&gt;
# A USB with /etc/X11/xorg.conf set to use an NVIDIA GPU driver won&#039;t be as mobile:&lt;br /&gt;
## e.g. Will not boot graphically on an Intel GPU system but to a [https://en.wikipedia.org/wiki/Virtual_console virtual console].&lt;br /&gt;
## This can be mitigated by editing xorg.conf while on the Intel system&#039;s virtual console and rebooting to get the graphical interface. Or possibily without rebooting with some wizardry like rmmod and then startx, but I don&#039;t recall off the top of my head. And you have to redo this in reverse going back to the NVIDIA system. Maybe this is just a limitation of proprietary GPU drivers.&lt;br /&gt;
# Copy-on-write [https://superuser.com/questions/833576/differences-of-aufs-unionfs-and-overlayfs-from-each-other aufs/overlayfs] (whetever distro has chosen) has some limitations:&lt;br /&gt;
## Read-only &#039;live&#039; partition needs to be updated whenever libc or linux-image are updated, or the system won&#039;t boot. So it needs to be mounted read-write and in order to do so &#039;toram&#039; kernal boot parameter must be used. I work around this problem manually via inspecting apt output before installing anything, but this chore can be mitigated via an apt hook which I&#039;ve not written yet.&lt;br /&gt;
## &#039;live&#039; partition containing the squashfs should only have packages which are not updated often, being core packages, and not something like firefox which is updated often. This will minimize the size of the squashfs.&lt;br /&gt;
## When Debian stable is updated to the next revision, the linux-image must be updated, and the squashfs recompressed. To do this, all non-core packages must be removed, the distro upgraded, the squashfs recompressed, and then non-core packages reinstalled. This can also be scripted and I have some non-robust helper scripts I&#039;ve written.&lt;br /&gt;
# Flash memory has limitations, where sequential writes are [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 5000x-10000x] faster than random writes. Due to this, there should always be at least 2GB free on the &#039;persistence&#039; filesystem, or else risk files becoming fragmented and the any application blocking on reads/writes will &#039;&#039;&#039;hang&#039;&#039;&#039; from &#039;&#039;&#039;very slow&#039;&#039;&#039; reading and writing. In this circumstance it may be a number of minutes before such applications respond again, but you&#039;re free to use this time to do other things with already opened applications, like use the web browser or read opened documents.&lt;br /&gt;
&lt;br /&gt;
I personally use a lightweight Debian distro (not Ubuntu!) to minimize RAM footprint, minimize squashfs size, and maximize responsiveness. It is all instantaneous on USB3 (was a bit sluggish on USB2 on an older 4GB stick when I first started). I recommend at least a 32GB stick.&lt;br /&gt;
&lt;br /&gt;
Once the apt hook is implemented and distro-upgrade script polished, this should be a very nice option for interested users.&lt;br /&gt;
&lt;br /&gt;
There are tons of persistence guides, which unfairly dismiss this live-boot squashfs/persistence setup because they don&#039;t know how to mitigate/handle the upgrade problem as I do, because making a squashfs is not something well known which requires a lot of plumbing. Or they suggest other unnecessarily complex setups or make suggestions without having investigated performance implications (e.g. suggesting a full install to USB).&lt;br /&gt;
&lt;br /&gt;
I do not recommend modern Samsung, Sandisk, or any other cheap off-brands for this &amp;quot;heavy&amp;quot; use. Good chance they&#039;ll fail within a year and be too hot to touch. &#039;&#039;&#039;Buy from Toshiba/Kioxia&#039;&#039;&#039;, the inventors of flash memory. Yes their [https://www.amazon.com/Toshiba-TransMemory-U364-USB3-0-THN-U364W0320A4/dp/B078NPLXGC#customerReviews performance] as shown in benchmarks isn&#039;t as good, nor are they inexpensive, but they are reliable and will last years. &#039;&#039;&#039;Do not&#039;&#039;&#039; skimp to save a few $ buying a Sandisk/Samsung on a sale for this use-case, I&#039;m speaking from experience!&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&#039;&#039;&#039;Pros:&#039;&#039;&#039;&lt;br /&gt;
# Sure it may be useful if for example, you forget the drive in an internet cafe or library. Or have something you don&#039;t want to turn up in investigation.&lt;br /&gt;
&#039;&#039;&#039;Cons:&#039;&#039;&#039;&lt;br /&gt;
# It costs additional CPU &amp;amp; energy usage.&lt;br /&gt;
# Encryption offers zero &amp;quot;online&amp;quot;/mounted protection, e.g. encryption does not protect against a web browser vulnerability allowing disk access. Mental energy would be better spent on [https://wiki.archlinux.org/index.php/security &#039;hardening&#039;] the system.&lt;br /&gt;
# Harder to recover data when things break. &#039;&#039;Big&#039;&#039; headache.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 20:40, 4 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I will write more thoughts, I see this is an ongoing need/interest [[OSE_Linux_Log]]. Today I have ordered two Toshiba USB flash drives. I will write a guide here for preparing any Debian distro for USB persistence with optimal performance (squashfs &amp;amp; persistence partition) for interested readers.&lt;br /&gt;
&lt;br /&gt;
==GUIDE==&lt;br /&gt;
This guide will first make a live USB stick persistent.&lt;br /&gt;
&lt;br /&gt;
In the appendix will be additional knowledge and procedures to make it perform better.&lt;br /&gt;
&lt;br /&gt;
Brief steps:&lt;br /&gt;
#Make live USB&lt;br /&gt;
##Partition the USB.&lt;br /&gt;
##Mount the ISO, and copy select files to the USB&#039;s live partition.&lt;br /&gt;
##Install grub.&lt;br /&gt;
#Make the live USB a persistent USB&lt;br /&gt;
##Boot to live USB &amp;amp; Setup persistence.&lt;br /&gt;
&lt;br /&gt;
===Make live USB===&lt;br /&gt;
You can follow a different guide and then run the command `live-persistence`. Then when it comes time to upgrade libc or the kernel you can run `live-toram`, then follow the squash guide below.&lt;br /&gt;
&lt;br /&gt;
But here is the way I&#039;d do it.&lt;br /&gt;
====Partition the USB====&lt;br /&gt;
Use gparted. Make a GPT partition, with 16MB unused.&lt;br /&gt;
&lt;br /&gt;
Make live partition 1GB is fine. Big enough to fit the squashfs, vmlinuz, and initrd files from the ISO. Label it &#039;live&#039;, or whatever you want.&lt;br /&gt;
&lt;br /&gt;
Make persistence partition filling up the remainder. Label it &#039;peristence&#039;, or whatever you want, but you&#039;ll have to use the label you use in the grub.cfg later.&lt;br /&gt;
&lt;br /&gt;
Now make a small partition at least 1MB big into the 16MB unused space at the start. Don&#039;t format it with a filesystem, leave it unformatted. This is where GRUB installs stuff into.&lt;br /&gt;
====Mount the ISO, and copy select files to the USB&#039;s live partition====&lt;br /&gt;
Yep, copy the squashfs, vmlinuz, and initrd to /live on the live partition, e.g. /media/live/live&lt;br /&gt;
Easy peasy.&lt;br /&gt;
====Install grub====&lt;br /&gt;
Should go to /media/live/grub&lt;br /&gt;
&lt;br /&gt;
Boot to the USB! It is live!&lt;br /&gt;
===Make the live USB a persistent USB===&lt;br /&gt;
While you&#039;re booted to the live USB, mount the persistence partition, and put a peristence.conf file on it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; | sudo tee /media/peristence/persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, read the short manual on live-tools. And type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
man live-tools&lt;br /&gt;
live-peristence&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Neat, all your files you&#039;re using in the live USB, are now saved to the persistence partition. Though, we have to write a few changes to grub.cfg in order to load that stuff on next boot.&lt;br /&gt;
====Edit grub.cfg====&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
This guide seeks a USB stick with optimal performance, which requires a minimal squashfs.&lt;br /&gt;
&lt;br /&gt;
If USB space and performance are not concerns for you, you&#039;re welcome to modify an existing live USB, name a 2nd partition &amp;quot;persistence&amp;quot;, add suitable kernel parameters including &amp;quot;persistence&amp;quot;, and write a persistence.conf file containing &amp;quot;/ union&amp;quot; in the persistence partition. You can understand necessary details by understanding the guide below. Boot time may take a minute or longer, and applications may be slow and hang due to limitations of flash media which this guide seeks to minimize.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s proceed with making the USB with optimal performance.&lt;br /&gt;
&lt;br /&gt;
===Some notes on flash media===&lt;br /&gt;
The first partition should start after some multiple of the medium&#039;s [https://lwn.net/Articles/428584/ erase block]. The erase block size might be published by the manufacturer, or reasoned about via [https://github.com/bradfa/flashbench benchmarking]. However SSDs and modern USB sticks use more sophisticated controllers so flashbench [https://lists.linaro.org/pipermail/flashbench-results/2016-December/000599.html won&#039;t provide the necessary insights]. So starting the first partition at a 16MiB or 32MiB offset would be a reasonable choice, being some multiple of the erase block.&lt;br /&gt;
&lt;br /&gt;
When considering the [https://superuser.com/questions/379074/how-to-correctly-partition-usb-flash-drive-and-which-filesystem-to-choose-consid stride and stripe-width] parameters I&#039;m not sure it makes a difference anymore with more sophisticated controllers.&lt;br /&gt;
&lt;br /&gt;
On the flash media, writing is slow, so modern ones typically have a faster volatile cache, which is then written to the non-volatile flash memory. So when you write a large file to the medium, and it appears to finish via the command completing, but in reality it won&#039;t be done for some time. This is why writing speed appears to slow down in benchmarking the longer the write goes, from say 20MB/s to 4MB/s, this is due to the volatile cache filling up. ext4 when writing the journal uses a &amp;quot;barrier&amp;quot; somehow implemented, and usually implemented by the USB driver/device where the command blocks until the write is actually written to non-volatile memory, but I think this feature isn&#039;t exposed by ext4 for use in benchmarking. This is something to be cautious about before shutting down the system, leave the system idle for about 30-60 seconds after shutting down the browser or other write activity before powering down the system, as it is possible the write is still transferring from the volatile cache to non-volatile memory, and the OS doesn&#039;t know better, as we&#039;d disabled ext4 journalling for performance and longevity reasons, and it has been my experience that linux doesn&#039;t wait for the non-volatile write to finish anyway on shutdown, printing write errors on shutdown if this is the case. If this happens, then run a fsck on next boot, we&#039;ll make the Grub entry later to make running fsck convenient to best fix the consistency problems.&lt;br /&gt;
&lt;br /&gt;
===Partitioning===&lt;br /&gt;
A GPT partition table is fine, as is an MBR partition table.&lt;br /&gt;
&lt;br /&gt;
If doing GPT then make a small unformatted partition in the 16MiB or 32MiB offset before the live partition. It only needs to be 1MiB, but can be larger. Set the &#039;boot_grub&#039; flag on it in gparted. Grub will install to it later in this guide.&lt;br /&gt;
&lt;br /&gt;
Here is my example command of how I made the ext4 filesystem for the live partition. The option ^has_journal disables the journal, important for flash memory longevity. Determine which partition to run mkfs.ext4 on, mine is /dev/sdd1 and /dev/sdd2.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -N 2048 -L live -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;yourpartition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to do an EFI system partition (ESP), then have this also be the live partition, which we use as our &amp;quot;/boot&amp;quot; partition. This must be FAT32 instead of ext4 unfortunately. Set the &#039;esp&#039; flag on the live partition in gparted. When we install GRUB later, it will install EFI files to the live partition.&lt;br /&gt;
&lt;br /&gt;
And for the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -L persistence -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;your partition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare squashfs===&lt;br /&gt;
Download ISO of desired debian distro (e.g. OSE Linux). Put it at /tmp/&lt;br /&gt;
&lt;br /&gt;
chroot just uses your current Kernel. That&#039;s just how it works. Because of this it is best if the kernel of the system you&#039;re running to be the most recent available for the distro release of the ISO (e.g. for me [https://packages.debian.org/buster/linux-image-amd64 linux-image-4.19.0-13-amd64] as of this writing). If this isn&#039;t possible, boot to the ISO and skip to the [[Talk:OSE_Linux_Persistence#Remove_non-core_packages]] instructions without doing the chroot. You can do this all on a single USB stick if you do it correctly. Or you could use [https://help.ubuntu.com/community/DebootstrapChroot] or virtualization, lots of possibilities outside the scope of this guide.&lt;br /&gt;
&lt;br /&gt;
Actually now that I think about it writing the guide following the live USB installation without doing the chroot may be best, being more generalized and perhaps easier. I will rewrite this guide that way in the future, but for now, here are the chroot directions.&lt;br /&gt;
&lt;br /&gt;
====prepare chroot filesystem====&lt;br /&gt;
Let us continue with the chroot assuming we&#039;re running the same distro/kernel. Mount the ISO, and look for filesystem.squashfs, initrd.img, vmlinuz on it. Also note the location of config, System.map and filesystem.packages.xz, we&#039;ll copy or make these to follow convention.&lt;br /&gt;
&lt;br /&gt;
Make temporary directories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir /media/filesystem.squashfs /media/iso /media/overlay /media/myadditions /media/myadditions/rw /media/myadditions/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -o loop /tmp/debian-distro-i386.iso /media/iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount filesystem.squashfs on the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t squashfs /media/iso/live/filesystem.squashfs /media/filesystem.squashfs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount an in-memory filesystem to hold temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t tmpfs -o size=1024m none /media/myadditions&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prepare the union filesystem, so that we&#039;re able to edit the squashfs on the iso and compress the result. We can use either [https://wiki.archlinux.org/index.php/Overlay_filesystem overlayfs] or aufs. Here is the overlayfs command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t overlay overlay -o lowerdir=/media/filesystem.squashfs,upperdir=/media/myadditions/rw,workdir=/media/myadditions/work /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or afus. overlayfs hasn&#039;t been widely available until kernel 3.18, and aufs is available on earlier kernels (from [https://sourceforge.net/p/aufs/aufs3-standalone/ci/f88513f985e153aaf3e2950622c2a2329c3c3f8f/log/ kernel 3.9 late 2014 aufs supports xattr]) via aufs-tools, and their may be some differences I&#039;m not aware of but I think the concensus is that overlayfs is better. Hopefully aufs supports extended attributes (xattr) good enough to not loose said attributes, which are important for hardening the system (extended attributes are I believe where [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities] are stored/configured).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t aufs -o br=/media/myadditions=rw -o br=/media/filesystem.squashfs=ro -o udba=reval none /media/overlay/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====chroot====&lt;br /&gt;
Prepare the chroot, so that we can run apt within it and remove packages. resolv.conf and mount binds are to remove error/warning messages when installing packages with apt.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp /etc/resolv.conf /media/overlay/etc/resolv.conf&lt;br /&gt;
sudo mount --bind /dev/ /media/overlay/dev/&lt;br /&gt;
sudo mount --bind /dev/pts /media/overlay/dev/pts #https://wiki.debian.org/chroot#A.2Fdev.2Fpts&lt;br /&gt;
sudo mount --bind /proc /media/overlay/proc&lt;br /&gt;
sudo mount --bind /sys /media/overlay/sys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now chroot into the squashfs so we can use apt within it to remove packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chroot --userspec root:root /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the locale, you&#039;ll get many warning messages in apt otherwise. You probably want to select UTF-8 for your country/language, for example I picked en_US.UTF-8. Press space bar to toggle each locale you want generated, then press enter to proceed. Then it asks if you want the locales you chose to be applied systemwide, forcing your selection on each user, which may be desired for desktop software which starts up before the user-specific ~/.profile is read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure locales&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And set the timezone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure tzdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If /boot exists, then back it up, we&#039;re replacing /boot with a symlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /boot /boot.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must make a symlink so that as we work with apt-get, it may call `live-update-initramfs -u`, and we need those updates to /boot to go to the proper location, the &#039;live&#039; partition&#039;s /live:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /lib/live/mount/medium/live /boot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve not yet made the live partition, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If already have the live partition ready, or like me are updating an existing live partition&#039;s squashfs, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
mkdir /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have to do the above steps to work around update-initramfs&#039;s logic and assumptions regarding a read/write test that this works around. If you ever run into problems with update-initramfs while using apt-get, this is what you run once the problem is fixed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg --configure initramfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we remove packages, such at btrfs-progs, update-initramfs will be triggered which should update /boot/vmlinuz and /boot/initrd, these files are not compressed into the filesystem.squashfs and we need those files within /live of the live partition to boot.&lt;br /&gt;
&lt;br /&gt;
`man live-boot` is a useful reference, ensure live-boot-doc is installed. Also the [https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html Debian live-manual] is a useful reference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install live-boot-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Remove non-core packages====&lt;br /&gt;
&lt;br /&gt;
Now we gut the filesystem.squashfs from the iso of packages that:&lt;br /&gt;
* We don&#039;t want.&lt;br /&gt;
* Are frequently updated (e.g. web browser).&lt;br /&gt;
* With particular scrutiny of packages that are large.&lt;br /&gt;
* Are not necessary to boot to a desktop.&lt;br /&gt;
All of those can they can go onto persistence partition. We remove them now, and install them after the squashfs has been made, or as needed. Examples of what should be considered &amp;quot;core&amp;quot; packages necessary to boot are: linux-image (this is the kernel), firmware, GPU driver, and X11 server. This way the USB will:&lt;br /&gt;
* Boot fast,&lt;br /&gt;
* The OS running from it will be maximally responsive,&lt;br /&gt;
* Will have minimal memory footprint,&lt;br /&gt;
* And be persistent!&lt;br /&gt;
&lt;br /&gt;
Run this to see packages installed ordered by size, then apt-get remove or purge stuff, and ignore anything beginning with &amp;quot;lib&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W -f &#039;${Installed-Size}\t${Package}\n&#039; | sort -n | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To understand what a package is, you can search [https://packages.debian.org/buster/os-prober packages.debian.org]. If the description there isn&#039;t informative enough, you can try clicking the links on the right hand side such as a project homepage, or looking through the files of the package. Ignore or don&#039;t pay much attention to any package beginning with &amp;quot;lib&amp;quot;, with the exception of things like libc6, but apt will probably warn you about doing something silly like that with the prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
You are about to do something potentially harmful.&lt;br /&gt;
To continue type in the phrase &#039;Yes, do as I say!&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example of stuff I removed from a different Debian distro (BunsenLabs), but I removed some firmware packages so that reduces portability:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get remove -y firefox-esr libjsoncpp1&lt;br /&gt;
apt-get remove -y libreoffice-core libreoffice-common coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1 libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-locale1.67.0 libboost-thread1.67.0 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data libgpgmepp6 liblangtag-common liblangtag1 libmhash2 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libnumbertext-data libodfgen-0.1-1 liborcus-0.14-0 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 libstaroffice-0.0-0 libsuitesparseconfig5 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure&lt;br /&gt;
apt-get remove -y firmware-atheros firmware-netronome firmware-iwlwifi firmware-brcm80211 firmware-qlogic firmware-ti-connectivity firmware-myricom firmware-intelwimax firmware-libertas dahdi-firmware-nonfree atmel-firmware firmware-cavium firmware-bnx2x firmware-qcom-media firmware-netxen firmware-samsung firmware-ipw2x00 firmware-siano firmware-ivtv firmware-bnx2&lt;br /&gt;
apt-get remove -y samba-libs libavahi-glib1 libcdio-cdda2 libcdio-paranoia2 libgd3 libgdata-common libgdata22 libgoa-1.0-0b libgoa-1.0-common libgphoto2-6 libgphoto2-port12 libldb1 liblmdb0 liboauth0 libpython2.7 libtalloc2 libtevent0 libwbclient0 python-talloc&lt;br /&gt;
apt-get remove -y fonts-noto-core fonts-noto-cjk papirus-icon-theme bunsen-papirus-icon-theme gnome-icon-theme gdebi-core gir1.2-vte-2.91 python3-apt python3-chardet python3-debian python3-pkg-resources&lt;br /&gt;
rm -r /usr/share/gdebi/GDebi /usr/lib/python3/dist-packages/aptsources /usr/lib/python3/dist-packages/apt/progress /usr/lib/python3/dist-packages/debian_bundle /usr/lib/python3/dist-packages/debian /usr/lib/python3/dist-packages/chardet/cli /usr/lib/python3/dist-packages/pkg_resources/extern /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging&lt;br /&gt;
apt-get remove -y evince synaptic bubblewrap evince-common gnome-desktop3-data libbrotli1 libdjvulibre-text libdjvulibre21 libept1.5.0 libevdocument3-4 libevview3-3 libgnome-desktop-3-17 libgspell-1-1 libgspell-1-common libgxps2 libharfbuzz-icu0 libhyphen0 libjavascriptcoregtk-4.0-18 libkpathsea6 libspectre1 libsynctex2 libwebkit2gtk-4.0-37 libwebpdemux2 libwoff1 xdg-dbus-proxy zenity zenity-common&lt;br /&gt;
apt-get remove -y vlc libaribb24-0 libbasicusageenvironment1 libcddb2 libdvbpsi10 libebml4v5 libgles2 libgroupsock8 libixml10 liblirc-client0 liblivemedia64 liblua5.2-0 libmad0 libmatroska6v5 libmtp-common libmtp9 libnfs12 libopenmpt-modplug1 libplacebo7 libprotobuf-lite17 libqt5x11extras5 libresid-builder0c2a libsdl-image1.2 libsdl1.2debian libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libxcb-xv0 vlc-bin vlc-data vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output vlc-plugin-notify libvlccore9&lt;br /&gt;
apt-get remove -y file-roller p7zip-full p7zip libarchive13 libnautilus-extension1a xfburn libburn4 libexo-1-0 libisofs6 libjte1 unar gnustep-base-common gnustep-base-runtime gnustep-common libgnustep-base1.26 libobjc4&lt;br /&gt;
apt-get remove -y transmission-gtk libevent-2.1-6 libminiupnpc17 libnatpmp1 transmission-common filezilla filezilla-common libfilezilla0 libpugixml1v5 libwxbase3.0-0v5 libwxgtk3.0-0v5 yudit-common feh&lt;br /&gt;
apt-get remove -y libpython2.7-stdlib libblas3 libgfortran5 libkeybinder0 liblapack3 libpython2.7-minimal libsodium23 lua-bit32 lua-expat lua-penlight lua-posix lua-socket lua5.2 python-apt-common python-minimal python2-minimal python2.7-minimal libavformat58 libmysofa0 libnorm1 libpgm-5.2-0 libpostproc55 librubberband2 libssh-gcrypt-4 libswscale5 libvidstab1.1&lt;br /&gt;
apt-get remove -y aptitude aptitude-common libboost-iostreams1.67.0 libboost-system1.67.0 libcwidget3v5 libxapian30 ristretto file libmagic-mgc libmagic1 hexchat-common&lt;br /&gt;
apt-get install wpasupplicant network-manager --no-install-recommends&lt;br /&gt;
#modem support&lt;br /&gt;
apt-get remove -y modemmanager libmbim-glib4 libmbim-proxy libqmi-glib5 libqmi-proxy openssh-client libxatracker2 nitrogen libgtkmm-2.4-1v5 lvm2 dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 nano geany geany-common ghostscript poppler-data libcupsimage2 libgs9-common libijs-0.35 libjbig2dec0 libpaper1 pcmciautils vdpau-va-driver arandr&lt;br /&gt;
apt-get remove -y intel-microcode iucode-tool va-driver-all i965-va-driver xserver-xorg-video-intel libxvmc1 intel-media-va-driver libigdgmm5 xserver-xorg-video-qxl btrfs-progs cryptsetup-initramfs cryptsetup-bin cryptsetup-run&lt;br /&gt;
apt-get remove -y python3.7-minimal dconf-cli distro-info-data gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-pango-1.0 libfm-extra4 libgirepository-1.0-1 libmenu-cache-bin libmenu-cache3 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libxslt1.1 mime-support wmctrl&lt;br /&gt;
rm -r /usr/lib/python3&lt;br /&gt;
apt-get remove -y iso-codes liba52-0.7.4 libaa1 libass9 libatomic1 libavc1394-0 libavfilter7 libavformat58 libbs2b0 libcaca0 libcdio18 libcdparanoia0 libchromaprint1 libdc1394-22 libdca0 libde265-0 libdv4 libdvdnav4 libdvdread4 libfaad2 libfftw3-double3 libflite1 libfluidsynth1 libgme0 libgssdp-1.0-3 libgstreamer1.0-0 libgupnp-1.0-4 libgupnp-igd-1.0-4 libiec61883-0 libilmbase23 libkate1 liblilv-0-0 libmjpegutils-2.1-0 libmms0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa0 libnice10 libnorm1 libofa0 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr23 libopenmpt0 libpgm-5.2-0 libpoppler-glib8 libpoppler82 libpostproc55 libraw1394-11 librubberband2 libsbc1 libserd-0-0 libshout3 libsidplay1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libspandsp2 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libswscale5 libtumbler-1-0 libv4l-0 libv4lconvert0 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvulkan1 libwildmidi2 libzbar0 libzmq5 tumbler-common&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, much of what was removed can be installed again after persistence is set up. These packages are conveniently listed as removed within dpkg utilities, I&#039;ll illustrate how to conveniently reinstall them later.&lt;br /&gt;
&lt;br /&gt;
====Misc setup tips====&lt;br /&gt;
&lt;br /&gt;
[https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#521 One important consideration is that the live user is created by live-boot at boot time]. We need to ensure the live user is set up. Inspect the contents of /etc/live/ for any configuration files. If there is none in your distribution then let&#039;s make it, and feel free to customize this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/config.conf.d/10-user-setup.conf&lt;br /&gt;
LIVE_HOSTNAME=debian-persistence&lt;br /&gt;
LIVE_USERNAME=user&lt;br /&gt;
LIVE_USER_FULLNAME=&amp;quot;Debian LiveUser&amp;quot;&lt;br /&gt;
LIVE_USER_DEFAULT_GROUPS=&amp;quot;cdrom floppy audio dip video plugdev fuse bluetooth netdev scanner staff&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These options to live-boot will minimize the generated initramfs size:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/boot.conf&lt;br /&gt;
#man live-boot&lt;br /&gt;
#see /usr/share/initramfs-tools/hooks/live, might make initrd smaller&lt;br /&gt;
DISABLE_CDROM=true&lt;br /&gt;
DISABLE_FAT=true&lt;br /&gt;
DISABLE_FUSE=true&lt;br /&gt;
DISABLE_NTFS=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Performance tips====&lt;br /&gt;
&lt;br /&gt;
USB sticks use flash memory, and to maximize performance with it we can [https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler change the IO scheduler for such devices].&lt;br /&gt;
&lt;br /&gt;
BFQ looks like a nice scheduler. Quote:&lt;br /&gt;
&amp;quot;Regardless of the actual background workload, BFQ guarantees that, for interactive tasks, the storage device is virtually as responsive as if it was idle. [...] As a comparison, with CFQ, NOOP or DEADLINE, and in the same conditions, applications experience high latencies, or even become unresponsive until the background workload terminates (also on SSDs).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mq_deadline is fine while the system is booting. The scheduler in use can also be [https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers tuned], but I need to do more research before giving advice on tuning in this context. To [https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler setup/enable]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/modules-load.d/bfq.conf&lt;br /&gt;
bfq&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set bfq scheduler during startup. Alternatives include mq_deadline and none, either might be faster than bfq during startup when GUI application responsiveness isn&#039;t important, but I&#039;d need to do some research/experiments.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/udev/rules.d/60-ssd-scheduler.rules&lt;br /&gt;
# set bfq scheduler for non-rotating disks during startup&lt;br /&gt;
ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;sd[a-z]&amp;quot;, ATTR{queue/rotational}==&amp;quot;0&amp;quot;, ATTR{queue/scheduler}=&amp;quot;bfq&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use [https://wiki.archlinux.org/index.php/profile-sync-daemon profile-sync-daemon] to enhance performance of the browser, and minimize flash memory writes (maximize longevity).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install profile-sync-damon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For SD card longevity, consider mounting a tmpfs on /var/log. But perhaps only after you&#039;ve booted to the system a few times and verify the system is stable, as putting log files in RAM means they can&#039;t be read offline to diagnose a problem. So disable this feature if needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /var/log tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/tmpfiles.d/varlog.conf&lt;br /&gt;
d /var/log/apt 755 root root&lt;br /&gt;
d /var/log/lightdm 711 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vlc&#039;s default lookahead is too short, leads to music cutting out. &#039;Tools-&amp;gt;Preferences&#039;, toggle &#039;Show all settings&#039;, click &#039;Input/Codecs&#039; in tree view, scroll down to &#039;Advanced&#039; section and look at caching settings. Increase them to at least 600ms. This should largely mitigate problems with music/video stopping momentarily due to I/O delays.&lt;br /&gt;
&lt;br /&gt;
====Pruning tips====&lt;br /&gt;
Install deborphan and localepurge to help clean stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install deborphan localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you&#039;re done pruning things, run deborphan and remove things it tells you to as you desire. Deborphan helps you find &amp;quot;orphan&amp;quot; packages not needed by anything else, which take up space. Such orphaned packages may have been necessary by a previously installed package.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
deborphan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next run localepurge to remove space consuming files for locales you&#039;ll never use, I removed 160MB from my system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, clear out apt temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get autoremove&lt;br /&gt;
apt-get clean&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend vim.tiny over vim, vim.tiny much smaller, also install whatever else your heart desires that is small and infrequently updated. Such small utilities will be available in &#039;live&#039; mode (if installed when in &#039;persistence&#039; mode, it won&#039;t be available in plain &#039;live&#039; mode):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install vim-tiny&lt;br /&gt;
echo &amp;quot;set nocp&amp;quot; &amp;gt;&amp;gt; /etc/vim/vimrc.tiny #Allows arrow keys to work, and vim.tiny to act like vim instead of vi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Hardening tips====&lt;br /&gt;
&lt;br /&gt;
I think it is best for /tmp to be mounted noexec, but many applications have bugs regarding this&lt;br /&gt;
Double check the /etc/fstab file with a text editor after editing /etc/fstab:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /tmp tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mount /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often apt packages during installation will require the ability to execute temporary files on /tmp, this is how we allow this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/apt/apt.conf.d/50remount&lt;br /&gt;
DPkg::Pre-Install-Pkgs {&amp;quot;mount -o remount,exec /tmp&amp;quot;;};&lt;br /&gt;
DPkg::Post-Invoke {&amp;quot;mount -o remount /tmp&amp;quot;;};&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A common thing people do, is charge their android phone, or other USB device via a USB port on the computer. Realize that this is physical access, which a compromised device may use to log in to Linux via root. I suspect I had fallen victim to in the past, a keylogger following a pattern I&#039;d seen exhibited in the news, which I believe came after I&#039;d plugged in a new android I had run questionable rooting software on, to my computer. I suggest both setting a root password, and disallowing this access, by editing /etc/securetty and commenting out root access via UART serial ports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# UART serial ports&lt;br /&gt;
#ttyS0&lt;br /&gt;
#ttyS1&lt;br /&gt;
#ttyS2&lt;br /&gt;
#ttyS3&lt;br /&gt;
#ttyS4&lt;br /&gt;
#ttyS5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the [https://www.debian.org/doc/manuals/securing-debian-manual/ch03s04.en.html root password]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What has piqued my interest lately is [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities]. Debian distributions should include both [https://packages.debian.org/buster/libcap2 libcap2] and [https://packages.debian.org/buster/libcap-ng0 libcap-ng0 (RedHat&#039;s fork)]. And I&#039;m looking for a more convenient open-source means of administration. What has me interested in the idea of a [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html proactive defense against root-kits] by removing module loading capabilities (CAP_SYS_MODULE) even for the root user, after the system had booted. It appears that lcap is no longer functional, it and many capabilities articles detail a system-wide capability bounding set in pre-2.6.25 kernels, but since kernel 2.6.25 capability bounding sets are now per-thread. The [http://people.redhat.com/sgrubb/libcap-ng/ images here] may help visually explain capabilities and their inheritance. What I have in mind may be within a custom /etc/init.d/ script calling [https://man7.org/linux/man-pages/man2/capset.2.html setcap] on init (pid 1) to remove the CAP_SYS_MODULE capability from the bounding set system-wide. The capabilities on any process can be viewed with `cat /proc/&amp;lt;pid&amp;gt;/status`.&lt;br /&gt;
&lt;br /&gt;
Something else that can be done is use of more than one account, for example an account dedicated to web browsing with minimal privileges, and an account with administration privileges (sudo, member of staff,adm groups).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser browser&lt;br /&gt;
dm-tool switch-to-user browser #with LightDM desktop manager: https://wiki.ubuntu.com/LightDM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files downloaded with the browser can be transfered to other users via /tmp, which is a good place to set as the default location to download files in the browser settings anyway.&lt;br /&gt;
&lt;br /&gt;
With this separation of user privileges, if malware managed to gained the privileges of the browser account (no privilege escalation), and escaped the browser sandbox, the worst it could do is keylog, delete or encrypt/ransom the browser account&#039;s files. Since the browser account is running on a difference X11 server than an administration account, I think [https://security.stackexchange.com/questions/4641/why-are-people-saying-that-the-x-window-system-is-not-secure/4646 risks] are reduced.&lt;br /&gt;
&lt;br /&gt;
Switching between the administration account and browser account X11 servers can be done with ctrl+alt+F7 or F8 (or F1/F2 or whatever).&lt;br /&gt;
&lt;br /&gt;
Or just have the desktop load with the browser account instead of the administrative account, and do administrative tasks on a virtual terminal (ctrl+alt+F1 through F6).&lt;br /&gt;
&lt;br /&gt;
Set up the [https://www.debian.org/doc/manuals/securing-debian-manual/ch04s11.en.html#id-1.5.14.17 shell history file], .bash_history better. An easy way a bad actor can circumvent the stock configuration from logging his evil deeds is to proceed those evil things with a space, this guide will fix that!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lsattr /home/browser/.bash_history  #See what attributes are set&lt;br /&gt;
sudo chattr +a /home/browser/.bash_history   #Only root user can chattr&lt;br /&gt;
sudo chattr +a /home/user/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Make filesystem.packages and filesystem.squashfs====&lt;br /&gt;
Now that we have a set of &amp;quot;core&amp;quot; packages to go in the squashfs, of minimal size, on the &#039;live&#039; partition, we must make our new squashfs!&lt;br /&gt;
&lt;br /&gt;
Print out a list of &amp;quot;core&amp;quot; packages we have, we&#039;ll need them for reference later. Lets put them in filesystem.packages.xz:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W --showformat=&#039;${Package}\t${Version}\n&#039; | xz &amp;gt; /tmp/filesystem.packages.xz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get -y install squashfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exclude stuff we don&#039;t want in the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXCLUDES=&#039;.wh* dev live-persistence.conf live lost+found media mnt proc .pulse* run home selinux sys tmp* lib/live/mount usr/lib/live/mount var/cache/apt var/cache/apt-xapian-index var/lib/apt/lists var/tmp&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Directives to squashfs-tools to make pseudofiles, necessary to boot. Linux will make many pseudofiles in /dev when it boots, but not all, and through experimentation and observations I&#039;ve come up with this list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /tmp/mksquashfs.pf&lt;br /&gt;
dev d 755 root root&lt;br /&gt;
dev/console c 662 root tty 5 1&lt;br /&gt;
dev/full c 666 root root 1 7&lt;br /&gt;
dev/kmem c 640 root kmem 1 2&lt;br /&gt;
dev/kmsg c 644 root root 1 11&lt;br /&gt;
dev/loop0 b 660 root disk 7 0&lt;br /&gt;
dev/loop1 b 660 root disk 7 1&lt;br /&gt;
dev/loop2 b 660 root disk 7 2&lt;br /&gt;
dev/loop3 b 660 root disk 7 3&lt;br /&gt;
dev/loop4 b 660 root disk 7 4&lt;br /&gt;
dev/loop5 b 660 root disk 7 5&lt;br /&gt;
dev/loop6 b 660 root disk 7 6&lt;br /&gt;
dev/loop7 b 660 root disk 7 7&lt;br /&gt;
dev/mem c 640 root kmem 1 1&lt;br /&gt;
dev/null c 666 root root 1 3&lt;br /&gt;
dev/port c 640 root kmem 1 4&lt;br /&gt;
dev/ptmx c 666 root tty 5 2&lt;br /&gt;
dev/pts d 755 root root&lt;br /&gt;
dev/ram0 b 640 root disk 1 0&lt;br /&gt;
dev/ram1 b 640 root disk 1 1&lt;br /&gt;
dev/ram2 b 640 root disk 1 2&lt;br /&gt;
dev/ram3 b 640 root disk 1 3&lt;br /&gt;
dev/ram4 b 640 root disk 1 4&lt;br /&gt;
dev/ram5 b 640 root disk 1 5&lt;br /&gt;
dev/ram6 b 640 root disk 1 6&lt;br /&gt;
dev/ram7 b 640 root disk 1 7&lt;br /&gt;
dev/ram8 b 640 root disk 1 8&lt;br /&gt;
dev/ram9 b 640 root disk 1 9&lt;br /&gt;
dev/ram10 b 640 root disk 1 10&lt;br /&gt;
dev/ram11 b 640 root disk 1 11&lt;br /&gt;
dev/ram12 b 640 root disk 1 12&lt;br /&gt;
dev/ram13 b 640 root disk 1 13&lt;br /&gt;
dev/ram14 b 640 root disk 1 14&lt;br /&gt;
dev/ram15 b 640 root disk 1 15&lt;br /&gt;
dev/ram16 b 640 root disk 1 16&lt;br /&gt;
dev/random c 644 root root 1 8&lt;br /&gt;
dev/shm d 755 root root&lt;br /&gt;
dev/tty c 662 root tty 5 0&lt;br /&gt;
dev/tty0 c 600 root tty 4 0&lt;br /&gt;
dev/urandom c 644 root root 1 9&lt;br /&gt;
dev/zero c 644 root root 1 5&lt;br /&gt;
home d 755 root root&lt;br /&gt;
media d 755 root root&lt;br /&gt;
mnt d 755 root root&lt;br /&gt;
proc d 755 root root&lt;br /&gt;
run d 755 root root&lt;br /&gt;
run/lock d 1777 root root&lt;br /&gt;
sys d 755 root root&lt;br /&gt;
tmp d 1777 root root&lt;br /&gt;
var/cache/apt d 755 root root&lt;br /&gt;
var/cache/apt/partial d 755 root root&lt;br /&gt;
var/cache/apt/lock f 640 root root echo &amp;quot;&amp;quot;&lt;br /&gt;
var/lib/apt/lists d 755 root root&lt;br /&gt;
var/lib/apt/lists/partial d 755 root root&lt;br /&gt;
var/tmp d 1777 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now make the squashfs, it is compressed with xz compression:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mksquashfs / /tmp/filesystem.squashfs -comp xz -info -always-use-fragments -noappend -wildcards -pf /tmp/mksquashfs.pf -e ${EXCLUDES} &amp;gt; /tmp/mksquashfs.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/tmp/mksquashfs.log will contain interesting details, such as the filesystem is now roughly 30% of its uncompressed size.&lt;br /&gt;
&lt;br /&gt;
Hopefully the squashfs you made is around 800MB or less, mine for a different Debian distribution was about 300MB. Let us say your flash drive has 100MB/s sequential read speed, and your &amp;quot;core&amp;quot; filesystem was squashed down to 300MB, which will take 3 seconds to read into memory. How long do you think yours will take to boot?&lt;br /&gt;
&lt;br /&gt;
===Prepare the live partition===&lt;br /&gt;
If you hadn&#039;t yet mounted the live partition to /lib/live/mount/medium earlier in the guide, we need to move files off, then mount it, and move vmlinuz, initrd, and etc onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /lib/live/mount/medium /tmp/&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
cd /lib/live/mount/medium&lt;br /&gt;
mkdir live&lt;br /&gt;
mv /tmp/medium/boot/vmlinuz* live/&lt;br /&gt;
mv /tmp/medium/boot/initrd* live/&lt;br /&gt;
mv /tmp/filesystem.squashfs live/&lt;br /&gt;
mv /tmp/filesystem.packages.xz live/&lt;br /&gt;
#update-initramfs or something else pointed at live/ incorrectly puts grub/unicode.pf2 here, this symlink fixes that:&lt;br /&gt;
ln -s ../boot/grub/ live/grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also copy files like System.map-4.19.0-9-amd64 and config-4.19.0-9-amd64 to /lib/live/mount/medium/live, they should be in /media/overlay/boot.bak and/or /media/iso/live/ (outside the chroot). Or if the kernel is updated then you&#039;ll get these files, corresponding to the new kernel, automatically put in there anyway.&lt;br /&gt;
&lt;br /&gt;
The file named config is a nice reference, it says what flags the kernel was built with, there are a vast number of options.&lt;br /&gt;
This System.map file, stored on the read-only live partition may be useful, for example, finding if your system had been [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html compromised with a rootkit].&lt;br /&gt;
&lt;br /&gt;
===Prepare GRUB on the live partition and USB device===&lt;br /&gt;
&lt;br /&gt;
The introduction of UEFI hardware complicates things. You&#039;re welcome to modify the instructions below if you desire to support UEFI functionality on such consumer hardware. The instructions below handles computers with [https://wiki.archlinux.org/index.php/GRUB#BIOS_systems traditional BIOS], with a [https://wiki.archlinux.org/index.php/Partitioning#Master_Boot_Record traditional MBR], as well as UEFI hardware which supports such &amp;quot;legacy&amp;quot; standards. &lt;br /&gt;
&lt;br /&gt;
From within the chroot, install non-uefi grub (grub-pc), and --no-install-recommends will result in os-prober not being installed. I think os-prober is workstation-specific and not useful to configure a USB device which may move between workstations. grub-pc will ask two questions, don&#039;t select anything and enter on Ok on the first, and press enter on Yes on the next to continue without --exclude.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install grub-pc --no-install-recommends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find your live partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -l /dev/disk/by-label/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say it is /dev/sdd1. Then we use the device /dev/sdd in the command below.&lt;br /&gt;
&lt;br /&gt;
Install grub, to both the USB device and the live partition on the USB device. Where /dev/sdd below is the USB device (not a partition), and /lib/live/mount/medium is where the live partition is mounted:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-install --target=i386-pc --root-directory=/lib/live/mount/medium /dev/sdd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now grub needs a configuration file. We can either craft one by hand or use grub-mkconfig, but grub-mkconfig doesn&#039;t really support this use-case.&lt;br /&gt;
&lt;br /&gt;
====Either (1) Handcraft grub.cfg====&lt;br /&gt;
What follows is my legacy grub.cfg, which should work but I hope to make something workable within the newer /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Make sure to fill in this template /lib/live/mount/medium/boot/grub/grub.cfg on &#039;live&#039; partition with your appropriate UUIDs. The partitions you made will have unique UUIDs. You can determine which is which on your system by comparing `ls -l /dev/disk/by-uuid/` and ls -l `/dev/disk/by-label/`.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;LABELorGPTname&amp;quot; to the label or GPT name of your persistence partition. I labeled mine &amp;quot;u365-persistence&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Fill in the template with how your vmlinuz and initrd.img are named, which may not have a suffix of &amp;quot;-4.19.0-9-amd64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make note of the kernel parameters used here, such as &#039;toram&#039; and &#039;persistence&#039;. I&#039;m not sure if elevator=as is the optimal choice, feel free to read about it.&lt;br /&gt;
&lt;br /&gt;
You can customize the [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#530 locale, language, and keyboard layout] here via kernel parameters here such as `locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variants=bepo keyboard-model=tm2030usb`, but I think the console-setup package may be required (installed before the squashfs is made), and perhaps these things are fine configured elsewhere.&lt;br /&gt;
&lt;br /&gt;
You can see other things configurable via kernel parameters such as tzdata, and initial username by looking at /lib/live/config/*. But be aware many things are only configured once via /var/lib/live/config/ (remove the relevant file to allow reconfiguration).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
#Enter the UUID of your boot partition (this is where grub and your kernel reside)&lt;br /&gt;
set uuid_grub_boot=dc434800-22ac-4fd4-b6cb-603da325d5d0&lt;br /&gt;
#Enter the UUID of the persistence partition.&lt;br /&gt;
set uuid_os_root=858d963f-8718-4520-83dd-fb89a842e9bd&lt;br /&gt;
#Here we set the grub &amp;quot;root&amp;quot; variable by locating the uuid of the root partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_os_root --set=root&lt;br /&gt;
#Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot&lt;br /&gt;
#Here&#039;s the magic. We test to see if the boot and root partitions have the same UUID.&lt;br /&gt;
#If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.&lt;br /&gt;
if [ $uuid_grub_boot == $uuid_os_root ] ; then&lt;br /&gt;
  set grub_boot=$grub_boot/boot&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
set kernel_parameters_common=&amp;quot;boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot usbcore.autosuspend=-1&amp;quot;&lt;br /&gt;
set kernel_parameters_persistence=&amp;quot;persistence persistence-storage=filesystem persistence-label=LABELorGPTname&amp;quot;&lt;br /&gt;
set myversion=4.19.0-13-amd64&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#With an unsafe shutdown or powerloss the persistence filesystem will have errors,&lt;br /&gt;
#since it has no journaling, we want to run fsck on it once&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence fsck&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence forcefsck&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Live&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Or (2) Generate grub.cfg with grub-mkconfig====&lt;br /&gt;
Again, using the handcrafted grub.cfg above is probably fine, but here are details on how to get grub-mkconfig to work, which geterates grub.cfg from directives in /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Now, /usr/sbin/grub-mkconfig is not robust line 142 &amp;amp; 146 in our context of chroot usage, assumes we&#039;re installing to / device and /boot, and offers no way to configure around the problem, so we change line 142 &amp;amp; 146:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Line 142:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium`&amp;quot;&lt;br /&gt;
# Line 146:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /boot`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium/boot`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy by hand the legacy grub.cfg menu entries I have, with your disk UUIDs into [https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file /etc/grub.d/40_custom].&lt;br /&gt;
&lt;br /&gt;
Now run grub-mkconfig, from within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-mkconfig -o /lib/live/mount/medium/boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmount /lib/live/mount/medium:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unmount /lib/live/mount/medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare the persistence partition===&lt;br /&gt;
And don&#039;t forget to make the persistence.conf file &#039;/ union&#039; on the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#cd to wherever you have mounted your persistence partition, e.g. /media/persistence&lt;br /&gt;
cd /media/persistence&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; &amp;gt; persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From /media/overlay/home grab the OSE Linux stuff in there, and put in /media/persistence/home:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /media/overlay/home /media/persistence/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There may also be other OSE Linux specific things removed by prior purges of non-&amp;quot;core&amp;quot; packages, e.g. in /etc/&lt;br /&gt;
I suppose there may be a way to &amp;quot;diff&amp;quot; those out, and re-add them to the persistence partition after the packages are installed anew. Maybe there is a convenient dpkg way of doing that... diffing and saving the configuration file changes from stock packages instead of purging them? Or is that the difference between apt-get remove and apt-get purge where apt-get remove will only remove stock configuration files leaving modified ones intact? Yes I think that may be right.&lt;br /&gt;
&lt;br /&gt;
===Cleanup===&lt;br /&gt;
Cleanup!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo umount /media/overlay/dev/pts&lt;br /&gt;
sudo umount /media/overlay/dev/&lt;br /&gt;
sudo umount /media/overlay/proc&lt;br /&gt;
sudo umount /media/overlay/sys&lt;br /&gt;
sudo umount /media/overlay/tmp&lt;br /&gt;
sudo umount /media/overlay&lt;br /&gt;
sudo umount /media/filesystem.squashfs&lt;br /&gt;
sudo umount /media/iso&lt;br /&gt;
sudo umount /media/myadditions&lt;br /&gt;
sudo rmdir /media/iso /media/filesystem.squashfs /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You now have an Linux OS on your USB with persistence that will boot within seconds and reliably outperforms the competition!&lt;br /&gt;
&lt;br /&gt;
==Further Details==&lt;br /&gt;
===Upgrading===&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when linux-image (the package containing the kernel) is upgraded?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; apt will want to update /boot/vmlinuz and /boot/initrd.img. So we need to do things in order to allow this to happen. We must boot with &#039;toram&#039; and also remount &#039;live&#039; as rw before running apt-get update.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#TODO, I wrote this elsewhere need to copy here, something along these lines:&lt;br /&gt;
mount -o remount,rw /lib/live/mount/medium /dev/disk/by-label/live&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this upgrade process apt might rename vmlinuz to say vmlinuz-3.16.0-4-amd64, and initrd similarly. It didn&#039;t always do this. But, you must match the names of those files with what is listed in grub.cfg! Either use &#039;vmlinuz&#039; or whatever name the apt script renamed them to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when libc is upgraded? Be it a security update, or when Debian Stable advances every couple years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; We will want to do a resquash:&lt;br /&gt;
# We need to to the same as above, &#039;toram&#039; and remount &#039;live&#039; as rw.&lt;br /&gt;
# dpkq-query our currently installed packages, and compare to /boot/filesystem.packages.xz we made earlier.&lt;br /&gt;
# Remove all non &amp;quot;core&amp;quot; packages, they should be cached in /var/cache/apt/archives/ so they don&#039;t need to be downloaded again, just reinstalled after we do the resquash.&lt;br /&gt;
# apt-get update&lt;br /&gt;
# Resquash, reboot to verify things working, in &#039;live&#039; mode remove squashed stuff from persistance partition.&lt;br /&gt;
## squash script https://gist.github.com/AndrewSmart/90eb186aea08db8f1426&lt;br /&gt;
## cleanup script https://gist.github.com/AndrewSmart/2f67f79f6f1922c4556f&lt;br /&gt;
# Reinstall packages removed prior to resquash from /var/cache/apt/archives&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; That looks like a lot to deal with.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I agree. I&#039;m looking at using dpkg triggers or /etc/apt/apt.conf.d/ hooks to manage this upgrade process. I hope to have something sufficient soon.&lt;br /&gt;
&lt;br /&gt;
I hope to also make a smaller guide that is not optimal in performance, but has way less steps, so the end user can test out the persistence and take the time to &amp;quot;upgrade&amp;quot; the performance later if so inclined.&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
Keep in mind with the USB we can still boot either in &#039;live&#039; mode, or &#039;persistence&#039; mode depending on the GRUB entry we choose. This is useful in case something breaks in &#039;persistence&#039; mode, like libc was upgraded in &#039;persistence&#039; but libc on &#039;live&#039; is still old! This will result in segmentation faults... a kernel panic, or whatever, it won&#039;t boot. We can access all of the software in the squashfs in &#039;live mode&#039;. Eventually I&#039;d like to write an apt hook to prevent the update of libc unless the system is prepared (&#039;toram&#039;, and &#039;live&#039; partition is mounted rw, the hook won&#039;t trigger unless &#039;persistence&#039; kernel parameter is used).&lt;br /&gt;
&lt;br /&gt;
Debian&#039;s live-boot scripts will put stuff in /lib/live/, and /lib/live/mount is of particularly good use in troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Ubuntu is a bit of a can of worms from my perspective as a fan of vanilla Debian. So... hopefully things will go smoothly... I highly recommend a lighter-weight environment for USB persistence, but I understand everyone has their preferences.&lt;br /&gt;
&lt;br /&gt;
Since &#039;toram&#039; puts the squashfs into memory, lets say you have 8GB RAM and an 800MB squashfs, that is fine, but say you move to a workstation with only 2GB RAM, you will probably want to remove the &#039;toram&#039; kernel parameter, things will be slower but the memory footprint used by the OS will be less, and only use &#039;toram&#039; when updating the &#039;live&#039; partition as detailed above. Perhaps consider 2 additional GRUB entries, in addition to the two I have listed above, where the 2 additional entries are live and persistence mode without &#039;toram&#039; kernel parameter, and when booting select the entry depending on the amount of RAM the system has.&lt;br /&gt;
&lt;br /&gt;
In the event of a power outage, kernel panic, unsafe shutdown or whatever, the filesystem may have problems you&#039;re warned about on next boot. In this setup, the &#039;live&#039; partition was mounted ro, so it is not possible to have filesystem errors there, but with the &#039;persistence&#039; partition there will likely be errors. So, on next boot we select the &#039;live&#039; mode in grub, and run fsck.ext4 -p /dev/disk/by-label/persistence, and all problems are fixed!&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 06:43, 5 November 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=242904</id>
		<title>Talk:OSE Linux Persistence</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=242904"/>
		<updated>2021-01-26T14:56:52Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Andrewusu&amp;#039;s Thoughts */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://en.m.wikipedia.org/wiki/UNetbootin claims to have a persistence option for ubuntu distros. I couldn&#039;t get it to work. --[[User:Dorkmo|Dorkmo]] ([[User talk:Dorkmo|talk]]) 19:33, 14 July 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==Andrewusu&#039;s Thoughts==&lt;br /&gt;
I&#039;ve used persistence on USB for over 10 years now as my primary system (4+ hours/day) and will share some thoughts. Way back with USB2 I spent a lot of time investigating performance, ways to speed up boot time and system responsiveness. Keep in mind benchmarks of any flash memory device, where sequential reading is [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 10-20x] faster than non-sequential reads (possibly more depending on the device). By following this setup I describe below you take advantage of those fast reads for a quick boot and a very responsive OS.&lt;br /&gt;
&lt;br /&gt;
[https://youtu.be/JdnA6LblqOE Here] is a video of a minimal Debian distro on a live-boot persistence USB booting. By 35s system uptime I have launched both the terminal and filesystem browser.&lt;br /&gt;
&lt;br /&gt;
It has been great, I can move my programs, data, and OS from workstation to workstation with a breeze. From a desktop to a laptop, a library computer, or computer at work at times even. I&#039;ll never going back to installing Linux on a HDD. I use HDDs on workstations for storing data, or even making a ~8GB swap file if I need more system memory for some big task (e.g. big FreeCAD model).&lt;br /&gt;
&lt;br /&gt;
I don&#039;t use unetbootin, ISOs, or any other setups, just [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#547 Debian&#039;s live-boot]  and a &#039;persistence&#039; partition.&lt;br /&gt;
&lt;br /&gt;
On Ubuntu an alternative to live-boot is casper, which supports more options such as booting from an ISO file via a kernel parameter. The [https://manpages.debian.org/buster/live-boot-doc/live-boot.7.en.html &#039;boot=live&#039;] kernel parameter results in live-boot being used, while the [http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html &#039;boot=casper&#039;] kernel parameter results in casper being used. With casper the default labeling of the persistence partition is &#039;casper-rw&#039; instead of &#039;persistence&#039; with live-boot.&lt;br /&gt;
&lt;br /&gt;
It is very simple, you have the second partition labeled &#039;persistence&#039; with a configuration file, and Debian&#039;s live-boot scripts handle everything.&lt;br /&gt;
&lt;br /&gt;
===live-boot Squashfs/Persistence===&lt;br /&gt;
[[File:LinuxUSBPersistencePartitions.png]]&lt;br /&gt;
* &#039;live&#039; partition contains the squashfs, initrd and vmlinuz in /live. Can only be mounted ro unless &#039;toram&#039; kernel parameter used.&lt;br /&gt;
* &#039;persistence&#039; partition is mounted rw.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;&lt;br /&gt;
# With a squashfs/persistence install instead of a full install to USB, you&#039;ll see a much faster boot, because the &#039;live&#039; partition is compressed ([https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html squashfs]) and is thus sequentially read into memory faster compared to random reads of various uncompressed files from the USB as they&#039;re needed during the boot process. Mine boots within 20 or so seconds.&lt;br /&gt;
# When running the system with day to day tasks, the performance and responsiveness of a squashfs/persistence setup is better than a full install, because the squashfs may be loaded to memory ([https://manpages.debian.org/jessie/live-boot-doc/live-boot.7.en.html toram]) occupying around 600-800MB RAM, and is thus not a bottleneck on reads/writes to the USB slowing the system down like you&#039;d see in a full install to USB. This translates into better framerate playing games like Starcraft 2, which I&#039;ve run from this flash drive, and a more responsive system in general (to mouse clicks, key presses, etc).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Limitations:&#039;&#039;&#039;&lt;br /&gt;
# A 64-bit install won&#039;t work on a 32-bit machine&lt;br /&gt;
# A USB with /etc/X11/xorg.conf set to use an NVIDIA GPU driver won&#039;t be as mobile:&lt;br /&gt;
## e.g. Will not boot graphically on an Intel GPU system but to a [https://en.wikipedia.org/wiki/Virtual_console virtual console].&lt;br /&gt;
## This can be mitigated by editing xorg.conf while on the Intel system&#039;s virtual console and rebooting to get the graphical interface. Or possibily without rebooting with some wizardry like rmmod and then startx, but I don&#039;t recall off the top of my head. And you have to redo this in reverse going back to the NVIDIA system. Maybe this is just a limitation of proprietary GPU drivers.&lt;br /&gt;
# Copy-on-write [https://superuser.com/questions/833576/differences-of-aufs-unionfs-and-overlayfs-from-each-other aufs/overlayfs] (whetever distro has chosen) has some limitations:&lt;br /&gt;
## Read-only &#039;live&#039; partition needs to be updated whenever libc or linux-image are updated, or the system won&#039;t boot. So it needs to be mounted read-write and in order to do so &#039;toram&#039; kernal boot parameter must be used. I work around this problem manually via inspecting apt output before installing anything, but this chore can be mitigated via an apt hook which I&#039;ve not written yet.&lt;br /&gt;
## &#039;live&#039; partition containing the squashfs should only have packages which are not updated often, being core packages, and not something like firefox which is updated often. This will minimize the size of the squashfs.&lt;br /&gt;
## When Debian stable is updated to the next revision, the linux-image must be updated, and the squashfs recompressed. To do this, all non-core packages must be removed, the distro upgraded, the squashfs recompressed, and then non-core packages reinstalled. This can also be scripted and I have some non-robust helper scripts I&#039;ve written.&lt;br /&gt;
# Flash memory has limitations, where sequential writes are [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 5000x-10000x] faster than random writes. Due to this, there should always be at least 2GB free on the &#039;persistence&#039; filesystem, or else risk files becoming fragmented and the any application blocking on reads/writes will &#039;&#039;&#039;hang&#039;&#039;&#039; from &#039;&#039;&#039;very slow&#039;&#039;&#039; reading and writing. In this circumstance it may be a number of minutes before such applications respond again, but you&#039;re free to use this time to do other things with already opened applications, like use the web browser or read opened documents.&lt;br /&gt;
&lt;br /&gt;
I personally use a lightweight Debian distro (not Ubuntu!) to minimize RAM footprint, minimize squashfs size, and maximize responsiveness. It is all instantaneous on USB3 (was a bit sluggish on USB2 on an older 4GB stick when I first started). I recommend at least a 32GB stick.&lt;br /&gt;
&lt;br /&gt;
Once the apt hook is implemented and distro-upgrade script polished, this should be a very nice option for interested users.&lt;br /&gt;
&lt;br /&gt;
There are tons of persistence guides, which unfairly dismiss this live-boot squashfs/persistence setup because they don&#039;t know how to mitigate/handle the upgrade problem as I do, because making a squashfs is not something well known which requires a lot of plumbing. Or they suggest other unnecessarily complex setups or make suggestions without having investigated performance implications (e.g. suggesting a full install to USB).&lt;br /&gt;
&lt;br /&gt;
I do not recommend modern Samsung, Sandisk, or any other cheap off-brands for this &amp;quot;heavy&amp;quot; use. Good chance they&#039;ll fail within a year and be too hot to touch. &#039;&#039;&#039;Buy from Toshiba/Kioxia&#039;&#039;&#039;, the inventors of flash memory. Yes their [https://www.amazon.com/Toshiba-TransMemory-U364-USB3-0-THN-U364W0320A4/dp/B078NPLXGC#customerReviews performance] as shown in benchmarks isn&#039;t as good, nor are they inexpensive, but they are reliable and will last years. &#039;&#039;&#039;Do not&#039;&#039;&#039; skimp to save a few $ buying a Sandisk/Samsung on a sale for this use-case, I&#039;m speaking from experience!&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&#039;&#039;&#039;Pros:&#039;&#039;&#039;&lt;br /&gt;
# Sure it may be useful if for example, you forget the drive in an internet cafe or library. Or have something you don&#039;t want to turn up in investigation.&lt;br /&gt;
&#039;&#039;&#039;Cons:&#039;&#039;&#039;&lt;br /&gt;
# It costs additional CPU &amp;amp; energy usage.&lt;br /&gt;
# Encryption offers zero &amp;quot;online&amp;quot;/mounted protection, e.g. encryption does not protect against a web browser vulnerability allowing disk access. Mental energy would be better spent on [https://wiki.archlinux.org/index.php/security &#039;hardening&#039;] the system.&lt;br /&gt;
# Harder to recover data when things break. &#039;&#039;Big&#039;&#039; headache.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 20:40, 4 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I will write more thoughts, I see this is an ongoing need/interest [[OSE_Linux_Log]]. Today I have ordered two Toshiba USB flash drives. I will write a guide here for preparing any Debian distro for USB persistence with optimal performance (squashfs &amp;amp; persistence partition) for interested readers.&lt;br /&gt;
&lt;br /&gt;
==GUIDE==&lt;br /&gt;
This guide will first make a live USB stick persistent.&lt;br /&gt;
&lt;br /&gt;
In the appendix will be additional knowledge and procedures to make it perform better.&lt;br /&gt;
&lt;br /&gt;
Brief steps:&lt;br /&gt;
#Make live USB&lt;br /&gt;
##Partition the USB.&lt;br /&gt;
##Mount the ISO, and copy select files to the USB&#039;s live partition.&lt;br /&gt;
##Install grub.&lt;br /&gt;
#Make the live USB a persistent USB&lt;br /&gt;
##Boot to live USB &amp;amp; Setup persistence.&lt;br /&gt;
&lt;br /&gt;
===Make live USB===&lt;br /&gt;
You can follow a different guide and then run the command `live-persistence`. Then when it comes time to upgrade libc or the kernel you can run `live-toram`, then follow the squash guide below.&lt;br /&gt;
&lt;br /&gt;
But here is the way I&#039;d do it.&lt;br /&gt;
====Partition the USB====&lt;br /&gt;
Use gparted. Make a GPT partition, with 16MB unused.&lt;br /&gt;
&lt;br /&gt;
Make live partition 1GB is fine. Big enough to fit the squashfs, vmlinuz, and initrd files from the ISO. Label it &#039;live&#039;, or whatever you want.&lt;br /&gt;
&lt;br /&gt;
Make persistence partition filling up the remainder. Label it &#039;peristence&#039;, or whatever you want, but you&#039;ll have to use the label you use in the grub.cfg later.&lt;br /&gt;
&lt;br /&gt;
Now make a small partition at least 1MB big into the 16MB unused space at the start. Don&#039;t format it with a filesystem, leave it unformatted. This is where GRUB installs stuff into.&lt;br /&gt;
====Mount the ISO, and copy select files to the USB&#039;s live partition====&lt;br /&gt;
Yep, copy the squashfs, vmlinuz, and initrd to /live on the live partition, e.g. /media/live/live&lt;br /&gt;
Easy peasy.&lt;br /&gt;
====Install grub====&lt;br /&gt;
Should go to /media/live/grub&lt;br /&gt;
&lt;br /&gt;
Boot to the USB! It is live!&lt;br /&gt;
===Make the live USB a persistent USB===&lt;br /&gt;
While you&#039;re booted to the live USB, mount the persistence partition, and put a peristence.conf file on it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; | sudo tee /media/peristence/persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, read the short manual on live-tools. And type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
man live-tools&lt;br /&gt;
live-peristence&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Neat, all your files you&#039;re using in the live USB, are now saved to the persistence partition. Though, we have to write a few changes to grub.cfg in order to load that stuff on next boot.&lt;br /&gt;
====Edit grub.cfg====&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
This guide seeks a USB stick with optimal performance, which requires a minimal squashfs.&lt;br /&gt;
&lt;br /&gt;
If USB space and performance are not concerns for you, you&#039;re welcome to modify an existing live USB, name a 2nd partition &amp;quot;persistence&amp;quot;, add suitable kernel parameters including &amp;quot;persistence&amp;quot;, and write a persistence.conf file containing &amp;quot;/ union&amp;quot; in the persistence partition. You can understand necessary details by understanding the guide below. Boot time may take a minute or longer, and applications may be slow and hang due to limitations of flash media which this guide seeks to minimize.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s proceed with making the USB with optimal performance.&lt;br /&gt;
&lt;br /&gt;
===Some notes on flash media===&lt;br /&gt;
The first partition should start after some multiple of the medium&#039;s [https://lwn.net/Articles/428584/ erase block]. The erase block size might be published by the manufacturer, or reasoned about via [https://github.com/bradfa/flashbench benchmarking]. However SSDs and modern USB sticks use more sophisticated controllers so flashbench [https://lists.linaro.org/pipermail/flashbench-results/2016-December/000599.html won&#039;t provide the necessary insights]. So starting the first partition at a 16MiB or 32MiB offset would be a reasonable choice, being some multiple of the erase block.&lt;br /&gt;
&lt;br /&gt;
When considering the [https://superuser.com/questions/379074/how-to-correctly-partition-usb-flash-drive-and-which-filesystem-to-choose-consid stride and stripe-width] parameters I&#039;m not sure it makes a difference anymore with more sophisticated controllers.&lt;br /&gt;
&lt;br /&gt;
On the flash media, writing is slow, so modern ones typically have a faster volatile cache, which is then written to the non-volatile flash memory. So when you write a large file to the medium, and it appears to finish via the command completing, but in reality it won&#039;t be done for some time. This is why writing speed appears to slow down in benchmarking the longer the write goes, from say 20MB/s to 4MB/s, this is due to the volatile cache filling up. ext4 when writing the journal uses a &amp;quot;barrier&amp;quot; somehow implemented, and usually implemented by the USB driver/device where the command blocks until the write is actually written to non-volatile memory, but I think this feature isn&#039;t exposed by ext4 for use in benchmarking. This is something to be cautious about before shutting down the system, leave the system idle for about 30-60 seconds after shutting down the browser or other write activity before powering down the system, as it is possible the write is still transferring from the volatile cache to non-volatile memory, and the OS doesn&#039;t know better, as we&#039;d disabled ext4 journalling for performance and longevity reasons, and it has been my experience that linux doesn&#039;t wait for the non-volatile write to finish anyway on shutdown, printing write errors on shutdown if this is the case. If this happens, then run a fsck on next boot, we&#039;ll make the Grub entry later to make running fsck convenient to best fix the consistency problems.&lt;br /&gt;
&lt;br /&gt;
===Partitioning===&lt;br /&gt;
A GPT partition table is fine, as is an MBR partition table.&lt;br /&gt;
&lt;br /&gt;
If doing GPT then make a small unformatted partition in the 16MiB or 32MiB offset before the live partition. It only needs to be 1MiB, but can be larger. Set the &#039;boot_grub&#039; flag on it in gparted. Grub will install to it later in this guide.&lt;br /&gt;
&lt;br /&gt;
Here is my example command of how I made the ext4 filesystem for the live partition. The option ^has_journal disables the journal, important for flash memory longevity. Determine which partition to run mkfs.ext4 on, mine is /dev/sdd1 and /dev/sdd2.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -N 2048 -L live -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;yourpartition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to do an EFI system partition (ESP), then have this also be the live partition, which we use as our &amp;quot;/boot&amp;quot; partition. This must be FAT32 instead of ext4 unfortunately. Set the &#039;esp&#039; flag on the live partition in gparted. When we install GRUB later, it will install EFI files to the live partition.&lt;br /&gt;
&lt;br /&gt;
And for the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -L persistence -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;your partition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare squashfs===&lt;br /&gt;
Download ISO of desired debian distro (e.g. OSE Linux). Put it at /tmp/&lt;br /&gt;
&lt;br /&gt;
chroot just uses your current Kernel. That&#039;s just how it works. Because of this it is best if the kernel of the system you&#039;re running to be the most recent available for the distro release of the ISO (e.g. for me [https://packages.debian.org/buster/linux-image-amd64 linux-image-4.19.0-13-amd64] as of this writing). If this isn&#039;t possible, boot to the ISO and skip to the [[Talk:OSE_Linux_Persistence#Remove_non-core_packages]] instructions without doing the chroot. You can do this all on a single USB stick if you do it correctly. Or you could use [https://help.ubuntu.com/community/DebootstrapChroot] or virtualization, lots of possibilities outside the scope of this guide.&lt;br /&gt;
&lt;br /&gt;
Actually now that I think about it writing the guide following the live USB installation without doing the chroot may be best, being more generalized and perhaps easier. I will rewrite this guide that way in the future, but for now, here are the chroot directions.&lt;br /&gt;
&lt;br /&gt;
====prepare chroot filesystem====&lt;br /&gt;
Let us continue with the chroot assuming we&#039;re running the same distro/kernel. Mount the ISO, and look for filesystem.squashfs, initrd.img, vmlinuz on it. Also note the location of config, System.map and filesystem.packages.xz, we&#039;ll copy or make these to follow convention.&lt;br /&gt;
&lt;br /&gt;
Make temporary directories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir /media/filesystem.squashfs /media/iso /media/overlay /media/myadditions /media/myadditions/rw /media/myadditions/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -o loop /tmp/debian-distro-i386.iso /media/iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount filesystem.squashfs on the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t squashfs /media/iso/live/filesystem.squashfs /media/filesystem.squashfs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount an in-memory filesystem to hold temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t tmpfs -o size=1024m none /media/myadditions&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prepare the union filesystem, so that we&#039;re able to edit the squashfs on the iso and compress the result. We can use either [https://wiki.archlinux.org/index.php/Overlay_filesystem overlayfs] or aufs. Here is the overlayfs command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t overlay overlay -o lowerdir=/media/filesystem.squashfs,upperdir=/media/myadditions/rw,workdir=/media/myadditions/work /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or afus. overlayfs hasn&#039;t been widely available until kernel 3.18, and aufs is available on earlier kernels (from [https://sourceforge.net/p/aufs/aufs3-standalone/ci/f88513f985e153aaf3e2950622c2a2329c3c3f8f/log/ kernel 3.9 late 2014 aufs supports xattr]) via aufs-tools, and their may be some differences I&#039;m not aware of but I think the concensus is that overlayfs is better. Hopefully aufs supports extended attributes (xattr) good enough to not loose said attributes, which are important for hardening the system (extended attributes are I believe where [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities] are stored/configured).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t aufs -o br=/media/myadditions=rw -o br=/media/filesystem.squashfs=ro -o udba=reval none /media/overlay/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====chroot====&lt;br /&gt;
Prepare the chroot, so that we can run apt within it and remove packages. resolv.conf and mount binds are to remove error/warning messages when installing packages with apt.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp /etc/resolv.conf /media/overlay/etc/resolv.conf&lt;br /&gt;
sudo mount --bind /dev/ /media/overlay/dev/&lt;br /&gt;
sudo mount --bind /dev/pts /media/overlay/dev/pts #https://wiki.debian.org/chroot#A.2Fdev.2Fpts&lt;br /&gt;
sudo mount --bind /proc /media/overlay/proc&lt;br /&gt;
sudo mount --bind /sys /media/overlay/sys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now chroot into the squashfs so we can use apt within it to remove packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chroot --userspec root:root /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the locale, you&#039;ll get many warning messages in apt otherwise. You probably want to select UTF-8 for your country/language, for example I picked en_US.UTF-8. Press space bar to toggle each locale you want generated, then press enter to proceed. Then it asks if you want the locales you chose to be applied systemwide, forcing your selection on each user, which may be desired for desktop software which starts up before the user-specific ~/.profile is read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure locales&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And set the timezone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure tzdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If /boot exists, then back it up, we&#039;re replacing /boot with a symlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /boot /boot.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must make a symlink so that as we work with apt-get, it may call `live-update-initramfs -u`, and we need those updates to /boot to go to the proper location, the &#039;live&#039; partition&#039;s /live:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /lib/live/mount/medium/live /boot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve not yet made the live partition, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If already have the live partition ready, or like me are updating an existing live partition&#039;s squashfs, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
mkdir /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have to do the above steps to work around update-initramfs&#039;s logic and assumptions regarding a read/write test that this works around. If you ever run into problems with update-initramfs while using apt-get, this is what you run once the problem is fixed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg --configure initramfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we remove packages, such at btrfs-progs, update-initramfs will be triggered which should update /boot/vmlinuz and /boot/initrd, these files are not compressed into the filesystem.squashfs and we need those files within /live of the live partition to boot.&lt;br /&gt;
&lt;br /&gt;
`man live-boot` is a useful reference, ensure live-boot-doc is installed. Also the [https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html Debian live-manual] is a useful reference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install live-boot-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Remove non-core packages====&lt;br /&gt;
&lt;br /&gt;
Now we gut the filesystem.squashfs from the iso of packages that:&lt;br /&gt;
* We don&#039;t want.&lt;br /&gt;
* Are frequently updated (e.g. web browser).&lt;br /&gt;
* With particular scrutiny of packages that are large.&lt;br /&gt;
* Are not necessary to boot to a desktop.&lt;br /&gt;
All of those can they can go onto persistence partition. We remove them now, and install them after the squashfs has been made, or as needed. Examples of what should be considered &amp;quot;core&amp;quot; packages necessary to boot are: linux-image (this is the kernel), firmware, GPU driver, and X11 server. This way the USB will:&lt;br /&gt;
* Boot fast,&lt;br /&gt;
* The OS running from it will be maximally responsive,&lt;br /&gt;
* Will have minimal memory footprint,&lt;br /&gt;
* And be persistent!&lt;br /&gt;
&lt;br /&gt;
Run this to see packages installed ordered by size, then apt-get remove or purge stuff, and ignore anything beginning with &amp;quot;lib&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W -f &#039;${Installed-Size}\t${Package}\n&#039; | sort -n | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To understand what a package is, you can search [https://packages.debian.org/buster/os-prober packages.debian.org]. If the description there isn&#039;t informative enough, you can try clicking the links on the right hand side such as a project homepage, or looking through the files of the package. Ignore or don&#039;t pay much attention to any package beginning with &amp;quot;lib&amp;quot;, with the exception of things like libc6, but apt will probably warn you about doing something silly like that with the prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
You are about to do something potentially harmful.&lt;br /&gt;
To continue type in the phrase &#039;Yes, do as I say!&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example of stuff I removed from a different Debian distro (BunsenLabs), but I removed some firmware packages so that reduces portability:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get remove -y firefox-esr libjsoncpp1&lt;br /&gt;
apt-get remove -y libreoffice-core libreoffice-common coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1 libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-locale1.67.0 libboost-thread1.67.0 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data libgpgmepp6 liblangtag-common liblangtag1 libmhash2 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libnumbertext-data libodfgen-0.1-1 liborcus-0.14-0 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 libstaroffice-0.0-0 libsuitesparseconfig5 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure&lt;br /&gt;
apt-get remove -y firmware-atheros firmware-netronome firmware-iwlwifi firmware-brcm80211 firmware-qlogic firmware-ti-connectivity firmware-myricom firmware-intelwimax firmware-libertas dahdi-firmware-nonfree atmel-firmware firmware-cavium firmware-bnx2x firmware-qcom-media firmware-netxen firmware-samsung firmware-ipw2x00 firmware-siano firmware-ivtv firmware-bnx2&lt;br /&gt;
apt-get remove -y samba-libs libavahi-glib1 libcdio-cdda2 libcdio-paranoia2 libgd3 libgdata-common libgdata22 libgoa-1.0-0b libgoa-1.0-common libgphoto2-6 libgphoto2-port12 libldb1 liblmdb0 liboauth0 libpython2.7 libtalloc2 libtevent0 libwbclient0 python-talloc&lt;br /&gt;
apt-get remove -y fonts-noto-core fonts-noto-cjk papirus-icon-theme bunsen-papirus-icon-theme gnome-icon-theme gdebi-core gir1.2-vte-2.91 python3-apt python3-chardet python3-debian python3-pkg-resources&lt;br /&gt;
rm -r /usr/share/gdebi/GDebi /usr/lib/python3/dist-packages/aptsources /usr/lib/python3/dist-packages/apt/progress /usr/lib/python3/dist-packages/debian_bundle /usr/lib/python3/dist-packages/debian /usr/lib/python3/dist-packages/chardet/cli /usr/lib/python3/dist-packages/pkg_resources/extern /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging&lt;br /&gt;
apt-get remove -y evince synaptic bubblewrap evince-common gnome-desktop3-data libbrotli1 libdjvulibre-text libdjvulibre21 libept1.5.0 libevdocument3-4 libevview3-3 libgnome-desktop-3-17 libgspell-1-1 libgspell-1-common libgxps2 libharfbuzz-icu0 libhyphen0 libjavascriptcoregtk-4.0-18 libkpathsea6 libspectre1 libsynctex2 libwebkit2gtk-4.0-37 libwebpdemux2 libwoff1 xdg-dbus-proxy zenity zenity-common&lt;br /&gt;
apt-get remove -y vlc libaribb24-0 libbasicusageenvironment1 libcddb2 libdvbpsi10 libebml4v5 libgles2 libgroupsock8 libixml10 liblirc-client0 liblivemedia64 liblua5.2-0 libmad0 libmatroska6v5 libmtp-common libmtp9 libnfs12 libopenmpt-modplug1 libplacebo7 libprotobuf-lite17 libqt5x11extras5 libresid-builder0c2a libsdl-image1.2 libsdl1.2debian libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libxcb-xv0 vlc-bin vlc-data vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output vlc-plugin-notify libvlccore9&lt;br /&gt;
apt-get remove -y file-roller p7zip-full p7zip libarchive13 libnautilus-extension1a xfburn libburn4 libexo-1-0 libisofs6 libjte1 unar gnustep-base-common gnustep-base-runtime gnustep-common libgnustep-base1.26 libobjc4&lt;br /&gt;
apt-get remove -y transmission-gtk libevent-2.1-6 libminiupnpc17 libnatpmp1 transmission-common filezilla filezilla-common libfilezilla0 libpugixml1v5 libwxbase3.0-0v5 libwxgtk3.0-0v5 yudit-common feh&lt;br /&gt;
apt-get remove -y libpython2.7-stdlib libblas3 libgfortran5 libkeybinder0 liblapack3 libpython2.7-minimal libsodium23 lua-bit32 lua-expat lua-penlight lua-posix lua-socket lua5.2 python-apt-common python-minimal python2-minimal python2.7-minimal libavformat58 libmysofa0 libnorm1 libpgm-5.2-0 libpostproc55 librubberband2 libssh-gcrypt-4 libswscale5 libvidstab1.1&lt;br /&gt;
apt-get remove -y aptitude aptitude-common libboost-iostreams1.67.0 libboost-system1.67.0 libcwidget3v5 libxapian30 ristretto file libmagic-mgc libmagic1 hexchat-common&lt;br /&gt;
apt-get install wpasupplicant network-manager --no-install-recommends&lt;br /&gt;
#modem support&lt;br /&gt;
apt-get remove -y modemmanager libmbim-glib4 libmbim-proxy libqmi-glib5 libqmi-proxy openssh-client libxatracker2 nitrogen libgtkmm-2.4-1v5 lvm2 dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 nano geany geany-common ghostscript poppler-data libcupsimage2 libgs9-common libijs-0.35 libjbig2dec0 libpaper1 pcmciautils vdpau-va-driver arandr&lt;br /&gt;
apt-get remove -y intel-microcode iucode-tool va-driver-all i965-va-driver xserver-xorg-video-intel libxvmc1 intel-media-va-driver libigdgmm5 xserver-xorg-video-qxl btrfs-progs cryptsetup-initramfs cryptsetup-bin cryptsetup-run&lt;br /&gt;
apt-get remove -y python3.7-minimal dconf-cli distro-info-data gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-pango-1.0 libfm-extra4 libgirepository-1.0-1 libmenu-cache-bin libmenu-cache3 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libxslt1.1 mime-support wmctrl&lt;br /&gt;
rm -r /usr/lib/python3&lt;br /&gt;
apt-get remove -y iso-codes liba52-0.7.4 libaa1 libass9 libatomic1 libavc1394-0 libavfilter7 libavformat58 libbs2b0 libcaca0 libcdio18 libcdparanoia0 libchromaprint1 libdc1394-22 libdca0 libde265-0 libdv4 libdvdnav4 libdvdread4 libfaad2 libfftw3-double3 libflite1 libfluidsynth1 libgme0 libgssdp-1.0-3 libgstreamer1.0-0 libgupnp-1.0-4 libgupnp-igd-1.0-4 libiec61883-0 libilmbase23 libkate1 liblilv-0-0 libmjpegutils-2.1-0 libmms0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa0 libnice10 libnorm1 libofa0 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr23 libopenmpt0 libpgm-5.2-0 libpoppler-glib8 libpoppler82 libpostproc55 libraw1394-11 librubberband2 libsbc1 libserd-0-0 libshout3 libsidplay1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libspandsp2 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libswscale5 libtumbler-1-0 libv4l-0 libv4lconvert0 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvulkan1 libwildmidi2 libzbar0 libzmq5 tumbler-common&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, much of what was removed can be installed again after persistence is set up. These packages are conveniently listed as removed within dpkg utilities, I&#039;ll illustrate how to conveniently reinstall them later.&lt;br /&gt;
&lt;br /&gt;
====Misc setup tips====&lt;br /&gt;
&lt;br /&gt;
[https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#521 One important consideration is that the live user is created by live-boot at boot time]. We need to ensure the live user is set up. Inspect the contents of /etc/live/ for any configuration files. If there is none in your distribution then let&#039;s make it, and feel free to customize this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/config.conf.d/10-user-setup.conf&lt;br /&gt;
LIVE_HOSTNAME=debian-persistence&lt;br /&gt;
LIVE_USERNAME=user&lt;br /&gt;
LIVE_USER_FULLNAME=&amp;quot;Debian LiveUser&amp;quot;&lt;br /&gt;
LIVE_USER_DEFAULT_GROUPS=&amp;quot;cdrom floppy audio dip video plugdev fuse bluetooth netdev scanner staff&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These options to live-boot will minimize the generated initramfs size:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/boot.conf&lt;br /&gt;
#man live-boot&lt;br /&gt;
#see /usr/share/initramfs-tools/hooks/live, might make initrd smaller&lt;br /&gt;
DISABLE_CDROM=true&lt;br /&gt;
DISABLE_FAT=true&lt;br /&gt;
DISABLE_FUSE=true&lt;br /&gt;
DISABLE_NTFS=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Performance tips====&lt;br /&gt;
&lt;br /&gt;
USB sticks use flash memory, and to maximize performance with it we can [https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler change the IO scheduler for such devices].&lt;br /&gt;
&lt;br /&gt;
BFQ looks like a nice scheduler. Quote:&lt;br /&gt;
&amp;quot;Regardless of the actual background workload, BFQ guarantees that, for interactive tasks, the storage device is virtually as responsive as if it was idle. [...] As a comparison, with CFQ, NOOP or DEADLINE, and in the same conditions, applications experience high latencies, or even become unresponsive until the background workload terminates (also on SSDs).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mq_deadline is fine while the system is booting. The scheduler in use can also be [https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers tuned], but I need to do more research before giving advice on tuning in this context. To [https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler setup/enable]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/modules-load.d/bfq.conf&lt;br /&gt;
bfq&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set bfq scheduler during startup. Alternatives include mq_deadline and none, either might be faster than bfq during startup when GUI application responsiveness isn&#039;t important, but I&#039;d need to do some research/experiments.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/udev/rules.d/60-ssd-scheduler.rules&lt;br /&gt;
# set bfq scheduler for non-rotating disks during startup&lt;br /&gt;
ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;sd[a-z]&amp;quot;, ATTR{queue/rotational}==&amp;quot;0&amp;quot;, ATTR{queue/scheduler}=&amp;quot;bfq&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use [https://wiki.archlinux.org/index.php/profile-sync-daemon profile-sync-daemon] to enhance performance of the browser, and minimize flash memory writes (maximize longevity).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install profile-sync-damon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For SD card longevity, consider mounting a tmpfs on /var/log. But perhaps only after you&#039;ve booted to the system a few times and verify the system is stable, as putting log files in RAM means they can&#039;t be read offline to diagnose a problem. So disable this feature if needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /var/log tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/tmpfiles.d/varlog.conf&lt;br /&gt;
d /var/log/apt 755 root root&lt;br /&gt;
d /var/log/lightdm 711 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vlc&#039;s default lookahead is too short, leads to music cutting out. &#039;Tools-&amp;gt;Preferences&#039;, toggle &#039;Show all settings&#039;, click &#039;Input/Codecs&#039; in tree view, scroll down to &#039;Advanced&#039; section and look at caching settings. Increase them to at least 600ms. This should largely mitigate problems with music/video stopping momentarily due to I/O delays.&lt;br /&gt;
&lt;br /&gt;
====Pruning tips====&lt;br /&gt;
Install deborphan and localepurge to help clean stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install deborphan localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you&#039;re done pruning things, run deborphan and remove things it tells you to as you desire. Deborphan helps you find &amp;quot;orphan&amp;quot; packages not needed by anything else, which take up space. Such orphaned packages may have been necessary by a previously installed package.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
deborphan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next run localepurge to remove space consuming files for locales you&#039;ll never use, I removed 160MB from my system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, clear out apt temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get autoremove&lt;br /&gt;
apt-get clean&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend vim.tiny over vim, vim.tiny much smaller, also install whatever else your heart desires that is small and infrequently updated. Such small utilities will be available in &#039;live&#039; mode (if installed when in &#039;persistence&#039; mode, it won&#039;t be available in plain &#039;live&#039; mode):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install vim-tiny&lt;br /&gt;
echo &amp;quot;set nocp&amp;quot; &amp;gt;&amp;gt; /etc/vim/vimrc.tiny #Allows arrow keys to work, and vim.tiny to act like vim instead of vi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Hardening tips====&lt;br /&gt;
&lt;br /&gt;
I think it is best for /tmp to be mounted noexec, but many applications have bugs regarding this&lt;br /&gt;
Double check the /etc/fstab file with a text editor after editing /etc/fstab:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /tmp tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mount /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often apt packages during installation will require the ability to execute temporary files on /tmp, this is how we allow this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/apt/apt.conf.d/50remount&lt;br /&gt;
DPkg::Pre-Install-Pkgs {&amp;quot;mount -o remount,exec /tmp&amp;quot;;};&lt;br /&gt;
DPkg::Post-Invoke {&amp;quot;mount -o remount /tmp&amp;quot;;};&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A common thing people do, is charge their android phone, or other USB device via a USB port on the computer. Realize that this is physical access, which a compromised device may use to log in to Linux via root. I suspect I had fallen victim to in the past, a keylogger following a pattern I&#039;d seen exhibited in the news, which I believe came after I&#039;d plugged in a new android I had run questionable rooting software on, to my computer. I suggest both setting a root password, and disallowing this access, by editing /etc/securetty and commenting out root access via UART serial ports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# UART serial ports&lt;br /&gt;
#ttyS0&lt;br /&gt;
#ttyS1&lt;br /&gt;
#ttyS2&lt;br /&gt;
#ttyS3&lt;br /&gt;
#ttyS4&lt;br /&gt;
#ttyS5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the [https://www.debian.org/doc/manuals/securing-debian-manual/ch03s04.en.html root password]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What has piqued my interest lately is [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities]. Debian distributions should include both [https://packages.debian.org/buster/libcap2 libcap2] and [https://packages.debian.org/buster/libcap-ng0 libcap-ng0 (RedHat&#039;s fork)]. And I&#039;m looking for a more convenient open-source means of administration. What has me interested in the idea of a [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html proactive defense against root-kits] by removing module loading capabilities (CAP_SYS_MODULE) even for the root user, after the system had booted. It appears that lcap is no longer functional, it and many capabilities articles detail a system-wide capability bounding set in pre-2.6.25 kernels, but since kernel 2.6.25 capability bounding sets are now per-thread. The [http://people.redhat.com/sgrubb/libcap-ng/ images here] may help visually explain capabilities and their inheritance. What I have in mind may be within a custom /etc/init.d/ script calling [https://man7.org/linux/man-pages/man2/capset.2.html setcap] on init (pid 1) to remove the CAP_SYS_MODULE capability from the bounding set system-wide. The capabilities on any process can be viewed with `cat /proc/&amp;lt;pid&amp;gt;/status`.&lt;br /&gt;
&lt;br /&gt;
Something else that can be done is use of more than one account, for example an account dedicated to web browsing with minimal privileges, and an account with administration privileges (sudo, member of staff,adm groups).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser browser&lt;br /&gt;
dm-tool switch-to-user browser #with LightDM desktop manager: https://wiki.ubuntu.com/LightDM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files downloaded with the browser can be transfered to other users via /tmp, which is a good place to set as the default location to download files in the browser settings anyway.&lt;br /&gt;
&lt;br /&gt;
With this separation of user privileges, if malware managed to gained the privileges of the browser account (no privilege escalation), and escaped the browser sandbox, the worst it could do is keylog, delete or encrypt/ransom the browser account&#039;s files. Since the browser account is running on a difference X11 server than an administration account, I think [https://security.stackexchange.com/questions/4641/why-are-people-saying-that-the-x-window-system-is-not-secure/4646 risks] are reduced.&lt;br /&gt;
&lt;br /&gt;
Switching between the administration account and browser account X11 servers can be done with ctrl+alt+F7 or F8 (or F1/F2 or whatever).&lt;br /&gt;
&lt;br /&gt;
Or just have the desktop load with the browser account instead of the administrative account, and do administrative tasks on a virtual terminal (ctrl+alt+F1 through F6).&lt;br /&gt;
&lt;br /&gt;
Set up the [https://www.debian.org/doc/manuals/securing-debian-manual/ch04s11.en.html#id-1.5.14.17 shell history file], .bash_history better. An easy way a bad actor can circumvent the stock configuration from logging his evil deeds is to proceed those evil things with a space, this guide will fix that!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lsattr /home/browser/.bash_history  #See what attributes are set&lt;br /&gt;
sudo chattr +a /home/browser/.bash_history   #Only root user can chattr&lt;br /&gt;
sudo chattr +a /home/user/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Make filesystem.packages and filesystem.squashfs====&lt;br /&gt;
Now that we have a set of &amp;quot;core&amp;quot; packages to go in the squashfs, of minimal size, on the &#039;live&#039; partition, we must make our new squashfs!&lt;br /&gt;
&lt;br /&gt;
Print out a list of &amp;quot;core&amp;quot; packages we have, we&#039;ll need them for reference later. Lets put them in filesystem.packages.xz:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W --showformat=&#039;${Package}\t${Version}\n&#039; | xz &amp;gt; /tmp/filesystem.packages.xz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get -y install squashfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exclude stuff we don&#039;t want in the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXCLUDES=&#039;.wh* dev live-persistence.conf live lost+found media mnt proc .pulse* run home selinux sys tmp* lib/live/mount usr/lib/live/mount var/cache/apt var/cache/apt-xapian-index var/lib/apt/lists var/tmp&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Directives to squashfs-tools to make pseudofiles, necessary to boot. Linux will make many pseudofiles in /dev when it boots, but not all, and through experimentation and observations I&#039;ve come up with this list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /tmp/mksquashfs.pf&lt;br /&gt;
dev d 755 root root&lt;br /&gt;
dev/console c 662 root tty 5 1&lt;br /&gt;
dev/full c 666 root root 1 7&lt;br /&gt;
dev/kmem c 640 root kmem 1 2&lt;br /&gt;
dev/kmsg c 644 root root 1 11&lt;br /&gt;
dev/loop0 b 660 root disk 7 0&lt;br /&gt;
dev/loop1 b 660 root disk 7 1&lt;br /&gt;
dev/loop2 b 660 root disk 7 2&lt;br /&gt;
dev/loop3 b 660 root disk 7 3&lt;br /&gt;
dev/loop4 b 660 root disk 7 4&lt;br /&gt;
dev/loop5 b 660 root disk 7 5&lt;br /&gt;
dev/loop6 b 660 root disk 7 6&lt;br /&gt;
dev/loop7 b 660 root disk 7 7&lt;br /&gt;
dev/mem c 640 root kmem 1 1&lt;br /&gt;
dev/null c 666 root root 1 3&lt;br /&gt;
dev/port c 640 root kmem 1 4&lt;br /&gt;
dev/ptmx c 666 root tty 5 2&lt;br /&gt;
dev/pts d 755 root root&lt;br /&gt;
dev/ram0 b 640 root disk 1 0&lt;br /&gt;
dev/ram1 b 640 root disk 1 1&lt;br /&gt;
dev/ram2 b 640 root disk 1 2&lt;br /&gt;
dev/ram3 b 640 root disk 1 3&lt;br /&gt;
dev/ram4 b 640 root disk 1 4&lt;br /&gt;
dev/ram5 b 640 root disk 1 5&lt;br /&gt;
dev/ram6 b 640 root disk 1 6&lt;br /&gt;
dev/ram7 b 640 root disk 1 7&lt;br /&gt;
dev/ram8 b 640 root disk 1 8&lt;br /&gt;
dev/ram9 b 640 root disk 1 9&lt;br /&gt;
dev/ram10 b 640 root disk 1 10&lt;br /&gt;
dev/ram11 b 640 root disk 1 11&lt;br /&gt;
dev/ram12 b 640 root disk 1 12&lt;br /&gt;
dev/ram13 b 640 root disk 1 13&lt;br /&gt;
dev/ram14 b 640 root disk 1 14&lt;br /&gt;
dev/ram15 b 640 root disk 1 15&lt;br /&gt;
dev/ram16 b 640 root disk 1 16&lt;br /&gt;
dev/random c 644 root root 1 8&lt;br /&gt;
dev/shm d 755 root root&lt;br /&gt;
dev/tty c 662 root tty 5 0&lt;br /&gt;
dev/tty0 c 600 root tty 4 0&lt;br /&gt;
dev/urandom c 644 root root 1 9&lt;br /&gt;
dev/zero c 644 root root 1 5&lt;br /&gt;
home d 755 root root&lt;br /&gt;
media d 755 root root&lt;br /&gt;
mnt d 755 root root&lt;br /&gt;
proc d 755 root root&lt;br /&gt;
run d 755 root root&lt;br /&gt;
run/lock d 1777 root root&lt;br /&gt;
sys d 755 root root&lt;br /&gt;
tmp d 1777 root root&lt;br /&gt;
var/cache/apt d 755 root root&lt;br /&gt;
var/cache/apt/partial d 755 root root&lt;br /&gt;
var/cache/apt/lock f 640 root root echo &amp;quot;&amp;quot;&lt;br /&gt;
var/lib/apt/lists d 755 root root&lt;br /&gt;
var/lib/apt/lists/partial d 755 root root&lt;br /&gt;
var/tmp d 1777 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now make the squashfs, it is compressed with xz compression:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mksquashfs / /tmp/filesystem.squashfs -comp xz -info -always-use-fragments -noappend -wildcards -pf /tmp/mksquashfs.pf -e ${EXCLUDES} &amp;gt; /tmp/mksquashfs.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/tmp/mksquashfs.log will contain interesting details, such as the filesystem is now roughly 30% of its uncompressed size.&lt;br /&gt;
&lt;br /&gt;
Hopefully the squashfs you made is around 800MB or less, mine for a different Debian distribution was about 300MB. Let us say your flash drive has 100MB/s sequential read speed, and your &amp;quot;core&amp;quot; filesystem was squashed down to 300MB, which will take 3 seconds to read into memory. How long do you think yours will take to boot?&lt;br /&gt;
&lt;br /&gt;
===Prepare the live partition===&lt;br /&gt;
If you hadn&#039;t yet mounted the live partition to /lib/live/mount/medium earlier in the guide, we need to move files off, then mount it, and move vmlinuz, initrd, and etc onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /lib/live/mount/medium /tmp/&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
cd /lib/live/mount/medium&lt;br /&gt;
mkdir live&lt;br /&gt;
mv /tmp/medium/boot/vmlinuz* live/&lt;br /&gt;
mv /tmp/medium/boot/initrd* live/&lt;br /&gt;
mv /tmp/filesystem.squashfs live/&lt;br /&gt;
mv /tmp/filesystem.packages.xz live/&lt;br /&gt;
#update-initramfs or something else pointed at live/ incorrectly puts grub/unicode.pf2 here, this symlink fixes that:&lt;br /&gt;
ln -s ../boot/grub/ live/grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also copy files like System.map-4.19.0-9-amd64 and config-4.19.0-9-amd64 to /lib/live/mount/medium/live, they should be in /media/overlay/boot.bak and/or /media/iso/live/ (outside the chroot). Or if the kernel is updated then you&#039;ll get these files, corresponding to the new kernel, automatically put in there anyway.&lt;br /&gt;
&lt;br /&gt;
The file named config is a nice reference, it says what flags the kernel was built with, there are a vast number of options.&lt;br /&gt;
This System.map file, stored on the read-only live partition may be useful, for example, finding if your system had been [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html compromised with a rootkit].&lt;br /&gt;
&lt;br /&gt;
===Prepare GRUB on the live partition and USB device===&lt;br /&gt;
&lt;br /&gt;
The introduction of UEFI hardware complicates things. You&#039;re welcome to modify the instructions below if you desire to support UEFI functionality on such consumer hardware. The instructions below handles computers with [https://wiki.archlinux.org/index.php/GRUB#BIOS_systems traditional BIOS], with a [https://wiki.archlinux.org/index.php/Partitioning#Master_Boot_Record traditional MBR], as well as UEFI hardware which supports such &amp;quot;legacy&amp;quot; standards. &lt;br /&gt;
&lt;br /&gt;
From within the chroot, install non-uefi grub (grub-pc), and --no-install-recommends will result in os-prober not being installed. I think os-prober is workstation-specific and not useful to configure a USB device which may move between workstations. grub-pc will ask two questions, don&#039;t select anything and enter on Ok on the first, and press enter on Yes on the next to continue without --exclude.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install grub-pc --no-install-recommends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find your live partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -l /dev/disk/by-label/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say it is /dev/sdd1. Then we use the device /dev/sdd in the command below.&lt;br /&gt;
&lt;br /&gt;
Install grub, to both the USB device and the live partition on the USB device. Where /dev/sdd below is the USB device (not a partition), and /lib/live/mount/medium is where the live partition is mounted:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-install --target=i386-pc --root-directory=/lib/live/mount/medium /dev/sdd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now grub needs a configuration file. We can either craft one by hand or use grub-mkconfig, but grub-mkconfig doesn&#039;t really support this use-case.&lt;br /&gt;
&lt;br /&gt;
====Either (1) Handcraft grub.cfg====&lt;br /&gt;
What follows is my legacy grub.cfg, which should work but I hope to make something workable within the newer /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Make sure to fill in this template /lib/live/mount/medium/boot/grub/grub.cfg on &#039;live&#039; partition with your appropriate UUIDs. The partitions you made will have unique UUIDs. You can determine which is which on your system by comparing `ls -l /dev/disk/by-uuid/` and ls -l `/dev/disk/by-label/`.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;LABELorGPTname&amp;quot; to the label or GPT name of your persistence partition. I labeled mine &amp;quot;u365-persistence&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Fill in the template with how your vmlinuz and initrd.img are named, which may not have a suffix of &amp;quot;-4.19.0-9-amd64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make note of the kernel parameters used here, such as &#039;toram&#039; and &#039;persistence&#039;. I&#039;m not sure if elevator=as is the optimal choice, feel free to read about it.&lt;br /&gt;
&lt;br /&gt;
You can customize the [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#530 locale, language, and keyboard layout] here via kernel parameters here such as `locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variants=bepo keyboard-model=tm2030usb`, but I think the console-setup package may be required (installed before the squashfs is made), and perhaps these things are fine configured elsewhere.&lt;br /&gt;
&lt;br /&gt;
You can see other things configurable via kernel parameters such as tzdata, and initial username by looking at /lib/live/config/*. But be aware many things are only configured once via /var/lib/live/config/ (remove the relevant file to allow reconfiguration).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
#Enter the UUID of your boot partition (this is where grub and your kernel reside)&lt;br /&gt;
set uuid_grub_boot=dc434800-22ac-4fd4-b6cb-603da325d5d0&lt;br /&gt;
#Enter the UUID of the persistence partition.&lt;br /&gt;
set uuid_os_root=858d963f-8718-4520-83dd-fb89a842e9bd&lt;br /&gt;
#Here we set the grub &amp;quot;root&amp;quot; variable by locating the uuid of the root partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_os_root --set=root&lt;br /&gt;
#Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot&lt;br /&gt;
#Here&#039;s the magic. We test to see if the boot and root partitions have the same UUID.&lt;br /&gt;
#If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.&lt;br /&gt;
if [ $uuid_grub_boot == $uuid_os_root ] ; then&lt;br /&gt;
  set grub_boot=$grub_boot/boot&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
set kernel_parameters_common=&amp;quot;boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot usbcore.autosuspend=-1&amp;quot;&lt;br /&gt;
set kernel_parameters_persistence=&amp;quot;persistence persistence-storage=filesystem persistence-label=LABELorGPTname&amp;quot;&lt;br /&gt;
set myversion=4.19.0-13-amd64&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#With an unsafe shutdown or powerloss the persistence filesystem will have errors,&lt;br /&gt;
#since it has no journaling, we want to run fsck on it once&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence fsck&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence forcefsck&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Live&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Or (2) Generate grub.cfg with grub-mkconfig====&lt;br /&gt;
Again, using the handcrafted grub.cfg above is probably fine, but here are details on how to get grub-mkconfig to work, which geterates grub.cfg from directives in /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Now, /usr/sbin/grub-mkconfig is not robust line 142 &amp;amp; 146 in our context of chroot usage, assumes we&#039;re installing to / device and /boot, and offers no way to configure around the problem, so we change line 142 &amp;amp; 146:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Line 142:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium`&amp;quot;&lt;br /&gt;
# Line 146:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /boot`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium/boot`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy by hand the legacy grub.cfg menu entries I have, with your disk UUIDs into [https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file /etc/grub.d/40_custom].&lt;br /&gt;
&lt;br /&gt;
Now run grub-mkconfig, from within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-mkconfig -o /lib/live/mount/medium/boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmount /lib/live/mount/medium:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unmount /lib/live/mount/medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare the persistence partition===&lt;br /&gt;
And don&#039;t forget to make the persistence.conf file &#039;/ union&#039; on the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#cd to wherever you have mounted your persistence partition, e.g. /media/persistence&lt;br /&gt;
cd /media/persistence&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; &amp;gt; persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From /media/overlay/home grab the OSE Linux stuff in there, and put in /media/persistence/home:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /media/overlay/home /media/persistence/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There may also be other OSE Linux specific things removed by prior purges of non-&amp;quot;core&amp;quot; packages, e.g. in /etc/&lt;br /&gt;
I suppose there may be a way to &amp;quot;diff&amp;quot; those out, and re-add them to the persistence partition after the packages are installed anew. Maybe there is a convenient dpkg way of doing that... diffing and saving the configuration file changes from stock packages instead of purging them? Or is that the difference between apt-get remove and apt-get purge where apt-get remove will only remove stock configuration files leaving modified ones intact? Yes I think that may be right.&lt;br /&gt;
&lt;br /&gt;
===Cleanup===&lt;br /&gt;
Cleanup!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo umount /media/overlay/dev/pts&lt;br /&gt;
sudo umount /media/overlay/dev/&lt;br /&gt;
sudo umount /media/overlay/proc&lt;br /&gt;
sudo umount /media/overlay/sys&lt;br /&gt;
sudo umount /media/overlay/tmp&lt;br /&gt;
sudo umount /media/overlay&lt;br /&gt;
sudo umount /media/filesystem.squashfs&lt;br /&gt;
sudo umount /media/iso&lt;br /&gt;
sudo umount /media/myadditions&lt;br /&gt;
sudo rmdir /media/iso /media/filesystem.squashfs /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You now have an Linux OS on your USB with persistence that will boot within seconds and reliably outperforms the competition!&lt;br /&gt;
&lt;br /&gt;
==Further Details==&lt;br /&gt;
===Upgrading===&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when linux-image (the package containing the kernel) is upgraded?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; apt will want to update /boot/vmlinuz and /boot/initrd.img. So we need to do things in order to allow this to happen. We must boot with &#039;toram&#039; and also remount &#039;live&#039; as rw before running apt-get update.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#TODO, I wrote this elsewhere need to copy here, something along these lines:&lt;br /&gt;
mount -o remount,rw /lib/live/mount/medium /dev/disk/by-label/live&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this upgrade process apt might rename vmlinuz to say vmlinuz-3.16.0-4-amd64, and initrd similarly. It didn&#039;t always do this. But, you must match the names of those files with what is listed in grub.cfg! Either use &#039;vmlinuz&#039; or whatever name the apt script renamed them to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when libc is upgraded? Be it a security update, or when Debian Stable advances every couple years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; We will want to do a resquash:&lt;br /&gt;
# We need to to the same as above, &#039;toram&#039; and remount &#039;live&#039; as rw.&lt;br /&gt;
# dpkq-query our currently installed packages, and compare to /boot/filesystem.packages.xz we made earlier.&lt;br /&gt;
# Remove all non &amp;quot;core&amp;quot; packages, they should be cached in /var/cache/apt/archives/ so they don&#039;t need to be downloaded again, just reinstalled after we do the resquash.&lt;br /&gt;
# apt-get update&lt;br /&gt;
# Resquash, reboot to verify things working, in &#039;live&#039; mode remove squashed stuff from persistance partition.&lt;br /&gt;
## squash script https://gist.github.com/AndrewSmart/90eb186aea08db8f1426&lt;br /&gt;
## cleanup script https://gist.github.com/AndrewSmart/2f67f79f6f1922c4556f&lt;br /&gt;
# Reinstall packages removed prior to resquash from /var/cache/apt/archives&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; That looks like a lot to deal with.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I agree. I&#039;m looking at using dpkg triggers or /etc/apt/apt.conf.d/ hooks to manage this upgrade process. I hope to have something sufficient soon.&lt;br /&gt;
&lt;br /&gt;
I hope to also make a smaller guide that is not optimal in performance, but has way less steps, so the end user can test out the persistence and take the time to &amp;quot;upgrade&amp;quot; the performance later if so inclined.&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
Keep in mind with the USB we can still boot either in &#039;live&#039; mode, or &#039;persistence&#039; mode depending on the GRUB entry we choose. This is useful in case something breaks in &#039;persistence&#039; mode, like libc was upgraded in &#039;persistence&#039; but libc on &#039;live&#039; is still old! This will result in segmentation faults... a kernel panic, or whatever, it won&#039;t boot. We can access all of the software in the squashfs in &#039;live mode&#039;. Eventually I&#039;d like to write an apt hook to prevent the update of libc unless the system is prepared (&#039;toram&#039;, and &#039;live&#039; partition is mounted rw, the hook won&#039;t trigger unless &#039;persistence&#039; kernel parameter is used).&lt;br /&gt;
&lt;br /&gt;
Debian&#039;s live-boot scripts will put stuff in /lib/live/, and /lib/live/mount is of particularly good use in troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Ubuntu is a bit of a can of worms from my perspective as a fan of vanilla Debian. So... hopefully things will go smoothly... I highly recommend a lighter-weight environment for USB persistence, but I understand everyone has their preferences.&lt;br /&gt;
&lt;br /&gt;
Since &#039;toram&#039; puts the squashfs into memory, lets say you have 8GB RAM and an 800MB squashfs, that is fine, but say you move to a workstation with only 2GB RAM, you will probably want to remove the &#039;toram&#039; kernel parameter, things will be slower but the memory footprint used by the OS will be less, and only use &#039;toram&#039; when updating the &#039;live&#039; partition as detailed above. Perhaps consider 2 additional GRUB entries, in addition to the two I have listed above, where the 2 additional entries are live and persistence mode without &#039;toram&#039; kernel parameter, and when booting select the entry depending on the amount of RAM the system has.&lt;br /&gt;
&lt;br /&gt;
In the event of a power outage, kernel panic, unsafe shutdown or whatever, the filesystem may have problems you&#039;re warned about on next boot. In this setup, the &#039;live&#039; partition was mounted ro, so it is not possible to have filesystem errors there, but with the &#039;persistence&#039; partition there will likely be errors. So, on next boot we select the &#039;live&#039; mode in grub, and run fsck.ext4 -p /dev/disk/by-label/persistence, and all problems are fixed!&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 06:43, 5 November 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242090</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242090"/>
		<updated>2021-01-14T02:52:10Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.20 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
All these tools do essentially, is re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an FreeCAD module to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Module will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a Module to respond to the signals. The signal data will include what files were modified/deleted/added. The module will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the module will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the module:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the module as the module iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The module can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=User_talk:Vagabondpermaculture&amp;diff=242089</id>
		<title>User talk:Vagabondpermaculture</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=User_talk:Vagabondpermaculture&amp;diff=242089"/>
		<updated>2021-01-14T02:09:21Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&#039;&#039;&#039;Welcome to &#039;&#039;Open Source Ecology&#039;&#039;!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Thank you for registering on the Open Source Ecology wiki. Please see my &#039;&#039;&#039;[[Global Village Construction Set TED Talk]]&#039;&#039;&#039; for a 4 minute introduction to the project.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Please see all the ways for getting involved at the [[Getting Involved]] wiki page.&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Do you see any other ways that you would like to get involved? You can email me at marcin at opensourceecology dot org.&lt;br /&gt;
&lt;br /&gt;
Thanks,&lt;br /&gt;
&lt;br /&gt;
Marcin Jakubowski&lt;br /&gt;
&lt;br /&gt;
OSE Founder [[User:Marcin|Marcin]] ([[User talk:Marcin|talk]]) 01:42, 14 January 2021 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Vagabondpermaculture,&lt;br /&gt;
&lt;br /&gt;
You&#039;ll find lots of good stuff in wiki format over on [[Appropedia:Portal:Food_and_agriculture]] as well.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 02:09, 14 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242083</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242083"/>
		<updated>2021-01-13T01:36:05Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: Undo revision 242082 by Andrewusu (talk)&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
All these tools do essentially, is re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242082</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242082"/>
		<updated>2021-01-13T01:34:43Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
All these tools do essentially, is re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes.&lt;br /&gt;
&lt;br /&gt;
It might be a good idea to have a [https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks git pre-commit hook] that verifies that any user with the repo has the filter set up that is in .gitattributes, as otherwise git does not fail or warn the user about the missing filter.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242081</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242081"/>
		<updated>2021-01-13T01:07:23Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
All these tools do essentially, is re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
If you have Java then hoijui/ReZipDoc would be more robust. callegar/Rezip in bash seems fine if you don&#039;t have Java installed and the git-config filter name matches what is in gitattributes.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242078</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242078"/>
		<updated>2021-01-13T00:58:43Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
## [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used). Might have unwanted permissions changes on files due to the rezip?&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
All these tools do essentially, is re-zip the zip archive with a compression of 0, to allow git to compress better given changes through time.&lt;br /&gt;
&lt;br /&gt;
callegar/Rezip in bash appears to be the most suitable to me as I don&#039;t have Java installed. If you have Java then hoijui/ReZipDoc would be more robust.&lt;br /&gt;
&lt;br /&gt;
To [https://git-scm.com/book/en/v2/Git-Internals-Packfiles see the results of the better compression], run `git gc`.&lt;br /&gt;
&lt;br /&gt;
However, FreeCAD in a future version will support better integration with version control without such re-zip workarounds and additional workflow steps (e.g. FreeCAD automatically controlling git after a save instead of the user controlling git after saving the file).&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242039</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242039"/>
		<updated>2021-01-11T05:49:06Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
## [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer [https://stackoverflow.com/a/54925238/1185900 writeup]&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
callegar/Rezip in bash appears to be the most suitable to me. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242038</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=242038"/>
		<updated>2021-01-11T05:38:30Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
## [https://git.opensourceecology.de/hoijui/ReZipDoc hoijui/ReZipDoc] Open Source Ecology Germany, requires JRE 8 or newer&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
callegar/Rezip in bash appears to be the most suitable to me. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:FreeCAD&amp;diff=241695</id>
		<title>Talk:FreeCAD</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:FreeCAD&amp;diff=241695"/>
		<updated>2021-01-05T00:01:04Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=5-18-14=&lt;br /&gt;
I have spent about 20 to 30 hours of the past few weeks in order to test the current capabilities of FreeCAD and also in order to learn the basics of FreeCAD.  My impressions are that the FreeCAD team has accomplished a few things that only large teams of full time programmers have accomplished in the past.  The conclusion I came to after doing my best to familiarize myself with all of the tools that are available in the latest release of Free-CAD is that until FreeCAD releases their planned &amp;quot;assembly module&amp;quot;, designing a machine with multiple parts may not currently be a good fit for FreeCAD.&lt;br /&gt;
&lt;br /&gt;
Right now FreeCAD would be my preferred open source program to design an accurate 3d parametric model of a part for printing or machining and for opening step files for some basic inspection.  (the measuring tool seems to have limited ability to measure between lines and faces of parts only measuring from point to point)  The latest version has even added the ability to make 2d drawings with title blocks and projections of 3d models.  The sketching and extruding/cutting tools seem to be very powerful, but without using some fairly complex work-arounds, it&#039;s my opinion that it would not be possible to design individual parts based on the geometry of other individual parts in a reasonable amount of time.  &lt;br /&gt;
&lt;br /&gt;
I am very interested to see what the FreeCAD development team comes up with in the next few years.  I was going to try to model a small assembly to show how freeCAD could help design a functional box whose parts could be exported to a lasercutter; but it became evident that, while possible, it would have required a few work arounds and more time than I currently have at my disposal.&lt;br /&gt;
--[[User:Rob B|Rob B]] ([[User talk:Rob B|talk]]) 06:58, 19 May 2014 (CEST)-&lt;br /&gt;
&lt;br /&gt;
=2013=&lt;br /&gt;
=Temp=&lt;br /&gt;
&lt;br /&gt;
Ok, first FreeCAD:&lt;br /&gt;
&lt;br /&gt;
As they say themselves, it is still in the early stages of&lt;br /&gt;
development. I (Conor) have searched for documentation, and apart from the&lt;br /&gt;
getstarted [http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Getting_started]&lt;br /&gt;
there are 2 nice articles from December (so version 0.9, which btw. is&lt;br /&gt;
in Lucid already). The funny thing is that for some reason, both are&lt;br /&gt;
in... Polish! I understand you have polish origins, so maybe you speak&lt;br /&gt;
Polish. Otherwise just google translate. They give you examples and a&lt;br /&gt;
better idea of what it is right now capable of. &lt;br /&gt;
[http://www.ubucentrum.net/2009/12/rozpoczynamy-zabawe-z-freecad-krok-po.html] &lt;br /&gt;
[http://wkupiesila.blogspot.com/2009/12/freecad-poznajemy-klawisz-f5.html]&lt;br /&gt;
&lt;br /&gt;
So I propose the following: you try to reproduce the steps in the&lt;br /&gt;
articles, so you get a feeling for it. But then regardless stick with&lt;br /&gt;
Blender a bit longer, and try FreeCAD again when version 0.11 or 0.12&lt;br /&gt;
comes out.&lt;br /&gt;
&lt;br /&gt;
== Undo doesn&#039;t work ==&lt;br /&gt;
Using FreeCAD 0.13.1828 on Windows. &lt;br /&gt;
&lt;br /&gt;
* Situation: I draw a box and modify it&#039;s size. Then I hit Ctrl+Z (or Redo from the menu).&lt;br /&gt;
* What happens: Box is deleted :-(&lt;br /&gt;
* Expected: Box returns to old size.&lt;br /&gt;
&lt;br /&gt;
=July 2012=&lt;br /&gt;
What is the Assembly module?&lt;br /&gt;
I presume you are thinking of an assembly module for freeCAD.&lt;br /&gt;
We (my employer (Vanderbilt/ISIS)) may be situated to provide such a thing.&lt;br /&gt;
&lt;br /&gt;
=2020=&lt;br /&gt;
&lt;br /&gt;
Should we move the OSE CAD Stuff to some sort of dedicated page; this page seems a bit cluttered?&lt;br /&gt;
&lt;br /&gt;
--[[User:Eric|Eric]] ([[User talk:Eric|talk]]) 1:16, 4 August 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I saw Marcin&#039;s inquiry [https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=53967 here] about large files.&lt;br /&gt;
&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=34583 Here] are options for assembly handling. Assembly3 and Assembly4 appear to be the best options now. I&#039;m a big fan of constraints, with fully constrained sketches, and using the solver to place parts in global space, so I like Assembly3. In looking at FreeCAD 101 videos Marcin doesn&#039;t appear to like constraints so much beyond initial placement, maybe he&#039;d prefer Assembly4.&lt;br /&gt;
&lt;br /&gt;
When using such assemblies you can freeze them. As described [https://wiki.freecadweb.org/Assembly3_Workbench here]:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;links&#039;&#039;&#039;. This means you can use one single part, e.g. a screw multiple times in an assembly (at different places) without duplicating geometry.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;external links&#039;&#039;&#039;. It is possible to have a freecad document that only contains an assembly and not parts. All parts could be in single files. The files even could be in a library or anyhwere else in the file system. The only requirement is that the file must be loaded when the link is made. After the link is made, the file must be open to make updates to the links involving the file. Assembly3 solves this by opening files in the background as required.&lt;br /&gt;
&#039;&#039;&#039;assembly freeze&#039;&#039;&#039;. As the CPU can handle only so many concurrent constraints in real time, to freeze an assembly allows to use constraints even for large assemblies. By freezing finished assemblies or constraints that are not required to remain dynamic (e.g. welded, bolted or glued parts) those are excluded from update calculations and considered fixed geometry by the Assembly3 solver.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From my understanding when a subassembly is an external link, and frozen, it is minimally loaded. It is read-only in this state, but the geometry visible and navigable within the parent assembly. A [https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;start=1240#p305466 quote from realthunder]:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;The freeze function is helpful to detach part history from assembly. Say you have a part made by PartDesign containing hundreds of historical features. You can add this part into an assembly, right click the assembly item in the tree view and select &#039;Freeze&#039;. The assembly will copy the part shape without history. You can then link to this assembly in your main assembly file. Next time you open the main assembly file, the sub-assembly file will be partially loaded without the history.&lt;br /&gt;
&lt;br /&gt;
Please note that once an assembly is frozen, it cannot be modified. So before you freeze it, you should figure out all the constraining elements that is going to be used by any higher level assembly, and add them to the &#039;Element group&#039;. You can follow [https://github.com/realthunder/FreeCAD_assembly3/wiki/How-to-Handle-Large-Scale-Assembly this] tutorial to get some idea.&amp;quot;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;p=302669#p302669 Back in 2019] I tried various means of getting a complicated STEP model into FreeCAD. By using different approaches, the filesize on disk changed, and memory usage changed. It had 205 unique parts and about 260 rendered parts (many parts with multiple instances).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Without Assembly3:&#039;&#039;&#039;&lt;br /&gt;
2.8 GB memory usage from 43.3MB on disk (default file compression setting of 3).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With Assembly3:&#039;&#039;&#039;&lt;br /&gt;
1.7GB memory usage and 20MB on disk (with [https://forum.freecadweb.org/viewtopic.php?p=239692#p239879 ReduceObjects=true] option)&lt;br /&gt;
&lt;br /&gt;
Assembly3 did a much better job importing the STEP file, I saw duplicate instances were linked instead of copied. IIRC I saw a further memory decrease from 1.7GB to 1.2ish by freezing the top level assemblies but didn&#039;t write about it.&lt;br /&gt;
&lt;br /&gt;
When the solver runs there may be a [https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;p=249226&amp;amp;hilit=memory#p249226 large jump] in memory usage.&lt;br /&gt;
&lt;br /&gt;
realthunder and others have put a lot of effort into things since these observations so I think things may be improved.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:52, 4 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:FreeCAD&amp;diff=241694</id>
		<title>Talk:FreeCAD</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:FreeCAD&amp;diff=241694"/>
		<updated>2021-01-04T23:57:11Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* July 2012 */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=5-18-14=&lt;br /&gt;
I have spent about 20 to 30 hours of the past few weeks in order to test the current capabilities of FreeCAD and also in order to learn the basics of FreeCAD.  My impressions are that the FreeCAD team has accomplished a few things that only large teams of full time programmers have accomplished in the past.  The conclusion I came to after doing my best to familiarize myself with all of the tools that are available in the latest release of Free-CAD is that until FreeCAD releases their planned &amp;quot;assembly module&amp;quot;, designing a machine with multiple parts may not currently be a good fit for FreeCAD.&lt;br /&gt;
&lt;br /&gt;
Right now FreeCAD would be my preferred open source program to design an accurate 3d parametric model of a part for printing or machining and for opening step files for some basic inspection.  (the measuring tool seems to have limited ability to measure between lines and faces of parts only measuring from point to point)  The latest version has even added the ability to make 2d drawings with title blocks and projections of 3d models.  The sketching and extruding/cutting tools seem to be very powerful, but without using some fairly complex work-arounds, it&#039;s my opinion that it would not be possible to design individual parts based on the geometry of other individual parts in a reasonable amount of time.  &lt;br /&gt;
&lt;br /&gt;
I am very interested to see what the FreeCAD development team comes up with in the next few years.  I was going to try to model a small assembly to show how freeCAD could help design a functional box whose parts could be exported to a lasercutter; but it became evident that, while possible, it would have required a few work arounds and more time than I currently have at my disposal.&lt;br /&gt;
--[[User:Rob B|Rob B]] ([[User talk:Rob B|talk]]) 06:58, 19 May 2014 (CEST)-&lt;br /&gt;
&lt;br /&gt;
=2013=&lt;br /&gt;
=Temp=&lt;br /&gt;
&lt;br /&gt;
Ok, first FreeCAD:&lt;br /&gt;
&lt;br /&gt;
As they say themselves, it is still in the early stages of&lt;br /&gt;
development. I (Conor) have searched for documentation, and apart from the&lt;br /&gt;
getstarted [http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Getting_started]&lt;br /&gt;
there are 2 nice articles from December (so version 0.9, which btw. is&lt;br /&gt;
in Lucid already). The funny thing is that for some reason, both are&lt;br /&gt;
in... Polish! I understand you have polish origins, so maybe you speak&lt;br /&gt;
Polish. Otherwise just google translate. They give you examples and a&lt;br /&gt;
better idea of what it is right now capable of. &lt;br /&gt;
[http://www.ubucentrum.net/2009/12/rozpoczynamy-zabawe-z-freecad-krok-po.html] &lt;br /&gt;
[http://wkupiesila.blogspot.com/2009/12/freecad-poznajemy-klawisz-f5.html]&lt;br /&gt;
&lt;br /&gt;
So I propose the following: you try to reproduce the steps in the&lt;br /&gt;
articles, so you get a feeling for it. But then regardless stick with&lt;br /&gt;
Blender a bit longer, and try FreeCAD again when version 0.11 or 0.12&lt;br /&gt;
comes out.&lt;br /&gt;
&lt;br /&gt;
== Undo doesn&#039;t work ==&lt;br /&gt;
Using FreeCAD 0.13.1828 on Windows. &lt;br /&gt;
&lt;br /&gt;
* Situation: I draw a box and modify it&#039;s size. Then I hit Ctrl+Z (or Redo from the menu).&lt;br /&gt;
* What happens: Box is deleted :-(&lt;br /&gt;
* Expected: Box returns to old size.&lt;br /&gt;
&lt;br /&gt;
=July 2012=&lt;br /&gt;
What is the Assembly module?&lt;br /&gt;
I presume you are thinking of an assembly module for freeCAD.&lt;br /&gt;
We (my employer (Vanderbilt/ISIS)) may be situated to provide such a thing.&lt;br /&gt;
&lt;br /&gt;
=2020=&lt;br /&gt;
&lt;br /&gt;
Should we move the OSE CAD Stuff to some sort of dedicated page; this page seems a bit cluttered?&lt;br /&gt;
&lt;br /&gt;
--[[User:Eric|Eric]] ([[User talk:Eric|talk]]) 1:16, 4 August 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I saw Marcin&#039;s inquiry [https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=53967 here] about large files.&lt;br /&gt;
&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=34583 Here] are options for assembly handling. Assembly3 and Assembly4 appear to be the best options now. I&#039;m a big fan of contraints, with fully constrained sketches, and using the solver to place parts in global space, so I like Assembly3. In looking at FreeCAD 101 videos Marcin doesn&#039;t appear to like constraints so much beyond initial placement, maybe he&#039;d prefer Assembly4.&lt;br /&gt;
&lt;br /&gt;
When using such assemblies you can freeze them. As described [https://wiki.freecadweb.org/Assembly3_Workbench here]:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;links&#039;&#039;&#039;. This means you can use one single part, e.g. a screw multiple times in an assembly (at different places) without duplicating geometry.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;external links&#039;&#039;&#039;. It is possible to have a freecad document that only contains an assembly and not parts. All parts could be in single files. The files even could be in a library or anyhwere else in the file system. The only requirement is that the file must be loaded when the link is made. After the link is made, the file must be open to make updates to the links involving the file. Assembly3 solves this by opening files in the background as required.&lt;br /&gt;
&#039;&#039;&#039;assembly freeze&#039;&#039;&#039;. As the CPU can handle only so many concurrent constraints in real time, to freeze an assembly allows to use constraints even for large assemblies. By freezing finished assemblies or constraints that are not required to remain dynamic (e.g. welded, bolted or glued parts) those are excluded from update calculations and considered fixed geometry by the Assembly3 solver.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From my understanding when a subassembly is an external link, and frozen, it is minimally loaded. It is read-only in this state, but the geometry visible and navigable within the parent assembly. A [https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;start=1240#p305466 quote from realthunder]:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;The freeze function is helpful to detach part history from assembly. Say you have a part made by PartDesign containing hundreds of historical features. You can add this part into an assembly, right click the assembly item in the tree view and select &#039;Freeze&#039;. The assembly will copy the part shape without history. You can then link to this assembly in your main assembly file. Next time you open the main assembly file, the sub-assembly file will be partially loaded without the history.&lt;br /&gt;
&lt;br /&gt;
Please note that once an assembly is frozen, it cannot be modified. So before you freeze it, you should figure out all the constraining elements that is going to be used by any higher level assembly, and add them to the &#039;Element group&#039;. You can follow [https://github.com/realthunder/FreeCAD_assembly3/wiki/How-to-Handle-Large-Scale-Assembly this] tutorial to get some idea.&amp;quot;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;p=302669#p302669 Back in 2019] I tried various means of getting a complicated STEP model into FreeCAD. By using different approaches, the filesize on disk changed, and memory usage changed. It had 205 unique parts and about 260 rendered parts (many parts with multiple instances).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Without Assembly3:&#039;&#039;&#039;&lt;br /&gt;
2.8 GB memory usage from 43.3MB on disk (default file compression setting of 3).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With Assembly3:&#039;&#039;&#039;&lt;br /&gt;
1.7GB memory usage and 20MB on disk (with [https://forum.freecadweb.org/viewtopic.php?p=239692#p239879 ReduceObjects=true] option)&lt;br /&gt;
&lt;br /&gt;
Assembly3 did a much better job importing the STEP file, I saw duplicate instances were linked instead of copied. IIRC I saw a further memory decrease from 1.7GB to 1.2ish by freezing the top level assemblies but didn&#039;t write about it.&lt;br /&gt;
&lt;br /&gt;
When the solver runs there may be a [https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;p=249226&amp;amp;hilit=memory#p249226 large jump] in memory usage.&lt;br /&gt;
&lt;br /&gt;
realthunder and others have put a lot of effort into things since these observations so I think things may be improved.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:52, 4 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:FreeCAD&amp;diff=241693</id>
		<title>Talk:FreeCAD</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:FreeCAD&amp;diff=241693"/>
		<updated>2021-01-04T23:53:05Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: FreeCAD assemblies discussion&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;br /&gt;
=5-18-14=&lt;br /&gt;
I have spent about 20 to 30 hours of the past few weeks in order to test the current capabilities of FreeCAD and also in order to learn the basics of FreeCAD.  My impressions are that the FreeCAD team has accomplished a few things that only large teams of full time programmers have accomplished in the past.  The conclusion I came to after doing my best to familiarize myself with all of the tools that are available in the latest release of Free-CAD is that until FreeCAD releases their planned &amp;quot;assembly module&amp;quot;, designing a machine with multiple parts may not currently be a good fit for FreeCAD.&lt;br /&gt;
&lt;br /&gt;
Right now FreeCAD would be my preferred open source program to design an accurate 3d parametric model of a part for printing or machining and for opening step files for some basic inspection.  (the measuring tool seems to have limited ability to measure between lines and faces of parts only measuring from point to point)  The latest version has even added the ability to make 2d drawings with title blocks and projections of 3d models.  The sketching and extruding/cutting tools seem to be very powerful, but without using some fairly complex work-arounds, it&#039;s my opinion that it would not be possible to design individual parts based on the geometry of other individual parts in a reasonable amount of time.  &lt;br /&gt;
&lt;br /&gt;
I am very interested to see what the FreeCAD development team comes up with in the next few years.  I was going to try to model a small assembly to show how freeCAD could help design a functional box whose parts could be exported to a lasercutter; but it became evident that, while possible, it would have required a few work arounds and more time than I currently have at my disposal.&lt;br /&gt;
--[[User:Rob B|Rob B]] ([[User talk:Rob B|talk]]) 06:58, 19 May 2014 (CEST)-&lt;br /&gt;
&lt;br /&gt;
=2013=&lt;br /&gt;
=Temp=&lt;br /&gt;
&lt;br /&gt;
Ok, first FreeCAD:&lt;br /&gt;
&lt;br /&gt;
As they say themselves, it is still in the early stages of&lt;br /&gt;
development. I (Conor) have searched for documentation, and apart from the&lt;br /&gt;
getstarted [http://sourceforge.net/apps/mediawiki/free-cad/index.php?title=Getting_started]&lt;br /&gt;
there are 2 nice articles from December (so version 0.9, which btw. is&lt;br /&gt;
in Lucid already). The funny thing is that for some reason, both are&lt;br /&gt;
in... Polish! I understand you have polish origins, so maybe you speak&lt;br /&gt;
Polish. Otherwise just google translate. They give you examples and a&lt;br /&gt;
better idea of what it is right now capable of. &lt;br /&gt;
[http://www.ubucentrum.net/2009/12/rozpoczynamy-zabawe-z-freecad-krok-po.html] &lt;br /&gt;
[http://wkupiesila.blogspot.com/2009/12/freecad-poznajemy-klawisz-f5.html]&lt;br /&gt;
&lt;br /&gt;
So I propose the following: you try to reproduce the steps in the&lt;br /&gt;
articles, so you get a feeling for it. But then regardless stick with&lt;br /&gt;
Blender a bit longer, and try FreeCAD again when version 0.11 or 0.12&lt;br /&gt;
comes out.&lt;br /&gt;
&lt;br /&gt;
== Undo doesn&#039;t work ==&lt;br /&gt;
Using FreeCAD 0.13.1828 on Windows. &lt;br /&gt;
&lt;br /&gt;
* Situation: I draw a box and modify it&#039;s size. Then I hit Ctrl+Z (or Redo from the menu).&lt;br /&gt;
* What happens: Box is deleted :-(&lt;br /&gt;
* Expected: Box returns to old size.&lt;br /&gt;
&lt;br /&gt;
=July 2012=&lt;br /&gt;
What is the Assembly module?&lt;br /&gt;
I presume you are thinking of an assembly module for freeCAD.&lt;br /&gt;
We (my employer (Vanderbilt/ISIS)) may be situated to provide such a thing.&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
Should we move the OSE CAD Stuff to some sort of dedicated page; this page seems a bit cluttered?&lt;br /&gt;
&lt;br /&gt;
--[[User:Eric|Eric]] ([[User talk:Eric|talk]]) 1:16, 4 August 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I saw Marcin&#039;s inquiry [https://forum.freecadweb.org/viewtopic.php?f=8&amp;amp;t=53967 here] about large files.&lt;br /&gt;
&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=34583 Here] are options for assembly handling. Assembly3 and Assembly4 appear to be the best options now. I&#039;m a big fan of contraints, with fully constrained sketches, and using the solver to place parts in global space, so I like Assembly3. In looking at FreeCAD 101 videos Marcin doesn&#039;t appear to like constraints so much beyond initial placement, maybe he&#039;d prefer Assembly4.&lt;br /&gt;
&lt;br /&gt;
When using such assemblies you can freeze them. As described [https://wiki.freecadweb.org/Assembly3_Workbench here]:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&#039;&#039;&#039;links&#039;&#039;&#039;. This means you can use one single part, e.g. a screw multiple times in an assembly (at different places) without duplicating geometry.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;external links&#039;&#039;&#039;. It is possible to have a freecad document that only contains an assembly and not parts. All parts could be in single files. The files even could be in a library or anyhwere else in the file system. The only requirement is that the file must be loaded when the link is made. After the link is made, the file must be open to make updates to the links involving the file. Assembly3 solves this by opening files in the background as required.&lt;br /&gt;
&#039;&#039;&#039;assembly freeze&#039;&#039;&#039;. As the CPU can handle only so many concurrent constraints in real time, to freeze an assembly allows to use constraints even for large assemblies. By freezing finished assemblies or constraints that are not required to remain dynamic (e.g. welded, bolted or glued parts) those are excluded from update calculations and considered fixed geometry by the Assembly3 solver.&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From my understanding when a subassembly is an external link, and frozen, it is minimally loaded. It is read-only in this state, but the geometry visible and navigable within the parent assembly. A [https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;start=1240#p305466 quote from realthunder]:&lt;br /&gt;
&amp;lt;blockquote&amp;gt;&lt;br /&gt;
&amp;quot;The freeze function is helpful to detach part history from assembly. Say you have a part made by PartDesign containing hundreds of historical features. You can add this part into an assembly, right click the assembly item in the tree view and select &#039;Freeze&#039;. The assembly will copy the part shape without history. You can then link to this assembly in your main assembly file. Next time you open the main assembly file, the sub-assembly file will be partially loaded without the history.&lt;br /&gt;
&lt;br /&gt;
Please note that once an assembly is frozen, it cannot be modified. So before you freeze it, you should figure out all the constraining elements that is going to be used by any higher level assembly, and add them to the &#039;Element group&#039;. You can follow [https://github.com/realthunder/FreeCAD_assembly3/wiki/How-to-Handle-Large-Scale-Assembly this] tutorial to get some idea.&amp;quot;&lt;br /&gt;
&amp;lt;/blockquote&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;p=302669#p302669 Back in 2019] I tried various means of getting a complicated STEP model into FreeCAD. By using different approaches, the filesize on disk changed, and memory usage changed. It had 205 unique parts and about 260 rendered parts (many parts with multiple instances).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Without Assembly3:&#039;&#039;&#039;&lt;br /&gt;
2.8 GB memory usage from 43.3MB on disk (default file compression setting of 3).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;With Assembly3:&#039;&#039;&#039;&lt;br /&gt;
1.7GB memory usage and 20MB on disk (with [https://forum.freecadweb.org/viewtopic.php?p=239692#p239879 ReduceObjects=true] option)&lt;br /&gt;
&lt;br /&gt;
Assembly3 did a much better job importing the STEP file, I saw duplicate instances were linked instead of copied. IIRC I saw a further memory decrease by freezing the top level assemblies but didn&#039;t write about it.&lt;br /&gt;
&lt;br /&gt;
When the solver runs there may be a [https://forum.freecadweb.org/viewtopic.php?f=20&amp;amp;t=25712&amp;amp;p=249226&amp;amp;hilit=memory#p249226 large jump] in memory usage.&lt;br /&gt;
&lt;br /&gt;
realthunder and others have put a lot of effort into things since these observations so I think things may be improved.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:52, 4 January 2021 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=241690</id>
		<title>Talk:OSE Linux Persistence</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=241690"/>
		<updated>2021-01-04T21:28:35Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Performance tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://en.m.wikipedia.org/wiki/UNetbootin claims to have a persistence option for ubuntu distros. I couldn&#039;t get it to work. --[[User:Dorkmo|Dorkmo]] ([[User talk:Dorkmo|talk]]) 19:33, 14 July 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==Andrewusu&#039;s Thoughts==&lt;br /&gt;
I&#039;ve used persistence on USB for over 10 years now as my primary system (4+ hours/day) and will share some thoughts. Way back with USB2 I spent a lot of time investigating performance, ways to speed up boot time and system responsiveness. Keep in mind benchmarks of any flash memory device, where sequential reading is [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 10-20x] faster than non-sequential reads (possibly more depending on the device). By following this setup I describe below you take advantage of those fast reads for a quick boot and a very responsive OS.&lt;br /&gt;
&lt;br /&gt;
It has been great, I can move my programs, data, and OS from workstation to workstation with a breeze. From a desktop to a laptop, a library computer, or computer at work at times even. I&#039;ll never going back to installing Linux on a HDD. I use HDDs on workstations for storing data, or even making a ~8GB swap file if I need more system memory for some big task (e.g. big FreeCAD model).&lt;br /&gt;
&lt;br /&gt;
I don&#039;t use unetbootin, ISOs, or any other setups, just [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#547 Debian&#039;s live-boot]  and a &#039;persistence&#039; partition.&lt;br /&gt;
&lt;br /&gt;
On Ubuntu an alternative to live-boot is casper, which supports more options such as booting from an ISO file via a kernel parameter. The [https://manpages.debian.org/buster/live-boot-doc/live-boot.7.en.html &#039;boot=live&#039;] kernel parameter results in live-boot being used, while the [http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html &#039;boot=casper&#039;] kernel parameter results in casper being used. With casper the default labeling of the persistence partition is &#039;casper-rw&#039; instead of &#039;persistence&#039; with live-boot.&lt;br /&gt;
&lt;br /&gt;
It is very simple, you have the second partition labeled &#039;persistence&#039; with a configuration file, and Debian&#039;s live-boot scripts handle everything.&lt;br /&gt;
&lt;br /&gt;
===live-boot Squashfs/Persistence===&lt;br /&gt;
[[File:LinuxUSBPersistencePartitions.png]]&lt;br /&gt;
* &#039;live&#039; partition contains the squashfs, initrd and vmlinuz in /live. Can only be mounted ro unless &#039;toram&#039; kernel parameter used.&lt;br /&gt;
* &#039;persistence&#039; partition is mounted rw.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;&lt;br /&gt;
# With a squashfs/persistence install instead of a full install to USB, you&#039;ll see a much faster boot, because the &#039;live&#039; partition is compressed ([https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html squashfs]) and is thus sequentially read into memory faster compared to random reads of various uncompressed files from the USB as they&#039;re needed during the boot process. Mine boots within 20 or so seconds.&lt;br /&gt;
# When running the system with day to day tasks, the performance and responsiveness of a squashfs/persistence setup is better than a full install, because the squashfs may be loaded to memory ([https://manpages.debian.org/jessie/live-boot-doc/live-boot.7.en.html toram]) occupying around 600-800MB RAM, and is thus not a bottleneck on reads/writes to the USB slowing the system down like you&#039;d see in a full install to USB. This translates into better framerate playing games like Starcraft 2, which I&#039;ve run from this flash drive, and a more responsive system in general (to mouse clicks, key presses, etc).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Limitations:&#039;&#039;&#039;&lt;br /&gt;
# A 64-bit install won&#039;t work on a 32-bit machine&lt;br /&gt;
# A USB with /etc/X11/xorg.conf set to use an NVIDIA GPU driver won&#039;t be as mobile:&lt;br /&gt;
## e.g. Will not boot graphically on an Intel GPU system but to a [https://en.wikipedia.org/wiki/Virtual_console virtual console].&lt;br /&gt;
## This can be mitigated by editing xorg.conf while on the Intel system&#039;s virtual console and rebooting to get the graphical interface. Or possibily without rebooting with some wizardry like rmmod and then startx, but I don&#039;t recall off the top of my head. And you have to redo this in reverse going back to the NVIDIA system. Maybe this is just a limitation of proprietary GPU drivers.&lt;br /&gt;
# Copy-on-write [https://superuser.com/questions/833576/differences-of-aufs-unionfs-and-overlayfs-from-each-other aufs/overlayfs] (whetever distro has chosen) has some limitations:&lt;br /&gt;
## Read-only &#039;live&#039; partition needs to be updated whenever libc or linux-image are updated, or the system won&#039;t boot. So it needs to be mounted read-write and in order to do so &#039;toram&#039; kernal boot parameter must be used. I work around this problem manually via inspecting apt output before installing anything, but this chore can be mitigated via an apt hook which I&#039;ve not written yet.&lt;br /&gt;
## &#039;live&#039; partition containing the squashfs should only have packages which are not updated often, being core packages, and not something like firefox which is updated often. This will minimize the size of the squashfs.&lt;br /&gt;
## When Debian stable is updated to the next revision, the linux-image must be updated, and the squashfs recompressed. To do this, all non-core packages must be removed, the distro upgraded, the squashfs recompressed, and then non-core packages reinstalled. This can also be scripted and I have some non-robust helper scripts I&#039;ve written.&lt;br /&gt;
# Flash memory has limitations, where sequential writes are [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 5000x-10000x] faster than random writes. Due to this, there should always be at least 2GB free on the &#039;persistence&#039; filesystem, or else risk files becoming fragmented and the any application blocking on reads/writes will &#039;&#039;&#039;hang&#039;&#039;&#039; from &#039;&#039;&#039;very slow&#039;&#039;&#039; reading and writing. In this circumstance it may be a number of minutes before such applications respond again, but you&#039;re free to use this time to do other things with already opened applications, like use the web browser or read opened documents.&lt;br /&gt;
&lt;br /&gt;
I personally use a lightweight Debian distro (not Ubuntu!) to minimize RAM footprint, minimize squashfs size, and maximize responsiveness. It is all instantaneous on USB3 (was a bit sluggish on USB2 on an older 4GB stick when I first started). I recommend at least a 32GB stick.&lt;br /&gt;
&lt;br /&gt;
Once the apt hook is implemented and distro-upgrade script polished, this should be a very nice option for interested users.&lt;br /&gt;
&lt;br /&gt;
There are tons of persistence guides, which unfairly dismiss this live-boot squashfs/persistence setup because they don&#039;t know how to mitigate/handle the upgrade problem as I do, because making a squashfs is not something well known which requires a lot of plumbing. Or they suggest other unnecessarily complex setups or make suggestions without having investigated performance implications (e.g. suggesting a full install to USB).&lt;br /&gt;
&lt;br /&gt;
I do not recommend modern Samsung, Sandisk, or any other cheap off-brands for this &amp;quot;heavy&amp;quot; use. Good chance they&#039;ll fail within a year and be too hot to touch. &#039;&#039;&#039;Buy from Toshiba/Kioxia&#039;&#039;&#039;, the inventors of flash memory. Yes their [https://www.amazon.com/Toshiba-TransMemory-U364-USB3-0-THN-U364W0320A4/dp/B078NPLXGC#customerReviews performance] as shown in benchmarks isn&#039;t as good, nor are they inexpensive, but they are reliable and will last years. &#039;&#039;&#039;Do not&#039;&#039;&#039; skimp to save a few $ buying a Sandisk/Samsung on a sale for this use-case, I&#039;m speaking from experience!&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&#039;&#039;&#039;Pros:&#039;&#039;&#039;&lt;br /&gt;
# Sure it may be useful if for example, you forget the drive in an internet cafe or library. Or have something you don&#039;t want to turn up in investigation.&lt;br /&gt;
&#039;&#039;&#039;Cons:&#039;&#039;&#039;&lt;br /&gt;
# It costs additional CPU &amp;amp; energy usage.&lt;br /&gt;
# Encryption offers zero &amp;quot;online&amp;quot;/mounted protection, e.g. encryption does not protect against a web browser vulnerability allowing disk access. Mental energy would be better spent on [https://wiki.archlinux.org/index.php/security &#039;hardening&#039;] the system.&lt;br /&gt;
# Harder to recover data when things break. &#039;&#039;Big&#039;&#039; headache.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 20:40, 4 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I will write more thoughts, I see this is an ongoing need/interest [[OSE_Linux_Log]]. Today I have ordered two Toshiba USB flash drives. I will write a guide here for preparing any Debian distro for USB persistence with optimal performance (squashfs &amp;amp; persistence partition) for interested readers.&lt;br /&gt;
&lt;br /&gt;
==GUIDE==&lt;br /&gt;
This guide will first make a live USB stick persistent.&lt;br /&gt;
&lt;br /&gt;
In the appendix will be additional knowledge and procedures to make it perform better.&lt;br /&gt;
&lt;br /&gt;
Brief steps:&lt;br /&gt;
#Make live USB&lt;br /&gt;
##Partition the USB.&lt;br /&gt;
##Mount the ISO, and copy select files to the USB&#039;s live partition.&lt;br /&gt;
##Install grub.&lt;br /&gt;
#Make the live USB a persistent USB&lt;br /&gt;
##Boot to live USB &amp;amp; Setup persistence.&lt;br /&gt;
&lt;br /&gt;
===Make live USB===&lt;br /&gt;
You can follow a different guide and then run the command `live-persistence`. Then when it comes time to upgrade libc or the kernel you can run `live-toram`, then follow the squash guide below.&lt;br /&gt;
&lt;br /&gt;
But here is the way I&#039;d do it.&lt;br /&gt;
====Partition the USB====&lt;br /&gt;
Use gparted. Make a GPT partition, with 16MB unused.&lt;br /&gt;
&lt;br /&gt;
Make live partition 1GB is fine. Big enough to fit the squashfs, vmlinuz, and initrd files from the ISO. Label it &#039;live&#039;, or whatever you want.&lt;br /&gt;
&lt;br /&gt;
Make persistence partition filling up the remainder. Label it &#039;peristence&#039;, or whatever you want, but you&#039;ll have to use the label you use in the grub.cfg later.&lt;br /&gt;
&lt;br /&gt;
Now make a small partition at least 1MB big into the 16MB unused space at the start. Don&#039;t format it with a filesystem, leave it unformatted. This is where GRUB installs stuff into.&lt;br /&gt;
====Mount the ISO, and copy select files to the USB&#039;s live partition====&lt;br /&gt;
Yep, copy the squashfs, vmlinuz, and initrd to /live on the live partition, e.g. /media/live/live&lt;br /&gt;
Easy peasy.&lt;br /&gt;
====Install grub====&lt;br /&gt;
Should go to /media/live/grub&lt;br /&gt;
&lt;br /&gt;
Boot to the USB! It is live!&lt;br /&gt;
===Make the live USB a persistent USB===&lt;br /&gt;
While you&#039;re booted to the live USB, mount the persistence partition, and put a peristence.conf file on it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; | sudo tee /media/peristence/persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, read the short manual on live-tools. And type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
man live-tools&lt;br /&gt;
live-peristence&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Neat, all your files you&#039;re using in the live USB, are now saved to the persistence partition. Though, we have to write a few changes to grub.cfg in order to load that stuff on next boot.&lt;br /&gt;
====Edit grub.cfg====&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
This guide seeks a USB stick with optimal performance, which requires a minimal squashfs.&lt;br /&gt;
&lt;br /&gt;
If USB space and performance are not concerns for you, you&#039;re welcome to modify an existing live USB, name a 2nd partition &amp;quot;persistence&amp;quot;, add suitable kernel parameters including &amp;quot;persistence&amp;quot;, and write a persistence.conf file containing &amp;quot;/ union&amp;quot; in the persistence partition. You can understand necessary details by understanding the guide below. Boot time may take a minute or longer, and applications may be slow and hang due to limitations of flash media which this guide seeks to minimize.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s proceed with making the USB with optimal performance.&lt;br /&gt;
&lt;br /&gt;
===Some notes on flash media===&lt;br /&gt;
The first partition should start after some multiple of the medium&#039;s [https://lwn.net/Articles/428584/ erase block]. The erase block size might be published by the manufacturer, or reasoned about via [https://github.com/bradfa/flashbench benchmarking]. However SSDs and modern USB sticks use more sophisticated controllers so flashbench [https://lists.linaro.org/pipermail/flashbench-results/2016-December/000599.html won&#039;t provide the necessary insights]. So starting the first partition at a 16MiB or 32MiB offset would be a reasonable choice, being some multiple of the erase block.&lt;br /&gt;
&lt;br /&gt;
When considering the [https://superuser.com/questions/379074/how-to-correctly-partition-usb-flash-drive-and-which-filesystem-to-choose-consid stride and stripe-width] parameters I&#039;m not sure it makes a difference anymore with more sophisticated controllers.&lt;br /&gt;
&lt;br /&gt;
On the flash media, writing is slow, so modern ones typically have a faster volatile cache, which is then written to the non-volatile flash memory. So when you write a large file to the medium, and it appears to finish via the command completing, but in reality it won&#039;t be done for some time. This is why writing speed appears to slow down in benchmarking the longer the write goes, from say 20MB/s to 4MB/s, this is due to the volatile cache filling up. ext4 when writing the journal uses a &amp;quot;barrier&amp;quot; somehow implemented, and usually implemented by the USB driver/device where the command blocks until the write is actually written to non-volatile memory, but I think this feature isn&#039;t exposed by ext4 for use in benchmarking. This is something to be cautious about before shutting down the system, leave the system idle for about 30-60 seconds after shutting down the browser or other write activity before powering down the system, as it is possible the write is still transferring from the volatile cache to non-volatile memory, and the OS doesn&#039;t know better, as we&#039;d disabled ext4 journalling for performance and longevity reasons, and it has been my experience that linux doesn&#039;t wait for the non-volatile write to finish anyway on shutdown, printing write errors on shutdown if this is the case. If this happens, then run a fsck on next boot, we&#039;ll make the Grub entry later to make running fsck convenient to best fix the consistency problems.&lt;br /&gt;
&lt;br /&gt;
===Partitioning===&lt;br /&gt;
A GPT partition table is fine, as is an MBR partition table.&lt;br /&gt;
&lt;br /&gt;
If doing GPT then make a small unformatted partition in the 16MiB or 32MiB offset before the live partition. It only needs to be 1MiB, but can be larger. Set the &#039;boot_grub&#039; flag on it in gparted. Grub will install to it later in this guide.&lt;br /&gt;
&lt;br /&gt;
Here is my example command of how I made the ext4 filesystem for the live partition. The option ^has_journal disables the journal, important for flash memory longevity. Determine which partition to run mkfs.ext4 on, mine is /dev/sdd1 and /dev/sdd2.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -N 2048 -L live -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;yourpartition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to do an EFI system partition (ESP), then have this also be the live partition, which we use as our &amp;quot;/boot&amp;quot; partition. This must be FAT32 instead of ext4 unfortunately. Set the &#039;esp&#039; flag on the live partition in gparted. When we install GRUB later, it will install EFI files to the live partition.&lt;br /&gt;
&lt;br /&gt;
And for the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -L persistence -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;your partition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare squashfs===&lt;br /&gt;
Download ISO of desired debian distro (e.g. OSE Linux). Put it at /tmp/&lt;br /&gt;
&lt;br /&gt;
chroot just uses your current Kernel. That&#039;s just how it works. Because of this it is best if the kernel of the system you&#039;re running to be the most recent available for the distro release of the ISO (e.g. for me [https://packages.debian.org/buster/linux-image-amd64 linux-image-4.19.0-13-amd64] as of this writing). If this isn&#039;t possible, boot to the ISO and skip to the [[Talk:OSE_Linux_Persistence#Remove_non-core_packages]] instructions without doing the chroot. You can do this all on a single USB stick if you do it correctly. Or you could use [https://help.ubuntu.com/community/DebootstrapChroot] or virtualization, lots of possibilities outside the scope of this guide.&lt;br /&gt;
&lt;br /&gt;
Actually now that I think about it writing the guide following the live USB installation without doing the chroot may be best, being more generalized and perhaps easier. I will rewrite this guide that way in the future, but for now, here are the chroot directions.&lt;br /&gt;
&lt;br /&gt;
====prepare chroot filesystem====&lt;br /&gt;
Let us continue with the chroot assuming we&#039;re running the same distro/kernel. Mount the ISO, and look for filesystem.squashfs, initrd.img, vmlinuz on it. Also note the location of config, System.map and filesystem.packages.xz, we&#039;ll copy or make these to follow convention.&lt;br /&gt;
&lt;br /&gt;
Make temporary directories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir /media/filesystem.squashfs /media/iso /media/overlay /media/myadditions /media/myadditions/rw /media/myadditions/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -o loop /tmp/debian-distro-i386.iso /media/iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount filesystem.squashfs on the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t squashfs /media/iso/live/filesystem.squashfs /media/filesystem.squashfs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount an in-memory filesystem to hold temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t tmpfs -o size=1024m none /media/myadditions&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prepare the union filesystem, so that we&#039;re able to edit the squashfs on the iso and compress the result. We can use either [https://wiki.archlinux.org/index.php/Overlay_filesystem overlayfs] or aufs. Here is the overlayfs command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t overlay overlay -o lowerdir=/media/filesystem.squashfs,upperdir=/media/myadditions/rw,workdir=/media/myadditions/work /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or afus. overlayfs hasn&#039;t been widely available until kernel 3.18, and aufs is available on earlier kernels (from [https://sourceforge.net/p/aufs/aufs3-standalone/ci/f88513f985e153aaf3e2950622c2a2329c3c3f8f/log/ kernel 3.9 late 2014 aufs supports xattr]) via aufs-tools, and their may be some differences I&#039;m not aware of but I think the concensus is that overlayfs is better. Hopefully aufs supports extended attributes (xattr) good enough to not loose said attributes, which are important for hardening the system (extended attributes are I believe where [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities] are stored/configured).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t aufs -o br=/media/myadditions=rw -o br=/media/filesystem.squashfs=ro -o udba=reval none /media/overlay/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====chroot====&lt;br /&gt;
Prepare the chroot, so that we can run apt within it and remove packages. resolv.conf and mount binds are to remove error/warning messages when installing packages with apt.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp /etc/resolv.conf /media/overlay/etc/resolv.conf&lt;br /&gt;
sudo mount --bind /dev/ /media/overlay/dev/&lt;br /&gt;
sudo mount --bind /dev/pts /media/overlay/dev/pts #https://wiki.debian.org/chroot#A.2Fdev.2Fpts&lt;br /&gt;
sudo mount --bind /proc /media/overlay/proc&lt;br /&gt;
sudo mount --bind /sys /media/overlay/sys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now chroot into the squashfs so we can use apt within it to remove packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chroot --userspec root:root /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the locale, you&#039;ll get many warning messages in apt otherwise. You probably want to select UTF-8 for your country/language, for example I picked en_US.UTF-8. Press space bar to toggle each locale you want generated, then press enter to proceed. Then it asks if you want the locales you chose to be applied systemwide, forcing your selection on each user, which may be desired for desktop software which starts up before the user-specific ~/.profile is read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure locales&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And set the timezone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure tzdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If /boot exists, then back it up, we&#039;re replacing /boot with a symlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /boot /boot.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must make a symlink so that as we work with apt-get, it may call `live-update-initramfs -u`, and we need those updates to /boot to go to the proper location, the &#039;live&#039; partition&#039;s /live:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /lib/live/mount/medium/live /boot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve not yet made the live partition, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If already have the live partition ready, or like me are updating an existing live partition&#039;s squashfs, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
mkdir /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have to do the above steps to work around update-initramfs&#039;s logic and assumptions regarding a read/write test that this works around. If you ever run into problems with update-initramfs while using apt-get, this is what you run once the problem is fixed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg --configure initramfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we remove packages, such at btrfs-progs, update-initramfs will be triggered which should update /boot/vmlinuz and /boot/initrd, these files are not compressed into the filesystem.squashfs and we need those files within /live of the live partition to boot.&lt;br /&gt;
&lt;br /&gt;
`man live-boot` is a useful reference, ensure live-boot-doc is installed. Also the [https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html Debian live-manual] is a useful reference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install live-boot-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Remove non-core packages====&lt;br /&gt;
&lt;br /&gt;
Now we gut the filesystem.squashfs from the iso of packages that:&lt;br /&gt;
* We don&#039;t want.&lt;br /&gt;
* Are frequently updated (e.g. web browser).&lt;br /&gt;
* With particular scrutiny of packages that are large.&lt;br /&gt;
* Are not necessary to boot to a desktop.&lt;br /&gt;
All of those can they can go onto persistence partition. We remove them now, and install them after the squashfs has been made, or as needed. Examples of what should be considered &amp;quot;core&amp;quot; packages necessary to boot are: linux-image (this is the kernel), firmware, GPU driver, and X11 server. This way the USB will:&lt;br /&gt;
* Boot fast,&lt;br /&gt;
* The OS running from it will be maximally responsive,&lt;br /&gt;
* Will have minimal memory footprint,&lt;br /&gt;
* And be persistent!&lt;br /&gt;
&lt;br /&gt;
Run this to see packages installed ordered by size, then apt-get remove or purge stuff, and ignore anything beginning with &amp;quot;lib&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W -f &#039;${Installed-Size}\t${Package}\n&#039; | sort -n | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To understand what a package is, you can search [https://packages.debian.org/buster/os-prober packages.debian.org]. If the description there isn&#039;t informative enough, you can try clicking the links on the right hand side such as a project homepage, or looking through the files of the package. Ignore or don&#039;t pay much attention to any package beginning with &amp;quot;lib&amp;quot;, with the exception of things like libc6, but apt will probably warn you about doing something silly like that with the prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
You are about to do something potentially harmful.&lt;br /&gt;
To continue type in the phrase &#039;Yes, do as I say!&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example of stuff I removed from a different Debian distro (BunsenLabs), but I removed some firmware packages so that reduces portability:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get remove -y firefox-esr libjsoncpp1&lt;br /&gt;
apt-get remove -y libreoffice-core libreoffice-common coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1 libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-locale1.67.0 libboost-thread1.67.0 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data libgpgmepp6 liblangtag-common liblangtag1 libmhash2 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libnumbertext-data libodfgen-0.1-1 liborcus-0.14-0 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 libstaroffice-0.0-0 libsuitesparseconfig5 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure&lt;br /&gt;
apt-get remove -y firmware-atheros firmware-netronome firmware-iwlwifi firmware-brcm80211 firmware-qlogic firmware-ti-connectivity firmware-myricom firmware-intelwimax firmware-libertas dahdi-firmware-nonfree atmel-firmware firmware-cavium firmware-bnx2x firmware-qcom-media firmware-netxen firmware-samsung firmware-ipw2x00 firmware-siano firmware-ivtv firmware-bnx2&lt;br /&gt;
apt-get remove -y samba-libs libavahi-glib1 libcdio-cdda2 libcdio-paranoia2 libgd3 libgdata-common libgdata22 libgoa-1.0-0b libgoa-1.0-common libgphoto2-6 libgphoto2-port12 libldb1 liblmdb0 liboauth0 libpython2.7 libtalloc2 libtevent0 libwbclient0 python-talloc&lt;br /&gt;
apt-get remove -y fonts-noto-core fonts-noto-cjk papirus-icon-theme bunsen-papirus-icon-theme gnome-icon-theme gdebi-core gir1.2-vte-2.91 python3-apt python3-chardet python3-debian python3-pkg-resources&lt;br /&gt;
rm -r /usr/share/gdebi/GDebi /usr/lib/python3/dist-packages/aptsources /usr/lib/python3/dist-packages/apt/progress /usr/lib/python3/dist-packages/debian_bundle /usr/lib/python3/dist-packages/debian /usr/lib/python3/dist-packages/chardet/cli /usr/lib/python3/dist-packages/pkg_resources/extern /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging&lt;br /&gt;
apt-get remove -y evince synaptic bubblewrap evince-common gnome-desktop3-data libbrotli1 libdjvulibre-text libdjvulibre21 libept1.5.0 libevdocument3-4 libevview3-3 libgnome-desktop-3-17 libgspell-1-1 libgspell-1-common libgxps2 libharfbuzz-icu0 libhyphen0 libjavascriptcoregtk-4.0-18 libkpathsea6 libspectre1 libsynctex2 libwebkit2gtk-4.0-37 libwebpdemux2 libwoff1 xdg-dbus-proxy zenity zenity-common&lt;br /&gt;
apt-get remove -y vlc libaribb24-0 libbasicusageenvironment1 libcddb2 libdvbpsi10 libebml4v5 libgles2 libgroupsock8 libixml10 liblirc-client0 liblivemedia64 liblua5.2-0 libmad0 libmatroska6v5 libmtp-common libmtp9 libnfs12 libopenmpt-modplug1 libplacebo7 libprotobuf-lite17 libqt5x11extras5 libresid-builder0c2a libsdl-image1.2 libsdl1.2debian libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libxcb-xv0 vlc-bin vlc-data vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output vlc-plugin-notify libvlccore9&lt;br /&gt;
apt-get remove -y file-roller p7zip-full p7zip libarchive13 libnautilus-extension1a xfburn libburn4 libexo-1-0 libisofs6 libjte1 unar gnustep-base-common gnustep-base-runtime gnustep-common libgnustep-base1.26 libobjc4&lt;br /&gt;
apt-get remove -y transmission-gtk libevent-2.1-6 libminiupnpc17 libnatpmp1 transmission-common filezilla filezilla-common libfilezilla0 libpugixml1v5 libwxbase3.0-0v5 libwxgtk3.0-0v5 yudit-common feh&lt;br /&gt;
apt-get remove -y libpython2.7-stdlib libblas3 libgfortran5 libkeybinder0 liblapack3 libpython2.7-minimal libsodium23 lua-bit32 lua-expat lua-penlight lua-posix lua-socket lua5.2 python-apt-common python-minimal python2-minimal python2.7-minimal libavformat58 libmysofa0 libnorm1 libpgm-5.2-0 libpostproc55 librubberband2 libssh-gcrypt-4 libswscale5 libvidstab1.1&lt;br /&gt;
apt-get remove -y aptitude aptitude-common libboost-iostreams1.67.0 libboost-system1.67.0 libcwidget3v5 libxapian30 ristretto file libmagic-mgc libmagic1 hexchat-common&lt;br /&gt;
apt-get install wpasupplicant network-manager --no-install-recommends&lt;br /&gt;
#modem support&lt;br /&gt;
apt-get remove -y modemmanager libmbim-glib4 libmbim-proxy libqmi-glib5 libqmi-proxy openssh-client libxatracker2 nitrogen libgtkmm-2.4-1v5 lvm2 dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 nano geany geany-common ghostscript poppler-data libcupsimage2 libgs9-common libijs-0.35 libjbig2dec0 libpaper1 pcmciautils vdpau-va-driver arandr&lt;br /&gt;
apt-get remove -y intel-microcode iucode-tool va-driver-all i965-va-driver xserver-xorg-video-intel libxvmc1 intel-media-va-driver libigdgmm5 xserver-xorg-video-qxl btrfs-progs cryptsetup-initramfs cryptsetup-bin cryptsetup-run&lt;br /&gt;
apt-get remove -y python3.7-minimal dconf-cli distro-info-data gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-pango-1.0 libfm-extra4 libgirepository-1.0-1 libmenu-cache-bin libmenu-cache3 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libxslt1.1 mime-support wmctrl&lt;br /&gt;
rm -r /usr/lib/python3&lt;br /&gt;
apt-get remove -y iso-codes liba52-0.7.4 libaa1 libass9 libatomic1 libavc1394-0 libavfilter7 libavformat58 libbs2b0 libcaca0 libcdio18 libcdparanoia0 libchromaprint1 libdc1394-22 libdca0 libde265-0 libdv4 libdvdnav4 libdvdread4 libfaad2 libfftw3-double3 libflite1 libfluidsynth1 libgme0 libgssdp-1.0-3 libgstreamer1.0-0 libgupnp-1.0-4 libgupnp-igd-1.0-4 libiec61883-0 libilmbase23 libkate1 liblilv-0-0 libmjpegutils-2.1-0 libmms0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa0 libnice10 libnorm1 libofa0 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr23 libopenmpt0 libpgm-5.2-0 libpoppler-glib8 libpoppler82 libpostproc55 libraw1394-11 librubberband2 libsbc1 libserd-0-0 libshout3 libsidplay1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libspandsp2 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libswscale5 libtumbler-1-0 libv4l-0 libv4lconvert0 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvulkan1 libwildmidi2 libzbar0 libzmq5 tumbler-common&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, much of what was removed can be installed again after persistence is set up. These packages are conveniently listed as removed within dpkg utilities, I&#039;ll illustrate how to conveniently reinstall them later.&lt;br /&gt;
&lt;br /&gt;
====Misc setup tips====&lt;br /&gt;
&lt;br /&gt;
[https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#521 One important consideration is that the live user is created by live-boot at boot time]. We need to ensure the live user is set up. Inspect the contents of /etc/live/ for any configuration files. If there is none in your distribution then let&#039;s make it, and feel free to customize this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/config.conf.d/10-user-setup.conf&lt;br /&gt;
LIVE_HOSTNAME=debian-persistence&lt;br /&gt;
LIVE_USERNAME=user&lt;br /&gt;
LIVE_USER_FULLNAME=&amp;quot;Debian LiveUser&amp;quot;&lt;br /&gt;
LIVE_USER_DEFAULT_GROUPS=&amp;quot;cdrom floppy audio dip video plugdev fuse bluetooth netdev scanner staff&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These options to live-boot will minimize the generated initramfs size:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/boot.conf&lt;br /&gt;
#man live-boot&lt;br /&gt;
#see /usr/share/initramfs-tools/hooks/live, might make initrd smaller&lt;br /&gt;
DISABLE_CDROM=true&lt;br /&gt;
DISABLE_FAT=true&lt;br /&gt;
DISABLE_FUSE=true&lt;br /&gt;
DISABLE_NTFS=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Performance tips====&lt;br /&gt;
&lt;br /&gt;
USB sticks use flash memory, and to maximize performance with it we can [https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler change the IO scheduler for such devices].&lt;br /&gt;
&lt;br /&gt;
BFQ looks like a nice scheduler. Quote:&lt;br /&gt;
&amp;quot;Regardless of the actual background workload, BFQ guarantees that, for interactive tasks, the storage device is virtually as responsive as if it was idle. [...] As a comparison, with CFQ, NOOP or DEADLINE, and in the same conditions, applications experience high latencies, or even become unresponsive until the background workload terminates (also on SSDs).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mq_deadline is fine while the system is booting. The scheduler in use can also be [https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers tuned], but I need to do more research before giving advice on tuning in this context. To [https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler setup/enable]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/modules-load.d/bfq.conf&lt;br /&gt;
bfq&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set bfq scheduler during startup. Alternatives include mq_deadline and none, either might be faster than bfq during startup when GUI application responsiveness isn&#039;t important, but I&#039;d need to do some research/experiments.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/udev/rules.d/60-ssd-scheduler.rules&lt;br /&gt;
# set bfq scheduler for non-rotating disks during startup&lt;br /&gt;
ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;sd[a-z]&amp;quot;, ATTR{queue/rotational}==&amp;quot;0&amp;quot;, ATTR{queue/scheduler}=&amp;quot;bfq&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use [https://wiki.archlinux.org/index.php/profile-sync-daemon profile-sync-daemon] to enhance performance of the browser, and minimize flash memory writes (maximize longevity).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install profile-sync-damon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For SD card longevity, consider mounting a tmpfs on /var/log. But perhaps only after you&#039;ve booted to the system a few times and verify the system is stable, as putting log files in RAM means they can&#039;t be read offline to diagnose a problem. So disable this feature if needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /var/log tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/tmpfiles.d/varlog.conf&lt;br /&gt;
d /var/log/apt 755 root root&lt;br /&gt;
d /var/log/lightdm 711 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vlc&#039;s default lookahead is too short, leads to music cutting out. &#039;Tools-&amp;gt;Preferences&#039;, toggle &#039;Show all settings&#039;, click &#039;Input/Codecs&#039; in tree view, scroll down to &#039;Advanced&#039; section and look at caching settings. Increase them to at least 600ms. This should largely mitigate problems with music/video stopping momentarily due to I/O delays.&lt;br /&gt;
&lt;br /&gt;
====Pruning tips====&lt;br /&gt;
Install deborphan and localepurge to help clean stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install deborphan localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you&#039;re done pruning things, run deborphan and remove things it tells you to as you desire. Deborphan helps you find &amp;quot;orphan&amp;quot; packages not needed by anything else, which take up space. Such orphaned packages may have been necessary by a previously installed package.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
deborphan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next run localepurge to remove space consuming files for locales you&#039;ll never use, I removed 160MB from my system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, clear out apt temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get autoremove&lt;br /&gt;
apt-get clean&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend vim.tiny over vim, vim.tiny much smaller, also install whatever else your heart desires that is small and infrequently updated. Such small utilities will be available in &#039;live&#039; mode (if installed when in &#039;persistence&#039; mode, it won&#039;t be available in plain &#039;live&#039; mode):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install vim-tiny&lt;br /&gt;
echo &amp;quot;set nocp&amp;quot; &amp;gt;&amp;gt; /etc/vim/vimrc.tiny #Allows arrow keys to work, and vim.tiny to act like vim instead of vi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Hardening tips====&lt;br /&gt;
&lt;br /&gt;
I think it is best for /tmp to be mounted noexec, but many applications have bugs regarding this&lt;br /&gt;
Double check the /etc/fstab file with a text editor after editing /etc/fstab:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /tmp tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mount /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often apt packages during installation will require the ability to execute temporary files on /tmp, this is how we allow this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/apt/apt.conf.d/50remount&lt;br /&gt;
DPkg::Pre-Install-Pkgs {&amp;quot;mount -o remount,exec /tmp&amp;quot;;};&lt;br /&gt;
DPkg::Post-Invoke {&amp;quot;mount -o remount /tmp&amp;quot;;};&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A common thing people do, is charge their android phone, or other USB device via a USB port on the computer. Realize that this is physical access, which a compromised device may use to log in to Linux via root. I suspect I had fallen victim to in the past, a keylogger following a pattern I&#039;d seen exhibited in the news, which I believe came after I&#039;d plugged in a new android I had run questionable rooting software on, to my computer. I suggest both setting a root password, and disallowing this access, by editing /etc/securetty and commenting out root access via UART serial ports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# UART serial ports&lt;br /&gt;
#ttyS0&lt;br /&gt;
#ttyS1&lt;br /&gt;
#ttyS2&lt;br /&gt;
#ttyS3&lt;br /&gt;
#ttyS4&lt;br /&gt;
#ttyS5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the [https://www.debian.org/doc/manuals/securing-debian-manual/ch03s04.en.html root password]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What has piqued my interest lately is [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities]. Debian distributions should include both [https://packages.debian.org/buster/libcap2 libcap2] and [https://packages.debian.org/buster/libcap-ng0 libcap-ng0 (RedHat&#039;s fork)]. And I&#039;m looking for a more convenient open-source means of administration. What has me interested in the idea of a [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html proactive defense against root-kits] by removing module loading capabilities (CAP_SYS_MODULE) even for the root user, after the system had booted. It appears that lcap is no longer functional, it and many capabilities articles detail a system-wide capability bounding set in pre-2.6.25 kernels, but since kernel 2.6.25 capability bounding sets are now per-thread. The [http://people.redhat.com/sgrubb/libcap-ng/ images here] may help visually explain capabilities and their inheritance. What I have in mind may be within a custom /etc/init.d/ script calling [https://man7.org/linux/man-pages/man2/capset.2.html setcap] on init (pid 1) to remove the CAP_SYS_MODULE capability from the bounding set system-wide. The capabilities on any process can be viewed with `cat /proc/&amp;lt;pid&amp;gt;/status`.&lt;br /&gt;
&lt;br /&gt;
Something else that can be done is use of more than one account, for example an account dedicated to web browsing with minimal privileges, and an account with administration privileges (sudo, member of staff,adm groups).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser browser&lt;br /&gt;
dm-tool switch-to-user browser #with LightDM desktop manager: https://wiki.ubuntu.com/LightDM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files downloaded with the browser can be transfered to other users via /tmp, which is a good place to set as the default location to download files in the browser settings anyway.&lt;br /&gt;
&lt;br /&gt;
With this separation of user privileges, if malware managed to gained the privileges of the browser account (no privilege escalation), and escaped the browser sandbox, the worst it could do is keylog, delete or encrypt/ransom the browser account&#039;s files. Since the browser account is running on a difference X11 server than an administration account, I think [https://security.stackexchange.com/questions/4641/why-are-people-saying-that-the-x-window-system-is-not-secure/4646 risks] are reduced.&lt;br /&gt;
&lt;br /&gt;
Switching between the administration account and browser account X11 servers can be done with ctrl+alt+F7 or F8 (or F1/F2 or whatever).&lt;br /&gt;
&lt;br /&gt;
Or just have the desktop load with the browser account instead of the administrative account, and do administrative tasks on a virtual terminal (ctrl+alt+F1 through F6).&lt;br /&gt;
&lt;br /&gt;
Set up the [https://www.debian.org/doc/manuals/securing-debian-manual/ch04s11.en.html#id-1.5.14.17 shell history file], .bash_history better. An easy way a bad actor can circumvent the stock configuration from logging his evil deeds is to proceed those evil things with a space, this guide will fix that!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lsattr /home/browser/.bash_history  #See what attributes are set&lt;br /&gt;
sudo chattr +a /home/browser/.bash_history   #Only root user can chattr&lt;br /&gt;
sudo chattr +a /home/user/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Make filesystem.packages and filesystem.squashfs====&lt;br /&gt;
Now that we have a set of &amp;quot;core&amp;quot; packages to go in the squashfs, of minimal size, on the &#039;live&#039; partition, we must make our new squashfs!&lt;br /&gt;
&lt;br /&gt;
Print out a list of &amp;quot;core&amp;quot; packages we have, we&#039;ll need them for reference later. Lets put them in filesystem.packages.xz:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W --showformat=&#039;${Package}\t${Version}\n&#039; | xz &amp;gt; /tmp/filesystem.packages.xz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get -y install squashfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exclude stuff we don&#039;t want in the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXCLUDES=&#039;.wh* dev live-persistence.conf live lost+found media mnt proc .pulse* run home selinux sys tmp* lib/live/mount usr/lib/live/mount var/cache/apt var/cache/apt-xapian-index var/lib/apt/lists var/tmp&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Directives to squashfs-tools to make pseudofiles, necessary to boot. Linux will make many pseudofiles in /dev when it boots, but not all, and through experimentation and observations I&#039;ve come up with this list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /tmp/mksquashfs.pf&lt;br /&gt;
dev d 755 root root&lt;br /&gt;
dev/console c 662 root tty 5 1&lt;br /&gt;
dev/full c 666 root root 1 7&lt;br /&gt;
dev/kmem c 640 root kmem 1 2&lt;br /&gt;
dev/kmsg c 644 root root 1 11&lt;br /&gt;
dev/loop0 b 660 root disk 7 0&lt;br /&gt;
dev/loop1 b 660 root disk 7 1&lt;br /&gt;
dev/loop2 b 660 root disk 7 2&lt;br /&gt;
dev/loop3 b 660 root disk 7 3&lt;br /&gt;
dev/loop4 b 660 root disk 7 4&lt;br /&gt;
dev/loop5 b 660 root disk 7 5&lt;br /&gt;
dev/loop6 b 660 root disk 7 6&lt;br /&gt;
dev/loop7 b 660 root disk 7 7&lt;br /&gt;
dev/mem c 640 root kmem 1 1&lt;br /&gt;
dev/null c 666 root root 1 3&lt;br /&gt;
dev/port c 640 root kmem 1 4&lt;br /&gt;
dev/ptmx c 666 root tty 5 2&lt;br /&gt;
dev/pts d 755 root root&lt;br /&gt;
dev/ram0 b 640 root disk 1 0&lt;br /&gt;
dev/ram1 b 640 root disk 1 1&lt;br /&gt;
dev/ram2 b 640 root disk 1 2&lt;br /&gt;
dev/ram3 b 640 root disk 1 3&lt;br /&gt;
dev/ram4 b 640 root disk 1 4&lt;br /&gt;
dev/ram5 b 640 root disk 1 5&lt;br /&gt;
dev/ram6 b 640 root disk 1 6&lt;br /&gt;
dev/ram7 b 640 root disk 1 7&lt;br /&gt;
dev/ram8 b 640 root disk 1 8&lt;br /&gt;
dev/ram9 b 640 root disk 1 9&lt;br /&gt;
dev/ram10 b 640 root disk 1 10&lt;br /&gt;
dev/ram11 b 640 root disk 1 11&lt;br /&gt;
dev/ram12 b 640 root disk 1 12&lt;br /&gt;
dev/ram13 b 640 root disk 1 13&lt;br /&gt;
dev/ram14 b 640 root disk 1 14&lt;br /&gt;
dev/ram15 b 640 root disk 1 15&lt;br /&gt;
dev/ram16 b 640 root disk 1 16&lt;br /&gt;
dev/random c 644 root root 1 8&lt;br /&gt;
dev/shm d 755 root root&lt;br /&gt;
dev/tty c 662 root tty 5 0&lt;br /&gt;
dev/tty0 c 600 root tty 4 0&lt;br /&gt;
dev/urandom c 644 root root 1 9&lt;br /&gt;
dev/zero c 644 root root 1 5&lt;br /&gt;
home d 755 root root&lt;br /&gt;
media d 755 root root&lt;br /&gt;
mnt d 755 root root&lt;br /&gt;
proc d 755 root root&lt;br /&gt;
run d 755 root root&lt;br /&gt;
run/lock d 1777 root root&lt;br /&gt;
sys d 755 root root&lt;br /&gt;
tmp d 1777 root root&lt;br /&gt;
var/cache/apt d 755 root root&lt;br /&gt;
var/cache/apt/partial d 755 root root&lt;br /&gt;
var/cache/apt/lock f 640 root root echo &amp;quot;&amp;quot;&lt;br /&gt;
var/lib/apt/lists d 755 root root&lt;br /&gt;
var/lib/apt/lists/partial d 755 root root&lt;br /&gt;
var/tmp d 1777 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now make the squashfs, it is compressed with xz compression:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mksquashfs / /tmp/filesystem.squashfs -comp xz -info -always-use-fragments -noappend -wildcards -pf /tmp/mksquashfs.pf -e ${EXCLUDES} &amp;gt; /tmp/mksquashfs.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/tmp/mksquashfs.log will contain interesting details, such as the filesystem is now roughly 30% of its uncompressed size.&lt;br /&gt;
&lt;br /&gt;
Hopefully the squashfs you made is around 800MB or less, mine for a different Debian distribution was about 300MB. Let us say your flash drive has 100MB/s sequential read speed, and your &amp;quot;core&amp;quot; filesystem was squashed down to 300MB, which will take 3 seconds to read into memory. How long do you think yours will take to boot?&lt;br /&gt;
&lt;br /&gt;
===Prepare the live partition===&lt;br /&gt;
If you hadn&#039;t yet mounted the live partition to /lib/live/mount/medium earlier in the guide, we need to move files off, then mount it, and move vmlinuz, initrd, and etc onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /lib/live/mount/medium /tmp/&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
cd /lib/live/mount/medium&lt;br /&gt;
mkdir live&lt;br /&gt;
mv /tmp/medium/boot/vmlinuz* live/&lt;br /&gt;
mv /tmp/medium/boot/initrd* live/&lt;br /&gt;
mv /tmp/filesystem.squashfs live/&lt;br /&gt;
mv /tmp/filesystem.packages.xz live/&lt;br /&gt;
#update-initramfs or something else pointed at live/ incorrectly puts grub/unicode.pf2 here, this symlink fixes that:&lt;br /&gt;
ln -s ../boot/grub/ live/grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also copy files like System.map-4.19.0-9-amd64 and config-4.19.0-9-amd64 to /lib/live/mount/medium/live, they should be in /media/overlay/boot.bak and/or /media/iso/live/ (outside the chroot). Or if the kernel is updated then you&#039;ll get these files, corresponding to the new kernel, automatically put in there anyway.&lt;br /&gt;
&lt;br /&gt;
The file named config is a nice reference, it says what flags the kernel was built with, there are a vast number of options.&lt;br /&gt;
This System.map file, stored on the read-only live partition may be useful, for example, finding if your system had been [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html compromised with a rootkit].&lt;br /&gt;
&lt;br /&gt;
===Prepare GRUB on the live partition and USB device===&lt;br /&gt;
&lt;br /&gt;
The introduction of UEFI hardware complicates things. You&#039;re welcome to modify the instructions below if you desire to support UEFI functionality on such consumer hardware. The instructions below handles computers with [https://wiki.archlinux.org/index.php/GRUB#BIOS_systems traditional BIOS], with a [https://wiki.archlinux.org/index.php/Partitioning#Master_Boot_Record traditional MBR], as well as UEFI hardware which supports such &amp;quot;legacy&amp;quot; standards. &lt;br /&gt;
&lt;br /&gt;
From within the chroot, install non-uefi grub (grub-pc), and --no-install-recommends will result in os-prober not being installed. I think os-prober is workstation-specific and not useful to configure a USB device which may move between workstations. grub-pc will ask two questions, don&#039;t select anything and enter on Ok on the first, and press enter on Yes on the next to continue without --exclude.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install grub-pc --no-install-recommends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find your live partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -l /dev/disk/by-label/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say it is /dev/sdd1. Then we use the device /dev/sdd in the command below.&lt;br /&gt;
&lt;br /&gt;
Install grub, to both the USB device and the live partition on the USB device. Where /dev/sdd below is the USB device (not a partition), and /lib/live/mount/medium is where the live partition is mounted:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-install --target=i386-pc --root-directory=/lib/live/mount/medium /dev/sdd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now grub needs a configuration file. We can either craft one by hand or use grub-mkconfig, but grub-mkconfig doesn&#039;t really support this use-case.&lt;br /&gt;
&lt;br /&gt;
====Either (1) Handcraft grub.cfg====&lt;br /&gt;
What follows is my legacy grub.cfg, which should work but I hope to make something workable within the newer /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Make sure to fill in this template /lib/live/mount/medium/boot/grub/grub.cfg on &#039;live&#039; partition with your appropriate UUIDs. The partitions you made will have unique UUIDs. You can determine which is which on your system by comparing `ls -l /dev/disk/by-uuid/` and ls -l `/dev/disk/by-label/`.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;LABELorGPTname&amp;quot; to the label or GPT name of your persistence partition. I labeled mine &amp;quot;u365-persistence&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Fill in the template with how your vmlinuz and initrd.img are named, which may not have a suffix of &amp;quot;-4.19.0-9-amd64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make note of the kernel parameters used here, such as &#039;toram&#039; and &#039;persistence&#039;. I&#039;m not sure if elevator=as is the optimal choice, feel free to read about it.&lt;br /&gt;
&lt;br /&gt;
You can customize the [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#530 locale, language, and keyboard layout] here via kernel parameters here such as `locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variants=bepo keyboard-model=tm2030usb`, but I think the console-setup package may be required (installed before the squashfs is made), and perhaps these things are fine configured elsewhere.&lt;br /&gt;
&lt;br /&gt;
You can see other things configurable via kernel parameters such as tzdata, and initial username by looking at /lib/live/config/*. But be aware many things are only configured once via /var/lib/live/config/ (remove the relevant file to allow reconfiguration).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
#Enter the UUID of your boot partition (this is where grub and your kernel reside)&lt;br /&gt;
set uuid_grub_boot=dc434800-22ac-4fd4-b6cb-603da325d5d0&lt;br /&gt;
#Enter the UUID of the persistence partition.&lt;br /&gt;
set uuid_os_root=858d963f-8718-4520-83dd-fb89a842e9bd&lt;br /&gt;
#Here we set the grub &amp;quot;root&amp;quot; variable by locating the uuid of the root partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_os_root --set=root&lt;br /&gt;
#Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot&lt;br /&gt;
#Here&#039;s the magic. We test to see if the boot and root partitions have the same UUID.&lt;br /&gt;
#If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.&lt;br /&gt;
if [ $uuid_grub_boot == $uuid_os_root ] ; then&lt;br /&gt;
  set grub_boot=$grub_boot/boot&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
set kernel_parameters_common=&amp;quot;boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot usbcore.autosuspend=-1&amp;quot;&lt;br /&gt;
set kernel_parameters_persistence=&amp;quot;persistence persistence-storage=filesystem persistence-label=LABELorGPTname&amp;quot;&lt;br /&gt;
set myversion=4.19.0-13-amd64&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#With an unsafe shutdown or powerloss the persistence filesystem will have errors,&lt;br /&gt;
#since it has no journaling, we want to run fsck on it once&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence fsck&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence forcefsck&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Live&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Or (2) Generate grub.cfg with grub-mkconfig====&lt;br /&gt;
Again, using the handcrafted grub.cfg above is probably fine, but here are details on how to get grub-mkconfig to work, which geterates grub.cfg from directives in /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Now, /usr/sbin/grub-mkconfig is not robust line 142 &amp;amp; 146 in our context of chroot usage, assumes we&#039;re installing to / device and /boot, and offers no way to configure around the problem, so we change line 142 &amp;amp; 146:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Line 142:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium`&amp;quot;&lt;br /&gt;
# Line 146:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /boot`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium/boot`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy by hand the legacy grub.cfg menu entries I have, with your disk UUIDs into [https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file /etc/grub.d/40_custom].&lt;br /&gt;
&lt;br /&gt;
Now run grub-mkconfig, from within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-mkconfig -o /lib/live/mount/medium/boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmount /lib/live/mount/medium:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unmount /lib/live/mount/medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare the persistence partition===&lt;br /&gt;
And don&#039;t forget to make the persistence.conf file &#039;/ union&#039; on the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#cd to wherever you have mounted your persistence partition, e.g. /media/persistence&lt;br /&gt;
cd /media/persistence&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; &amp;gt; persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From /media/overlay/home grab the OSE Linux stuff in there, and put in /media/persistence/home:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /media/overlay/home /media/persistence/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There may also be other OSE Linux specific things removed by prior purges of non-&amp;quot;core&amp;quot; packages, e.g. in /etc/&lt;br /&gt;
I suppose there may be a way to &amp;quot;diff&amp;quot; those out, and re-add them to the persistence partition after the packages are installed anew. Maybe there is a convenient dpkg way of doing that... diffing and saving the configuration file changes from stock packages instead of purging them? Or is that the difference between apt-get remove and apt-get purge where apt-get remove will only remove stock configuration files leaving modified ones intact? Yes I think that may be right.&lt;br /&gt;
&lt;br /&gt;
===Cleanup===&lt;br /&gt;
Cleanup!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo umount /media/overlay/dev/pts&lt;br /&gt;
sudo umount /media/overlay/dev/&lt;br /&gt;
sudo umount /media/overlay/proc&lt;br /&gt;
sudo umount /media/overlay/sys&lt;br /&gt;
sudo umount /media/overlay/tmp&lt;br /&gt;
sudo umount /media/overlay&lt;br /&gt;
sudo umount /media/filesystem.squashfs&lt;br /&gt;
sudo umount /media/iso&lt;br /&gt;
sudo umount /media/myadditions&lt;br /&gt;
sudo rmdir /media/iso /media/filesystem.squashfs /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You now have an Linux OS on your USB with persistence that will boot within seconds and reliably outperforms the competition!&lt;br /&gt;
&lt;br /&gt;
==Further Details==&lt;br /&gt;
===Upgrading===&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when linux-image (the package containing the kernel) is upgraded?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; apt will want to update /boot/vmlinuz and /boot/initrd.img. So we need to do things in order to allow this to happen. We must boot with &#039;toram&#039; and also remount &#039;live&#039; as rw before running apt-get update.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#TODO, I wrote this elsewhere need to copy here, something along these lines:&lt;br /&gt;
mount -o remount,rw /lib/live/mount/medium /dev/disk/by-label/live&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this upgrade process apt might rename vmlinuz to say vmlinuz-3.16.0-4-amd64, and initrd similarly. It didn&#039;t always do this. But, you must match the names of those files with what is listed in grub.cfg! Either use &#039;vmlinuz&#039; or whatever name the apt script renamed them to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when libc is upgraded? Be it a security update, or when Debian Stable advances every couple years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; We will want to do a resquash:&lt;br /&gt;
# We need to to the same as above, &#039;toram&#039; and remount &#039;live&#039; as rw.&lt;br /&gt;
# dpkq-query our currently installed packages, and compare to /boot/filesystem.packages.xz we made earlier.&lt;br /&gt;
# Remove all non &amp;quot;core&amp;quot; packages, they should be cached in /var/cache/apt/archives/ so they don&#039;t need to be downloaded again, just reinstalled after we do the resquash.&lt;br /&gt;
# apt-get update&lt;br /&gt;
# Resquash, reboot to verify things working, in &#039;live&#039; mode remove squashed stuff from persistance partition.&lt;br /&gt;
## squash script https://gist.github.com/AndrewSmart/90eb186aea08db8f1426&lt;br /&gt;
## cleanup script https://gist.github.com/AndrewSmart/2f67f79f6f1922c4556f&lt;br /&gt;
# Reinstall packages removed prior to resquash from /var/cache/apt/archives&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; That looks like a lot to deal with.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I agree. I&#039;m looking at using dpkg triggers or /etc/apt/apt.conf.d/ hooks to manage this upgrade process. I hope to have something sufficient soon.&lt;br /&gt;
&lt;br /&gt;
I hope to also make a smaller guide that is not optimal in performance, but has way less steps, so the end user can test out the persistence and take the time to &amp;quot;upgrade&amp;quot; the performance later if so inclined.&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
Keep in mind with the USB we can still boot either in &#039;live&#039; mode, or &#039;persistence&#039; mode depending on the GRUB entry we choose. This is useful in case something breaks in &#039;persistence&#039; mode, like libc was upgraded in &#039;persistence&#039; but libc on &#039;live&#039; is still old! This will result in segmentation faults... a kernel panic, or whatever, it won&#039;t boot. We can access all of the software in the squashfs in &#039;live mode&#039;. Eventually I&#039;d like to write an apt hook to prevent the update of libc unless the system is prepared (&#039;toram&#039;, and &#039;live&#039; partition is mounted rw, the hook won&#039;t trigger unless &#039;persistence&#039; kernel parameter is used).&lt;br /&gt;
&lt;br /&gt;
Debian&#039;s live-boot scripts will put stuff in /lib/live/, and /lib/live/mount is of particularly good use in troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Ubuntu is a bit of a can of worms from my perspective as a fan of vanilla Debian. So... hopefully things will go smoothly... I highly recommend a lighter-weight environment for USB persistence, but I understand everyone has their preferences.&lt;br /&gt;
&lt;br /&gt;
Since &#039;toram&#039; puts the squashfs into memory, lets say you have 8GB RAM and an 800MB squashfs, that is fine, but say you move to a workstation with only 2GB RAM, you will probably want to remove the &#039;toram&#039; kernel parameter, things will be slower but the memory footprint used by the OS will be less, and only use &#039;toram&#039; when updating the &#039;live&#039; partition as detailed above. Perhaps consider 2 additional GRUB entries, in addition to the two I have listed above, where the 2 additional entries are live and persistence mode without &#039;toram&#039; kernel parameter, and when booting select the entry depending on the amount of RAM the system has.&lt;br /&gt;
&lt;br /&gt;
In the event of a power outage, kernel panic, unsafe shutdown or whatever, the filesystem may have problems you&#039;re warned about on next boot. In this setup, the &#039;live&#039; partition was mounted ro, so it is not possible to have filesystem errors there, but with the &#039;persistence&#039; partition there will likely be errors. So, on next boot we select the &#039;live&#039; mode in grub, and run fsck.ext4 -p /dev/disk/by-label/persistence, and all problems are fixed!&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 06:43, 5 November 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=241689</id>
		<title>Talk:OSE Linux Persistence</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Linux_Persistence&amp;diff=241689"/>
		<updated>2021-01-04T21:25:59Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Performance tips */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;https://en.m.wikipedia.org/wiki/UNetbootin claims to have a persistence option for ubuntu distros. I couldn&#039;t get it to work. --[[User:Dorkmo|Dorkmo]] ([[User talk:Dorkmo|talk]]) 19:33, 14 July 2018 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
==Andrewusu&#039;s Thoughts==&lt;br /&gt;
I&#039;ve used persistence on USB for over 10 years now as my primary system (4+ hours/day) and will share some thoughts. Way back with USB2 I spent a lot of time investigating performance, ways to speed up boot time and system responsiveness. Keep in mind benchmarks of any flash memory device, where sequential reading is [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 10-20x] faster than non-sequential reads (possibly more depending on the device). By following this setup I describe below you take advantage of those fast reads for a quick boot and a very responsive OS.&lt;br /&gt;
&lt;br /&gt;
It has been great, I can move my programs, data, and OS from workstation to workstation with a breeze. From a desktop to a laptop, a library computer, or computer at work at times even. I&#039;ll never going back to installing Linux on a HDD. I use HDDs on workstations for storing data, or even making a ~8GB swap file if I need more system memory for some big task (e.g. big FreeCAD model).&lt;br /&gt;
&lt;br /&gt;
I don&#039;t use unetbootin, ISOs, or any other setups, just [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#547 Debian&#039;s live-boot]  and a &#039;persistence&#039; partition.&lt;br /&gt;
&lt;br /&gt;
On Ubuntu an alternative to live-boot is casper, which supports more options such as booting from an ISO file via a kernel parameter. The [https://manpages.debian.org/buster/live-boot-doc/live-boot.7.en.html &#039;boot=live&#039;] kernel parameter results in live-boot being used, while the [http://manpages.ubuntu.com/manpages/bionic/man7/casper.7.html &#039;boot=casper&#039;] kernel parameter results in casper being used. With casper the default labeling of the persistence partition is &#039;casper-rw&#039; instead of &#039;persistence&#039; with live-boot.&lt;br /&gt;
&lt;br /&gt;
It is very simple, you have the second partition labeled &#039;persistence&#039; with a configuration file, and Debian&#039;s live-boot scripts handle everything.&lt;br /&gt;
&lt;br /&gt;
===live-boot Squashfs/Persistence===&lt;br /&gt;
[[File:LinuxUSBPersistencePartitions.png]]&lt;br /&gt;
* &#039;live&#039; partition contains the squashfs, initrd and vmlinuz in /live. Can only be mounted ro unless &#039;toram&#039; kernel parameter used.&lt;br /&gt;
* &#039;persistence&#039; partition is mounted rw.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Benefits:&#039;&#039;&#039;&lt;br /&gt;
# With a squashfs/persistence install instead of a full install to USB, you&#039;ll see a much faster boot, because the &#039;live&#039; partition is compressed ([https://tldp.org/HOWTO/SquashFS-HOWTO/whatis.html squashfs]) and is thus sequentially read into memory faster compared to random reads of various uncompressed files from the USB as they&#039;re needed during the boot process. Mine boots within 20 or so seconds.&lt;br /&gt;
# When running the system with day to day tasks, the performance and responsiveness of a squashfs/persistence setup is better than a full install, because the squashfs may be loaded to memory ([https://manpages.debian.org/jessie/live-boot-doc/live-boot.7.en.html toram]) occupying around 600-800MB RAM, and is thus not a bottleneck on reads/writes to the USB slowing the system down like you&#039;d see in a full install to USB. This translates into better framerate playing games like Starcraft 2, which I&#039;ve run from this flash drive, and a more responsive system in general (to mouse clicks, key presses, etc).&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Limitations:&#039;&#039;&#039;&lt;br /&gt;
# A 64-bit install won&#039;t work on a 32-bit machine&lt;br /&gt;
# A USB with /etc/X11/xorg.conf set to use an NVIDIA GPU driver won&#039;t be as mobile:&lt;br /&gt;
## e.g. Will not boot graphically on an Intel GPU system but to a [https://en.wikipedia.org/wiki/Virtual_console virtual console].&lt;br /&gt;
## This can be mitigated by editing xorg.conf while on the Intel system&#039;s virtual console and rebooting to get the graphical interface. Or possibily without rebooting with some wizardry like rmmod and then startx, but I don&#039;t recall off the top of my head. And you have to redo this in reverse going back to the NVIDIA system. Maybe this is just a limitation of proprietary GPU drivers.&lt;br /&gt;
# Copy-on-write [https://superuser.com/questions/833576/differences-of-aufs-unionfs-and-overlayfs-from-each-other aufs/overlayfs] (whetever distro has chosen) has some limitations:&lt;br /&gt;
## Read-only &#039;live&#039; partition needs to be updated whenever libc or linux-image are updated, or the system won&#039;t boot. So it needs to be mounted read-write and in order to do so &#039;toram&#039; kernal boot parameter must be used. I work around this problem manually via inspecting apt output before installing anything, but this chore can be mitigated via an apt hook which I&#039;ve not written yet.&lt;br /&gt;
## &#039;live&#039; partition containing the squashfs should only have packages which are not updated often, being core packages, and not something like firefox which is updated often. This will minimize the size of the squashfs.&lt;br /&gt;
## When Debian stable is updated to the next revision, the linux-image must be updated, and the squashfs recompressed. To do this, all non-core packages must be removed, the distro upgraded, the squashfs recompressed, and then non-core packages reinstalled. This can also be scripted and I have some non-robust helper scripts I&#039;ve written.&lt;br /&gt;
# Flash memory has limitations, where sequential writes are [https://xsreviews.co.uk/reviews/toshiba-transmemory-u365-usb-flash-drive-review/ 5000x-10000x] faster than random writes. Due to this, there should always be at least 2GB free on the &#039;persistence&#039; filesystem, or else risk files becoming fragmented and the any application blocking on reads/writes will &#039;&#039;&#039;hang&#039;&#039;&#039; from &#039;&#039;&#039;very slow&#039;&#039;&#039; reading and writing. In this circumstance it may be a number of minutes before such applications respond again, but you&#039;re free to use this time to do other things with already opened applications, like use the web browser or read opened documents.&lt;br /&gt;
&lt;br /&gt;
I personally use a lightweight Debian distro (not Ubuntu!) to minimize RAM footprint, minimize squashfs size, and maximize responsiveness. It is all instantaneous on USB3 (was a bit sluggish on USB2 on an older 4GB stick when I first started). I recommend at least a 32GB stick.&lt;br /&gt;
&lt;br /&gt;
Once the apt hook is implemented and distro-upgrade script polished, this should be a very nice option for interested users.&lt;br /&gt;
&lt;br /&gt;
There are tons of persistence guides, which unfairly dismiss this live-boot squashfs/persistence setup because they don&#039;t know how to mitigate/handle the upgrade problem as I do, because making a squashfs is not something well known which requires a lot of plumbing. Or they suggest other unnecessarily complex setups or make suggestions without having investigated performance implications (e.g. suggesting a full install to USB).&lt;br /&gt;
&lt;br /&gt;
I do not recommend modern Samsung, Sandisk, or any other cheap off-brands for this &amp;quot;heavy&amp;quot; use. Good chance they&#039;ll fail within a year and be too hot to touch. &#039;&#039;&#039;Buy from Toshiba/Kioxia&#039;&#039;&#039;, the inventors of flash memory. Yes their [https://www.amazon.com/Toshiba-TransMemory-U364-USB3-0-THN-U364W0320A4/dp/B078NPLXGC#customerReviews performance] as shown in benchmarks isn&#039;t as good, nor are they inexpensive, but they are reliable and will last years. &#039;&#039;&#039;Do not&#039;&#039;&#039; skimp to save a few $ buying a Sandisk/Samsung on a sale for this use-case, I&#039;m speaking from experience!&lt;br /&gt;
&lt;br /&gt;
===Encryption===&lt;br /&gt;
&#039;&#039;&#039;Pros:&#039;&#039;&#039;&lt;br /&gt;
# Sure it may be useful if for example, you forget the drive in an internet cafe or library. Or have something you don&#039;t want to turn up in investigation.&lt;br /&gt;
&#039;&#039;&#039;Cons:&#039;&#039;&#039;&lt;br /&gt;
# It costs additional CPU &amp;amp; energy usage.&lt;br /&gt;
# Encryption offers zero &amp;quot;online&amp;quot;/mounted protection, e.g. encryption does not protect against a web browser vulnerability allowing disk access. Mental energy would be better spent on [https://wiki.archlinux.org/index.php/security &#039;hardening&#039;] the system.&lt;br /&gt;
# Harder to recover data when things break. &#039;&#039;Big&#039;&#039; headache.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 20:40, 4 November 2020 (UTC)&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&lt;br /&gt;
I will write more thoughts, I see this is an ongoing need/interest [[OSE_Linux_Log]]. Today I have ordered two Toshiba USB flash drives. I will write a guide here for preparing any Debian distro for USB persistence with optimal performance (squashfs &amp;amp; persistence partition) for interested readers.&lt;br /&gt;
&lt;br /&gt;
==GUIDE==&lt;br /&gt;
This guide will first make a live USB stick persistent.&lt;br /&gt;
&lt;br /&gt;
In the appendix will be additional knowledge and procedures to make it perform better.&lt;br /&gt;
&lt;br /&gt;
Brief steps:&lt;br /&gt;
#Make live USB&lt;br /&gt;
##Partition the USB.&lt;br /&gt;
##Mount the ISO, and copy select files to the USB&#039;s live partition.&lt;br /&gt;
##Install grub.&lt;br /&gt;
#Make the live USB a persistent USB&lt;br /&gt;
##Boot to live USB &amp;amp; Setup persistence.&lt;br /&gt;
&lt;br /&gt;
===Make live USB===&lt;br /&gt;
You can follow a different guide and then run the command `live-persistence`. Then when it comes time to upgrade libc or the kernel you can run `live-toram`, then follow the squash guide below.&lt;br /&gt;
&lt;br /&gt;
But here is the way I&#039;d do it.&lt;br /&gt;
====Partition the USB====&lt;br /&gt;
Use gparted. Make a GPT partition, with 16MB unused.&lt;br /&gt;
&lt;br /&gt;
Make live partition 1GB is fine. Big enough to fit the squashfs, vmlinuz, and initrd files from the ISO. Label it &#039;live&#039;, or whatever you want.&lt;br /&gt;
&lt;br /&gt;
Make persistence partition filling up the remainder. Label it &#039;peristence&#039;, or whatever you want, but you&#039;ll have to use the label you use in the grub.cfg later.&lt;br /&gt;
&lt;br /&gt;
Now make a small partition at least 1MB big into the 16MB unused space at the start. Don&#039;t format it with a filesystem, leave it unformatted. This is where GRUB installs stuff into.&lt;br /&gt;
====Mount the ISO, and copy select files to the USB&#039;s live partition====&lt;br /&gt;
Yep, copy the squashfs, vmlinuz, and initrd to /live on the live partition, e.g. /media/live/live&lt;br /&gt;
Easy peasy.&lt;br /&gt;
====Install grub====&lt;br /&gt;
Should go to /media/live/grub&lt;br /&gt;
&lt;br /&gt;
Boot to the USB! It is live!&lt;br /&gt;
===Make the live USB a persistent USB===&lt;br /&gt;
While you&#039;re booted to the live USB, mount the persistence partition, and put a peristence.conf file on it.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; | sudo tee /media/peristence/persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now, read the short manual on live-tools. And type:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
man live-tools&lt;br /&gt;
live-peristence&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Neat, all your files you&#039;re using in the live USB, are now saved to the persistence partition. Though, we have to write a few changes to grub.cfg in order to load that stuff on next boot.&lt;br /&gt;
====Edit grub.cfg====&lt;br /&gt;
&lt;br /&gt;
==Appendix==&lt;br /&gt;
&lt;br /&gt;
This guide seeks a USB stick with optimal performance, which requires a minimal squashfs.&lt;br /&gt;
&lt;br /&gt;
If USB space and performance are not concerns for you, you&#039;re welcome to modify an existing live USB, name a 2nd partition &amp;quot;persistence&amp;quot;, add suitable kernel parameters including &amp;quot;persistence&amp;quot;, and write a persistence.conf file containing &amp;quot;/ union&amp;quot; in the persistence partition. You can understand necessary details by understanding the guide below. Boot time may take a minute or longer, and applications may be slow and hang due to limitations of flash media which this guide seeks to minimize.&lt;br /&gt;
&lt;br /&gt;
Let&#039;s proceed with making the USB with optimal performance.&lt;br /&gt;
&lt;br /&gt;
===Some notes on flash media===&lt;br /&gt;
The first partition should start after some multiple of the medium&#039;s [https://lwn.net/Articles/428584/ erase block]. The erase block size might be published by the manufacturer, or reasoned about via [https://github.com/bradfa/flashbench benchmarking]. However SSDs and modern USB sticks use more sophisticated controllers so flashbench [https://lists.linaro.org/pipermail/flashbench-results/2016-December/000599.html won&#039;t provide the necessary insights]. So starting the first partition at a 16MiB or 32MiB offset would be a reasonable choice, being some multiple of the erase block.&lt;br /&gt;
&lt;br /&gt;
When considering the [https://superuser.com/questions/379074/how-to-correctly-partition-usb-flash-drive-and-which-filesystem-to-choose-consid stride and stripe-width] parameters I&#039;m not sure it makes a difference anymore with more sophisticated controllers.&lt;br /&gt;
&lt;br /&gt;
On the flash media, writing is slow, so modern ones typically have a faster volatile cache, which is then written to the non-volatile flash memory. So when you write a large file to the medium, and it appears to finish via the command completing, but in reality it won&#039;t be done for some time. This is why writing speed appears to slow down in benchmarking the longer the write goes, from say 20MB/s to 4MB/s, this is due to the volatile cache filling up. ext4 when writing the journal uses a &amp;quot;barrier&amp;quot; somehow implemented, and usually implemented by the USB driver/device where the command blocks until the write is actually written to non-volatile memory, but I think this feature isn&#039;t exposed by ext4 for use in benchmarking. This is something to be cautious about before shutting down the system, leave the system idle for about 30-60 seconds after shutting down the browser or other write activity before powering down the system, as it is possible the write is still transferring from the volatile cache to non-volatile memory, and the OS doesn&#039;t know better, as we&#039;d disabled ext4 journalling for performance and longevity reasons, and it has been my experience that linux doesn&#039;t wait for the non-volatile write to finish anyway on shutdown, printing write errors on shutdown if this is the case. If this happens, then run a fsck on next boot, we&#039;ll make the Grub entry later to make running fsck convenient to best fix the consistency problems.&lt;br /&gt;
&lt;br /&gt;
===Partitioning===&lt;br /&gt;
A GPT partition table is fine, as is an MBR partition table.&lt;br /&gt;
&lt;br /&gt;
If doing GPT then make a small unformatted partition in the 16MiB or 32MiB offset before the live partition. It only needs to be 1MiB, but can be larger. Set the &#039;boot_grub&#039; flag on it in gparted. Grub will install to it later in this guide.&lt;br /&gt;
&lt;br /&gt;
Here is my example command of how I made the ext4 filesystem for the live partition. The option ^has_journal disables the journal, important for flash memory longevity. Determine which partition to run mkfs.ext4 on, mine is /dev/sdd1 and /dev/sdd2.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -N 2048 -L live -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;yourpartition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you want to do an EFI system partition (ESP), then have this also be the live partition, which we use as our &amp;quot;/boot&amp;quot; partition. This must be FAT32 instead of ext4 unfortunately. Set the &#039;esp&#039; flag on the live partition in gparted. When we install GRUB later, it will install EFI files to the live partition.&lt;br /&gt;
&lt;br /&gt;
And for the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkfs.ext4 -m 5 -b 4096 -L persistence -E stride=4,stripe-width=2048 -O ^has_journal &amp;lt;your partition&amp;gt;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare squashfs===&lt;br /&gt;
Download ISO of desired debian distro (e.g. OSE Linux). Put it at /tmp/&lt;br /&gt;
&lt;br /&gt;
chroot just uses your current Kernel. That&#039;s just how it works. Because of this it is best if the kernel of the system you&#039;re running to be the most recent available for the distro release of the ISO (e.g. for me [https://packages.debian.org/buster/linux-image-amd64 linux-image-4.19.0-13-amd64] as of this writing). If this isn&#039;t possible, boot to the ISO and skip to the [[Talk:OSE_Linux_Persistence#Remove_non-core_packages]] instructions without doing the chroot. You can do this all on a single USB stick if you do it correctly. Or you could use [https://help.ubuntu.com/community/DebootstrapChroot] or virtualization, lots of possibilities outside the scope of this guide.&lt;br /&gt;
&lt;br /&gt;
Actually now that I think about it writing the guide following the live USB installation without doing the chroot may be best, being more generalized and perhaps easier. I will rewrite this guide that way in the future, but for now, here are the chroot directions.&lt;br /&gt;
&lt;br /&gt;
====prepare chroot filesystem====&lt;br /&gt;
Let us continue with the chroot assuming we&#039;re running the same distro/kernel. Mount the ISO, and look for filesystem.squashfs, initrd.img, vmlinuz on it. Also note the location of config, System.map and filesystem.packages.xz, we&#039;ll copy or make these to follow convention.&lt;br /&gt;
&lt;br /&gt;
Make temporary directories:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mkdir /media/filesystem.squashfs /media/iso /media/overlay /media/myadditions /media/myadditions/rw /media/myadditions/work&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -o loop /tmp/debian-distro-i386.iso /media/iso&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount filesystem.squashfs on the iso:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t squashfs /media/iso/live/filesystem.squashfs /media/filesystem.squashfs&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Mount an in-memory filesystem to hold temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t tmpfs -o size=1024m none /media/myadditions&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Prepare the union filesystem, so that we&#039;re able to edit the squashfs on the iso and compress the result. We can use either [https://wiki.archlinux.org/index.php/Overlay_filesystem overlayfs] or aufs. Here is the overlayfs command:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t overlay overlay -o lowerdir=/media/filesystem.squashfs,upperdir=/media/myadditions/rw,workdir=/media/myadditions/work /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Or afus. overlayfs hasn&#039;t been widely available until kernel 3.18, and aufs is available on earlier kernels (from [https://sourceforge.net/p/aufs/aufs3-standalone/ci/f88513f985e153aaf3e2950622c2a2329c3c3f8f/log/ kernel 3.9 late 2014 aufs supports xattr]) via aufs-tools, and their may be some differences I&#039;m not aware of but I think the concensus is that overlayfs is better. Hopefully aufs supports extended attributes (xattr) good enough to not loose said attributes, which are important for hardening the system (extended attributes are I believe where [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities] are stored/configured).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo mount -t aufs -o br=/media/myadditions=rw -o br=/media/filesystem.squashfs=ro -o udba=reval none /media/overlay/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====chroot====&lt;br /&gt;
Prepare the chroot, so that we can run apt within it and remove packages. resolv.conf and mount binds are to remove error/warning messages when installing packages with apt.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo cp /etc/resolv.conf /media/overlay/etc/resolv.conf&lt;br /&gt;
sudo mount --bind /dev/ /media/overlay/dev/&lt;br /&gt;
sudo mount --bind /dev/pts /media/overlay/dev/pts #https://wiki.debian.org/chroot#A.2Fdev.2Fpts&lt;br /&gt;
sudo mount --bind /proc /media/overlay/proc&lt;br /&gt;
sudo mount --bind /sys /media/overlay/sys&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now chroot into the squashfs so we can use apt within it to remove packages:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo chroot --userspec root:root /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Configure the locale, you&#039;ll get many warning messages in apt otherwise. You probably want to select UTF-8 for your country/language, for example I picked en_US.UTF-8. Press space bar to toggle each locale you want generated, then press enter to proceed. Then it asks if you want the locales you chose to be applied systemwide, forcing your selection on each user, which may be desired for desktop software which starts up before the user-specific ~/.profile is read:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure locales&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And set the timezone:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-reconfigure tzdata&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If /boot exists, then back it up, we&#039;re replacing /boot with a symlink:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /boot /boot.bak&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We must make a symlink so that as we work with apt-get, it may call `live-update-initramfs -u`, and we need those updates to /boot to go to the proper location, the &#039;live&#039; partition&#039;s /live:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ln -s /lib/live/mount/medium/live /boot&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If you&#039;ve not yet made the live partition, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
If already have the live partition ready, or like me are updating an existing live partition&#039;s squashfs, then:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mkdir -p /lib/live/mount/medium&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
mkdir /lib/live/mount/medium/live&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
We have to do the above steps to work around update-initramfs&#039;s logic and assumptions regarding a read/write test that this works around. If you ever run into problems with update-initramfs while using apt-get, this is what you run once the problem is fixed:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg --configure initramfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
As we remove packages, such at btrfs-progs, update-initramfs will be triggered which should update /boot/vmlinuz and /boot/initrd, these files are not compressed into the filesystem.squashfs and we need those files within /live of the live partition to boot.&lt;br /&gt;
&lt;br /&gt;
`man live-boot` is a useful reference, ensure live-boot-doc is installed. Also the [https://live-team.pages.debian.net/live-manual/html/live-manual/toc.en.html Debian live-manual] is a useful reference.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install live-boot-doc&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Remove non-core packages====&lt;br /&gt;
&lt;br /&gt;
Now we gut the filesystem.squashfs from the iso of packages that:&lt;br /&gt;
* We don&#039;t want.&lt;br /&gt;
* Are frequently updated (e.g. web browser).&lt;br /&gt;
* With particular scrutiny of packages that are large.&lt;br /&gt;
* Are not necessary to boot to a desktop.&lt;br /&gt;
All of those can they can go onto persistence partition. We remove them now, and install them after the squashfs has been made, or as needed. Examples of what should be considered &amp;quot;core&amp;quot; packages necessary to boot are: linux-image (this is the kernel), firmware, GPU driver, and X11 server. This way the USB will:&lt;br /&gt;
* Boot fast,&lt;br /&gt;
* The OS running from it will be maximally responsive,&lt;br /&gt;
* Will have minimal memory footprint,&lt;br /&gt;
* And be persistent!&lt;br /&gt;
&lt;br /&gt;
Run this to see packages installed ordered by size, then apt-get remove or purge stuff, and ignore anything beginning with &amp;quot;lib&amp;quot;:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W -f &#039;${Installed-Size}\t${Package}\n&#039; | sort -n | less&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
To understand what a package is, you can search [https://packages.debian.org/buster/os-prober packages.debian.org]. If the description there isn&#039;t informative enough, you can try clicking the links on the right hand side such as a project homepage, or looking through the files of the package. Ignore or don&#039;t pay much attention to any package beginning with &amp;quot;lib&amp;quot;, with the exception of things like libc6, but apt will probably warn you about doing something silly like that with the prompt:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
You are about to do something potentially harmful.&lt;br /&gt;
To continue type in the phrase &#039;Yes, do as I say!&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
An example of stuff I removed from a different Debian distro (BunsenLabs), but I removed some firmware packages so that reduces portability:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get remove -y firefox-esr libjsoncpp1&lt;br /&gt;
apt-get remove -y libreoffice-core libreoffice-common coinor-libcbc3 coinor-libcgl1 coinor-libclp1 coinor-libcoinmp1v5 coinor-libcoinutils3v5 coinor-libosi1v5 fonts-opensymbol libabw-0.1-1 libboost-atomic1.67.0 libboost-chrono1.67.0 libboost-date-time1.67.0 libboost-filesystem1.67.0 libboost-locale1.67.0 libboost-thread1.67.0 libclucene-contribs1v5 libclucene-core1v5 libcmis-0.5-5v5 libcolamd2 libe-book-0.1-1 libeot0 libepubgen-0.1-1 libetonyek-0.1-1 libexttextcat-2.0-0 libexttextcat-data libgpgmepp6 liblangtag-common liblangtag1 libmhash2 libmwaw-0.3-3 libmythes-1.2-0 libneon27-gnutls libnumbertext-1.0-0 libnumbertext-data libodfgen-0.1-1 liborcus-0.14-0 libraptor2-0 librasqal3 librdf0 librevenge-0.0-0 libstaroffice-0.0-0 libsuitesparseconfig5 libwpd-0.10-10 libwpg-0.3-3 libwps-0.4-4 libxmlsec1 libxmlsec1-nss libyajl2 lp-solve uno-libs3 ure&lt;br /&gt;
apt-get remove -y firmware-atheros firmware-netronome firmware-iwlwifi firmware-brcm80211 firmware-qlogic firmware-ti-connectivity firmware-myricom firmware-intelwimax firmware-libertas dahdi-firmware-nonfree atmel-firmware firmware-cavium firmware-bnx2x firmware-qcom-media firmware-netxen firmware-samsung firmware-ipw2x00 firmware-siano firmware-ivtv firmware-bnx2&lt;br /&gt;
apt-get remove -y samba-libs libavahi-glib1 libcdio-cdda2 libcdio-paranoia2 libgd3 libgdata-common libgdata22 libgoa-1.0-0b libgoa-1.0-common libgphoto2-6 libgphoto2-port12 libldb1 liblmdb0 liboauth0 libpython2.7 libtalloc2 libtevent0 libwbclient0 python-talloc&lt;br /&gt;
apt-get remove -y fonts-noto-core fonts-noto-cjk papirus-icon-theme bunsen-papirus-icon-theme gnome-icon-theme gdebi-core gir1.2-vte-2.91 python3-apt python3-chardet python3-debian python3-pkg-resources&lt;br /&gt;
rm -r /usr/share/gdebi/GDebi /usr/lib/python3/dist-packages/aptsources /usr/lib/python3/dist-packages/apt/progress /usr/lib/python3/dist-packages/debian_bundle /usr/lib/python3/dist-packages/debian /usr/lib/python3/dist-packages/chardet/cli /usr/lib/python3/dist-packages/pkg_resources/extern /usr/lib/python3/dist-packages/pkg_resources/_vendor/packaging&lt;br /&gt;
apt-get remove -y evince synaptic bubblewrap evince-common gnome-desktop3-data libbrotli1 libdjvulibre-text libdjvulibre21 libept1.5.0 libevdocument3-4 libevview3-3 libgnome-desktop-3-17 libgspell-1-1 libgspell-1-common libgxps2 libharfbuzz-icu0 libhyphen0 libjavascriptcoregtk-4.0-18 libkpathsea6 libspectre1 libsynctex2 libwebkit2gtk-4.0-37 libwebpdemux2 libwoff1 xdg-dbus-proxy zenity zenity-common&lt;br /&gt;
apt-get remove -y vlc libaribb24-0 libbasicusageenvironment1 libcddb2 libdvbpsi10 libebml4v5 libgles2 libgroupsock8 libixml10 liblirc-client0 liblivemedia64 liblua5.2-0 libmad0 libmatroska6v5 libmtp-common libmtp9 libnfs12 libopenmpt-modplug1 libplacebo7 libprotobuf-lite17 libqt5x11extras5 libresid-builder0c2a libsdl-image1.2 libsdl1.2debian libsidplay2 libspatialaudio0 libupnp13 libusageenvironment3 libva-wayland2 libvlc-bin libvlc5 libxcb-xv0 vlc-bin vlc-data vlc-plugin-base vlc-plugin-qt vlc-plugin-video-output vlc-plugin-notify libvlccore9&lt;br /&gt;
apt-get remove -y file-roller p7zip-full p7zip libarchive13 libnautilus-extension1a xfburn libburn4 libexo-1-0 libisofs6 libjte1 unar gnustep-base-common gnustep-base-runtime gnustep-common libgnustep-base1.26 libobjc4&lt;br /&gt;
apt-get remove -y transmission-gtk libevent-2.1-6 libminiupnpc17 libnatpmp1 transmission-common filezilla filezilla-common libfilezilla0 libpugixml1v5 libwxbase3.0-0v5 libwxgtk3.0-0v5 yudit-common feh&lt;br /&gt;
apt-get remove -y libpython2.7-stdlib libblas3 libgfortran5 libkeybinder0 liblapack3 libpython2.7-minimal libsodium23 lua-bit32 lua-expat lua-penlight lua-posix lua-socket lua5.2 python-apt-common python-minimal python2-minimal python2.7-minimal libavformat58 libmysofa0 libnorm1 libpgm-5.2-0 libpostproc55 librubberband2 libssh-gcrypt-4 libswscale5 libvidstab1.1&lt;br /&gt;
apt-get remove -y aptitude aptitude-common libboost-iostreams1.67.0 libboost-system1.67.0 libcwidget3v5 libxapian30 ristretto file libmagic-mgc libmagic1 hexchat-common&lt;br /&gt;
apt-get install wpasupplicant network-manager --no-install-recommends&lt;br /&gt;
#modem support&lt;br /&gt;
apt-get remove -y modemmanager libmbim-glib4 libmbim-proxy libqmi-glib5 libqmi-proxy openssh-client libxatracker2 nitrogen libgtkmm-2.4-1v5 lvm2 dmeventd libaio1 libdevmapper-event1.02.1 liblvm2cmd2.03 libreadline5 nano geany geany-common ghostscript poppler-data libcupsimage2 libgs9-common libijs-0.35 libjbig2dec0 libpaper1 pcmciautils vdpau-va-driver arandr&lt;br /&gt;
apt-get remove -y intel-microcode iucode-tool va-driver-all i965-va-driver xserver-xorg-video-intel libxvmc1 intel-media-va-driver libigdgmm5 xserver-xorg-video-qxl btrfs-progs cryptsetup-initramfs cryptsetup-bin cryptsetup-run&lt;br /&gt;
apt-get remove -y python3.7-minimal dconf-cli distro-info-data gir1.2-atk-1.0 gir1.2-freedesktop gir1.2-gdkpixbuf-2.0 gir1.2-glib-2.0 gir1.2-gtk-3.0 gir1.2-pango-1.0 libfm-extra4 libgirepository-1.0-1 libmenu-cache-bin libmenu-cache3 libmpdec2 libpython3-stdlib libpython3.7-minimal libpython3.7-stdlib libxslt1.1 mime-support wmctrl&lt;br /&gt;
rm -r /usr/lib/python3&lt;br /&gt;
apt-get remove -y iso-codes liba52-0.7.4 libaa1 libass9 libatomic1 libavc1394-0 libavfilter7 libavformat58 libbs2b0 libcaca0 libcdio18 libcdparanoia0 libchromaprint1 libdc1394-22 libdca0 libde265-0 libdv4 libdvdnav4 libdvdread4 libfaad2 libfftw3-double3 libflite1 libfluidsynth1 libgme0 libgssdp-1.0-3 libgstreamer1.0-0 libgupnp-1.0-4 libgupnp-igd-1.0-4 libiec61883-0 libilmbase23 libkate1 liblilv-0-0 libmjpegutils-2.1-0 libmms0 libmodplug1 libmpcdec6 libmpeg2-4 libmpeg2encpp-2.1-0 libmpg123-0 libmplex2-2.1-0 libmysofa0 libnice10 libnorm1 libofa0 libopenal-data libopenal1 libopencore-amrnb0 libopencore-amrwb0 libopenexr23 libopenmpt0 libpgm-5.2-0 libpoppler-glib8 libpoppler82 libpostproc55 libraw1394-11 librubberband2 libsbc1 libserd-0-0 libshout3 libsidplay1v5 libsndio7.0 libsord-0-0 libsoundtouch1 libspandsp2 libsratom-0-0 libsrtp2-1 libssh-gcrypt-4 libswscale5 libtumbler-1-0 libv4l-0 libv4lconvert0 libvidstab1.1 libvisual-0.4-0 libvo-aacenc0 libvo-amrwbenc0 libvulkan1 libwildmidi2 libzbar0 libzmq5 tumbler-common&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Again, much of what was removed can be installed again after persistence is set up. These packages are conveniently listed as removed within dpkg utilities, I&#039;ll illustrate how to conveniently reinstall them later.&lt;br /&gt;
&lt;br /&gt;
====Misc setup tips====&lt;br /&gt;
&lt;br /&gt;
[https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#521 One important consideration is that the live user is created by live-boot at boot time]. We need to ensure the live user is set up. Inspect the contents of /etc/live/ for any configuration files. If there is none in your distribution then let&#039;s make it, and feel free to customize this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/config.conf.d/10-user-setup.conf&lt;br /&gt;
LIVE_HOSTNAME=debian-persistence&lt;br /&gt;
LIVE_USERNAME=user&lt;br /&gt;
LIVE_USER_FULLNAME=&amp;quot;Debian LiveUser&amp;quot;&lt;br /&gt;
LIVE_USER_DEFAULT_GROUPS=&amp;quot;cdrom floppy audio dip video plugdev fuse bluetooth netdev scanner staff&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
These options to live-boot will minimize the generated initramfs size:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/live/boot.conf&lt;br /&gt;
#man live-boot&lt;br /&gt;
#see /usr/share/initramfs-tools/hooks/live, might make initrd smaller&lt;br /&gt;
DISABLE_CDROM=true&lt;br /&gt;
DISABLE_FAT=true&lt;br /&gt;
DISABLE_FUSE=true&lt;br /&gt;
DISABLE_NTFS=true&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Performance tips====&lt;br /&gt;
&lt;br /&gt;
USB sticks use flash memory, and to maximize performance with it we can [https://wiki.debian.org/SSDOptimization#Low-Latency_IO-Scheduler change the IO scheduler for such devices].&lt;br /&gt;
&lt;br /&gt;
BFQ looks like a nice scheduler. Quote:&lt;br /&gt;
&amp;quot;Regardless of the actual background workload, BFQ guarantees that, for interactive tasks, the storage device is virtually as responsive as if it was idle. [...] As a comparison, with CFQ, NOOP or DEADLINE, and in the same conditions, applications experience high latencies, or even become unresponsive until the background workload terminates (also on SSDs).&amp;quot;&lt;br /&gt;
&lt;br /&gt;
mq_deadline is fine while the system is booting. The scheduler in use can also be [https://wiki.ubuntu.com/Kernel/Reference/IOSchedulers tuned], but I need to do more research before giving advice on tuning in this context. To [https://unix.stackexchange.com/questions/375600/how-to-enable-and-use-the-bfq-scheduler setup/enable]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/modules-load.d/bfq.conf&lt;br /&gt;
bfq&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set bfq scheduler during startup. Alternatives include mq_deadline and none, either might be faster than bfq during startup when GUI application responsiveness isn&#039;t important, but I&#039;d need to do some research/experiments.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/udev/rules.d/60-ssd-scheduler.rules&lt;br /&gt;
# set bfq scheduler for non-rotating disks during startup&lt;br /&gt;
ACTION==&amp;quot;add|change&amp;quot;, KERNEL==&amp;quot;sd[a-z]&amp;quot;, ATTR{queue/rotational}==&amp;quot;0&amp;quot;, ATTR{queue/scheduler}=&amp;quot;bfq&amp;quot;&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Use [https://wiki.archlinux.org/index.php/profile-sync-daemon profile-sync-daemon] to enhance performance of the browser, and minimize flash memory writes (maximize longevity).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install profile-sync-damon&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
For SD card longevity, consider mounting a tmpfs on /var/log. But perhaps only after you&#039;ve booted to the system a few times and verify the system is stable, as putting log files in RAM means they can&#039;t be read offline to diagnose a problem. So disable this feature if needed. &lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /var/log tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/tmpfiles.d/varlog.conf&lt;br /&gt;
d /var/log/apt 755 root root&lt;br /&gt;
d /var/log/lightdm 711 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
vlc&#039;s default lookahead is too short, leads to music cutting out. &#039;Tools-&amp;gt;Preferences&#039;, toggle &#039;Show all settings&#039;, click &#039;Input/Codecs&#039; in tree view, scroll down to &#039;Advanced&#039; section and look at caching settings. Increase them to at least 600ms.&lt;br /&gt;
&lt;br /&gt;
====Pruning tips====&lt;br /&gt;
Install deborphan and localepurge to help clean stuff:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install deborphan localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After you&#039;re done pruning things, run deborphan and remove things it tells you to as you desire. Deborphan helps you find &amp;quot;orphan&amp;quot; packages not needed by anything else, which take up space. Such orphaned packages may have been necessary by a previously installed package.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
deborphan&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Next run localepurge to remove space consuming files for locales you&#039;ll never use, I removed 160MB from my system:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
localepurge&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
And finally, clear out apt temporary files:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get autoremove&lt;br /&gt;
apt-get clean&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
I recommend vim.tiny over vim, vim.tiny much smaller, also install whatever else your heart desires that is small and infrequently updated. Such small utilities will be available in &#039;live&#039; mode (if installed when in &#039;persistence&#039; mode, it won&#039;t be available in plain &#039;live&#039; mode):&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install vim-tiny&lt;br /&gt;
echo &amp;quot;set nocp&amp;quot; &amp;gt;&amp;gt; /etc/vim/vimrc.tiny #Allows arrow keys to work, and vim.tiny to act like vim instead of vi&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Hardening tips====&lt;br /&gt;
&lt;br /&gt;
I think it is best for /tmp to be mounted noexec, but many applications have bugs regarding this&lt;br /&gt;
Double check the /etc/fstab file with a text editor after editing /etc/fstab:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
echo &amp;quot;tmpfs /tmp tmpfs nosuid,nodev,noexec 0 0&amp;quot; &amp;gt;&amp;gt; /etc/fstab&lt;br /&gt;
mount /tmp&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Often apt packages during installation will require the ability to execute temporary files on /tmp, this is how we allow this:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /etc/apt/apt.conf.d/50remount&lt;br /&gt;
DPkg::Pre-Install-Pkgs {&amp;quot;mount -o remount,exec /tmp&amp;quot;;};&lt;br /&gt;
DPkg::Post-Invoke {&amp;quot;mount -o remount /tmp&amp;quot;;};&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A common thing people do, is charge their android phone, or other USB device via a USB port on the computer. Realize that this is physical access, which a compromised device may use to log in to Linux via root. I suspect I had fallen victim to in the past, a keylogger following a pattern I&#039;d seen exhibited in the news, which I believe came after I&#039;d plugged in a new android I had run questionable rooting software on, to my computer. I suggest both setting a root password, and disallowing this access, by editing /etc/securetty and commenting out root access via UART serial ports:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# UART serial ports&lt;br /&gt;
#ttyS0&lt;br /&gt;
#ttyS1&lt;br /&gt;
#ttyS2&lt;br /&gt;
#ttyS3&lt;br /&gt;
#ttyS4&lt;br /&gt;
#ttyS5&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Set the [https://www.debian.org/doc/manuals/securing-debian-manual/ch03s04.en.html root password]:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
passwd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
What has piqued my interest lately is [https://man7.org/linux/man-pages/man7/capabilities.7.html Linux capabilities]. Debian distributions should include both [https://packages.debian.org/buster/libcap2 libcap2] and [https://packages.debian.org/buster/libcap-ng0 libcap-ng0 (RedHat&#039;s fork)]. And I&#039;m looking for a more convenient open-source means of administration. What has me interested in the idea of a [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html proactive defense against root-kits] by removing module loading capabilities (CAP_SYS_MODULE) even for the root user, after the system had booted. It appears that lcap is no longer functional, it and many capabilities articles detail a system-wide capability bounding set in pre-2.6.25 kernels, but since kernel 2.6.25 capability bounding sets are now per-thread. The [http://people.redhat.com/sgrubb/libcap-ng/ images here] may help visually explain capabilities and their inheritance. What I have in mind may be within a custom /etc/init.d/ script calling [https://man7.org/linux/man-pages/man2/capset.2.html setcap] on init (pid 1) to remove the CAP_SYS_MODULE capability from the bounding set system-wide. The capabilities on any process can be viewed with `cat /proc/&amp;lt;pid&amp;gt;/status`.&lt;br /&gt;
&lt;br /&gt;
Something else that can be done is use of more than one account, for example an account dedicated to web browsing with minimal privileges, and an account with administration privileges (sudo, member of staff,adm groups).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo adduser browser&lt;br /&gt;
dm-tool switch-to-user browser #with LightDM desktop manager: https://wiki.ubuntu.com/LightDM&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Files downloaded with the browser can be transfered to other users via /tmp, which is a good place to set as the default location to download files in the browser settings anyway.&lt;br /&gt;
&lt;br /&gt;
With this separation of user privileges, if malware managed to gained the privileges of the browser account (no privilege escalation), and escaped the browser sandbox, the worst it could do is keylog, delete or encrypt/ransom the browser account&#039;s files. Since the browser account is running on a difference X11 server than an administration account, I think [https://security.stackexchange.com/questions/4641/why-are-people-saying-that-the-x-window-system-is-not-secure/4646 risks] are reduced.&lt;br /&gt;
&lt;br /&gt;
Switching between the administration account and browser account X11 servers can be done with ctrl+alt+F7 or F8 (or F1/F2 or whatever).&lt;br /&gt;
&lt;br /&gt;
Or just have the desktop load with the browser account instead of the administrative account, and do administrative tasks on a virtual terminal (ctrl+alt+F1 through F6).&lt;br /&gt;
&lt;br /&gt;
Set up the [https://www.debian.org/doc/manuals/securing-debian-manual/ch04s11.en.html#id-1.5.14.17 shell history file], .bash_history better. An easy way a bad actor can circumvent the stock configuration from logging his evil deeds is to proceed those evil things with a space, this guide will fix that!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
lsattr /home/browser/.bash_history  #See what attributes are set&lt;br /&gt;
sudo chattr +a /home/browser/.bash_history   #Only root user can chattr&lt;br /&gt;
sudo chattr +a /home/user/.bash_history&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Make filesystem.packages and filesystem.squashfs====&lt;br /&gt;
Now that we have a set of &amp;quot;core&amp;quot; packages to go in the squashfs, of minimal size, on the &#039;live&#039; partition, we must make our new squashfs!&lt;br /&gt;
&lt;br /&gt;
Print out a list of &amp;quot;core&amp;quot; packages we have, we&#039;ll need them for reference later. Lets put them in filesystem.packages.xz:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
dpkg-query -W --showformat=&#039;${Package}\t${Version}\n&#039; | xz &amp;gt; /tmp/filesystem.packages.xz&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now let&#039;s make the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get -y install squashfs-tools&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Exclude stuff we don&#039;t want in the squashfs:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
EXCLUDES=&#039;.wh* dev live-persistence.conf live lost+found media mnt proc .pulse* run home selinux sys tmp* lib/live/mount usr/lib/live/mount var/cache/apt var/cache/apt-xapian-index var/lib/apt/lists var/tmp&#039;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Directives to squashfs-tools to make pseudofiles, necessary to boot. Linux will make many pseudofiles in /dev when it boots, but not all, and through experimentation and observations I&#039;ve come up with this list:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cat&amp;lt;&amp;lt;-EOF &amp;gt; /tmp/mksquashfs.pf&lt;br /&gt;
dev d 755 root root&lt;br /&gt;
dev/console c 662 root tty 5 1&lt;br /&gt;
dev/full c 666 root root 1 7&lt;br /&gt;
dev/kmem c 640 root kmem 1 2&lt;br /&gt;
dev/kmsg c 644 root root 1 11&lt;br /&gt;
dev/loop0 b 660 root disk 7 0&lt;br /&gt;
dev/loop1 b 660 root disk 7 1&lt;br /&gt;
dev/loop2 b 660 root disk 7 2&lt;br /&gt;
dev/loop3 b 660 root disk 7 3&lt;br /&gt;
dev/loop4 b 660 root disk 7 4&lt;br /&gt;
dev/loop5 b 660 root disk 7 5&lt;br /&gt;
dev/loop6 b 660 root disk 7 6&lt;br /&gt;
dev/loop7 b 660 root disk 7 7&lt;br /&gt;
dev/mem c 640 root kmem 1 1&lt;br /&gt;
dev/null c 666 root root 1 3&lt;br /&gt;
dev/port c 640 root kmem 1 4&lt;br /&gt;
dev/ptmx c 666 root tty 5 2&lt;br /&gt;
dev/pts d 755 root root&lt;br /&gt;
dev/ram0 b 640 root disk 1 0&lt;br /&gt;
dev/ram1 b 640 root disk 1 1&lt;br /&gt;
dev/ram2 b 640 root disk 1 2&lt;br /&gt;
dev/ram3 b 640 root disk 1 3&lt;br /&gt;
dev/ram4 b 640 root disk 1 4&lt;br /&gt;
dev/ram5 b 640 root disk 1 5&lt;br /&gt;
dev/ram6 b 640 root disk 1 6&lt;br /&gt;
dev/ram7 b 640 root disk 1 7&lt;br /&gt;
dev/ram8 b 640 root disk 1 8&lt;br /&gt;
dev/ram9 b 640 root disk 1 9&lt;br /&gt;
dev/ram10 b 640 root disk 1 10&lt;br /&gt;
dev/ram11 b 640 root disk 1 11&lt;br /&gt;
dev/ram12 b 640 root disk 1 12&lt;br /&gt;
dev/ram13 b 640 root disk 1 13&lt;br /&gt;
dev/ram14 b 640 root disk 1 14&lt;br /&gt;
dev/ram15 b 640 root disk 1 15&lt;br /&gt;
dev/ram16 b 640 root disk 1 16&lt;br /&gt;
dev/random c 644 root root 1 8&lt;br /&gt;
dev/shm d 755 root root&lt;br /&gt;
dev/tty c 662 root tty 5 0&lt;br /&gt;
dev/tty0 c 600 root tty 4 0&lt;br /&gt;
dev/urandom c 644 root root 1 9&lt;br /&gt;
dev/zero c 644 root root 1 5&lt;br /&gt;
home d 755 root root&lt;br /&gt;
media d 755 root root&lt;br /&gt;
mnt d 755 root root&lt;br /&gt;
proc d 755 root root&lt;br /&gt;
run d 755 root root&lt;br /&gt;
run/lock d 1777 root root&lt;br /&gt;
sys d 755 root root&lt;br /&gt;
tmp d 1777 root root&lt;br /&gt;
var/cache/apt d 755 root root&lt;br /&gt;
var/cache/apt/partial d 755 root root&lt;br /&gt;
var/cache/apt/lock f 640 root root echo &amp;quot;&amp;quot;&lt;br /&gt;
var/lib/apt/lists d 755 root root&lt;br /&gt;
var/lib/apt/lists/partial d 755 root root&lt;br /&gt;
var/tmp d 1777 root root&lt;br /&gt;
EOF&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now make the squashfs, it is compressed with xz compression:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mksquashfs / /tmp/filesystem.squashfs -comp xz -info -always-use-fragments -noappend -wildcards -pf /tmp/mksquashfs.pf -e ${EXCLUDES} &amp;gt; /tmp/mksquashfs.log&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
/tmp/mksquashfs.log will contain interesting details, such as the filesystem is now roughly 30% of its uncompressed size.&lt;br /&gt;
&lt;br /&gt;
Hopefully the squashfs you made is around 800MB or less, mine for a different Debian distribution was about 300MB. Let us say your flash drive has 100MB/s sequential read speed, and your &amp;quot;core&amp;quot; filesystem was squashed down to 300MB, which will take 3 seconds to read into memory. How long do you think yours will take to boot?&lt;br /&gt;
&lt;br /&gt;
===Prepare the live partition===&lt;br /&gt;
If you hadn&#039;t yet mounted the live partition to /lib/live/mount/medium earlier in the guide, we need to move files off, then mount it, and move vmlinuz, initrd, and etc onto it:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
mv /lib/live/mount/medium /tmp/&lt;br /&gt;
mount /dev/disk/by-label/live /lib/live/mount/medium&lt;br /&gt;
cd /lib/live/mount/medium&lt;br /&gt;
mkdir live&lt;br /&gt;
mv /tmp/medium/boot/vmlinuz* live/&lt;br /&gt;
mv /tmp/medium/boot/initrd* live/&lt;br /&gt;
mv /tmp/filesystem.squashfs live/&lt;br /&gt;
mv /tmp/filesystem.packages.xz live/&lt;br /&gt;
#update-initramfs or something else pointed at live/ incorrectly puts grub/unicode.pf2 here, this symlink fixes that:&lt;br /&gt;
ln -s ../boot/grub/ live/grub&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also copy files like System.map-4.19.0-9-amd64 and config-4.19.0-9-amd64 to /lib/live/mount/medium/live, they should be in /media/overlay/boot.bak and/or /media/iso/live/ (outside the chroot). Or if the kernel is updated then you&#039;ll get these files, corresponding to the new kernel, automatically put in there anyway.&lt;br /&gt;
&lt;br /&gt;
The file named config is a nice reference, it says what flags the kernel was built with, there are a vast number of options.&lt;br /&gt;
This System.map file, stored on the read-only live partition may be useful, for example, finding if your system had been [https://www.debian.org/doc/manuals/securing-debian-manual/ch10s04.en.html compromised with a rootkit].&lt;br /&gt;
&lt;br /&gt;
===Prepare GRUB on the live partition and USB device===&lt;br /&gt;
&lt;br /&gt;
The introduction of UEFI hardware complicates things. You&#039;re welcome to modify the instructions below if you desire to support UEFI functionality on such consumer hardware. The instructions below handles computers with [https://wiki.archlinux.org/index.php/GRUB#BIOS_systems traditional BIOS], with a [https://wiki.archlinux.org/index.php/Partitioning#Master_Boot_Record traditional MBR], as well as UEFI hardware which supports such &amp;quot;legacy&amp;quot; standards. &lt;br /&gt;
&lt;br /&gt;
From within the chroot, install non-uefi grub (grub-pc), and --no-install-recommends will result in os-prober not being installed. I think os-prober is workstation-specific and not useful to configure a USB device which may move between workstations. grub-pc will ask two questions, don&#039;t select anything and enter on Ok on the first, and press enter on Yes on the next to continue without --exclude.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
apt-get install grub-pc --no-install-recommends&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Find your live partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
ls -l /dev/disk/by-label/&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Let&#039;s say it is /dev/sdd1. Then we use the device /dev/sdd in the command below.&lt;br /&gt;
&lt;br /&gt;
Install grub, to both the USB device and the live partition on the USB device. Where /dev/sdd below is the USB device (not a partition), and /lib/live/mount/medium is where the live partition is mounted:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-install --target=i386-pc --root-directory=/lib/live/mount/medium /dev/sdd&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Now grub needs a configuration file. We can either craft one by hand or use grub-mkconfig, but grub-mkconfig doesn&#039;t really support this use-case.&lt;br /&gt;
&lt;br /&gt;
====Either (1) Handcraft grub.cfg====&lt;br /&gt;
What follows is my legacy grub.cfg, which should work but I hope to make something workable within the newer /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Make sure to fill in this template /lib/live/mount/medium/boot/grub/grub.cfg on &#039;live&#039; partition with your appropriate UUIDs. The partitions you made will have unique UUIDs. You can determine which is which on your system by comparing `ls -l /dev/disk/by-uuid/` and ls -l `/dev/disk/by-label/`.&lt;br /&gt;
&lt;br /&gt;
Change &amp;quot;LABELorGPTname&amp;quot; to the label or GPT name of your persistence partition. I labeled mine &amp;quot;u365-persistence&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Fill in the template with how your vmlinuz and initrd.img are named, which may not have a suffix of &amp;quot;-4.19.0-9-amd64&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
Make note of the kernel parameters used here, such as &#039;toram&#039; and &#039;persistence&#039;. I&#039;m not sure if elevator=as is the optimal choice, feel free to read about it.&lt;br /&gt;
&lt;br /&gt;
You can customize the [https://live-team.pages.debian.net/live-manual/html/live-manual/customizing-run-time-behaviours.en.html#530 locale, language, and keyboard layout] here via kernel parameters here such as `locales=fr_FR.UTF-8 keyboard-layouts=fr keyboard-variants=bepo keyboard-model=tm2030usb`, but I think the console-setup package may be required (installed before the squashfs is made), and perhaps these things are fine configured elsewhere.&lt;br /&gt;
&lt;br /&gt;
You can see other things configurable via kernel parameters such as tzdata, and initial username by looking at /lib/live/config/*. But be aware many things are only configured once via /var/lib/live/config/ (remove the relevant file to allow reconfiguration).&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
set timeout=3&lt;br /&gt;
set default=0&lt;br /&gt;
&lt;br /&gt;
#Enter the UUID of your boot partition (this is where grub and your kernel reside)&lt;br /&gt;
set uuid_grub_boot=dc434800-22ac-4fd4-b6cb-603da325d5d0&lt;br /&gt;
#Enter the UUID of the persistence partition.&lt;br /&gt;
set uuid_os_root=858d963f-8718-4520-83dd-fb89a842e9bd&lt;br /&gt;
#Here we set the grub &amp;quot;root&amp;quot; variable by locating the uuid of the root partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_os_root --set=root&lt;br /&gt;
#Here we set a custom variable grub_boot by locating the uuid of the boot partition identified above&lt;br /&gt;
search --no-floppy --fs-uuid $uuid_grub_boot --set=grub_boot&lt;br /&gt;
#Here&#039;s the magic. We test to see if the boot and root partitions have the same UUID.&lt;br /&gt;
#If they do we append /boot to the $grub_boot variable. For ex. (hd0,1) becomes (hd0,1)/boot.&lt;br /&gt;
if [ $uuid_grub_boot == $uuid_os_root ] ; then&lt;br /&gt;
  set grub_boot=$grub_boot/boot&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
set kernel_parameters_common=&amp;quot;boot=live config quiet noeject toram live-media=/dev/disk/by-uuid/$uuid_grub_boot usbcore.autosuspend=-1&amp;quot;&lt;br /&gt;
set kernel_parameters_persistence=&amp;quot;persistence persistence-storage=filesystem persistence-label=LABELorGPTname&amp;quot;&lt;br /&gt;
set myversion=4.19.0-13-amd64&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
#With an unsafe shutdown or powerloss the persistence filesystem will have errors,&lt;br /&gt;
#since it has no journaling, we want to run fsck on it once&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Persistence fsck&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common $kernel_parameters_persistence forcefsck&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
menuentry &amp;quot;DEBIAN 64bits - by UUID - Live&amp;quot; {&lt;br /&gt;
  linux ($grub_boot)/live/vmlinuz-$myversion $kernel_parameters_common&lt;br /&gt;
  initrd ($grub_boot)/live/initrd.img-$myversion&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====Or (2) Generate grub.cfg with grub-mkconfig====&lt;br /&gt;
Again, using the handcrafted grub.cfg above is probably fine, but here are details on how to get grub-mkconfig to work, which geterates grub.cfg from directives in /etc/grub.d/&lt;br /&gt;
&lt;br /&gt;
Now, /usr/sbin/grub-mkconfig is not robust line 142 &amp;amp; 146 in our context of chroot usage, assumes we&#039;re installing to / device and /boot, and offers no way to configure around the problem, so we change line 142 &amp;amp; 146:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
# Line 142:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium`&amp;quot;&lt;br /&gt;
# Line 146:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /boot`&amp;quot;&lt;br /&gt;
# Change to:&lt;br /&gt;
GRUB_DEVICE=&amp;quot;`${grub_probe} --target=device /lib/live/mount/medium/boot`&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Copy by hand the legacy grub.cfg menu entries I have, with your disk UUIDs into [https://wiki.archlinux.org/index.php/GRUB#Generate_the_main_configuration_file /etc/grub.d/40_custom].&lt;br /&gt;
&lt;br /&gt;
Now run grub-mkconfig, from within the chroot:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
grub-mkconfig -o /lib/live/mount/medium/boot/grub/grub.cfg&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unmount /lib/live/mount/medium:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
unmount /lib/live/mount/medium&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Prepare the persistence partition===&lt;br /&gt;
And don&#039;t forget to make the persistence.conf file &#039;/ union&#039; on the persistence partition:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#cd to wherever you have mounted your persistence partition, e.g. /media/persistence&lt;br /&gt;
cd /media/persistence&lt;br /&gt;
echo &amp;quot;/ union&amp;quot; &amp;gt; persistence.conf&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
From /media/overlay/home grab the OSE Linux stuff in there, and put in /media/persistence/home:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cp -a /media/overlay/home /media/persistence/home&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
There may also be other OSE Linux specific things removed by prior purges of non-&amp;quot;core&amp;quot; packages, e.g. in /etc/&lt;br /&gt;
I suppose there may be a way to &amp;quot;diff&amp;quot; those out, and re-add them to the persistence partition after the packages are installed anew. Maybe there is a convenient dpkg way of doing that... diffing and saving the configuration file changes from stock packages instead of purging them? Or is that the difference between apt-get remove and apt-get purge where apt-get remove will only remove stock configuration files leaving modified ones intact? Yes I think that may be right.&lt;br /&gt;
&lt;br /&gt;
===Cleanup===&lt;br /&gt;
Cleanup!&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
sudo umount /media/overlay/dev/pts&lt;br /&gt;
sudo umount /media/overlay/dev/&lt;br /&gt;
sudo umount /media/overlay/proc&lt;br /&gt;
sudo umount /media/overlay/sys&lt;br /&gt;
sudo umount /media/overlay/tmp&lt;br /&gt;
sudo umount /media/overlay&lt;br /&gt;
sudo umount /media/filesystem.squashfs&lt;br /&gt;
sudo umount /media/iso&lt;br /&gt;
sudo umount /media/myadditions&lt;br /&gt;
sudo rmdir /media/iso /media/filesystem.squashfs /media/overlay&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Congratulations! You now have an Linux OS on your USB with persistence that will boot within seconds and reliably outperforms the competition!&lt;br /&gt;
&lt;br /&gt;
==Further Details==&lt;br /&gt;
===Upgrading===&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when linux-image (the package containing the kernel) is upgraded?&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; apt will want to update /boot/vmlinuz and /boot/initrd.img. So we need to do things in order to allow this to happen. We must boot with &#039;toram&#039; and also remount &#039;live&#039; as rw before running apt-get update.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#TODO, I wrote this elsewhere need to copy here, something along these lines:&lt;br /&gt;
mount -o remount,rw /lib/live/mount/medium /dev/disk/by-label/live&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
In this upgrade process apt might rename vmlinuz to say vmlinuz-3.16.0-4-amd64, and initrd similarly. It didn&#039;t always do this. But, you must match the names of those files with what is listed in grub.cfg! Either use &#039;vmlinuz&#039; or whatever name the apt script renamed them to.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; What do we do when libc is upgraded? Be it a security update, or when Debian Stable advances every couple years.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; We will want to do a resquash:&lt;br /&gt;
# We need to to the same as above, &#039;toram&#039; and remount &#039;live&#039; as rw.&lt;br /&gt;
# dpkq-query our currently installed packages, and compare to /boot/filesystem.packages.xz we made earlier.&lt;br /&gt;
# Remove all non &amp;quot;core&amp;quot; packages, they should be cached in /var/cache/apt/archives/ so they don&#039;t need to be downloaded again, just reinstalled after we do the resquash.&lt;br /&gt;
# apt-get update&lt;br /&gt;
# Resquash, reboot to verify things working, in &#039;live&#039; mode remove squashed stuff from persistance partition.&lt;br /&gt;
## squash script https://gist.github.com/AndrewSmart/90eb186aea08db8f1426&lt;br /&gt;
## cleanup script https://gist.github.com/AndrewSmart/2f67f79f6f1922c4556f&lt;br /&gt;
# Reinstall packages removed prior to resquash from /var/cache/apt/archives&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;Q:&#039;&#039;&#039; That looks like a lot to deal with.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;A:&#039;&#039;&#039; I agree. I&#039;m looking at using dpkg triggers or /etc/apt/apt.conf.d/ hooks to manage this upgrade process. I hope to have something sufficient soon.&lt;br /&gt;
&lt;br /&gt;
I hope to also make a smaller guide that is not optimal in performance, but has way less steps, so the end user can test out the persistence and take the time to &amp;quot;upgrade&amp;quot; the performance later if so inclined.&lt;br /&gt;
&lt;br /&gt;
===Troubleshooting===&lt;br /&gt;
Keep in mind with the USB we can still boot either in &#039;live&#039; mode, or &#039;persistence&#039; mode depending on the GRUB entry we choose. This is useful in case something breaks in &#039;persistence&#039; mode, like libc was upgraded in &#039;persistence&#039; but libc on &#039;live&#039; is still old! This will result in segmentation faults... a kernel panic, or whatever, it won&#039;t boot. We can access all of the software in the squashfs in &#039;live mode&#039;. Eventually I&#039;d like to write an apt hook to prevent the update of libc unless the system is prepared (&#039;toram&#039;, and &#039;live&#039; partition is mounted rw, the hook won&#039;t trigger unless &#039;persistence&#039; kernel parameter is used).&lt;br /&gt;
&lt;br /&gt;
Debian&#039;s live-boot scripts will put stuff in /lib/live/, and /lib/live/mount is of particularly good use in troubleshooting.&lt;br /&gt;
&lt;br /&gt;
Ubuntu is a bit of a can of worms from my perspective as a fan of vanilla Debian. So... hopefully things will go smoothly... I highly recommend a lighter-weight environment for USB persistence, but I understand everyone has their preferences.&lt;br /&gt;
&lt;br /&gt;
Since &#039;toram&#039; puts the squashfs into memory, lets say you have 8GB RAM and an 800MB squashfs, that is fine, but say you move to a workstation with only 2GB RAM, you will probably want to remove the &#039;toram&#039; kernel parameter, things will be slower but the memory footprint used by the OS will be less, and only use &#039;toram&#039; when updating the &#039;live&#039; partition as detailed above. Perhaps consider 2 additional GRUB entries, in addition to the two I have listed above, where the 2 additional entries are live and persistence mode without &#039;toram&#039; kernel parameter, and when booting select the entry depending on the amount of RAM the system has.&lt;br /&gt;
&lt;br /&gt;
In the event of a power outage, kernel panic, unsafe shutdown or whatever, the filesystem may have problems you&#039;re warned about on next boot. In this setup, the &#039;live&#039; partition was mounted ro, so it is not possible to have filesystem errors there, but with the &#039;persistence&#039; partition there will likely be errors. So, on next boot we select the &#039;live&#039; mode in grub, and run fsck.ext4 -p /dev/disk/by-label/persistence, and all problems are fixed!&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 06:43, 5 November 2020 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241538</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241538"/>
		<updated>2021-01-03T04:08:21Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Annotated Visual History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
callegar/Rezip in bash appears to be the most suitable to me. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
This discussion page seemed like an ok sandbox to put my thoughts in before moving to a move formal page somewhere when I have a concrete solution.&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241534</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241534"/>
		<updated>2021-01-03T03:58:12Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.17 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
callegar/Rezip in bash appears to be the most suitable to me. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241525</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241525"/>
		<updated>2021-01-03T02:32:12Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Annotated Visual History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
costerwi/rezip appears to be the most suitable. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision.&lt;br /&gt;
# On each revision, take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px.&lt;br /&gt;
## The service can possibly iterate through each revision [https://wiki.freecadweb.org/Embedding_FreeCADGui#Without_even_firing_up_the_FreeCAD_Gui without opening up the FreeCAD GUI].&lt;br /&gt;
# An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241524</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241524"/>
		<updated>2021-01-03T02:25:18Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Annotated Visual History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
costerwi/rezip appears to be the most suitable. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision. On each revision, FreeCAD can take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px. An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
Or simpler would be to not make a cache, but just use FreeCAD&#039;s thumbnail generation as part of each versioned document. But this is binary and shouldn&#039;t be versioned if at all possible... caching is the optimal solution as illustrated earlier.&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241514</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241514"/>
		<updated>2021-01-03T01:33:46Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* Annotated Visual History */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
costerwi/rezip appears to be the most suitable. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision. On each revision, FreeCAD can take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px. An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement, or&lt;br /&gt;
## FreeCAD &#039;Preferences-&amp;gt;Document-&amp;gt;SaveThumbnail&#039; boolean indicates that a suitable feature may be in the FreeCAD API somewhere.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241513</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241513"/>
		<updated>2021-01-03T01:28:29Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.18 and newer (or v0.19 and newer?) */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
costerwi/rezip appears to be the most suitable. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
The clutter of external documents in the tree view can be hidden by the setting &#039;View -&amp;gt; TreeView actions -&amp;gt; Single document&#039;. But I&#039;m still looking for a way to hide the Constraints, Elements, Parts containers.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision. On each revision, FreeCAD can take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px. An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241506</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241506"/>
		<updated>2021-01-03T01:15:29Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: /* FreeCAD v0.18 and newer */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
costerwi/rezip appears to be the most suitable. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer (or v0.19 and newer?)===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision. On each revision, FreeCAD can take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px. An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241499</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241499"/>
		<updated>2021-01-03T00:57:31Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To prevent the explosion in space usage this mal-use would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
costerwi/rezip appears to be the most suitable. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision. On each revision, FreeCAD can take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px. An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=241497</id>
		<title>User talk:Andrewusu</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=User_talk:Andrewusu&amp;diff=241497"/>
		<updated>2021-01-03T00:54:30Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;=Wiki=&lt;br /&gt;
[[Wiki_instructions]]&lt;br /&gt;
[[mediawikiwiki:Help:Formatting]]&lt;br /&gt;
&lt;br /&gt;
[[Wiki_Reorganization_2011]]&lt;br /&gt;
&lt;br /&gt;
Perhaps better categorization of pages into the taxonomy would help enhance navigation of this wiki: [https://wiki.opensourceecology.org/index.php?title=Special%3ACategoryTree&amp;amp;target=main&amp;amp;mode=categories CategoryTree].&lt;br /&gt;
&lt;br /&gt;
With the tree navigable from the wiki sidebar via this MediaWiki plugin: [[mediawikiwiki:Extension:TreeAndMenu]]. Or how Appropedia has theirs set up: [[Appropedia:Appropedia:CategoryTree]].&lt;br /&gt;
&lt;br /&gt;
=Worker Cooperative=&lt;br /&gt;
&lt;br /&gt;
I am interested in worker owned companies. Trying to compile resources to assist in their formation.&lt;br /&gt;
&lt;br /&gt;
[https://www.youtube.com/watch?v=8G1-SYMatNc Laura Flanders] and Professor Richard D. Wolff speak a lot about worker coops on YouTube.&lt;br /&gt;
&lt;br /&gt;
==Resources==&lt;br /&gt;
* http://www.usworker.coop/home/ $100+ annual membership dues to access their database and technical assistance.&lt;br /&gt;
* https://solidarityeconomy.us/ Neat visual interface&lt;br /&gt;
* https://cooperationworks.coop/&lt;br /&gt;
* https://www.ncb.coop/&lt;br /&gt;
* More to add/read...&lt;br /&gt;
&lt;br /&gt;
=Software Tools=&lt;br /&gt;
==FreeCAD Real Time Collaboration==&lt;br /&gt;
From my brief analysis:&lt;br /&gt;
* Store the [https://www.freecadweb.org/wiki/File_Format_FCStd FCStd] file in git uncompressed (in own directory).&lt;br /&gt;
* Use libgit2 with [https://stackoverflow.com/questions/37849771/can-git-be-made-to-mostly-auto-merge-xml-order-insensitive-files custom XML merge driver].&lt;br /&gt;
* Make new workbench or augment existing ones with new drop down menu entries to handle git operations (push/pull).&lt;br /&gt;
* At some interval check for updates to origin.&lt;br /&gt;
* Handle real time transactions on top of that (e.g. real time cursor/updates you see in google-docs):&lt;br /&gt;
** Could make cloud service to handle real time data transfer if neither network supports UPNP. Or only support UPNP compliance.&lt;br /&gt;
** Handle locking/unlocking of essentially unmergable assets (e.g. 3D mesh). As well as visual representation changes to others with same file open.&lt;br /&gt;
** Other features as needed.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==FreeCAD Snapping of off the shelf parts like [[Vention]]==&lt;br /&gt;
From a very brief look:&lt;br /&gt;
* Use constraints and solver from FreeCAD&#039;s [https://github.com/realthunder/FreeCAD_assembly3 Assembly3].&lt;br /&gt;
* Use FreeCAD&#039;s [https://github.com/FreeCAD/FreeCAD-library/ part library]. Augment with &#039;snap point&#039; and parametric resizing data somehow, somewhere.&lt;br /&gt;
* Overload/script somewhere within FreeCAD to handle the snapping/resizing functionality, perhaps within Assembly3 workbench?&lt;br /&gt;
&lt;br /&gt;
==OSE Supply Chain Interface==&lt;br /&gt;
*Interface for customers.&lt;br /&gt;
*I think this would help with adaptation/feasibility of many OSE concepts... distribution of the means of production, minimize shipping emissions/cost, etc.&lt;br /&gt;
&lt;br /&gt;
=Adobe Brick=&lt;br /&gt;
Have adobe brick building built around 1870ish. Brick wall is about 14&#039; tall at highest on the crest of roof. Interesting sand/rock foundation and sandy mortar. Original builder couldn&#039;t believe it was still standing after he left and came back a number of years later. His journal is online. Still standing 150 years later.&lt;br /&gt;
&lt;br /&gt;
Clay has no organic content. Clay deposits were deposited from [https://en.wikipedia.org/wiki/Lake_Bonneville Lake Bonneville]. Lots of local limestone. I&#039;m confused as kiln industry didn&#039;t start up till a decade or so later in this valley, so I&#039;m not sure how these bricks are stabilized (water doesn&#039;t permeate more than a few mm, even after a 24 hour submersion). Maybe additive carted from 80+ miles away? Or something intrinsic to the clay?&lt;br /&gt;
&lt;br /&gt;
The sandy mortar seems to help quickly drain water, but the issue is the sandy mortar liquefies if it gets too wet. I didn&#039;t know it was adobe and left a rainbird that hit a wall for a couple days... caused some damage.&lt;br /&gt;
&lt;br /&gt;
Could look into [https://techxplore.com/news/2020-08-energy-red-bricks.html storing electricity in the bricks]. I suppose there may be a lot of leakage current when damp, but I&#039;d imagine it&#039;d be superfluous energy stored in the bricks anyway.&lt;br /&gt;
&lt;br /&gt;
=Power Electronics=&lt;br /&gt;
[https://techxplore.com/news/2020-07-hybrid-inverter-energy-resources-smart.html This] looks like a good, feature rich platform, [https://volttron.org/about-volttron Volttron]. Would be interesting to see if there is a hardware reference implementation available to the public in their DOE Data Management Plan (couldn&#039;t find at a glance elsewhere).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
----&lt;br /&gt;
&#039;&#039;&#039;Welcome to &#039;&#039;Open Source Ecology&#039;&#039;!&#039;&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
Thank you for registering on the Open Source Ecology wiki.&lt;br /&gt;
&lt;br /&gt;
*We suggest that you review our [[Crash Course]] for an overview of our work. Our current goal is finishing the [[Global Village Construction Set]] by 2028, at which point we begin focus on human development - of [[Integrated Humans]].&lt;br /&gt;
*To join our dedicated development team, see [[OSE Developers]]&lt;br /&gt;
*To join OSE full time - we are offering our first ever [[Immersion Program]] in 2008. [[User:Marcin|Marcin]] ([[User talk:Marcin|talk]]) 10:14, 22 November 2019 (UTC)&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
	<entry>
		<id>https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241496</id>
		<title>Talk:OSE Collaboration Protocol</title>
		<link rel="alternate" type="text/html" href="https://wiki.opensourceecology.org/index.php?title=Talk:OSE_Collaboration_Protocol&amp;diff=241496"/>
		<updated>2021-01-03T00:49:41Z</updated>

		<summary type="html">&lt;p&gt;Andrewusu: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Andrewusu&#039;s thoughts on FreeCAD git integration==&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.17 and newer===&lt;br /&gt;
As of FreeCAD version 0.17 the [https://wiki.freecadweb.org/WebTools_Git WebTools Workbench] allows Git integration through manual steps.&lt;br /&gt;
&lt;br /&gt;
However *.fcstd files are binary files, specifically zip archives, and binary files aren&#039;t really suitable for version control tools like Git.&lt;br /&gt;
&lt;br /&gt;
To minimize the explosion in space usage this would cause, a git filter should be set up for these *.fcstd files, such as:&lt;br /&gt;
# [https://forum.freecadweb.org/viewtopic.php?f=22&amp;amp;t=8688&amp;amp;start=30#p436343 costerwi/rezip], But requires Java JRE 8 or newer...&lt;br /&gt;
# [https://github.com/callegar/Rezip callegar/Rezip], written in bash, won&#039;t work on Windows (unless cygwin is used)&lt;br /&gt;
# [https://bitbucket.org/sippey/zippey Zippey], written in python, appears to be less optimal than the other two approaches.&lt;br /&gt;
&lt;br /&gt;
costerwi/rezip appears to be the most suitable. However, FreeCAD in a future version will support better integration with version control without such workarounds and additional workflow steps.&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.18 and newer===&lt;br /&gt;
[[File:FreeCAD_assembly3_document_links.png|thumb|Brief view of Assembly3 assembly, document, and link organization. Sub-assemblies which are linked to an external document, will result in that external document being loaded and displayed as shown. While frozen they won&#039;t consume much memory.]]&lt;br /&gt;
&lt;br /&gt;
Has realthunder&#039;s Assembly3 workbench. Supports links, which help eliminate prior memory limitations with larger assemblies, and need for such workarounds like [[File_Simplification]]. So long as the linked document is opened and the link is frozen, the assembly is displayed within the parent document as a single unmodifiable geometry.  When the linked document is closed it won&#039;t be displayed anymore in the parent document.&lt;br /&gt;
&lt;br /&gt;
I think it would be best if when the Assembly3 workbench isn&#039;t active,&lt;br /&gt;
[[File:FreeCAD_assembly3_workbench.png]]&lt;br /&gt;
&lt;br /&gt;
That a simplified view of the model is presented in the Combo view, without the &#039;&#039;&#039;Constraints, Elements, Parts&#039;&#039;&#039; and additional hierarchy that Assembly3 at present introduces to FreeCAD:&lt;br /&gt;
[[File:FreeCAD_simple_hiearichy.png]]&lt;br /&gt;
&lt;br /&gt;
===FreeCAD v0.20 and newer===&lt;br /&gt;
realthunder [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353 has made changes in FreeCAD to better support Version Control], however he writes [https://forum.freecadweb.org/viewtopic.php?f=10&amp;amp;t=38353&amp;amp;start=20#p379536 &amp;quot;It is still in my fork. I think this feature will most likely land in the next 0.20 release&amp;quot;].&lt;br /&gt;
&lt;br /&gt;
[[File:FreeCAD_realthunder_save_as_directory.png|thumb|Save as directory for version control integration in FreeCAD v0.20 and newer and realthunder&#039;s fork]]&lt;br /&gt;
&lt;br /&gt;
realthunder has put in the plumbing to allow an external tool/service to automatically manage the version control of the CAD files.&lt;br /&gt;
&lt;br /&gt;
At this time the use of such beta features may be premature, but I imaging you&#039;ll want to migrate projects to use Assembly3 instead of Assembly2 anyway.&lt;br /&gt;
&lt;br /&gt;
====My envisioned solution====&lt;br /&gt;
While the solution with the FreeCAD WebTools Workbench and rezip should work... better possibilities exist, which will:&lt;br /&gt;
# Better handle multiple documents, allowing re-use of work done (why invent the wheel twice!)&lt;br /&gt;
## Each linked sub-assembly of a parent assembly will have their own document, in their own git branch, with their own history, allowing other assemblies to make use of and update that subassembly without changing the original parent assembly.&lt;br /&gt;
# Transparent git integration&lt;br /&gt;
## End-user does not have to interact with git or do any additional steps, other than save and enter a commit message&lt;br /&gt;
# Service will notify user of any update to a document they&#039;re working on&lt;br /&gt;
&lt;br /&gt;
Use FreeCAD v0.20 once available, or realthunder&#039;s present fork.&lt;br /&gt;
&lt;br /&gt;
Set up a service to respond to the signals, e.g. [https://github.com/torfsen/service]. The signal data will include what files were modified/deleted/added. The service will:&lt;br /&gt;
# Interact with git. e.g. Commit the changes to a new revision.&lt;br /&gt;
# Push the new commit to a remote repository, if a remote repository is designated in the document properties.&lt;br /&gt;
# Put sub-assemblies into their own branch, and use git sub-repo to include those sub-assemblies in a subdirectory in the main branch (likely master).&lt;br /&gt;
# If a remote repository was designated for any sub-assembly, the service will push any change for that sub-assembly to that sub-assembly.&lt;br /&gt;
&lt;br /&gt;
In addition to the service:&lt;br /&gt;
# Add a means of adding properties to the document, so that the FreeCAD user can use the GUI to designate a remote version control repository to push/pull the changes to.&lt;br /&gt;
# Add a means for the user to enter a commit message when they save the document.&lt;br /&gt;
&lt;br /&gt;
====Annotated Visual History====&lt;br /&gt;
I&#039;m not sure what would be the most optimal way to implement [[Annotated_Visual_History]].&lt;br /&gt;
&lt;br /&gt;
A simple idea would be to have:&lt;br /&gt;
# An &amp;quot;.annotated_visual_history_cache&amp;quot; folder, which is listed in .gitignore (not versioned)&lt;br /&gt;
# FreeCAD on opening a version controlled directory without, to interact with the service as the service iterates through git revisions, to cache each revision. On each revision, FreeCAD can take a set of isometric snapshots rotating around the assembly, resized to say 64x64 px. An image processing utility will assign a complexity score to each snapshot, and the snapshot with the maximal complexity score will be selected as the thumbnail. A complexity score being a proxy measure of what image best illustrates the part!&lt;br /&gt;
## Filesize might suffice as an indirect measurement of complexity, the largest image being the most complex, otherwise,&lt;br /&gt;
## ImageMagick&#039;s identify might suffice, with a grep of a -verbose output, or a [https://imagemagick.org/script/command-line-options.php#features -features] measurement.&lt;br /&gt;
# Have a FreeCAD workbench, such as the WebTools workbench, able to interpret the git log and these thumbnails in a meaningful way for the user&lt;br /&gt;
&lt;br /&gt;
Related docs:&lt;br /&gt;
[[Collaboration_Architecture]],&lt;br /&gt;
[[FreeCAD_101]]&lt;br /&gt;
&lt;br /&gt;
--[[User:Andrewusu|Andrewusu]] ([[User talk:Andrewusu|talk]]) 23:22, 2 January 2021 (UTC)&lt;br /&gt;
]]&lt;/div&gt;</summary>
		<author><name>Andrewusu</name></author>
	</entry>
</feed>