Re: [systemd-devel] systemd startup

2019-11-25 Thread Mantas Mikulėnas
On Fri, Nov 22, 2019 at 6:47 PM Michał Zegan 
wrote:

> Note that if systemd is running in the initramfs too, then journal logs
> from the current boot will contain initramfs logs too.
>

True, but it won't necessarily show whether event order is enforced by
configuration, or merely accidental because one service is slower than
another.

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

Re: [systemd-devel] How to compile systemd v219

2019-11-25 Thread Mantas Mikulėnas
On Tue, Nov 26, 2019 at 4:36 AM Ankele zhang  wrote:

>
> On CentOS7.6(3.10.0-957.el7.x86_64), I encrypt my root disk and I have to
> enter my passphrase while booting my CentOS before mount root disk. Now, I
> want to hardcode the passphrase into the program, what should I do?
>

IMHO you should give up on that idea and just configure a keyfile (e.g.
using the rd.luks.key= boot option). It's a more supported method and the
key information is easy to extract in both cases.


>
> I have tried to recompile `systemd` source V219 but I don not really
> understand how to compile it correctly. So I test on
> Fedora31(5.3.7-301.fc31.x86_64), compile `systemd` V243 and replace the
> executable binary in initramfs-$(uname -r).img with the compiled
> systemd-cryptsetup file. But it does not work.
>
> and I execute `file new_systemd-cryptsetup` and execute `file
> old_systemd-cryptsetup`, I got some difference between them.
> # file systemd-cryptsetup
> > systemd-cryptsetup: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
> dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
> BuildID[sha1]=9935897aeaf65a746e86f8af2c2a960c4a316acc, for GNU/Linux
> 3.2.0, with debug_info, not stripped
> # file systemd-cryptsetup.bak
> > systemd-cryptsetup.bak: ELF 64-bit LSB pie executable, x86-64, version 1
> (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
> BuildID[sha1]=fe13d068d10950b02945537972a4f5b687f41cc0, for GNU/Linux
> 3.2.0, stripped
>

Did you build from tthe Fedora RPM or manually from systemd source? Debug
info is usually removed during packaging using `strip`.

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

[systemd-devel] How to compile systemd v219

2019-11-25 Thread Ankele zhang
On CentOS7.6(3.10.0-957.el7.x86_64), I encrypt my root disk and I have to
enter my passphrase while booting my CentOS before mount root disk. Now, I
want to hardcode the passphrase into the program, what should I do?

I have tried to recompile `systemd` source V219 but I don not really
understand how to compile it correctly. So I test on
Fedora31(5.3.7-301.fc31.x86_64), compile `systemd` V243 and replace the
executable binary in initramfs-$(uname -r).img with the compiled
systemd-cryptsetup file. But it does not work.

and I execute `file new_systemd-cryptsetup` and execute `file
old_systemd-cryptsetup`, I got some difference between them.
# file systemd-cryptsetup
> systemd-cryptsetup: ELF 64-bit LSB executable, x86-64, version 1 (SYSV),
dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=9935897aeaf65a746e86f8af2c2a960c4a316acc, for GNU/Linux
3.2.0, with debug_info, not stripped
# file systemd-cryptsetup.bak
> systemd-cryptsetup.bak: ELF 64-bit LSB pie executable, x86-64, version 1
(SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2,
BuildID[sha1]=fe13d068d10950b02945537972a4f5b687f41cc0, for GNU/Linux
3.2.0, stripped
[image: image.png]

I'm dying to know how to compile correctly, thank you very much.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] Make systemd-localed modify the kernel commandline for the initrd keymap?

2019-11-25 Thread Colin Walters


On Thu, Oct 31, 2019, at 12:26 PM, Lennart Poettering wrote:

> Well, what I proposed is a file. OSTree can cover files on disk, no?

Yes...we can try to figure out an extension to version them.

> I doubt on AWS you want to configure keymaps though, do you?

No, but there are similar server cases:

 - iSCSI which apparently has quite nontrivial configuration files (things you 
wouldn't ergonomically do in the kernel cmdline) so they end up requiring 
regenerating the initramfs.
 - Tang/NBDE 
https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Security_Guide/sec-Using_Network-Bound_Disk_Encryption.html

And for OpenShift 4 we are aiming to support NBDE even in clouds like AWS for a 
few reasons; some customers don't want to 100% rely on EBS encryption, and 
supporting it everywhere makes our story for bare metal installation more 
consistent.

Finally another case just came up, which is enabling some real-time kernel 
tuning:
https://bugzilla.redhat.com/show_bug.cgi?id=1775917

Today tuned injects some bits into the initramfs for this - specifically we 
need to configure systemd in the initramfs for the `CPUAffinity`.

I've lately been thinking maybe we should just generalize this and introduce: 
/boot/etc

The initramfs then can mount /boot and read files from it (or just copy in over 
its own /etc).   
One downside of this though is that it doesn't apply to PXE/NFS-root (diskless) 
scenarios.  Those need either an overlay initramfs or kernel cmdline.

Though, I guess for CPUAffinity we really need this set up and readable before 
systemd even starts.  Hmm. 

So maybe we really need systemd.cpuaffinity= as a kernel argument - and in 
general, anything necessary for the kernel or systemd in the initramfs need to 
be kernel arguments.  Anything after that could be /boot/etc or an overlay 
initramfs.



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

Re: [systemd-devel] No error even a Required= service does not exist

2019-11-25 Thread Zbigniew Jędrzejewski-Szmek
On Mon, Nov 25, 2019 at 06:13:17PM +0200, Uoti Urpala wrote:
> On Mon, 2019-11-25 at 15:19 +0200, Mantas Mikulėnas wrote:
> > > Requires=xyz.service 
> > > 
> > > produces no complaint and starts the service even if there is no 
> > > xyz.service
> > > Is this the normal behavior or can I configure systemd to throw an error 
> > > in this case?
> > 
> > The docs say you can get this behavior if you also have After=xyz.service. 
> > (Not entirely sure why.)
> 
> No when there IS NOT an "After=xyz.service".
> 
> Without "After=", there is no ordering dependency - it just tells that
> anything starting this unit will effectively order the start of the
> other as well. Without ordering, this unit can be the one to start
> first. If the other one fails to actually start later, that doesn't
> make systemd go back to stop this one (note that this is consistent
> with ordering dependencies - if a depended-on service fails later
> during runtime, that does not automatically force a stop of already
> running depending services). I guess this logic extends to failures of
> the "does not exist at all" type where there was never a chance of
> successfully starting the unit.

Sounds like a bug. I'd expect the transaction to fail if the Required
unit cannot be found.

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

Re: [systemd-devel] No error even a Required= service does not exist

2019-11-25 Thread Jörg Weinhardt

> Mantas Mikulėnas  hat am 25. November 2019 um 14:19 
> geschrieben:
> 
> 
> On Mon, Nov 25, 2019 at 3:13 PM Jörg Weinhardt  wrote:
> 
> > Hi,
> >
> > the behavior of systemd is not quite clear to me:
> > I have a service which requires another service to be started and running,
> > so I use a Requires= dependency to the required service.
> > But if the required service does not exist at all, there is no error
> > message from systemd.
> > e.g.
> >
> > Requires=xyz.service
> >
> > produces no complaint and starts the service even if there is no
> > xyz.service
> > Is this the normal behavior or can I configure systemd to throw an error
> > in this case?
> >
> 
> The docs say you can get this behavior if you also have After=xyz.service.
> (Not entirely sure why.)
> 

Thanks for the quick answer. Require= and After= together also accepts a non 
existing xyz.service. But as I read the docs I found the dependency "BindsTo=" 
which together with "After=" does the job.
Not so easy..

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

Re: [systemd-devel] No error even a Required= service does not exist

2019-11-25 Thread Bruce A. Johnson
Joerg,

I'm not anything near an expert, but perhaps you could try "PartOf=..."
in the Unit section for the dependent service. I'll be interested in
hearing others' opinion of this idea. But, really, a missing service
file shouldn't get out the door.

Bruce A. Johnson 
Chantilly, VA

On 25/11/2019 08.07, Jörg Weinhardt wrote:
> Hi,
>
> the behavior of systemd is not quite clear to me:
> I have a service which requires another service to be started and running,
> so I use a Requires= dependency to the required service.
> But if the required service does not exist at all, there is no error message 
> from systemd.
> e.g. 
>
> Requires=xyz.service 
>
> produces no complaint and starts the service even if there is no xyz.service
> Is this the normal behavior or can I configure systemd to throw an error in 
> this case?
>
> If I write
> "Requires=xyz"
>
> there will be a message: Failed to add dependency on xyz, ignoring: Invalid 
> argument
> Does that error mean that "xyz" is not a valid unit name?
>
> Thank you,
> Joerg
> ___
> 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] No error even a Required= service does not exist

2019-11-25 Thread Uoti Urpala
On Mon, 2019-11-25 at 13:22 +, mikko.rap...@bmw.de wrote:
> Maybe you need Wants instead of Requires in the service file.

I don't think so. "Wants" is in the opposite direction - it explicitly
does not require the other unit to successfully start. Even with
"After=" specified, it just makes an attempt to start the other unit,
and will then start this unit whether that succeeded or failed.


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

Re: [systemd-devel] No error even a Required= service does not exist

2019-11-25 Thread Uoti Urpala
On Mon, 2019-11-25 at 15:19 +0200, Mantas Mikulėnas wrote:
> > Requires=xyz.service 
> > 
> > produces no complaint and starts the service even if there is no xyz.service
> > Is this the normal behavior or can I configure systemd to throw an error in 
> > this case?
> 
> The docs say you can get this behavior if you also have After=xyz.service. 
> (Not entirely sure why.)

No when there IS NOT an "After=xyz.service".

Without "After=", there is no ordering dependency - it just tells that
anything starting this unit will effectively order the start of the
other as well. Without ordering, this unit can be the one to start
first. If the other one fails to actually start later, that doesn't
make systemd go back to stop this one (note that this is consistent
with ordering dependencies - if a depended-on service fails later
during runtime, that does not automatically force a stop of already
running depending services). I guess this logic extends to failures of
the "does not exist at all" type where there was never a chance of
successfully starting the unit.


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

Re: [systemd-devel] No error even a Required= service does not exist

2019-11-25 Thread Mikko.Rapeli
Hi,

On Mon, Nov 25, 2019 at 02:07:23PM +0100, Jörg Weinhardt wrote:
> Hi,
> 
> the behavior of systemd is not quite clear to me:
> I have a service which requires another service to be started and running,
> so I use a Requires= dependency to the required service.
> But if the required service does not exist at all, there is no error message 
> from systemd.
> e.g. 
> 
> Requires=xyz.service 
> 
> produces no complaint and starts the service even if there is no xyz.service
> Is this the normal behavior or can I configure systemd to throw an error in 
> this case?
> 
> If I write
> "Requires=xyz"
> 
> there will be a message: Failed to add dependency on xyz, ignoring: Invalid 
> argument
> Does that error mean that "xyz" is not a valid unit name?

I guess all these are by design. Maybe you need Wants instead of Requires in 
the service file.
See:

https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Requires=
and
https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Wants=
and possibly even
https://www.freedesktop.org/software/systemd/man/systemd.unit.html#Before=

Cheers,

-Mikko

> 
> Thank you,
> Joerg
> ___
> 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] No error even a Required= service does not exist

2019-11-25 Thread Mantas Mikulėnas
On Mon, Nov 25, 2019 at 3:13 PM Jörg Weinhardt  wrote:

> Hi,
>
> the behavior of systemd is not quite clear to me:
> I have a service which requires another service to be started and running,
> so I use a Requires= dependency to the required service.
> But if the required service does not exist at all, there is no error
> message from systemd.
> e.g.
>
> Requires=xyz.service
>
> produces no complaint and starts the service even if there is no
> xyz.service
> Is this the normal behavior or can I configure systemd to throw an error
> in this case?
>

The docs say you can get this behavior if you also have After=xyz.service.
(Not entirely sure why.)


>
> If I write
> "Requires=xyz"
>
> there will be a message: Failed to add dependency on xyz, ignoring:
> Invalid argument
> Does that error mean that "xyz" is not a valid unit name?
>

It's not a valid unit name if it doesn't have a ".type" suffix.

`systemctl start xyz` will just auto-expand it to xyz.service or something
that makes sense for systemctl, but systemd's configuration files do not
accept such shortcuts.

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

[systemd-devel] No error even a Required= service does not exist

2019-11-25 Thread Jörg Weinhardt
Hi,

the behavior of systemd is not quite clear to me:
I have a service which requires another service to be started and running,
so I use a Requires= dependency to the required service.
But if the required service does not exist at all, there is no error message 
from systemd.
e.g. 

Requires=xyz.service 

produces no complaint and starts the service even if there is no xyz.service
Is this the normal behavior or can I configure systemd to throw an error in 
this case?

If I write
"Requires=xyz"

there will be a message: Failed to add dependency on xyz, ignoring: Invalid 
argument
Does that error mean that "xyz" is not a valid unit name?

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