unofficial mirror of bug-guix@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64775: /run should be cleaned on boot
@ 2023-07-21 19:23 Vagrant Cascadian
  2023-07-21 19:36 ` Csepp
  0 siblings, 1 reply; 9+ messages in thread
From: Vagrant Cascadian @ 2023-07-21 19:23 UTC (permalink / raw)
  To: 64775

[-- Attachment #1: Type: text/plain, Size: 1192 bytes --]

So, if there are files sitting around in /run, they do not get cleaned
up unless it is something guix is already aware of
(e.g. /run/setuid-programs).

I noticed this when experimenting with:

  https://issues.guix.gnu.org/61462
  Add support for file capabilities(7)

Even after a reboot, the leftovers from that experimental patchset were
still present in /run...

While I know that Guix does not really follow the FHS in most respects,
maybe the intention of /run defined there should still be respected?

  https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html

  3.15. /run : Run-time variable data
  3.15.1. Purpose

  This directory contains system information data describing the system
  since it was booted. Files under this directory must be cleared
  (removed or truncated as appropriate) at the beginning of the boot
  process.
  ...

Many distros implement this by having /run on a tmpfs, but making sure
to clean up /run at boot seems like a reasonable thing to do at the very
least.

I am not sure if it makes sense to do housecleaning of /run from guix
system reconfigure ... as there may be legitimate uses for other
processes to write there.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
  2023-07-21 19:23 bug#64775: /run should be cleaned on boot Vagrant Cascadian
@ 2023-07-21 19:36 ` Csepp
  2023-07-21 19:57   ` Vagrant Cascadian
  0 siblings, 1 reply; 9+ messages in thread
From: Csepp @ 2023-07-21 19:36 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64775


Vagrant Cascadian <vagrant@debian.org> writes:

> [[PGP Signed Part:Undecided]]
> So, if there are files sitting around in /run, they do not get cleaned
> up unless it is something guix is already aware of
> (e.g. /run/setuid-programs).
>
> I noticed this when experimenting with:
>
>   https://issues.guix.gnu.org/61462
>   Add support for file capabilities(7)
>
> Even after a reboot, the leftovers from that experimental patchset were
> still present in /run...
>
> While I know that Guix does not really follow the FHS in most respects,
> maybe the intention of /run defined there should still be respected?
>
>   https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html
>
>   3.15. /run : Run-time variable data
>   3.15.1. Purpose
>
>   This directory contains system information data describing the system
>   since it was booted. Files under this directory must be cleared
>   (removed or truncated as appropriate) at the beginning of the boot
>   process.
>   ...
>
> Many distros implement this by having /run on a tmpfs, but making sure
> to clean up /run at boot seems like a reasonable thing to do at the very
> least.
>
> I am not sure if it makes sense to do housecleaning of /run from guix
> system reconfigure ... as there may be legitimate uses for other
> processes to write there.
>
>
> live well,
>   vagrant
>
> [[End of PGP Signed Part]]

I vote for TMPFS, since that would also reduce flash wear.
Honestly I don't get why it's not already using TMPFS.




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
  2023-07-21 19:36 ` Csepp
@ 2023-07-21 19:57   ` Vagrant Cascadian
  2023-07-21 20:24     ` Saku Laesvuori via Bug reports for GNU Guix
  0 siblings, 1 reply; 9+ messages in thread
From: Vagrant Cascadian @ 2023-07-21 19:57 UTC (permalink / raw)
  To: Csepp; +Cc: 64775

