hi: so for finding the pid the solution its (big surprise :D ) using systemd, instead of just executing you systemd-nspawn in bash you start it as a systemd-unit (you can even do this as ephemeral unit with `sytemd-run --unit myspawn.service systemd-nspawn ....bla...`)
then to get the ip of the nspawn process no need to ps aux you just do `systemctl show -pMainPID myspawn.service`, that will give you the mainpid, and your child you can get it with `pgrep -P`. as personal oprinion... i much like `tail -f /dev/null` better than `sleep <big number>` as a wait to "wait for ever" Alvaro Leiva On Sat, Jun 23, 2018 at 2:02 PM Nikolaus Rath <nikol...@rath.org> wrote: > On Jun 23 2018, Nikolaus Rath <nikol...@rath.org> wrote: > > On Jun 23 2018, aleivag <alei...@gmail.com> wrote: > >> short answer, yes, `machinectl login` is only suppported for > systemd-init , > >> and `machinectl shell` `systemd-run` will try to talk to the container > via > >> dbus, so i dont think you are force to have systemd runing inside the > >> container (i may be wrong) but you do need to have dbus (and its easy to > >> just have systemd). if you dont need it, you can always use nsenter to > >> access a namespace on your machine > > > > Still not working: > [..] > > $ sudo machinectl shell root@iofabric > > [sudo] password for nikratio: > > Failed to get shell PTY: Cannot set property > > StandardInputFileDescriptor, or unknown property. > > So this seems to be caused by systemd in the container being too old, > and is therefore not available here. > > The 'nsenter' approach seems to work so far, but I don't see a generally > applicable way to figure out the right PID. Is there a trick for that? > > (I ran a "sleep <big-unique-numebr>" in the container and grepped "ps > ax" for the number in the host). > > Best, > -Nikolaus > > -- > GPG Fingerprint: ED31 791B 2C5C 1613 AF38 8B8A D113 FCAC 3C4E 599F > > »Time flies like an arrow, fruit flies like a Banana.« > _______________________________________________ > systemd-devel mailing list > systemd-devel@lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/systemd-devel >
_______________________________________________ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel