Re: [systemd-devel] Bonding wireless and wired internet connection makes my internet really slow

2018-05-04 Thread Kai Krakow
Am Thu, 03 May 2018 14:34:34 +0300 schrieb Doron Behar:

> Hi everyone,
> 
> I'm trying to bond my wireless and wired network interfaces using
> `systemd-networkd`. Since I didn't want to put any configuration in
> `/etc/systemd/network/` I don't fully understand, this is the
> configuration I've ended up with:
> 
>   $ cat /etc/systemd/network/10-bond0.netdev
>   [NetDev]
>   Name=bond0
>   Kind=bond
> 
> ---
> 
>   $ cat /etc/systemd/network/20-wired.network
>   [Match]
>   Name=enp0s25
>   
>   [Network]
>   Bond=bond0
> 
> ---
> 
>   $ cat /etc/systemd/network/25-wireless.network
>   [Match]
>   Name=wlp2s0
>   
>   [Network]
>   Bond=bond0
> 
> ---
> 
>   $ cat /etc/systemd/network/35-tethering.network
>   [Match]
>   Name=enp0s20u*
>   
>   [Network]
>   Bond=bond0
> 
> ---
> 
>   $ cat /etc/systemd/network/40-bond0.network
>   [Match]
>   Name=bond0
>   
>   [Network]
>   DHCP=yes
> 
> ---
> 
> As opposed to the old configuration which works as fast as light:
> 
>   $ cat /etc/systemd/network/20-wired.network
>   [Match]
>   Name=enp0s25
>   
>   [Network]
>   DHCP=yes
> 
> ---
> 
>   $ cat /etc/systemd/network/25-wireless.network
>   [Match]
>   Name=wlp2s0
>   
>   [Network]
>   DHCP=yes
> 
> ---
> 
>   $ cat /etc/systemd/network/35-tethering.network
>   [Match]
>   Name=enp0s20u*
>   
>   [Network]
>   DHCP=yes
> 
> ---
> 
> With the 1st configuration, If I reboot, I definitely have networking
> capabilities but from some reason, after a while, browsing the web for
> example, becomes extremely slow.
> 
> How can I debug this? Are there any best practices for the simplest
> bonding configuration? What am I missing here?

Do the wifi and cable network connect to the same router? Then it
probably doesn't know about the bonding and network packets start to
travel in circles after a while.

You may be able to fix this by setting the bond mode to failover
instead of balancing. I think the mode is called "active-backup". But
usually the other end of the bond needs to know about this, too.

Another mode which may work is "balance-xor" which usually allows
attaching bonding members to different switches on the other side.

The mode defaults to balance-rr which is probably incompatible with
your setup.

BTW: Bonding may not improve throughput and even hurt latency a lot if
you combine very different types on links, i.e. wifi and cable. So
"active-backup" may be the best way to do it here.


-- 
Regards,
Kai

Replies to list-only preferred.

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


[systemd-devel] Wait for restarted unit to be ready

2018-05-04 Thread Jonathan Gold
I'm working on some code that handles restarting systemd units via dbus,
and I want to make sure that my logic is correct.

My goal is to restart a unit, and wait for it to be active before my
function returns. Once I've asked the unit to restart, I am watching the
`JobRemoved` signal for messages containing the unit name and handling the
result accordingly. If the signal result is "done" my function returns, and
otherwise it errors. Is this the correct way to wait for unit readiness?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Julian Andres Klode
On Fri, May 04, 2018 at 07:03:59PM +0200, Lennart Poettering wrote:
> On Fr, 04.05.18 18:59, Thorsten Schöning (tschoen...@am-soft.de) wrote:
> 
> > Guten Tag Lennart Poettering,
> > am Freitag, 4. Mai 2018 um 18:07 schrieben Sie:
> > 
> > > Hmm, you said /home was a subvolume? That suggests they are on the
> > > same fs? Not following here?
> > 
> > I guess "/etc/fstab" is clearer than my explanation:
> > 
> > > #
> > > # / was on /dev/sda1 during installation
> > > UUID=0841ef72-e9d4-45ca-af22-a403783859c6 /   btrfs   
> > > noatime,nodiratime,subvol=@ 0   1
> > >
> > > # /home was on /dev/sda1 during installation
> > > UUID=0841ef72-e9d4-45ca-af22-a403783859c6 /home   btrfs   
> > > noatime,nodiratime,subvol=@home 0   2
> > 
> > So the same BTRFS file system containing two sub volumes. That seems
> > to work for user configs, my problem was a wrong "WantedBy".
> 
> Note that btrfs subvolumes are just special directories, hence you can
> also do without an explicit entry for the home subvol, and simply
> create it below the root subvol.