[-- Attachment #1: Type: text/plain, Size: 1453 bytes --]

On 2023-07-21, Csepp wrote:
> Vagrant Cascadian <vagrant@debian.org> writes:
>> While I know that Guix does not really follow the FHS in most respects,
>> maybe the intention of /run defined there should still be respected?
>>
>>   https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s15.html
>>
>>   3.15. /run : Run-time variable data
>>   3.15.1. Purpose
>>
>>   This directory contains system information data describing the system
>>   since it was booted. Files under this directory must be cleared
>>   (removed or truncated as appropriate) at the beginning of the boot
>>   process.
>>   ...
>>
>> Many distros implement this by having /run on a tmpfs, but making sure
>> to clean up /run at boot seems like a reasonable thing to do at the very
>> least.
>>
>> I am not sure if it makes sense to do housecleaning of /run from guix
>> system reconfigure ... as there may be legitimate uses for other
>> processes to write there.
...
> I vote for TMPFS, since that would also reduce flash wear.
> Honestly I don't get why it's not already using TMPFS.

One argument could be how much ram it takes:

  $ du -sc /run/*
  12      /run/blkid
  0       /run/booted-system
  0       /run/current-system
  1312    /run/setuid-programs
  524     /run/udev
  1848    total

That is with no explicit setuid programs configured, on a machine with a
fairly minimal configuration.

Not a *huge* amount of ram, but not nothing, either...

live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
  2023-07-21 19:57   ` Vagrant Cascadian
@ 2023-07-21 20:24     ` Saku Laesvuori via Bug reports for GNU Guix
  2023-08-06 13:18       ` Hilton Chain via Bug reports for GNU Guix
  0 siblings, 1 reply; 9+ messages in thread
From: Saku Laesvuori via Bug reports for GNU Guix @ 2023-07-21 20:24 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64775, Csepp

[-- Attachment #1: Type: text/plain, Size: 771 bytes --]

> > I vote for TMPFS, since that would also reduce flash wear.
> > Honestly I don't get why it's not already using TMPFS.
>
> One argument could be how much ram it takes:
> 
>   $ du -sc /run/*
>   12      /run/blkid
>   0       /run/booted-system
>   0       /run/current-system
>   1312    /run/setuid-programs
>   524     /run/udev
>   1848    total
> 
> That is with no explicit setuid programs configured, on a machine with a
> fairly minimal configuration.
> 
> Not a *huge* amount of ram, but not nothing, either...

I'd say it's effectively nothing for almost all devices capable of
running Guix. On my laptop the size of /run is 4804 (4.7M). In a quick
test one terminal window with only zsh running in it took almost 10
times as much ram.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
  2023-07-21 20:24     ` Saku Laesvuori via Bug reports for GNU Guix
@ 2023-08-06 13:18       ` Hilton Chain via Bug reports for GNU Guix
  2023-08-06 20:06         ` Vagrant Cascadian
  2023-08-07 14:39         ` Maxim Cournoyer
  0 siblings, 2 replies; 9+ messages in thread
From: Hilton Chain via Bug reports for GNU Guix @ 2023-08-06 13:18 UTC (permalink / raw)
  To: 64775; +Cc: Vagrant Cascadian, Saku Laesvuori, Csepp

Hi all,

On Sat, 22 Jul 2023 04:24:17 +0800,
Saku Laesvuori via Bug reports for GNU Guix wrote:
>
> [1  <text/plain; us-ascii (quoted-printable)>]
> > > I vote for TMPFS, since that would also reduce flash wear.
> > > Honestly I don't get why it's not already using TMPFS.
> >
> > One argument could be how much ram it takes:
> >
> >   $ du -sc /run/*
> >   12      /run/blkid
> >   0       /run/booted-system
> >   0       /run/current-system
> >   1312    /run/setuid-programs
> >   524     /run/udev
> >   1848    total
> >
> > That is with no explicit setuid programs configured, on a machine with a
> > fairly minimal configuration.
> >
> > Not a *huge* amount of ram, but not nothing, either...
>
> I'd say it's effectively nothing for almost all devices capable of
> running Guix. On my laptop the size of /run is 4804 (4.7M). In a quick
> test one terminal window with only zsh running in it took almost 10
> times as much ram.
> [2 signature.asc <application/pgp-signature (7bit)>]
> No public key for 257D284A2A1D3A32 created at 2023-07-22T04:24:17+0800 using RSA

I'm currently using tmpfs for /tmp, /run and /var/run on my Guix
Systems.

If you are interested, this is my base file systems:
--8<---------------cut here---------------start------------->8---
(cons* (file-system
         (device "none")
         (mount-point "/tmp")
         (type "tmpfs")
         (check? #f))

       (file-system
         (device "none")
         (mount-point "/run")
         (type "tmpfs")
         (needed-for-boot? #t)
         (check? #f))

       (file-system
         (device "none")
         (mount-point "/var/run")
         (type "tmpfs")
         (needed-for-boot? #t)
         (check? #f))

       (delete %debug-file-system
               %base-file-systems))
--8<---------------cut here---------------end--------------->8---

Thanks




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
  2023-08-06 13:18       ` Hilton Chain via Bug reports for GNU Guix
@ 2023-08-06 20:06         ` Vagrant Cascadian
  2023-08-07  1:33           ` Hilton Chain via Bug reports for GNU Guix
  2023-08-07 14:39         ` Maxim Cournoyer
  1 sibling, 1 reply; 9+ messages in thread
From: Vagrant Cascadian @ 2023-08-06 20:06 UTC (permalink / raw)
  To: Hilton Chain, 64775; +Cc: Saku Laesvuori, Csepp

[-- Attachment #1: Type: text/plain, Size: 2326 bytes --]

On 2023-08-06, Hilton Chain wrote:
> On Sat, 22 Jul 2023 04:24:17 +0800,
> Saku Laesvuori via Bug reports for GNU Guix wrote:
>>
>> [1  <text/plain; us-ascii (quoted-printable)>]
>> > > I vote for TMPFS, since that would also reduce flash wear.
>> > > Honestly I don't get why it's not already using TMPFS.
>> >
>> > One argument could be how much ram it takes:
>> >
>> >   $ du -sc /run/*
>> >   12      /run/blkid
>> >   0       /run/booted-system
>> >   0       /run/current-system
>> >   1312    /run/setuid-programs
>> >   524     /run/udev
>> >   1848    total
>> >
>> > That is with no explicit setuid programs configured, on a machine with a
>> > fairly minimal configuration.
>> >
>> > Not a *huge* amount of ram, but not nothing, either...
>>
>> I'd say it's effectively nothing for almost all devices capable of
>> running Guix. On my laptop the size of /run is 4804 (4.7M). In a quick
>> test one terminal window with only zsh running in it took almost 10
>> times as much ram.
>> [2 signature.asc <application/pgp-signature (7bit)>]
>> No public key for 257D284A2A1D3A32 created at 2023-07-22T04:24:17+0800 using RSA
>
> I'm currently using tmpfs for /tmp, /run and /var/run on my Guix
> Systems.
>
> If you are interested, this is my base file systems:
> --8<---------------cut here---------------start------------->8---
> (cons* (file-system
>          (device "none")
>          (mount-point "/tmp")
>          (type "tmpfs")
>          (check? #f))
>
>        (file-system
>          (device "none")
>          (mount-point "/run")
>          (type "tmpfs")
>          (needed-for-boot? #t)
>          (check? #f))
>
>        (file-system
>          (device "none")
>          (mount-point "/var/run")
>          (type "tmpfs")
>          (needed-for-boot? #t)
>          (check? #f))

You probably want to restrict permissions on /run and /var/run, as the
defaults for tmpfs are world-writeable, allowing any user or process to
create files or directories in potentially harmful ways...

For /tmp, these defaults are appropriate, however tricky a
world-writeable directory is...

Although I rarely have enough spare ram on a system to have /tmp be
tmpfs for Guix System because builds happen there by default, and
occasionally I need a lot more space than available ram in some cases.


live well,
  vagrant

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 227 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
  2023-08-06 20:06         ` Vagrant Cascadian
@ 2023-08-07  1:33           ` Hilton Chain via Bug reports for GNU Guix
  0 siblings, 0 replies; 9+ messages in thread
From: Hilton Chain via Bug reports for GNU Guix @ 2023-08-07  1:33 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: 64775, Saku Laesvuori, Csepp

On Mon, 07 Aug 2023 04:06:37 +0800,
Vagrant Cascadian wrote:
>
> [1  <text/plain (7bit)>]
> On 2023-08-06, Hilton Chain wrote:
> > On Sat, 22 Jul 2023 04:24:17 +0800,
> > Saku Laesvuori via Bug reports for GNU Guix wrote:
> >>
> >> [1  <text/plain; us-ascii (quoted-printable)>]
> >> > > I vote for TMPFS, since that would also reduce flash wear.
> >> > > Honestly I don't get why it's not already using TMPFS.
> >> >
> >> > One argument could be how much ram it takes:
> >> >
> >> >   $ du -sc /run/*
> >> >   12      /run/blkid
> >> >   0       /run/booted-system
> >> >   0       /run/current-system
> >> >   1312    /run/setuid-programs
> >> >   524     /run/udev
> >> >   1848    total
> >> >
> >> > That is with no explicit setuid programs configured, on a machine with a
> >> > fairly minimal configuration.
> >> >
> >> > Not a *huge* amount of ram, but not nothing, either...
> >>
> >> I'd say it's effectively nothing for almost all devices capable of
> >> running Guix. On my laptop the size of /run is 4804 (4.7M). In a quick
> >> test one terminal window with only zsh running in it took almost 10
> >> times as much ram.
> >> [2 signature.asc <application/pgp-signature (7bit)>]
> >> No public key for 257D284A2A1D3A32 created at 2023-07-22T04:24:17+0800 using RSA
> >
> > I'm currently using tmpfs for /tmp, /run and /var/run on my Guix
> > Systems.
> >
> > If you are interested, this is my base file systems:
> > --8<---------------cut here---------------start------------->8---
> > (cons* (file-system
> >          (device "none")
> >          (mount-point "/tmp")
> >          (type "tmpfs")
> >          (check? #f))
> >
> >        (file-system
> >          (device "none")
> >          (mount-point "/run")
> >          (type "tmpfs")
> >          (needed-for-boot? #t)
> >          (check? #f))
> >
> >        (file-system
> >          (device "none")
> >          (mount-point "/var/run")
> >          (type "tmpfs")
> >          (needed-for-boot? #t)
> >          (check? #f))
>
> You probably want to restrict permissions on /run and /var/run, as the
> defaults for tmpfs are world-writeable, allowing any user or process to
> create files or directories in potentially harmful ways...
>
> For /tmp, these defaults are appropriate, however tricky a
> world-writeable directory is...

I have set the mode and size limit on them.

Thank you so much!  Otherwise I won't notice that...

> Although I rarely have enough spare ram on a system to have /tmp be
> tmpfs for Guix System because builds happen there by default, and
> occasionally I need a lot more space than available ram in some cases.

I have enough RAM for builds I currently do on my laptop and it's the
builder for other systems, so tmpfs is fine for me.

Thanks




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
  2023-08-06 13:18       ` Hilton Chain via Bug reports for GNU Guix
  2023-08-06 20:06         ` Vagrant Cascadian
@ 2023-08-07 14:39         ` Maxim Cournoyer
  1 sibling, 0 replies; 9+ messages in thread
From: Maxim Cournoyer @ 2023-08-07 14:39 UTC (permalink / raw)
  To: 64775; +Cc: vagrant, hako, saku, raingloom

Hi,

Hilton Chain via Bug reports for GNU Guix <bug-guix@gnu.org> writes:

> Hi all,
>
> On Sat, 22 Jul 2023 04:24:17 +0800,
> Saku Laesvuori via Bug reports for GNU Guix wrote:
>>
>> [1  <text/plain; us-ascii (quoted-printable)>]
>> > > I vote for TMPFS, since that would also reduce flash wear.
>> > > Honestly I don't get why it's not already using TMPFS.
>> >
>> > One argument could be how much ram it takes:
>> >
>> >   $ du -sc /run/*
>> >   12      /run/blkid
>> >   0       /run/booted-system
>> >   0       /run/current-system
>> >   1312    /run/setuid-programs
>> >   524     /run/udev
>> >   1848    total
>> >
>> > That is with no explicit setuid programs configured, on a machine with a
>> > fairly minimal configuration.
>> >
>> > Not a *huge* amount of ram, but not nothing, either...
>>
>> I'd say it's effectively nothing for almost all devices capable of
>> running Guix. On my laptop the size of /run is 4804 (4.7M). In a quick
>> test one terminal window with only zsh running in it took almost 10
>> times as much ram.
>> [2 signature.asc <application/pgp-signature (7bit)>]
>> No public key for 257D284A2A1D3A32 created at 2023-07-22T04:24:17+0800 using RSA
>
> I'm currently using tmpfs for /tmp, /run and /var/run on my Guix
> Systems.

Without reviewing how our code base uses /run, it seems reasonable that
this should be on a tmpfs.  Can anyone think of a reason not to do so?
Otherwise, I suggest we make it so.

-- 
Thanks,
Maxim




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#64775: /run should be cleaned on boot
       [not found]         ` <87o7ipvbhh.fsf__48662.4622646318$1693341314$gmane$org@wireframe>
@ 2023-08-29 21:21           ` brian via Bug reports for GNU Guix
  0 siblings, 0 replies; 9+ messages in thread
From: brian via Bug reports for GNU Guix @ 2023-08-29 21:21 UTC (permalink / raw)
  To: Vagrant Cascadian; +Cc: Ludovic Courtès, 64775, 61462

Vagrant Cascadian <vagrant@debian.org> writes:

> On 2023-08-08, Ludovic Courtès wrote:
>> We could try to make that change: /run as tmpfs, or wiped by
>> ‘cleanup-service-type’.
>
> Or both, really!
>
> Filed:
>
>   https://issues.guix.gnu.org/64775

I tried this a while ago, and the trivial case of mounting /run as tmpfs
in the operating-system definition causes errors during activation. It
turns out that the /run/current-system symlink is activated before all
non-root mounts, so mounting /run afterwards causes everything to break.

I don't have a solution, and haven't even looked at it past this, but
maybe this report will help.

-bjc




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-29 21:28 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-21 19:23 bug#64775: /run should be cleaned on boot Vagrant Cascadian
2023-07-21 19:36 ` Csepp
2023-07-21 19:57   ` Vagrant Cascadian
2023-07-21 20:24     ` Saku Laesvuori via Bug reports for GNU Guix
2023-08-06 13:18       ` Hilton Chain via Bug reports for GNU Guix
2023-08-06 20:06         ` Vagrant Cascadian
2023-08-07  1:33           ` Hilton Chain via Bug reports for GNU Guix
2023-08-07 14:39         ` Maxim Cournoyer
     [not found] <87r0uuehlr.fsf@nckx>
     [not found] ` <129e8d298556f6a159fcb704ed3df4bf0709ddd3.1689465600.git.me@tobias.gr>
     [not found]   ` <87edl1yu2k.fsf@wireframe>
     [not found]     ` <87bkg5yt91.fsf@wireframe>
     [not found]       ` <87r0odpmot.fsf_-_@gnu.org>
     [not found]         ` <87o7ipvbhh.fsf__48662.4622646318$1693341314$gmane$org@wireframe>
2023-08-29 21:21           ` brian via Bug reports for GNU Guix

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).