Debian Bug report logs - #666985
re-enable tmpfs on /tmp

Package: live-installer; Maintainer for live-installer is Debian Install System Team <debian-boot@lists.debian.org>; Source for live-installer is src:live-installer.

Reported by: Andrei Purdea <andrei@purdea.ro>

Date: Fri, 30 Dec 2011 06:33:02 UTC

Severity: normal

Tags: moreinfo

Done: Daniel Baumann <daniel.baumann@progress-technologies.net>

Bug is archived. No further changes may be made.

Toggle useless messages

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Fri, 30 Dec 2011 06:33:05 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrei Purdea <andrei@purdea.ro>:
New Bug report received and forwarded. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Fri, 30 Dec 2011 06:33:05 GMT) Full text and rfc822 format available.

Message #5 received at submit@bugs.debian.org (full text, mbox):

From: Andrei Purdea <andrei@purdea.ro>
To: submit@bugs.debian.org
Subject: the live-config init.d script should depend on mountkernfs
Date: Fri, 30 Dec 2011 08:29:19 +0200
Package: live-config
Version: 3.0~a31-1

There is a race condition between mountkernfs and user-setup

When RAMTMP=yes in /etc/default/rcS, then the
mountkernfs init.d script mounts /tmp as a tmpfs.

The 002-user-setup script first writes some data into a temporary file,
and then reads it back, and deletes it.

The race condition happens when the new /tmp partition is mounted
before the temporary data is read back. This doesn't happen always,
but the problem can be reproduced by adding sleep statements
artificially to the two scripts (add a small sleep statement to the start
of mountkernfs, and a bigger sleep statement on line 71 of user-setup
(between write and read).

Temporary quick fix:
make a hook in config/hooks , called fix_live_config_boot.sh.chroot, containing:
#!/bin/sh
sed -i -e 's|^# Required-Start:\(.*\)$|# Required-Start: mountkernfs
\1|' /etc/init.d/live-config
insserv


-- 
Purdea Andrei
http://purdea.ro
student at the “Politehnica” University of Timisoara
Faculty of Automation and Computers (AC)
Master's Degree Program - Computer Engineering (MCE)
2nd year




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Fri, 30 Dec 2011 08:45:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Fri, 30 Dec 2011 08:45:03 GMT) Full text and rfc822 format available.

Message #10 received at 653673@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Andrei Purdea <andrei@purdea.ro>
Cc: 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Fri, 30 Dec 2011 09:41:05 +0100
tag 653673 unreproducible
tag 653673 moreinfo
thanks

On 12/30/2011 07:29 AM, Andrei Purdea wrote:
> There is a race condition between mountkernfs and user-setup

first; /etc/init.d/live-config always has absolutely to be the first
script that gets executed, we do depend on that, if live-config is not
the first thing, then other things later during system start may not
work as they should. therefore, there should never by any depends within
the live-config initscript to another initscript.

second; if live-config is not the first script executed, then we need to
fix that. from my experience, it currently is always the first one. how
do you create the case where it does not get executed first?

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Added tag(s) unreproducible. Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Fri, 30 Dec 2011 08:45:05 GMT) Full text and rfc822 format available.

Added tag(s) moreinfo. Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Fri, 30 Dec 2011 08:45:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Fri, 30 Dec 2011 12:01:46 GMT) Full text and rfc822 format available.

Acknowledgement sent to intrigeri <intrigeri+debian-live@boum.org>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Fri, 30 Dec 2011 12:02:09 GMT) Full text and rfc822 format available.

Message #19 received at 653673@bugs.debian.org (full text, mbox):

From: intrigeri <intrigeri+debian-live@boum.org>
To: daniel.baumann@progress-technologies.net
Cc: 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Fri, 30 Dec 2011 12:59:30 +0100
Hi,

Daniel Baumann wrote (30 Dec 2011 08:41:05 GMT) :

> On 12/30/2011 07:29 AM, Andrei Purdea wrote:
>> There is a race condition between mountkernfs and user-setup

> first; /etc/init.d/live-config always has absolutely to be the first
> script that gets executed, we do depend on that, if live-config is
> not the first thing, then other things later during system start may
> not work as they should. therefore, there should never by any
> depends within the live-config initscript to another initscript.