That's not the best advise IMO. Subvolumes inside subvolumes have
weird behavior that sometimes bites you very hard. For example:
You can't restore an older / snapshot because it won't contain
your /home because it's a subvolume of the current /, but not of the
snapshot. It's just going to be a pain if you forget that.

I had this problem with lxd - it keeps containers in a btrfs subvolume
below /, and then I restored / to an older snapshot and all my containers
were gone / broken - I had to recreate them, as I only noticed later and
already had deleted my broken old "/"; so I switched to a mount for
them:

   /dev/mapper/ubuntu--vg-root /var/snap/lxd/common/lxd/storage-pools/default   
  btrfs   defaults,subvol=@lxd 0   2

For Ubuntu, it's worth noting that the @ subvolume that's mounted to / is 
automatically
snapshotted when upgrading distributions; or even on normal upgrades with 
apt-btrfs-snapshot.

-- 
debian developer - deb.li/jak | jak-linux.org - free software dev
ubuntu core developer  i speak de, en
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Is it safe to issue "systemctl daemon-reload" during boot?

2018-05-04 Thread Andrei Borzenkov
04.05.2018 17:32, Thorsten Schöning пишет:
> Hi all,
> 
> I'm using Ubuntu 16.04 LTS server with BTRFS, which created one
> subvolume for / and another one for /home. For various reasons I'm
> storing systemd service files in different folders underneath /home
> and provide them to systemd using "systemctl enable ..." with the
> absolute path to the file.
> 
> This approach doesn't work during boot, because /home is mounted after
> systemd recognized its service files in "/etc/systemd/systemd". After
> boot, "systemctl status ..." with one of my services tells that the
> service is not loaded because the file is not found.
> 
> One way to work around that seems to be using user configs. Another
> thing I just tested is creating foo.path and foo.service in /, while
> foo.path observes that /home/... is available. If thats the case,
> foo.service is started and issues a "systemctl daemon-reload". That at
> least allows all the services formerly not loaded to be properly
> loaded. The only thing missing is starting the services, but that
> could be managed in some script or whatever.
> 
> While this works in my test-VM, the docs regarding this command read
> a bit scary:
> 
>> Reload the systemd manager configuration. This will rerun all
>> generators (see systemd.generator(7)), reload all unit files, and
>> recreate the entire dependency tree.
> 
> Could executing "daemon-reload" during boot break things terribly or
> could this be considered somewhat safe?
> 

While this is supposed to be transparent, there were quite some issues
due to incomplete save/restore of systemd state across daemon-reload,
some fixed, some may not. One example that to my best knowledge is not
yet fixed is "systemctl start/stop" being terminated by concurrent
daemon-reload, thus not waiting for completion. Another problem (that
could really bite during startup) was that on daemon-reload systemd
"forgot" current ExecStart directive and executed them from the very
beginning. See also
https://lists.freedesktop.org/archives/systemd-devel/2018-January/040269.html

So your systemd version used by your distribution may have various
problems that may cause some "interesting" issues. I'd say it is better
to avoid it if at all possible.

One thing that may work - create service WantedBy and After home.mount,
that contains ExecStart=systemctl --no-block start
your-file-on-home.service. systemd should rescan for unit definitions
and should find them now when /home is mounted.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Thorsten Schöning
Guten Tag Lennart Poettering,
am Freitag, 4. Mai 2018 um 19:03 schrieben Sie:

> Note that btrfs subvolumes are just special directories, hence you can
> also do without an explicit entry for the home subvol, and simply
> create it below the root subvol.

Thanks for the hint, I'll think about that. The provided fstab was
from an Ubuntu default installation and I would like to keep that as
much as possible.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

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


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Lennart Poettering
On Fr, 04.05.18 18:59, Thorsten Schöning (tschoen...@am-soft.de) wrote:

