[sisyphus] systemd & network on boot

Денис Смирнов mithraen на freesource.info
Пт Авг 22 23:32:33 MSK 2014


On Fri, Aug 22, 2014 at 11:17:01PM +0400, Alexey Shabalin wrote:

> Да, потерпите недельку, я в отпуске, доступа ни к чему нет.
> Вы уже все грабли разобрали.
> Надо чинить юнит network.service в etcnet.
> Мы обсуждали с sem@ этот юнит, и согласились, что его правильнее причислить
> к network-online.target, т.к. все же после запуска сети через etcnet у нас
> сеть не просто стартовала, а и стартанули dhcpcd, vpn и т.п. и адреса
> получены. А вот в секцию Install все равно лучше выставить
> multi-user.target.

Собственно в systemd-networkd так и сделано.

> Или network-online.target засунуть внутрь multi-user.target (я почему-то думал, что так и есть)

А вот это некорректно:

       network-online.target
           Units that strictly require a configured network connection should pull in network-online.target (via a Wants=
           type dependency) and order themselves after it. This target unit is intended to pull in a service that delays
           further execution until the network is sufficiently set up. What precisely this requires is left to the
           implementation of the network managing service.

           Note the distinction between this unit and network.target. This unit is an active unit (i.e. pulled in by the
           consumer rather than the provider of this functionality) and pulls in a service which possibly adds substantial
           delays to further execution. In contrast, network.target is a passive unit (i.e. pulled in by the provider of
           the functionality, rather than the consumer) that usually does not delay execution much. Usually,
           network.target is part of the boot of most systems, while network-online.target is not, except when at least
           one unit requires it. Also see Running Services After the Network is up[1] for more information.

           All mount units for remote network file systems automatically pull in this unit, and order themselves after it.
           Note that networking daemons that simply provide functionality to other hosts generally do not need to pull
           this in.

Т.е. network.service должен быть Before=network-online.target, но не должен его втягивать.
А вот network.target он втягивать должен, как и втягиваться multi-user.target.

> И ещё, уже не раз видел ранее предложения в секцию Install указывать
> default.target. Так вот, мне кажется этого делать нельзя, цель должна быть
> чётко указана, local-fs, sysinit, basic,multi-user,graphical. Т.к. default
> может быть любым из 3 последних, и если мне нужен только
> basic.target(компьютер без сети), то хотелось бы что бы сеть нигде случайно
> не зацепилась.

Спасибо, у меня как раз был вопрос как правильно.

Т.е. большинство сервисов надо отправлять в multi-user.target, то что связано с
графикой в graphical.target. А что надо помещать в basic.target?

И правильно ли я понимаю, что если цель указана basic.target, но в юните не
указано Before=basic.target, то цель basic.target может считаться достигнутой
до того как соответствующий сервис стартовал?

-- 
С уважением, Денис

http://mithraen.ru/
----------- следующая часть -----------
Было удалено вложение не в текстовом формате...
Имя     : отсутствует
Тип     : application/pgp-signature
Размер  : 181 байтов
Описание: Digital signature
Url     : <http://lists.altlinux.org/pipermail/sisyphus/attachments/20140822/99e67f0c/attachment.bin>


Подробная информация о списке рассылки Sisyphus