Re: [systemd-devel] BUG: Huge Problem: systemd does not mount all filesystems on Boot

2016-10-14 Thread Kai Krakow
Am Fri, 14 Oct 2016 19:58:13 +0300
schrieb Andrei Borzenkov :

> 14.10.2016 12:11, Juergen Sauer пишет:
> > Moin,
> > 
> > Systemd 231, Archlinux current
> > 
> > The concept is /home is to be mounted from nfs server. Works.
> > For performance reasons (email thunderbird, kde/plasma 5.8.x i.e odr
> > gnome are unusable if home is pure nfs) the user sub dirs .local,
> > .cache, .config, .thunderbird etc. are mounts from local fs (btrfs
> > subvolume).
> > 
> > Network is without NetWorkmanager (masked), fixed configured via
> > systemd-networkd.
> > 
> > The Problem is, after boot /home is mounted or not, random result.
> > WTF?!? 
> 
> local mounts are by default ordered before remote mounts, so you have
> dependency loop. Systemd resolves it by deleting one of units in this
> loop. Depending on what unit gets deleted you get different results. I
> do not know how deterministic algorithm is.

I'd create something like /home/local/leander which contains your local
directories. This also requires only one subvolume mount for exactly
this one directory. Then put symlinks into your /home/leander to the
local directories.

Since local mounts are strictly ordered before remote mounts, you can
be sure than the local directories are available when your nfs home dir
is mounted.

> > The BUG is:
> > The btrfs subvols are i.g. mounted - disobeying the
> > x-systemd.requires=home.mount rule.
> >   
> 
> Yes, systemdm will create mount point if it does not exist. I am still
> unsure whether this is a good thing.
> 
> ...
> 
> > 
> > 192.168.11.10:/home/home   nfs
> > nofail,x-systemd.device-timeout=1,x-systemd.requires=network-online.target
> > 0 0
> >   
> 
> systemd already adds dependency on network-online.target to network
> mounts. But do not forget that you need something that actually
> implements waiting for network, otherwise this requirement is
> effectively noop.
> 
> > LABEL=pc11root /home/leander/.cache   btrfs
> > ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/cache,x-systemd.requires=home.mount
> > 0 0  
> 
> systemd adds equivalent to RequiresMountsFor=mount-point so
> x-systemd.requires here is redundant.
> ...
> 
> > 
> > 
> > How to fix?
> >  
> 
> Try adding _netdev to each mount that depends on /home to order them
> after network.


-- 
Regards,
Kai

Replies to list-only preferred.


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


Re: [systemd-devel] BUG: Huge Problem: systemd does not mount all filesystems on Boot

2016-10-14 Thread Andrei Borzenkov
14.10.2016 12:11, Juergen Sauer пишет:
> Moin,
> 
> Systemd 231, Archlinux current
> 
> The concept is /home is to be mounted from nfs server. Works.
> For performance reasons (email thunderbird, kde/plasma 5.8.x i.e odr
> gnome are unusable if home is pure nfs) the user sub dirs .local,
> .cache, .config, .thunderbird etc. are mounts from local fs (btrfs
> subvolume).
> 
> Network is without NetWorkmanager (masked), fixed configured via
> systemd-networkd.
> 
> The Problem is, after boot /home is mounted or not, random result. WTF?!?
> 

local mounts are by default ordered before remote mounts, so you have
dependency loop. Systemd resolves it by deleting one of units in this
loop. Depending on what unit gets deleted you get different results. I
do not know how deterministic algorithm is.

> The BUG is:
> The btrfs subvols are i.g. mounted - disobeying the
> x-systemd.requires=home.mount rule.
> 

Yes, systemdm will create mount point if it does not exist. I am still
unsure whether this is a good thing.

...

> 
> 192.168.11.10:/home/home   nfs
> nofail,x-systemd.device-timeout=1,x-systemd.requires=network-online.target
> 0 0
> 

systemd already adds dependency on network-online.target to network
mounts. But do not forget that you need something that actually
implements waiting for network, otherwise this requirement is
effectively noop.

> LABEL=pc11root /home/leander/.cache   btrfs
> ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/cache,x-systemd.requires=home.mount
> 0 0

systemd adds equivalent to RequiresMountsFor=mount-point so
x-systemd.requires here is redundant.
...

> 
> 
> How to fix?
>

Try adding _netdev to each mount that depends on /home to order them
after network.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Brian Kroth
I think there's been some recent discussion related to this on this mailing
list.  You might want to check the archives and/or look into the nofail
and/or noauto options in your fstab entries.  Seems like nofail at least
will change the local-fs.target dependency into a Want instead of a
Require, which may be what you're looking for here.

Cheers,
Brian