> Guten Tag Lennart Poettering,
> am Freitag, 4. Mai 2018 um 18:07 schrieben Sie:
> 
> > Hmm, you said /home was a subvolume? That suggests they are on the
> > same fs? Not following here?
> 
> I guess "/etc/fstab" is clearer than my explanation:
> 
> > #
> > # / was on /dev/sda1 during installation
> > UUID=0841ef72-e9d4-45ca-af22-a403783859c6 /   btrfs   
> > noatime,nodiratime,subvol=@ 0   1
> >
> > # /home was on /dev/sda1 during installation
> > UUID=0841ef72-e9d4-45ca-af22-a403783859c6 /home   btrfs   
> > noatime,nodiratime,subvol=@home 0   2
> 
> So the same BTRFS file system containing two sub volumes. That seems
> to work for user configs, my problem was a wrong "WantedBy".

Note that btrfs subvolumes are just special directories, hence you can
also do without an explicit entry for the home subvol, and simply
create it below the root subvol.

Lennart

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


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Thorsten Schöning
Guten Tag Lennart Poettering,
am Freitag, 4. Mai 2018 um 18:07 schrieben Sie:

> Hmm, you said /home was a subvolume? That suggests they are on the
> same fs? Not following here?

I guess "/etc/fstab" is clearer than my explanation:

> #
> # / was on /dev/sda1 during installation
> UUID=0841ef72-e9d4-45ca-af22-a403783859c6 /   btrfs   
> noatime,nodiratime,subvol=@ 0   1
>
> # /home was on /dev/sda1 during installation
> UUID=0841ef72-e9d4-45ca-af22-a403783859c6 /home   btrfs   
> noatime,nodiratime,subvol=@home 0   2

So the same BTRFS file system containing two sub volumes. That seems
to work for user configs, my problem was a wrong "WantedBy".

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

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


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Lennart Poettering
On Fr, 04.05.18 16:13, Thorsten Schöning (tschoen...@am-soft.de) wrote:

> Guten Tag Andrei Borzenkov,
> am Freitag, 4. Mai 2018 um 12:07 schrieben Sie:
> 
> > There is no multi-user.target in user instance (unless you added it
> > yourself), user instance starts default.target.
> 
> Thanks, that was the problem, after changing the target everything
> seems to work as expected. I didn't spot that difference to the docs I
> was using.
> 
> Is there some counterpart for "systemctl --user ..." allowing me to
> provide a username to work on instead of the "current user"? The only
> thing in this direction I see is "--root" and providing a path to some
> user's home dir.

No, that's not going to work. You might be able to use "sudo" or "su"
for that however.

Lennart

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


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Lennart Poettering
On Do, 03.05.18 21:07, Thorsten Schöning (tschoen...@am-soft.de) wrote:

> Hi all,
> 
> I'm using Ubuntu 16.04 LTS server with BTRFS, which created one
> subvolume for / and another one for /home. While I do like this setup,
> it makes me trouble with how I deploy our own software developed for
> various customers. For many reasons that software is stored under
> /home[/tenant1|tenant2|...] currently, including systemd service files
> nowadays. The good thing is that enabling those files is as easy as
> 
> > systemctl enable ...
> 
> with the absolute path. The bad thing is that because /home is another
> file system, during boot systemd can't find my service files and
> therefore can't start my services[1].

Hmm, you said /home was a subvolume? That suggests they are on the
same fs? Not following here?

> I'm looking for alternatives[2] now and thought of user configs. The
> good thing is that my service files seem to be properly available to
> systemd if I login e.g. using SSH, the status of the service is loaded
> and I'm able to start it manually. But I have trouble getting systemd
> to automatically start the service during boot and even during SSH
> login.
> 
> I'm pretty sure to already have use the suggested "loginctl enable-linger 
> ...",
> but might have some error somewhere of course. But it might as well be
> that the subvolume /home itself is making trouble here again. In the
> end, there's the following sentence in the docs which doesn't
> distinguish between system wide and user configs:
> 
> > The file system where the linked unit files are located must be
> > accessible when systemd is started (e.g. anything underneath /home
> > or /var is not allowed, unless those directories are located on the
> > root file system).
> 
> So, are user configs for systemd supported to be placed on a non-root
> file system AND be started during boot time? I don't have any users
> logging in in the end.

The comment above only applies to the systemd system instance,
i.e. PID 1. It does not apply to systemd user instances. I figure we
should clarify that in the docs...

