Re: [systemd-devel] arch linux container filesystems

2014-06-20 Thread Lennart Poettering
On Mon, 16.06.14 17:37, Robin Becker (ro...@reportlab.com) wrote:

 
 On 16/06/2014 14:00, Dave Reisner wrote:
 On Mon, Jun 16, 2014 at 01:01:31PM +0100, Robin Becker wrote:
 
 
 Why do I have all the file system duplicates?
 
 You don't -- df doesn't understand namespaces. You should use a tool
 which reads from /proc/self/mountinfo instead of /etc/mtab, e.g.
 findmnt. If you want df-like output from findmnt, use 'findmnt -vD'.
 
 
 OK thanks; pity we have to abandon old tools and learn a lot of red
 hat stuff. Price of progress I guess.

well, findmnt is neither red hat stuff, it's used all over the
distributions. And you shouldn't accept that df can't deal with mount
points that reference out-of-namespace sources. File a bug against
coreutils, they really should make sure they properly handle the Linux
mount logic in that area.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] arch linux container filesystems

2014-06-20 Thread Lennart Poettering
On Mon, 16.06.14 13:01, Robin Becker (ro...@reportlab.com) wrote:

 I asked about this at the arch linux forum, but got no response.
 
 I run an up to date arch linux X64 system with systemd-213-9. I
 built a simple container using the wiki article
https://wiki.archlinux.org/index.php/Systemd-nspawn
 
 after systemd-nspawn -bD ~/MyContainer and root login I see this in my df 
 output
 
 root@MyContainer ~]# df
 df: '/run/user/1000': No such file or directory
 df: '/run/user/1000/gvfs': No such file or directory
 df: '/proc/kmsg (deleted)': No such file or directory
 df: '/proc/sys/kernel/random/boot_id (deleted)': No such file or directory
 Filesystem 1K-blocks Used Available Use% Mounted on
 /dev/sda1  147418744 85779872  54127364  62% /
 dev  14139004   1413896   1% /dev
 tmpfs14139000   1413900   0% /dev/shm
 tmpfs14139000   1413900   0% /sys/fs/cgroup
 run  1413900   44   1413856   1% /run
 tmpfs14139000   1413900   0% /tmp
 tmpfs14139004   1413896   1% /dev
 tmpfs14139000   1413900   0% /dev/shm
 tmpfs1413900   44   1413856   1% /run
 tmpfs14139000   1413900   0% /sys/fs/cgroup
 tmpfs14139000   1413900   0% /tmp
 tmpfs 2827840282784   0% /run/user/0
 [root@MyContainer ~]#

 Is this what is expected? Not sure why my user id (1000) is being
 used.

Every user who logs in will nowadays get his own little /run/user/$UID
tmpfs directory for runtime purposes, with a strict size limit. logind
manages. Since this is a mount df will show it.

 I can imagine containers might not have /proc/kmsg 
 /proc/sys/kernel/random/boot_id; is that an error in df?

These files oiginate in out-of-namespace files the container itself
can't see. coreutils should probably get fixed to handle this more
gracefully (see other mail).

 Why do I have all the file system duplicates?

Probably because /proc/mounts is a bit limited, and df should probably
be smarter and look at /proc/self/mountinfo instead (see other mail).

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] arch linux container filesystems

2014-06-20 Thread Robin Becker

On 20/06/2014 12:48, Lennart Poettering wrote:

well, findmnt is neither red hat stuff, it's used all over the
distributions. And you shouldn't accept that df can't deal with mount
points that reference out-of-namespace sources. File a bug against
coreutils, they really should make sure they properly handle the Linux
mount logic in that area.

Lennart
as a matter of fact, my manual page for findmnt lists Karel Zak 
k...@redhat.com as the sole author if findmnt; that others have adopted it 
doesn't make it not redhat stuff.


You are probably right that this should be fixed in df and (presumably all the 
other tools that don't work properly in systemd-nspawn containers), but as a 
general principle I believe if you break it, you own it applies here. As a 
novice user of these containers, I suspect this kind of error must have been 
seen before by the systemd developers, so someone among the systemd contributors 
probably has prior discovery rights to this bug as well.


In any case, some might argue that a container (lightweight or not) should be 
virtually indistinguishable from the original system which would mean such a bug 
could not happen.

--
Robin Becker
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] arch linux container filesystems

2014-06-20 Thread Lennart Poettering
On Fri, 20.06.14 15:47, Robin Becker (ro...@reportlab.com) wrote:

 
 On 20/06/2014 12:48, Lennart Poettering wrote:
 well, findmnt is neither red hat stuff, it's used all over the
 distributions. And you shouldn't accept that df can't deal with mount
 points that reference out-of-namespace sources. File a bug against
 coreutils, they really should make sure they properly handle the Linux
 mount logic in that area.
 
 Lennart
 as a matter of fact, my manual page for findmnt lists Karel Zak
 k...@redhat.com as the sole author if findmnt; that others have
 adopted it doesn't make it not redhat stuff.
 
 You are probably right that this should be fixed in df and
 (presumably all the other tools that don't work properly in
 systemd-nspawn containers), but as a general principle I believe if
 you break it, you own it applies here. As a novice user of these
 containers, I suspect this kind of error must have been seen before
 by the systemd developers, so someone among the systemd contributors
 probably has prior discovery rights to this bug as well.