> second; if live-config is not the first script executed, then we need to
> fix that. from my experience, it currently is always the first one. how
> do you create the case where it does not get executed first?

In my experience too, the symlinks in rcS are ordered in a way so that
live-config gets S01 and mountkernfs gets S02. All great.

However, it seems to me boot time initscripts concurrency is the
default in Squeeze, and AFAIK nothing is done to avoid mountkernfs and
live-config initscripts to run in parallel, is it? Maybe I'm missing
something obvious.

Cheers,
-- 
  intrigeri <intrigeri@boum.org>
  | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
  | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc
  | Did you exchange a walk on part in the war
  | for a lead role in the cage?




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Fri, 30 Dec 2011 20:09:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrei Purdea <andrei@purdea.ro>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Fri, 30 Dec 2011 20:09:04 GMT) Full text and rfc822 format available.

Message #24 received at 653673@bugs.debian.org (full text, mbox):

From: Andrei Purdea <andrei@purdea.ro>
To: daniel.baumann@progress-technologies.net, 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Fri, 30 Dec 2011 22:04:01 +0200
[Message part 1 (text/plain, inline)]
I attached /etc/init.d/mountkernfs.sh, and /lib/live/config/002-user-setup
Only two modifications have been made: I added a sleep statement to each:
002-user-setup:72  contains: sleep 40
mountkernfs.sh:120 contains: sleep 20

This will force the bug to show up Every time you try to boot.
The error message says that it can't read /tmp/debconf.live.
I tested it with qemu, virtualbox 2 cores, virtualbox 1 core.

Without the sleep commands added (everything default), the bug appeard
for me in a virtualbox 1-core configuration, about 1 out of 20 times i booted
the image.

I hope this is enough to reproduce.
> first; /etc/init.d/live-config always has absolutely to be the first
> script that gets executed, we do depend on that, if live-config is not
> the first thing, then other things later during system start may not
> work as they should. therefore, there should never by any depends within
> the live-config initscript to another initscript.

There are a couple cases to discuss:
First, yes, I understand it is important for live-config to run as
soon as possible, because other scripts
might need the modifications it makes.
But live-config needs something too: It needs a writable /tmp partition.
And this /tmp partition can't be remounted while live-config is in execution,
or otherwise temporary data in it will be lost.

Currently what happens is that mountkernfs.sh and live-config gets executed
Concurrently. When the mount command happens to get executed right
between the writing and reading of temporary data, then the temp data ends
up in /live/cow/tmp/debconf.live (trough the aufs), and user-setup
tries to read it from
/tmp/debconf.live (which is now a pure tmpfs).

When the mount happens before, the data is written and read from the tmpfs
When the mount happens after, the data is written and read from the aufs.

That is why it's hard to reproduce without adding the "sleep" commands.

It is fine if live-config runs before mountkernfs.sh, but they can't
run concurrently.
Then mountkernfs.sh must depend of live-config, and that modification
can only be
made in the chroot stage, and that modification will not be good for
non-live systems.

Currently mountkernfs.sh doesn't depend on anything. So making
live-config depend on
mountkernfs.sh will let live-config run as the second script. in the
boot process.
Does live-config really affect the functioning of mountkernfs.sh?
Even in rcS.d live-config is configured third, After mountkernfs.sh.
All we need to make sure is that they don't execute concurrently.

-- 
Purdea Andrei
http://purdea.ro
student at the “Politehnica” University of Timisoara
Faculty of Automation and Computers (AC)
Master's Degree Program - Computer Engineering (MCE)
2nd year
[mountkernfs.sh (application/x-sh, attachment)]
[002-user-setup (application/octet-stream, attachment)]

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Fri, 30 Dec 2011 23:00:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Fri, 30 Dec 2011 23:00:03 GMT) Full text and rfc822 format available.

Message #29 received at 653673@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Andrei Purdea <andrei@purdea.ro>
Cc: 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Fri, 30 Dec 2011 23:57:22 +0100
tag 653673 - unreproducible
thanks

On 12/30/2011 09:04 PM, Andrei Purdea wrote:
> But live-config needs something too: It needs a writable /tmp partition.

which is ensured since / is writable (through aufs).

> And this /tmp partition can't be remounted while live-config is in execution,
> or otherwise temporary data in it will be lost.

right, so we need to make sure that cannot happen (automatically).

> Currently what happens is that mountkernfs.sh and live-config gets executed
> Concurrently. When the mount command happens to get executed right
> between the writing and reading of temporary data, then the temp data ends
> up in /live/cow/tmp/debconf.live (trough the aufs), and user-setup
> tries to read it from
> /tmp/debconf.live (which is now a pure tmpfs).

*iff* /tmp is a tmpfs, which it by default isn't (in squeeze), but in
sid. (jftr)

the only problem here remains that mountkernfs in sid does an automatic
tmpfs on /tmp (unless /tmp is configured in fstab).

since /tmp on a tmpfs for a live system has no merits in the first
place, it's save to disable that. and that can be done with RAMTMP=no in
/etc/default/rcS at build-time.

that seems to be the most non-invasive solution to me.

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Removed tag(s) unreproducible. Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Fri, 30 Dec 2011 23:00:05 GMT) Full text and rfc822 format available.

Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Sat, 31 Dec 2011 05:18:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to Andrei Purdea <andrei@purdea.ro>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Sat, 31 Dec 2011 05:18:03 GMT) Full text and rfc822 format available.

Message #36 received at 653673@bugs.debian.org (full text, mbox):

From: Andrei Purdea <andrei@purdea.ro>
To: daniel.baumann@progress-technologies.net
Cc: 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Sat, 31 Dec 2011 07:14:23 +0200
> which is ensured since / is writable (through aufs).\

--exposed-root is supposed to mount / as read-only. It doesn't really work for
me, so I might be wrong, but in that case /tmp would not be writable (unless
something in the initrd mounts /tmp as tmpfs)

> the only problem here remains that mountkernfs in sid does an automatic
> tmpfs on /tmp (unless /tmp is configured in fstab).

RAMTMP is on by default in wheezy too.

Also another case where RAMTMP seems reasonable for a live system
is if persistence is used. (another feature i haven't played around with
yet, so I might be wrong)




-- 
Purdea Andrei
http://purdea.ro
student at the “Politehnica” University of Timisoara
Faculty of Automation and Computers (AC)
Master's Degree Program - Computer Engineering (MCE)
2nd year




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Sat, 31 Dec 2011 09:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Sat, 31 Dec 2011 09:51:06 GMT) Full text and rfc822 format available.

Message #41 received at 653673@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: Andrei Purdea <andrei@purdea.ro>
Cc: 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Sat, 31 Dec 2011 10:46:53 +0100
On 12/31/2011 06:14 AM, Andrei Purdea wrote:
> --exposed-root is supposed to mount / as read-only.

..and make those directories rw that need to (which then would need to
include /tmp; but that's an issue from squeeze->sid that needs handling
anyway).

> RAMTMP is on by default in wheezy too.

[ naturally, yes. but we don't upload to wheezy, only to sid (and
testing gets whatever unstable has with some delays), so testing can be
ignored, we only care about stable and unstable at a time. ]

> Also another case where RAMTMP seems reasonable for a live system
> is if persistence is used. (another feature i haven't played around with
> yet, so I might be wrong)

right, but that's another issue.

i suggest we disable RAMTMP at build-time, and enable it at run-time
(by mounting tmpfs on /tmp manually through live-config, rather than
through mountkernfs) if there's persistency involved. in the case of
exposed root, /tmp is just another addition to the other rw directories.

that should cover all cases. any objections?

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Sat, 31 Dec 2011 09:51:11 GMT) Full text and rfc822 format available.

Acknowledgement sent to intrigeri <intrigeri+debian-live@boum.org>:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Sat, 31 Dec 2011 09:51:12 GMT) Full text and rfc822 format available.

Message #46 received at 653673@bugs.debian.org (full text, mbox):

From: intrigeri <intrigeri+debian-live@boum.org>
To: daniel.baumann@progress-technologies.net
Cc: 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Sat, 31 Dec 2011 10:49:01 +0100
Hi,