Lennart

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


[systemd-devel] Is it safe to issue "systemctl daemon-reload" during boot?

2018-05-04 Thread Thorsten Schöning
Hi all,

I'm using Ubuntu 16.04 LTS server with BTRFS, which created one
subvolume for / and another one for /home. For various reasons I'm
storing systemd service files in different folders underneath /home
and provide them to systemd using "systemctl enable ..." with the
absolute path to the file.

This approach doesn't work during boot, because /home is mounted after
systemd recognized its service files in "/etc/systemd/systemd". After
boot, "systemctl status ..." with one of my services tells that the
service is not loaded because the file is not found.

One way to work around that seems to be using user configs. Another
thing I just tested is creating foo.path and foo.service in /, while
foo.path observes that /home/... is available. If thats the case,
foo.service is started and issues a "systemctl daemon-reload". That at
least allows all the services formerly not loaded to be properly
loaded. The only thing missing is starting the services, but that
could be managed in some script or whatever.

While this works in my test-VM, the docs regarding this command read
a bit scary:

> Reload the systemd manager configuration. This will rerun all
> generators (see systemd.generator(7)), reload all unit files, and
> recreate the entire dependency tree.

Could executing "daemon-reload" during boot break things terribly or
could this be considered somewhat safe?

Thanks!

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

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


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Thorsten Schöning
Guten Tag Andrei Borzenkov,
am Freitag, 4. Mai 2018 um 12:07 schrieben Sie:

> There is no multi-user.target in user instance (unless you added it
> yourself), user instance starts default.target.

Thanks, that was the problem, after changing the target everything
seems to work as expected. I didn't spot that difference to the docs I
was using.

Is there some counterpart for "systemctl --user ..." allowing me to
provide a username to work on instead of the "current user"? The only
thing in this direction I see is "--root" and providing a path to some
user's home dir.

Mit freundlichen Grüßen,

Thorsten Schöning

-- 
Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
AM-SoFT IT-Systeme  http://www.AM-SoFT.de/

Telefon...05151-  9468- 55
Fax...05151-  9468- 88
Mobil..0178-8 9468- 04

AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow

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


Re: [systemd-devel] User configs, BTRFS subvolume for /home and automatic service start during boot?

2018-05-04 Thread Andrei Borzenkov
On Fri, May 4, 2018 at 9:14 AM, Thorsten Schöning  wrote:
> Guten Tag Andrei Borzenkov,
> am Freitag, 4. Mai 2018 um 06:57 schrieben Sie:
>
>> Or you can enable linger in
>> which case user instance will be started on boot.
>
> That's the part not working in my setup for some reason.
>
>> Which services will actually be started depends on this user's
>> configuration, which services are enabled. It sounds like you may not
>> have enabled them or at least not enabled for the correct top-level target.
>
> I'm pretty sure they are enabled, all the documented directories,
> files and links are available AND the services are started if I do it
> manually

How does it confirm that units are enabled?

> using SSH and "systemctl start ...". The service itself is
> pretty standard as well:
>
>> [Unit]
>> Description=Test /home being a subvolume in BTRFS and containing a service.
>>
>> [Install]
>> WantedBy=multi-user.target
>>
>> [Service]
>> Type=oneshot
>> ExecStart=/bin/bash -c "echo Works: `date` >> 
>> /home/tschoening/btrfs_home_test/ping.txt"
>
> Do you see any error?

There is no multi-user.target in user instance (unless you added it
yourself), user instance starts default.target. Which is incidentally
true also for system instance unless explicitly overridden, usually on
kernel command line.

> It is enabled using "systemctl --user enable ..."
> using the absolut path

That just makes it depedency of multi-user.target which itself does not exist.

> and can be diabled the same way and started
> manually. It's only not started automaticalyl, neither if I login
> using SSH, nor at boot time.
>
> So am I missing something in the service config or regarding
> "enable-linger"?
>
> Mit freundlichen Grüßen,
>
> Thorsten Schöning
>
> --
> Thorsten Schöning   E-Mail: thorsten.schoen...@am-soft.de
> AM-SoFT IT-Systeme  http://www.AM-SoFT.de/
>
> Telefon...05151-  9468- 55
> Fax...05151-  9468- 88
> Mobil..0178-8 9468- 04
>
> AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln
> AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow
>
> ___
> 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