On Fri, Oct 14, 2016 at 9:12 AM, Michael Hirmke 
wrote:

> Hi again,
>
> [...]
> >nfsserver and postfix are depending on local-fs.target, which includes
> >var-backup.mount.
> >When stopping /var/backup with systemctl, systemd also stops nfsserver
> >and postfix. Therefore this is not a solution, because in fact both
> >don't need /var/backup.
> >How can I solve this?
>
> it seems to be a very ugly solution, but masking var-backup.mount
> before umounting it and unmasking it after remounting works.
> Hopefully there are no side effects.
>
> Does anyone know any not so ugly solution?
>
> >[...]
>
> Bye.
> Michael.
> --
> Michael Hirmke
> ___
> 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


Re: [systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Michael Hirmke
Hi again,

[...]
>nfsserver and postfix are depending on local-fs.target, which includes
>var-backup.mount.
>When stopping /var/backup with systemctl, systemd also stops nfsserver
>and postfix. Therefore this is not a solution, because in fact both
>don't need /var/backup.
>How can I solve this?

it seems to be a very ugly solution, but masking var-backup.mount
before umounting it and unmasking it after remounting works.
Hopefully there are no side effects.

Does anyone know any not so ugly solution?

>[...]

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


Re: [systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Michael Hirmke
Hi,

[...]
>>systemd shouldn't generally start any unit on a whim ? if the corresponding
>>.mount was started, then it likely was either by request, or as a
>>dependency of some program, or via autofs (if you use systemd.automount).

>I don't use systemd.automount.
>No one requested it as far as I can see.
>And "systemctl list-dependencies var-backup.mount" only shows
>var-backup.mount.

found it out:

nfsserver and postfix are depending on local-fs.target, which includes
var-backup.mount.
When stopping /var/backup with systemctl, systemd also stops nfsserver
and postfix. Therefore this is not a solution, because in fact both
don't need /var/backup.
How can I solve this?

[...]

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


Re: [systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Michael Chapman

On Fri, 14 Oct 2016, Mantas Mikulėnas wrote:
[...]

   And how would a remount command (for read only or read write) look
   like?



There isn't any. Use `mount`.


FWIW, I'm pretty sure "systemctl reload var-backup.mount" will remount the 
filesystem.


You probably want to avoid "restart" though. :-p

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


Re: [systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Michael Hirmke
Hi Michael,

>On Fri, 14 Oct 2016, Mantas Mikul?nas wrote:
>[...]
>>>And how would a remount command (for read only or read write) look
>>>like?
>>>
>>
>> There isn't any. Use `mount`.

>FWIW, I'm pretty sure "systemctl reload var-backup.mount" will remount the
>filesystem.

yes, but not changing from read only to read write and back.

>You probably want to avoid "restart" though. :-p

>- Michael

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


Re: [systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Michael Hirmke
Hi Mantas,

thx for your answer.

[...]
>> 1. How can I prevent systemd from mounting a manually unmounted
>>partition? The partiton should be mounted automatically during system
>>start, though.
>>

>First, see if you can figure out *why* systemd mounted it.

I tried to found that out, but couldn't find any reason.

>systemd shouldn't generally start any unit on a whim ? if the corresponding
>.mount was started, then it likely was either by request, or as a
>dependency of some program, or via autofs (if you use systemd.automount).

I don't use systemd.automount.
No one requested it as far as I can see.
And "systemctl list-dependencies var-backup.mount" only shows
var-backup.mount.

>> 2. If I would switch from mount/umount to pure systemd behaviour for
>>mounting and unmounting partitons in my script, would a command like
>>"systemctl stop|start /var/backup" be sufficient?
>>

>Looks about right, though in some cases `systemctl foo var-backup.mount`
>might be needed.

Ok, thx.

>But, I don't think it will make any difference.

>>And how would a remount command (for read only or read write) look
>>like?
>>

>There isn't any. Use `mount`.

Ok.

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


Re: [systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Mantas Mikulėnas
On Fri, Oct 14, 2016 at 1:06 PM, Michael Hirmke 
wrote:

> Hi *,
>
> I've read the man pages and some more documentation about the mount
> behaviour of systemd, but I couldn't find a definitive answer to my
> questions.
> I have a backup script, that copies all files to backup to a hard disk
> partition, then duplicates the partition to one on a second disk, which
> in turn is changed every day. Before duplicating, the script tries to
> umount the partition on the original disk, does an fsck and then mounts
> the partition read only. When duplicating is finished, the original
> partition is remounted read write again.
> The script uses the "ancient" mount and umount commands, but once in a
> while, systemd takes over and remounts the disk, before fsck has been
> finished.
> So my questions are:
>
> 1. How can I prevent systemd from mounting a manually unmounted
>partition? The partiton should be mounted automatically during system
>start, though.
>

First, see if you can figure out *why* systemd mounted it.

systemd shouldn't generally start any unit on a whim – if the corresponding
.mount was started, then it likely was either by request, or as a
dependency of some program, or via autofs (if you use systemd.automount).


> 2. If I would switch from mount/umount to pure systemd behaviour for
>mounting and unmounting partitons in my script, would a command like
>"systemctl stop|start /var/backup" be sufficient?
>

Looks about right, though in some cases `systemctl foo var-backup.mount`
might be needed.

But, I don't think it will make any difference.


>And how would a remount command (for read only or read write) look
>like?
>

There isn't any. Use `mount`.

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


[systemd-devel] systemd 210 - mount/umount/remount

2016-10-14 Thread Michael Hirmke
Hi *,

I've read the man pages and some more documentation about the mount
behaviour of systemd, but I couldn't find a definitive answer to my
questions.
I have a backup script, that copies all files to backup to a hard disk
partition, then duplicates the partition to one on a second disk, which
in turn is changed every day. Before duplicating, the script tries to
umount the partition on the original disk, does an fsck and then mounts
the partition read only. When duplicating is finished, the original
partition is remounted read write again.
The script uses the "ancient" mount and umount commands, but once in a
while, systemd takes over and remounts the disk, before fsck has been
finished.
So my questions are:

1. How can I prevent systemd from mounting a manually unmounted
   partition? The partiton should be mounted automatically during system
   start, though.
2. If I would switch from mount/umount to pure systemd behaviour for
   mounting and unmounting partitons in my script, would a command like
   "systemctl stop|start /var/backup" be sufficient?
   And how would a remount command (for read only or read write) look
   like?


TIA.

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


[systemd-devel] BUG: Huge Problem: systemd does not mount all filesystems on Boot

2016-10-14 Thread Juergen Sauer
Moin,

Systemd 231, Archlinux current

The concept is /home is to be mounted from nfs server. Works.
For performance reasons (email thunderbird, kde/plasma 5.8.x i.e odr
gnome are unusable if home is pure nfs) the user sub dirs .local,
.cache, .config, .thunderbird etc. are mounts from local fs (btrfs
subvolume).

Network is without NetWorkmanager (masked), fixed configured via
systemd-networkd.

The Problem is, after boot /home is mounted or not, random result. WTF?!?

The BUG is:
The btrfs subvols are i.g. mounted - disobeying the
x-systemd.requires=home.mount rule.

I have this fstab
## Grundsystem
LABEL=pc11root  /   btrfs
rw,relatime,compress=lzo,ssd_spread,discard,space_cache,subvol=rootfs   0 0
LABEL=pc11root  /vm btrfs
rw,relatime,compress=lzo,ssd_spread,discard,space_cache,subvol=vm   0 0
LABEL=pc11root  /pc11   btrfs
rw,relatime,compress=lzo,ssd_spread,discard,space_cache,subvol=/,noauto 0 0
LABEL=swap  noneswapdefaults0 0

192.168.11.10:/home/home   nfs
nofail,x-systemd.device-timeout=1,x-systemd.requires=network-online.target
0 0

LABEL=pc11root /home/leander/.cache   btrfs
ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/cache,x-systemd.requires=home.mount
0 0
LABEL=pc11root /home/leander/.config  btrfs
ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/config,x-systemd.requires=home.mount
0 0
LABEL=pc11root /home/leander/.kde4btrfs
ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/kde4,x-systemd.requires=home.mount
0 0
LABEL=pc11root /home/leander/.local   btrfs
ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/local,x-systemd.requires=home.mount
0 0
LABEL=pc11root /home/leander/.thumbnails  btrfs
ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/thumbnails,x-systemd.requires=home.mount
0 0
LABEL=pc11root /home/leander/.thunderbird btrfs
ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/thunderbird,x-systemd.requires=home.mount
0 0
LABEL=pc11root /home/leander/.winebtrfs
ssd,ssd_spread,discard,compress=lzo,noatime,subvol=user/leander/wine,x-systemd.requires=home.mount
0 0


How to fix?

mit freundlichen Grüßen
Jürgen Sauer
-- 
Jürgen Sauer - automatiX GmbH,
+49-4209-4699, juergen.sa...@automatix.de
Geschäftsführer: Jürgen Sauer,
Gerichtstand: Amtsgericht Walsrode • HRB 120986
Ust-Id: DE191468481 • St.Nr.: 36/211/08000
GPG Public Key zur Signaturprüfung:
http://www.automatix.de/juergen_sauer_publickey.gpg



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel