[Lxc-users] /proc/<process id>/ns is not found
Greg Kurz
gkurz at fr.ibm.com
Fri Nov 4 21:04:34 UTC 2011
On Fri, 2011-11-04 at 08:15 -0700, Dong-In David Kang wrote:
> Here is the output of
> $ lxc-attach -n foo -- ps -ef --forest.
>
> (I've changed lxc-attach a little bit so that I can provide processor id instead of the name of lxc process.
> I've started the lxc process using libvirt.
> The process id of the lxc process is 4921.)
>
I'm not familiar with libvirt, but from the ps output below, it appears
that the pid you're interested in is the one running /sbin/init (4922).
It's the first process, with pid 1, in the container. The libvirt_lxc
(4921) process seems to be the container parent.
>
> [root at gpu2 lxc]# lxc-attach -n 4921 -- ps -ef --forest
> lxc-attach: No such file or directory - failed to exec 'ps'
> [root at gpu2 lxc]# lxc-attach -n 4921 -- /bin/ps -ef --forest
> UID PID PPID C STIME TTY TIME CMD
> root 2 0 0 Nov03 ? 00:00:00 [kthreadd]
> root 3 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/0]
> root 6 2 0 Nov03 ? 00:00:00 \_ [migration/0]
> root 7 2 0 Nov03 ? 00:00:00 \_ [watchdog/0]
> root 8 2 0 Nov03 ? 00:00:00 \_ [migration/1]
> root 9 2 0 Nov03 ? 00:00:00 \_ [kworker/1:0]
> root 10 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/1]
> root 12 2 0 Nov03 ? 00:00:00 \_ [watchdog/1]
> root 13 2 0 Nov03 ? 00:00:00 \_ [migration/2]
> root 14 2 0 Nov03 ? 00:00:00 \_ [kworker/2:0]
> root 15 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/2]
> root 16 2 0 Nov03 ? 00:00:00 \_ [watchdog/2]
> root 17 2 0 Nov03 ? 00:00:00 \_ [migration/3]
> root 18 2 0 Nov03 ? 00:00:00 \_ [kworker/3:0]
> root 19 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/3]
> root 20 2 0 Nov03 ? 00:00:00 \_ [watchdog/3]
> root 21 2 0 Nov03 ? 00:00:00 \_ [migration/4]
> root 23 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/4]
> root 24 2 0 Nov03 ? 00:00:00 \_ [watchdog/4]
> root 25 2 0 Nov03 ? 00:00:00 \_ [migration/5]
> root 26 2 0 Nov03 ? 00:00:01 \_ [kworker/5:0]
> root 27 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/5]
> root 28 2 0 Nov03 ? 00:00:00 \_ [watchdog/5]
> root 29 2 0 Nov03 ? 00:00:00 \_ [migration/6]
> root 30 2 0 Nov03 ? 00:00:00 \_ [kworker/6:0]
> root 31 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/6]
> root 32 2 0 Nov03 ? 00:00:00 \_ [watchdog/6]
> root 33 2 0 Nov03 ? 00:00:00 \_ [migration/7]
> root 34 2 0 Nov03 ? 00:00:00 \_ [kworker/7:0]
> root 35 2 0 Nov03 ? 00:00:00 \_ [ksoftirqd/7]
> root 36 2 0 Nov03 ? 00:00:00 \_ [watchdog/7]
> root 37 2 0 Nov03 ? 00:00:00 \_ [cpuset]
> root 38 2 0 Nov03 ? 00:00:00 \_ [khelper]
> root 39 2 0 Nov03 ? 00:00:00 \_ [netns]
> root 40 2 0 Nov03 ? 00:00:00 \_ [sync_supers]
> root 41 2 0 Nov03 ? 00:00:00 \_ [bdi-default]
> root 42 2 0 Nov03 ? 00:00:00 \_ [kintegrityd]
> root 43 2 0 Nov03 ? 00:00:00 \_ [kblockd]
> root 44 2 0 Nov03 ? 00:00:00 \_ [ata_sff]
> root 45 2 0 Nov03 ? 00:00:00 \_ [khubd]
> root 46 2 0 Nov03 ? 00:00:00 \_ [md]
> root 47 2 0 Nov03 ? 00:00:00 \_ [kworker/1:1]
> root 48 2 0 Nov03 ? 00:00:01 \_ [kworker/2:1]
> root 49 2 0 Nov03 ? 00:00:00 \_ [kworker/3:1]
> root 50 2 0 Nov03 ? 00:00:02 \_ [kworker/4:1]
> root 52 2 0 Nov03 ? 00:00:01 \_ [kworker/6:1]
> root 53 2 0 Nov03 ? 00:00:00 \_ [kworker/7:1]
> root 54 2 0 Nov03 ? 00:00:00 \_ [khungtaskd]
> root 55 2 0 Nov03 ? 00:00:02 \_ [kswapd0]
> root 56 2 0 Nov03 ? 00:00:00 \_ [ksmd]
> root 57 2 0 Nov03 ? 00:00:00 \_ [khugepaged]
> root 58 2 0 Nov03 ? 00:00:00 \_ [fsnotify_mark]
> root 59 2 0 Nov03 ? 00:00:00 \_ [aio]
> root 60 2 0 Nov03 ? 00:00:00 \_ [crypto]
> root 65 2 0 Nov03 ? 00:00:00 \_ [kthrotld]
> root 67 2 0 Nov03 ? 00:00:00 \_ [kpsmoused]
> root 89 2 0 Nov03 ? 00:00:03 \_ [kworker/0:2]
> root 235 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_0]
> root 236 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_1]
> root 241 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_2]
> root 242 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_3]
> root 243 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_4]
> root 244 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_5]
> root 245 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_6]
> root 246 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_7]
> root 256 2 0 Nov03 ? 00:00:00 \_ [mpt_poll_0]
> root 257 2 0 Nov03 ? 00:00:00 \_ [mpt/0]
> root 258 2 0 Nov03 ? 00:00:00 \_ [scsi_eh_8]
> root 373 2 0 Nov03 ? 00:00:00 \_ [kdmflush]
> root 375 2 0 Nov03 ? 00:00:00 \_ [kdmflush]
> root 400 2 0 Nov03 ? 00:00:04 \_ [jbd2/dm-0-8]
> root 401 2 0 Nov03 ? 00:00:00 \_ [ext4-dio-unwrit]
> root 795 2 0 Nov03 ? 00:00:00 \_ [hd-audio0]
> root 798 2 0 Nov03 ? 00:00:00 \_ [hd-audio1]
> root 799 2 0 Nov03 ? 00:00:00 \_ [hd-audio2]
> root 800 2 0 Nov03 ? 00:00:00 \_ [hd-audio3]
> root 831 2 0 Nov03 ? 00:00:00 \_ [edac-poller]
> root 878 2 0 Nov03 ? 00:00:00 \_ [mlx4]
> root 882 2 0 Nov03 ? 00:00:00 \_ [mlx4_en]
> root 884 2 0 Nov03 ? 00:00:00 \_ [mlx4_ib]
> root 885 2 0 Nov03 ? 00:00:00 \_ [ib_mad1]
> root 886 2 0 Nov03 ? 00:00:00 \_ [ib_mad2]
> root 1079 2 0 Nov03 ? 00:00:00 \_ [kvm-irqfd-clean]
> root 1124 2 0 Nov03 ? 00:00:00 \_ [jbd2/sdb1-8]
> root 1125 2 0 Nov03 ? 00:00:00 \_ [ext4-dio-unwrit]
> root 1126 2 0 Nov03 ? 00:00:00 \_ [loop0]
> root 1185 2 0 Nov03 ? 00:00:00 \_ [kauditd]
> root 1384 2 0 Nov03 ? 00:00:02 \_ [kworker/4:2]
> root 1386 2 0 Nov03 ? 00:00:03 \_ [flush-253:0]
> root 1695 2 0 Nov03 ? 00:00:00 \_ [rpciod]
> root 1764 2 0 Nov03 ? 00:00:00 \_ [nfsiod]
> root 1766 2 0 Nov03 ? 00:00:00 \_ [nfsv4.0-svc]
> root 4279 2 0 Nov03 ? 00:00:00 \_ [kworker/5:2]
> root 4690 2 0 Nov03 ? 00:00:00 \_ [flush-7:1]
> root 4698 2 0 Nov03 ? 00:00:00 \_ [loop1]
> root 4710 2 0 Nov03 ? 00:00:02 \_ [kworker/0:0]
> root 22018 2 0 Nov03 ? 00:00:00 \_ [flush-0:29]
> root 15337 2 0 10:31 ? 00:00:00 \_ [kworker/u:2]
> root 16389 2 0 11:04 ? 00:00:00 \_ [kworker/u:1]
> root 16538 2 0 11:10 ? 00:00:00 \_ [kworker/u:0]
> root 1 0 0 Nov03 ? 00:00:01 /sbin/init
> root 499 1 0 Nov03 ? 00:00:00 /sbin/udevd -d
> root 5265 499 0 Nov03 ? 00:00:00 \_ /sbin/udevd -d
> root 5266 499 0 Nov03 ? 00:00:00 \_ /sbin/udevd -d
> root 1577 1 0 Nov03 ? 00:00:00 auditd
> root 1602 1 0 Nov03 ? 00:00:00 /sbin/rsyslogd -c 4
> root 1627 1 0 Nov03 ? 00:00:16 irqbalance
> rpc 1646 1 0 Nov03 ? 00:00:00 rpcbind
> rpcuser 1664 1 0 Nov03 ? 00:00:00 rpc.statd
> root 1702 1 0 Nov03 ? 00:00:00 rpc.idmapd
> dbus 1732 1 0 Nov03 ? 00:00:00 dbus-daemon --system
> root 1744 1 0 Nov03 ? 00:00:00 cupsd -C /etc/cups/cupsd.conf
> 68 1782 1 0 Nov03 ? 00:00:00 hald
> root 1783 1782 0 Nov03 ? 00:00:00 \_ hald-runner
> root 1811 1783 0 Nov03 ? 00:00:00 \_ hald-addon-input: Listening on /dev/input/event0
> root 1842 1 0 Nov03 ? 00:00:00 /usr/sbin/ypbind
> root 1866 1 0 Nov03 ? 00:00:00 automount --pid-file /var/run/autofs.pid
> root 1885 1 0 Nov03 ? 00:00:00 /usr/sbin/sshd
> root 3408 1885 0 Nov03 ? 00:00:00 \_ sshd: dkang [priv]
> dkang 3487 3408 0 Nov03 ? 00:00:00 | \_ sshd: dkang at pts/0
> dkang 3489 3487 0 Nov03 pts/0 00:00:00 | \_ -bash
> root 4531 3489 0 Nov03 pts/0 00:00:00 | \_ sudo bash
> root 4535 4531 0 Nov03 pts/0 00:00:00 | \_ bash
> root 16552 4535 0 11:10 pts/0 00:00:00 | \_ lxc-attach -n 4921 -- /bin/ps -ef --forest
> root 16553 16552 6 11:10 pts/0 00:00:00 | \_ /bin/ps -ef --forest
> root 10234 1885 0 09:04 ? 00:00:00 \_ sshd: dkang [priv]
> dkang 10237 10234 0 09:04 ? 00:00:00 | \_ sshd: dkang at pts/1
> dkang 10238 10237 0 09:04 pts/1 00:00:00 | \_ -bash
> root 10259 10238 0 09:04 pts/1 00:00:00 | \_ sudo bash
> root 10262 10259 0 09:04 pts/1 00:00:00 | \_ bash
> root 10290 10262 0 09:05 pts/1 00:00:00 | \_ vim 0018-add-setns-syscall-for-x86.patch
> root 15490 1885 0 10:36 ? 00:00:00 \_ sshd: mkkang [priv]
> mkkang 15493 15490 0 10:36 ? 00:00:00 | \_ sshd: mkkang at pts/2
> mkkang 15494 15493 0 10:36 pts/2 00:00:00 | \_ -bash
> root 15515 15494 0 10:36 pts/2 00:00:00 | \_ sudo sh
> root 15518 15515 0 10:36 pts/2 00:00:00 | \_ sh
> root 16142 1885 0 10:57 ? 00:00:00 \_ sshd: lorin [priv]
> lorin 16144 16142 0 10:57 ? 00:00:00 \_ sshd: lorin at pts/3
> lorin 16145 16144 0 10:57 pts/3 00:00:00 \_ -bash
> root 1893 1 0 Nov03 ? 00:00:00 xinetd -stayalive -pidfile /var/run/xinetd.pid
> ntp 1901 1 0 Nov03 ? 00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -g
> root 1937 1 0 Nov03 ? 00:00:00 /bin/sh /usr/bin/mysqld_safe --datadir=/var/lib/mysql --socket=/var/lib/mysql/mysql.sock --pid-file=/var/run/mysqld/mysqld.pid --basedir=/usr --user=mysql
> mysql 2026 1937 0 Nov03 ? 00:00:40 \_ /usr/libexec/mysqld --basedir=/usr --datadir=/var/lib/mysql --user=mysql --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
> root 2117 1 0 Nov03 ? 00:00:00 /usr/libexec/postfix/master
> postfix 2131 2117 0 Nov03 ? 00:00:00 \_ qmgr -l -t fifo -u
> postfix 14889 2117 0 10:14 ? 00:00:00 \_ pickup -l -t fifo -u
> rabbitmq 2145 1 0 Nov03 ? 00:00:00 /usr/lib64/erlang/erts-5.8.1/bin/epmd -daemon
> rabbitmq 2162 1 0 Nov03 ? 00:02:20 /usr/lib64/erlang/erts-5.8.1/bin/beam.smp -W w -K true -A30 -P 1048576 -- -root /usr/lib64/erlang -progname erl -- -home /var/lib/rabbitmq -- -noshell -noinput -sname rabbit at gpu2 -boot /var/lib/ra
> rabbitmq 2238 2162 0 Nov03 ? 00:00:00 \_ /usr/lib64/erlang/lib/os_mon-2.2.5/priv/bin/cpu_sup
> rabbitmq 2241 2162 0 Nov03 ? 00:00:00 \_ inet_gethost 4
> rabbitmq 2242 2241 0 Nov03 ? 00:00:00 \_ inet_gethost 4
> root 2253 1 0 Nov03 ? 00:00:03 /usr/sbin/abrtd
> root 2268 1 0 Nov03 ? 00:00:00 /bin/bash /usr/sbin/ksmtuned
> root 16534 2268 0 11:10 ? 00:00:00 \_ sleep 60
> root 2277 1 0 Nov03 ? 00:00:00 crond
> root 2288 1 0 Nov03 ? 00:00:00 /usr/sbin/atd
> glance 2296 1 0 Nov03 ? 00:00:00 /usr/bin/python /usr/bin/glance-api -d -v --log-config=/etc/glance/logging-api.conf
> glance 2326 1 0 Nov03 ? 00:00:00 /usr/bin/python /usr/bin/glance-registry -d -v --log-config=/etc/glance/logging-registry.conf
> nova 2335 1 1 Nov03 ? 00:11:08 /usr/bin/python /usr/bin/nova-ajax-console-proxy --flagfile=/etc/nova/nova.conf --logfile=/var/log/nova/nova-ajax-console-proxy.log --pidfile /var/run/nova/nova-ajax-console-proxy.pid
> nova 2349 1 0 Nov03 ? 00:00:01 python /usr/local/nova/sandbox/nova/bin/nova-api --flagfile=/usr/local/nova/sandbox/nova/bin/nova.conf --logfile=/var/log/nova/api
> nova 2362 1 0 Nov03 ? 00:00:00 /usr/bin/python /usr/bin/nova-direct-api --flagfile=/etc/nova/nova.conf --logfile=/var/log/nova/nova-direct-api.log --pidfile /var/run/nova/nova-direct-api.pid
> nova 2403 1 0 Nov03 ? 00:00:00 python /usr/local/nova/sandbox/nova/bin/nova-objectstore --flagfile=/usr/local/nova/sandbox/nova/bin/nova.conf --logfile=/var/log/nova/objectstore
> root 2451 1 0 Nov03 ? 00:00:09 libvirtd --daemon
> root 2467 1 0 Nov03 ? 00:00:00 rhnsd
> root 2483 1 0 Nov03 ? 00:00:00 /usr/bin/rhsmcertd 240
> nova 2490 1 0 Nov03 ? 00:05:15 python /usr/local/nova/sandbox/nova//bin/nova-compute --flagfile=/usr/local/nova/sandbox/nova//bin/nova.conf --logfile=/var/log/nova/compute
> nova 4952 2490 0 Nov03 ? 00:00:00 \_ [sh] <defunct>
> nova 4956 2490 0 Nov03 ? 00:00:00 \_ [sh] <defunct>
> nova 4960 2490 0 Nov03 ? 00:00:00 \_ [sh] <defunct>
> nobody 2568 1 0 Nov03 ? 00:00:00 /usr/sbin/dnsmasq --strict-order --bind-interfaces --pid-file=/var/run/libvirt/network/default.pid --conf-file= --except-interface lo --listen-address 192.168.122.1 --dhcp-range 192.168.122.2,192.
> root 2668 1 0 Nov03 tty1 00:00:00 /sbin/mingetty /dev/tty1
> root 2670 1 0 Nov03 tty2 00:00:00 /sbin/mingetty /dev/tty2
> root 2672 1 0 Nov03 tty3 00:00:00 /sbin/mingetty /dev/tty3
> root 2676 1 0 Nov03 tty4 00:00:00 /sbin/mingetty /dev/tty4
> root 2680 1 0 Nov03 tty5 00:00:00 /sbin/mingetty /dev/tty5
> root 2682 1 0 Nov03 tty6 00:00:00 /sbin/mingetty /dev/tty6
> root 2691 1 0 Nov03 ? 00:00:00 /usr/libexec/polkit-1/polkitd
> root 2693 1 0 Nov03 ? 00:00:00 /usr/sbin/console-kit-daemon --no-daemon
> nova 4384 1 0 Nov03 ? 00:02:18 python /usr/local/nova/sandbox/nova/bin/nova-network --flagfile=/usr/local/nova/sandbox/nova/bin/nova.conf --logfile=/var/log/nova/network
> nova 4464 1 0 Nov03 ? 00:02:13 python /usr/local/nova/sandbox/nova/bin/nova-scheduler --flagfile=/usr/local/nova/sandbox/nova/bin/nova.conf --logfile=/var/log/nova/scheduler
> nobody 4494 1 0 Nov03 ? 00:00:00 dnsmasq --strict-order --bind-interfaces --conf-file= --domain=novalocal --pid-file=/usr/local/nova/sandbox/nova/networks/nova-br100.pid --listen-address=10.88.1.1 --except-interface=lo --dhcp-ran
> root 4495 4494 0 Nov03 ? 00:00:00 \_ dnsmasq --strict-order --bind-interfaces --conf-file= --domain=novalocal --pid-file=/usr/local/nova/sandbox/nova/networks/nova-br100.pid --listen-address=10.88.1.1 --except-interface=lo --dhcp
> root 4921 1 0 Nov03 ? 00:00:00 /usr/libexec/libvirt_lxc --name instance-00000005 --console 15 --handshake 18 --background --veth veth1
> root 4922 4921 0 Nov03 ? 00:00:00 \_ /sbin/init
> root 4927 4922 0 Nov03 ? 00:00:00 \_ /sbin/agetty -8 38400 /dev/console linux
> root 4933 4922 0 Nov03 pts/0 00:00:00 \_ /sbin/mingetty /dev/tty1
> root 5314 4922 0 Nov03 ? 00:00:00 \_ /sbin/dhclient -1 -q -lf /var/lib/dhclient/dhclient-eth0.leases -pf /var/run/dhclient-eth0.pid eth0
> root 5405 4922 0 Nov03 ? 00:00:00 \_ /usr/sbin/sshd
>
>
>
> ----------------------
> Dr. Dong-In "David" Kang
> Computer Scientist
> USC/ISI
>
> ----- Original Message -----
> From: "Cedric Le Goater" <legoater at free.fr>
> To: "Dong-In David Kang" <dkang at isi.edu>
> Cc: "Greg Kurz" <gkurz at fr.ibm.com>, lxc-users at lists.sourceforge.net
> Sent: Friday, November 4, 2011 11:00:47 AM
> Subject: Re: [Lxc-users] /proc/<process id>/ns is not found
>
> On 11/04/2011 03:37 PM, Dong-In David Kang wrote:
> > I could build Linux 2.6.83.2 with lxc patches.
> > I could make lxc-0.7.4 work with it.
> > (lxc-0.7.5 did not work.)
> > I mean it doesn't complain any more.
> >
> > However, I'm not sure if it really works.
> >
> > I did the follwoing:
> >
> > $ lxc-attach -n foo -- /bin/cat /etc/fstab
> >
> > But it shows host's /etc/fstab (not foo's /etc/fstab).
> > I did a few other things.
> > But the outputs are the host's (not the container's).
> >
>
> what about :
>
> $ lxc-attach -n foo -- ps -ef --forest
>
>
> C.
>
--
Gregory Kurz gkurz at fr.ibm.com
Software Engineer @ IBM/Meiosys http://www.ibm.com
Tel +33 (0)534 638 479 Fax +33 (0)561 400 420
"Anarchy is about taking complete responsibility for yourself."
Alan Moore.
More information about the lxc-users
mailing list