~alpine/users

1

lbu overlays kept in the /tmp directory

Details
Message ID
<CAD1Ag0w0_MSmc2FC4zxMoKhPA-iKEh-Z1pmn9LvgWZXnTVE2Ag@mail.gmail.com>
DKIM signature
missing
Download raw message
Hello,

I run 3.22.1 on a RPI and I use a dedicated partition for lbu and apk cache.
I noticed that every time I run 'lbu ci' the overlay file is created in a
temporary folder but it's not removed automatically.
I don't see any evidence of error : files are copied into the partition and
there is no error message in the log files

Is that a normal behaviour ?

Thank you
Stefan Hartmann SH <sh@hafenthal.de>
Details
Message ID
<9ac76b85-761d-401f-ac7c-e32bd30bd5b3@hafenthal.de>
In-Reply-To
<CAD1Ag0w0_MSmc2FC4zxMoKhPA-iKEh-Z1pmn9LvgWZXnTVE2Ag@mail.gmail.com> (view parent)
DKIM signature
missing
Download raw message
On 05/09/2025 16:34, Jerome Marc wrote:
> Hello,
> 
> I run 3.22.1 on a RPI and I use a dedicated partition for lbu and apk cache.
> I noticed that every time I run 'lbu ci' the overlay file is created in 
> a temporary folder but it's not removed automatically.
> I don't see any evidence of error : files are copied into the partition 
> and there is no error message in the log files
> 
> Is that a normal behaviour ?
> 
> Thank you

Recently I noticed the same behaviour.

I am running many Alpine systems with persistent disk and use lbu pkg to 
create a staged backup, so there are a lot of annoying lbu-* dirs in 
/tmp on long running systems. Eventually also a security impact in some 
bad circumstances.

I made a workaround for me but havent got time now to commit the changes 
at the appropriate place.

It could be as follow:

#1 in the shell script or better in the sourced libalpine.sh
clean_tmpdir() {
	if [ -n "$1" ] && [ "$( dirname "$1" )" = '/tmp' ] && basename "$1" | 
grep -Eq "^$PROGRAM-.+"; then
		rm -r "$1"  ||
			eecho "failed to clean tmpdir"
	fi
}

#2 in cmd_package(), cmd_status(), cmd_diff()
...
clean_tmpdir "${tmpdir}" or clean_tmpdir "${tmp}"


Also I have a second improvement with
RUN_LBU_PRE_POST_PACKAGE="true"		# dont run pre-post-backup on 
cmd_status, cmd_diff

-- 
Stefan Hartmann - ib.hafenthal.de
Reply to thread Export thread (mbox)