mount namespaces and bind mounts are in no way a systemd invention. We
didn't come up with this, we are not the first users. That's a kernel
feature, and since a long time. You might not have noticed this before
nspawn, but that's just bad luck, it could have been any other software
that uses mount namespaces, like LXC, docker, ... This is in no way a
systemd issue, but a general Linux issue.

 In any case, some might argue that a container (lightweight or not)
 should be virtually indistinguishable from the original system which
 would mean such a bug could not happen.

Well, these are containers not VMs. They are actually massively
different from the host. For example /sys nor /dev are virtualized, and
they are unlikely to ever be. Neither is SELinux or anythign like that.

Containers *are* distuingishable from normal hosts, and that's by
design. And in no way systemd's design but Linux kernel stuff.

You are barking up the wrong tree, we didn't introduce these concepts,
you just happened to run into them for the first time playing around
with systemd, but that's just bad luck.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] arch linux container filesystems

2014-06-16 Thread Robin Becker

I asked about this at the arch linux forum, but got no response.

I run an up to date arch linux X64 system with systemd-213-9. I built a simple 
container using the wiki article

   https://wiki.archlinux.org/index.php/Systemd-nspawn

after systemd-nspawn -bD ~/MyContainer and root login I see this in my df output


root@MyContainer ~]# df
df: '/run/user/1000': No such file or directory
df: '/run/user/1000/gvfs': No such file or directory
df: '/proc/kmsg (deleted)': No such file or directory
df: '/proc/sys/kernel/random/boot_id (deleted)': No such file or directory
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/sda1  147418744 85779872  54127364  62% /
dev  14139004   1413896   1% /dev
tmpfs14139000   1413900   0% /dev/shm
tmpfs14139000   1413900   0% /sys/fs/cgroup
run  1413900   44   1413856   1% /run
tmpfs14139000   1413900   0% /tmp
tmpfs14139004   1413896   1% /dev
tmpfs14139000   1413900   0% /dev/shm
tmpfs1413900   44   1413856   1% /run
tmpfs14139000   1413900   0% /sys/fs/cgroup
tmpfs14139000   1413900   0% /tmp
tmpfs 2827840282784   0% /run/user/0
[root@MyContainer ~]#



Is this what is expected? Not sure why my user id (1000) is being used.

I can imagine containers might not have /proc/kmsg  
/proc/sys/kernel/random/boot_id; is that an error in df?


Why do I have all the file system duplicates?
--
Robin Becker
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] arch linux container filesystems

2014-06-16 Thread Dave Reisner
On Mon, Jun 16, 2014 at 01:01:31PM +0100, Robin Becker wrote:
 I asked about this at the arch linux forum, but got no response.
 
 I run an up to date arch linux X64 system with systemd-213-9. I built a
 simple container using the wiki article
https://wiki.archlinux.org/index.php/Systemd-nspawn
 
 after systemd-nspawn -bD ~/MyContainer and root login I see this in my df 
 output
 
 root@MyContainer ~]# df
 df: '/run/user/1000': No such file or directory
 df: '/run/user/1000/gvfs': No such file or directory
 df: '/proc/kmsg (deleted)': No such file or directory
 df: '/proc/sys/kernel/random/boot_id (deleted)': No such file or directory
 Filesystem 1K-blocks Used Available Use% Mounted on
 /dev/sda1  147418744 85779872  54127364  62% /
 dev  14139004   1413896   1% /dev
 tmpfs14139000   1413900   0% /dev/shm
 tmpfs14139000   1413900   0% /sys/fs/cgroup
 run  1413900   44   1413856   1% /run
 tmpfs14139000   1413900   0% /tmp
 tmpfs14139004   1413896   1% /dev
 tmpfs14139000   1413900   0% /dev/shm
 tmpfs1413900   44   1413856   1% /run
 tmpfs14139000   1413900   0% /sys/fs/cgroup
 tmpfs14139000   1413900   0% /tmp
 tmpfs 2827840282784   0% /run/user/0
 [root@MyContainer ~]#
 
 
 Is this what is expected? Not sure why my user id (1000) is being used.
 
 I can imagine containers might not have /proc/kmsg 
 /proc/sys/kernel/random/boot_id; is that an error in df?
 
 Why do I have all the file system duplicates?

You don't -- df doesn't understand namespaces. You should use a tool
which reads from /proc/self/mountinfo instead of /etc/mtab, e.g.
findmnt. If you want df-like output from findmnt, use 'findmnt -vD'.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] arch linux container filesystems

2014-06-16 Thread Robin Becker

On 16/06/2014 14:00, Dave Reisner wrote:

On Mon, Jun 16, 2014 at 01:01:31PM +0100, Robin Becker wrote:




Why do I have all the file system duplicates?


You don't -- df doesn't understand namespaces. You should use a tool
which reads from /proc/self/mountinfo instead of /etc/mtab, e.g.
findmnt. If you want df-like output from findmnt, use 'findmnt -vD'.


OK thanks; pity we have to abandon old tools and learn a lot of red hat stuff. 
Price of progress I guess.

--
Robin Becker
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel