#1111351 setting unshare_tpmdir_template doesn't affect mmdebstrap

Package:
sbuild
Source:
sbuild
Submitter:
Marc Haber
Date:
2026-07-02 17:37:19 UTC
Severity:
normal
Tags:
#1111351#5
Date:
2025-08-17 09:35:11 UTC
From:
To:
Hi,

iusing $unshare_tmpdir_template = '/var/tmp/tmp.sbuild.XXXXXXXXXX'; in
the sbuild configuration, one can avoid a /tmp overflow if /tmp is a
tmpfs. This is especially important since trixie where /tmp is tmpfs by
default.

This is not honored if the chroot needs to be built, mmdebstrap still
happily fills up /tmp (and then terminates with a VERY misleading error
message).

Greetings
Marc

#1111351#10
Date:
2025-09-22 10:07:53 UTC
From:
To:
control: forward -1 https://salsa.debian.org/debian/sbuild/-/merge_requests/204

hi Marc,

Jochen pointed me to this bug, saying I would also need
to set
$unshare_mmdebstrap_env_cmnd = [ "env", "TMPDIR=/home/user/tmp/";
in sbuild's config.pl.

However, this wont work either, until
https://salsa.debian.org/debian/sbuild/-/merge_requests/204
has been merged, so for now one also need to do
alias sbuild="TMPDIR=/home/user/tmp/ sbuild"
after which simply invocating sbuild should work for the user user
with tmp in ~/tmp.

#1111351#17
Date:
2025-12-26 10:35:54 UTC
From:
To:
Hi Marc,

* Marc Haber <mh+debian-packages@zugschlus.de> [2025-08-17 11:35]:

I think the better option is to use:

$ TMPDIR=/var/tmp sbuild ...

This will put all temporary files below /var/tmp, also for piuparts and
autopkgtest since version 0.91.5.

* Holger Levsen <holger@layer-acht.org> [2025-09-22 10:07]:

This has been added in version 0.91.3 with the small variation that it
is now:

$unshare_mmdebstrap_env_cmd = [ "env", "TMPDIR=/home/user/tmp/";

(note the cmd instead of cmnd.)

I still think setting $TMPDIR is the better option and would propose to
close this bug unless you disagree.

Cheers Jochen

#1111351#22
Date:
2025-12-26 10:55:37 UTC
From:
To:
But that cannot be put in configuration and then forgotten, it needs to
be remembered every time. Or a wrapper needs to be written and used.

Greetings
Marc

#1111351#27
Date:
2025-12-26 12:14:04 UTC
From:
To:
yes. I want to be able use 'sbuild', not 'TMPDIR=$something sbuild'.
#1111351#32
Date:
2025-12-26 13:07:20 UTC
From:
To:
This.

MAYBE I would be fine with setting SBUILD_TMPDIR in my .bashrc (and then
forget about it¹), and have sbuild transport that to TMPDIR for the
subprocesses, but ideally I'd want to have that in sbuild configuration
where the rest of sbuild config lives.

Greetings
Marc

¹ and debug for hours on the next host where I set up sbuild and will
invariably run into that trap again

#1111351#37
Date:
2025-12-26 14:09:51 UTC
From:
To:
* Marc Haber <mh+debian-packages@zugschlus.de> [2025-12-26 14:07]:

Use this in your sbuild config:

$ENV{'TMPDIR'} = "/var/tmp";
$unshare_tmpdir_template = '/var/tmp/tmp.sbuild.XXXXXXXXXX';

The default for $unshare_tmpdir_template is set before the config file
is read so we need to override it.

Cheers Jochen

#1111351#42
Date:
2025-12-26 16:36:19 UTC
From:
To:
If that works (I didn't try it yet), it needs to be in the docs.
Prominently.

Greetings
Marc