Re: [systemd-devel] Q: Start network in chroot?

2022-06-13 Thread Topi Miettinen

On 13.6.2022 11.09, Ulrich Windl wrote:

Hi!

Two questions:
1) Why can't I use "systemctl start network" in a chroot environment (e.g. mounting the 
system from a rescue medium to fix a defective kernel)? When I try I get: "Running in chroot, 
ignoring command 'start'"


From docs/ENVIRONMENT.md:
* `$SYSTEMD_IGNORE_CHROOT=1` — if set, don't check whether being invoked 
in a
  `chroot()` environment. This is particularly relevant for systemctl, 
as it
  will not alter its behaviour for `chroot()` environments if set. 
Normally it
  refrains from talking to PID 1 in such a case; turning most 
operations such

  as `start` into no-ops.  If that's what's explicitly desired, you might
  consider setting `$SYSTEMD_OFFLINE=1`.

-Topi


Re: [systemd-devel] Q: Start network in chroot?

2022-06-13 Thread Colin Guthrie

Ulrich Windl wrote on 13/06/2022 09:09:

Hi!

Two questions:
1) Why can't I use "systemctl start network" in a chroot environment (e.g. mounting the 
system from a rescue medium to fix a defective kernel)? When I try I get: "Running in chroot, 
ignoring command 'start'"
2) How can I start the network using systemd?


You may wish to consider "booting" the container rather than just chrooting.

Combined with IPVLAN or similar (which systemd-nspawn makes easy) you 
can bring up a namespaced network interface inside the container 
completely isolated from the host.


I do this for various setups and it works pretty well.

Col




Re: [systemd-devel] Q: Start network in chroot?

2022-06-13 Thread Mantas Mikulėnas
On Mon, Jun 13, 2022 at 11:09 AM Ulrich Windl <
ulrich.wi...@rz.uni-regensburg.de> wrote:

> Hi!
>
> Two questions:
> 1) Why can't I use "systemctl start network" in a chroot environment (e.g.
> mounting the system from a rescue medium to fix a defective kernel)?


Because you don't have systemd as init while inside a chroot.

2) How can I start the network using systemd?
>

Start it outside the chroot.

-- 
Mantas Mikulėnas


[systemd-devel] Q: Start network in chroot?

2022-06-13 Thread Ulrich Windl
Hi!

Two questions:
1) Why can't I use "systemctl start network" in a chroot environment (e.g. 
mounting the system from a rescue medium to fix a defective kernel)? When I try 
I get: "Running in chroot, ignoring command 'start'"
2) How can I start the network using systemd?

(systemd-246-16 of SLES15 SP3)

Regards,
Ulrich