cleanfs: Clear /var/tmp on boot as well

Message ID a1b3c44d-fee8-1d8a-a61f-52332d04e938@ipfire.org
State Rejected
Headers
Series cleanfs: Clear /var/tmp on boot as well |

Commit Message

Peter Müller 27 Feb 2022, 9:53 p.m. UTC
Similar to /tmp/, there is no reason to keep any leftovers in /var/tmp,
nor can any application expect content placed there to be persistent.

On several IPFire installations I have access to, this would remove
quite some clutter accumulated in /var/tmp over the years.

Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
---
 src/initscripts/system/cleanfs | 5 +++++
 1 file changed, 5 insertions(+)
  

Comments

Paul Simmons 28 Feb 2022, 10:50 a.m. UTC | #1
On 2/27/22 15:53, Peter Müller wrote:
> Similar to /tmp/, there is no reason to keep any leftovers in /var/tmp,
> nor can any application expect content placed there to be persistent.
>
> On several IPFire installations I have access to, this would remove
> quite some clutter accumulated in /var/tmp over the years.
>
> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
> ---
>  src/initscripts/system/cleanfs | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/src/initscripts/system/cleanfs b/src/initscripts/system/cleanfs
> index d1cbb2547..f315682ce 100644
> --- a/src/initscripts/system/cleanfs
> +++ b/src/initscripts/system/cleanfs
> @@ -117,6 +117,11 @@ case "${1}" in
>  		find . -xdev -mindepth 1 ! -name lost+found \
>  			-delete || failed=1
>  
> +		boot_mesg -n " /var/tmp" ${NORMAL}
> +		cd /var/tmp &&
> +		find . -xdev -mindepth 1 ! -name lost+found \
> +			-delete || failed=1
> +
>  		boot_mesg -n " /var/ipfire/dhcp" ${NORMAL}
>  		cd /var/ipfire/dhcpc/ && find . -name "*.pid" -exec rm -f {} \; || failed=1
>  		cd /var/ipfire/dhcpc/ && find . -name "*.cache" -exec rm -f {} \; || failed=1

In that case, should ISO backups use a directory other than
"/var/tmp/backupiso"?

Thanks,

Paul
  
Stefan Schantl 28 Feb 2022, 6:48 p.m. UTC | #2
Hello Peter, Hello List,

I have to decline this patch because the IDS system currently stores
the downloaded tarballs (which contains the rules of a provider) in
that directory.

Each time the ruleset is altered or updated, these tarballs will be
decompressed and the required files are extracted from them.

So cleaning up this directory, would remove the tarballs and currently
breaks the entire IDS.

We might have to think about keeping this tarballs or to move them to a
different (better) location.

Best regards,

-Stefan
> Similar to /tmp/, there is no reason to keep any leftovers in
> /var/tmp,
> nor can any application expect content placed there to be persistent.
> 
> On several IPFire installations I have access to, this would remove
> quite some clutter accumulated in /var/tmp over the years.
> 
> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
> ---
>  src/initscripts/system/cleanfs | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/src/initscripts/system/cleanfs
> b/src/initscripts/system/cleanfs
> index d1cbb2547..f315682ce 100644
> --- a/src/initscripts/system/cleanfs
> +++ b/src/initscripts/system/cleanfs
> @@ -117,6 +117,11 @@ case "${1}" in
>                 find . -xdev -mindepth 1 ! -name lost+found \
>                         -delete || failed=1
>  
> +               boot_mesg -n " /var/tmp" ${NORMAL}
> +               cd /var/tmp &&
> +               find . -xdev -mindepth 1 ! -name lost+found \
> +                       -delete || failed=1
> +
>                 boot_mesg -n " /var/ipfire/dhcp" ${NORMAL}
>                 cd /var/ipfire/dhcpc/ && find . -name "*.pid" -exec
> rm -f {} \; || failed=1
>                 cd /var/ipfire/dhcpc/ && find . -name "*.cache" -exec
> rm -f {} \; || failed=1
  
Michael Tremer 1 Mar 2022, 10:56 a.m. UTC | #3
Hello everyone,

I agree with Paul and Stefan here. We should move things out of there first before we add this directory to the tidy up at boot time.

Who would like to grab this and work on this?

-Michael

> On 28 Feb 2022, at 18:48, Stefan Schantl <stefan.schantl@ipfire.org> wrote:
> 
> Hello Peter, Hello List,
> 
> I have to decline this patch because the IDS system currently stores
> the downloaded tarballs (which contains the rules of a provider) in
> that directory.
> 
> Each time the ruleset is altered or updated, these tarballs will be
> decompressed and the required files are extracted from them.
> 
> So cleaning up this directory, would remove the tarballs and currently
> breaks the entire IDS.
> 
> We might have to think about keeping this tarballs or to move them to a
> different (better) location.
> 
> Best regards,
> 
> -Stefan
>> Similar to /tmp/, there is no reason to keep any leftovers in
>> /var/tmp,
>> nor can any application expect content placed there to be persistent.
>> 
>> On several IPFire installations I have access to, this would remove
>> quite some clutter accumulated in /var/tmp over the years.
>> 
>> Signed-off-by: Peter Müller <peter.mueller@ipfire.org>
>> ---
>>  src/initscripts/system/cleanfs | 5 +++++
>>  1 file changed, 5 insertions(+)
>> 
>> diff --git a/src/initscripts/system/cleanfs
>> b/src/initscripts/system/cleanfs
>> index d1cbb2547..f315682ce 100644
>> --- a/src/initscripts/system/cleanfs
>> +++ b/src/initscripts/system/cleanfs
>> @@ -117,6 +117,11 @@ case "${1}" in
>>                 find . -xdev -mindepth 1 ! -name lost+found \
>>                         -delete || failed=1
>>  
>> +               boot_mesg -n " /var/tmp" ${NORMAL}
>> +               cd /var/tmp &&
>> +               find . -xdev -mindepth 1 ! -name lost+found \
>> +                       -delete || failed=1
>> +
>>                 boot_mesg -n " /var/ipfire/dhcp" ${NORMAL}
>>                 cd /var/ipfire/dhcpc/ && find . -name "*.pid" -exec
>> rm -f {} \; || failed=1
>>                 cd /var/ipfire/dhcpc/ && find . -name "*.cache" -exec
>> rm -f {} \; || failed=1
> 
>
  

Patch

diff --git a/src/initscripts/system/cleanfs b/src/initscripts/system/cleanfs
index d1cbb2547..f315682ce 100644
--- a/src/initscripts/system/cleanfs
+++ b/src/initscripts/system/cleanfs
@@ -117,6 +117,11 @@  case "${1}" in
 		find . -xdev -mindepth 1 ! -name lost+found \
 			-delete || failed=1
 
+		boot_mesg -n " /var/tmp" ${NORMAL}
+		cd /var/tmp &&
+		find . -xdev -mindepth 1 ! -name lost+found \
+			-delete || failed=1
+
 		boot_mesg -n " /var/ipfire/dhcp" ${NORMAL}
 		cd /var/ipfire/dhcpc/ && find . -name "*.pid" -exec rm -f {} \; || failed=1
 		cd /var/ipfire/dhcpc/ && find . -name "*.cache" -exec rm -f {} \; || failed=1