Daniel Baumann wrote (30 Dec 2011 22:57:22 GMT) :
> the only problem here remains that mountkernfs in sid does an
> automatic tmpfs on /tmp (unless /tmp is configured in fstab).

> since /tmp on a tmpfs for a live system has no merits in the first
> place, it's save to disable that. and that can be done with
> RAMTMP=no in /etc/default/rcS at build-time.

> that seems to be the most non-invasive solution to me.

Agreed; seems well for this specific bug report. However, considering
"/etc/init.d/live-config always has absolutely to be the first script
that gets executed, we do depend on that", how about adding a reverse
dependency to the live-config initscript, such as:

   X-Start-Before: mountkernfs

?

Cheers,
-- 
  intrigeri <intrigeri@boum.org>
  | GnuPG key @ https://gaffer.ptitcanardnoir.org/intrigeri/intrigeri.asc
  | OTR fingerprint @ https://gaffer.ptitcanardnoir.org/intrigeri/otr.asc
  | The impossible just takes a bit longer.




Information forwarded to debian-bugs-dist@lists.debian.org, Debian Live Project <debian-live@lists.debian.org>:
Bug#653673; Package live-config. (Sat, 31 Dec 2011 10:51:03 GMT) Full text and rfc822 format available.

Acknowledgement sent to daniel.baumann@progress-technologies.net:
Extra info received and forwarded to list. Copy sent to Debian Live Project <debian-live@lists.debian.org>. (Sat, 31 Dec 2011 10:51:08 GMT) Full text and rfc822 format available.

Message #51 received at 653673@bugs.debian.org (full text, mbox):

From: Daniel Baumann <daniel.baumann@progress-technologies.net>
To: intrigeri <intrigeri+debian-live@boum.org>
Cc: 653673@bugs.debian.org
Subject: Re: Bug#653673: the live-config init.d script should depend on mountkernfs
Date: Sat, 31 Dec 2011 11:48:48 +0100
On 12/31/2011 10:49 AM, intrigeri wrote:
>    X-Start-Before: mountkernfs

ack, thanks.

-- 
Address:        Daniel Baumann, Donnerbuehlweg 3, CH-3012 Bern
Email:          daniel.baumann@progress-technologies.net
Internet:       http://people.progress-technologies.net/~daniel.baumann/




Bug 653673 cloned as bug 658996. Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Tue, 07 Feb 2012 09:27:13 GMT) Full text and rfc822 format available.

Changed Bug title to 'improve handling of tmpfs on /tmp' from 'the live-config init.d script should depend on mountkernfs' Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Tue, 07 Feb 2012 09:27:17 GMT) Full text and rfc822 format available.

Bug 658996 cloned as bug 666985 Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Tue, 03 Apr 2012 06:33:03 GMT) Full text and rfc822 format available.

Bug reassigned from package 'live-config' to 'live-installer'. Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Tue, 03 Apr 2012 06:33:04 GMT) Full text and rfc822 format available.

No longer marked as found in versions live-config/3.0~a31-1. Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Tue, 03 Apr 2012 06:33:04 GMT) Full text and rfc822 format available.

Changed Bug title to 're-enable tmpfs on /tmp' from 'improve handling of tmpfs on /tmp' Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Tue, 03 Apr 2012 06:33:05 GMT) Full text and rfc822 format available.

Marked Bug as done Request was from Daniel Baumann <daniel.baumann@progress-technologies.net> to control@bugs.debian.org. (Tue, 03 Apr 2012 07:09:08 GMT) Full text and rfc822 format available.

Notification sent to Andrei Purdea <andrei@purdea.ro>:
Bug acknowledged by developer. (Tue, 03 Apr 2012 07:09:09 GMT) Full text and rfc822 format available.

Bug archived. Request was from Debbugs Internal Request <owner@bugs.debian.org> to internal_control@bugs.debian.org. (Tue, 01 May 2012 07:44:07 GMT) Full text and rfc822 format available.

Send a report that this bug log contains spam.


Debian bug tracking system administrator <owner@bugs.debian.org>. Last modified: Fri Apr 18 08:38:39 2014; Machine Name: beach.debian.org

Debian Bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.