[systemd-devel] service runs - but it's not really there

2021-01-28 Thread lejeczek

Hi guys

This absolutely boggled my mind, my brain exploded, but go 
easy on me as I ain't an expert.
I have, meaning the "root" but other users too, _NO_ 
"~/.config/systemd" - thus, how I understand it, no service 
definitions which are user-made, yet this..


● user@0.service - User Manager for UID 0
   Loaded: loaded (/usr/lib/systemd/system/user@.service; 
static; vendor preset: disabled)
   Active: active (running) since Thu 2021-01-28 17:13:01 
GMT; 2h 34min ago

 Main PID: 854314 (systemd)
   Status: "Startup finished in 44ms."
    Tasks: 35
   Memory: 69.3M
   CGroup: /user.slice/user-0.slice/user@0.service
   ├─init.scope
   │ ├─854314 /usr/lib/systemd/systemd --user
   │ └─854319 (sd-pam)
   └─syncthing.service

exists and gets auto started by "systemd" without any asking 
really.

This is really very bad, no?
What am I missing here?
many thanks, L.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] service runs - but it's not really there

2021-01-28 Thread Lennart Poettering
On Do, 28.01.21 20:06, lejeczek (pelj...@yahoo.co.uk) wrote:

> Hi guys
>
> This absolutely boggled my mind, my brain exploded, but go easy on me as I
> ain't an expert.
> I have, meaning the "root" but other users too, _NO_ "~/.config/systemd" -
> thus, how I understand it, no service definitions which are user-made, yet
> this..
>
> ● user@0.service - User Manager for UID 0
>    Loaded: loaded (/usr/lib/systemd/system/user@.service; static; vendor
> preset: disabled)
>    Active: active (running) since Thu 2021-01-28 17:13:01 GMT; 2h 34min ago
>  Main PID: 854314 (systemd)
>    Status: "Startup finished in 44ms."
>     Tasks: 35
>    Memory: 69.3M
>    CGroup: /user.slice/user-0.slice/user@0.service
>    ├─init.scope
>    │ ├─854314 /usr/lib/systemd/systemd --user
>    │ └─854319 (sd-pam)
>    └─syncthing.service
>
> exists and gets auto started by "systemd" without any asking really.
> This is really very bad, no?
> What am I missing here?

systemd at the very least will spawn your per-user dbus daemon, which
is needs to be available for many programs to function. Even others
require systemd themselves.

Lennart

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


Re: [systemd-devel] Journalctl reading incorrect file

2021-01-28 Thread Lennart Poettering
On Do, 28.01.21 17:42, John Lane (syst...@jelmail.com) wrote:

>
>
> > journalctl reads from both dirs, always. What makes you think it reads
> > from the wrong dir only?
> >
>
> when I do `journalctl` I only get output up to the switch-root:
>
>
> Jan 28 08:33:31 archlinux systemd[1]: Reached target Switch Root.
> Jan 28 08:33:31 archlinux systemd[1]: Starting Switch Root...
> Jan 28 08:33:31 archlinux systemd[1]: Switching root.
> Jan 28 08:33:31 archlinux audit: BPF prog-id=8 op=UNLOAD
> Jan 28 08:33:31 archlinux audit: BPF prog-id=7 op=UNLOAD
> Jan 28 08:33:31 archlinux audit: BPF prog-id=10 op=UNLOAD
> Jan 28 08:33:31 archlinux audit: BPF prog-id=9 op=UNLOAD
> Jan 28 08:33:31 archlinux systemd-journald[235]: Journal stopped
>
> If I use -D to select the newest subdir of /var/log/journal then
> I see live messages.
>
> So I think it's reading from /run and not from /var but I could of
> course be wrong. I'm just going on the fact that the "live" data is
> definitely on /var and the /run file ends with the output above.

Hmm, does "strace" show it opens the files in /var?

Is it possible you are playing some weird games with your machine ID
or boot ID?

journalctl by default only shows messages matching either the current machine ID
or the current boot ID. (the latter since the initrd will have a
different machine ID than the host)

Lennart

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


Re: [systemd-devel] Journalctl reading incorrect file

2021-01-28 Thread John Lane



> journalctl reads from both dirs, always. What makes you think it reads
> from the wrong dir only?
> 

when I do `journalctl` I only get output up to the switch-root:


Jan 28 08:33:31 archlinux systemd[1]: Reached target Switch Root.
Jan 28 08:33:31 archlinux systemd[1]: Starting Switch Root...
Jan 28 08:33:31 archlinux systemd[1]: Switching root.
Jan 28 08:33:31 archlinux audit: BPF prog-id=8 op=UNLOAD
Jan 28 08:33:31 archlinux audit: BPF prog-id=7 op=UNLOAD
Jan 28 08:33:31 archlinux audit: BPF prog-id=10 op=UNLOAD
Jan 28 08:33:31 archlinux audit: BPF prog-id=9 op=UNLOAD
Jan 28 08:33:31 archlinux systemd-journald[235]: Journal stopped

If I use -D to select the newest subdir of /var/log/journal then
I see live messages.

So I think it's reading from /run and not from /var but I could of
course be wrong. I'm just going on the fact that the "live" data is
definitely on /var and the /run file ends with the output above.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] systemd-resolved mDNS browse for services

2021-01-28 Thread Christian Schneider

Hi,
I wanted to use systemd-resolved for mDNS service discovery.
Using DBus Method ResolveService() to resolve a single instance name 
works fine.
But I actually wanted to know, if it is possible to browse for all 
services of a certain type, eg. _ipp._tcp in local domain. Or even all 
services regardles of type.

So something like avahi-browse _ipp._tcp or avahi-browse --all does.

Thx for answers,
BR,Christian
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Why does reboot invoke kexec command?

2021-01-28 Thread Lennart Poettering
On Do, 28.01.21 10:03, Baoquan He (b...@redhat.com) wrote:

> Hi,
>
> >From systemd code, if kexec kernel is loaded, executing 'reboot' will
> finally enter into reboot system call with KEXEC action. Wondering why
> it has to invoke kexec command.

systemd reboots via kexec only if you ask it to. "systemctl kexec" will
reboot via kexec, "systemctl reboot" will do a regular reboot.

> [ 1669.796863] dracut Warning: Killing all remaining processes
> dracut Warning: Killing all remaining processes
> [ 1670.134541] XFS (dm-0): Unmounting Filesystem
> [ 1670.145779] dracut Warning: Unmounted /oldroot.
> [ 1670.168229] dracut: Disassembling device-mapper devices
> kexec: /lib64/libc.so.6: version `GLIBC_2.33' not found (required by kexec)
> [ 1670.197024] dracut Warning: kexec failed!
> dracut Warning: kexec failed!
> Rebooting.
> [ 1670.211839] kvm: exiting hardware virtualization
> [ 1671.457978] reboot: Restarting system
> [ 1671.461965] reboot: machine restart
> ~~~

The logs above suggest dracut does kexec in your case, not systemd?

Lennart

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


Re: [systemd-devel] udev and btrfs multiple devices

2021-01-28 Thread Lennart Poettering
On Mi, 27.01.21 17:19, Chris Murphy (li...@colorremedies.com) wrote:

> Is it possible for a udev rule to have a timeout? For example:
> /usr/lib/udev/rules.d/64-btrfs.rules
>
> This udev rule will wait indefinitely for a missing device to
> appear.

Hmm, no, that's a mis understaning. "rules" can't "wait". The
activation of the btrfs file system won't happen, but that should then
be caught by systemd mount timeouts and put you into recovery mode.

udev only does the most basic form of btrfs raid activation. If you
want more complex policies (i.e. "boot cleanly if 5 of the 7 hdd's
have shown up plus 30s passed") then put that into some storage
daemon. udev is not supposed to implement complex policies like that.

> It'd be better if it gives up at some point and drops to a dracut
> shell. Is that possible? The only alternative right now is the user
> has to force power off, and boot with something like
> rd.break=pre-mount, although I'm not 100% certain that'll break soon
> enough to avoid the hang.

That should be the default.

But note that once you throw cryptsetup into mix the mount activation
timeout is typically automatically turned off, because we cannot
distinguish the cases where devices didn't show up because hdd borked
from "user didn't type in their pw in time". To give the user any time
they want for typing it in the logic thus turns off root fs activation
timeouts.

> Next, is it possible to enhance udev so that it can report the number
> of devices expected for a Btrfs file system? This information is
> currently in the Btrfs superblock found on each device in the
> num_devices field.
> https://github.com/storaged-project/udisks/pull/838#issuecomment-768372627

systemd/udev has no clue about btrfs superblocks. It only talks to
libblkid, and to the kernel. It doesn't parase anything on its own. If
you want this property to be attached to the udev device, please
request this from the libblkid maintainer, since we basically import
all props it gives us 1:1 into udev rules.

Lennart

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


Re: [systemd-devel] Questions about systemd's "root storage daemon" concept

2021-01-28 Thread Lennart Poettering
On Do, 28.01.21 10:08, Martin Wilck (mwi...@suse.com) wrote:

> Hi Lennart,
>
> thanks again.
>
> On Wed, 2021-01-27 at 23:56 +0100, Lennart Poettering wrote:
> > On Mi, 27.01.21 21:51, Martin Wilck (mwi...@suse.com) wrote:
> >
> > if you want the initrd environment to fully continue to exist,
>
> I don't. I just need /sys and /dev (and perhaps /proc and /run, too) to
> remain accessible. I believe most root storage daemons will need this.
>
> > consider creating a new mount namespace, bind mount the initrd root
> > into it recursively to some new dir you created. Then afterwards mark
> > that mount MS_PRIVATE. then pivot_root()+chroot()+chdir() into your
> > new old world.
>
> And on exit, I'd need to tear all that down again, right? I don't want
> my daemon to block shutdown because some file systems haven't been
> cleanly unmounted.

if you don't need the initrd root, i.e. don't intend to open any
further files, then you can just mount a an empty tmpfs to your
tempdir, mount proc/sys into it, then transition your process into it
and forget about the rest.

Lennart

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


Re: [systemd-devel] Journalctl reading incorrect file

2021-01-28 Thread Lennart Poettering
On Fr, 15.01.21 09:17, John Lane (syst...@jelmail.com) wrote:

> Hello,
>
> I've just set up a new system and have noticed a problem with journalctl
> where it appears to be reading from the incorrect journal. The journal
> is running and I can direct it at the correct file using -D, but I don't
> understand what is happening.
>
> There is a journal in /run/log/journal which contains events up to the
> switch root. There is a journal in /var/log/journal which contains those
> same events plus the events following the switch root. Events appear to
> be written correctly to /var but journalctl appears to read from
> /run.

journalctl reads from both dirs, always. What makes you think it reads
from the wrong dir only?

Lennart

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


Re: [systemd-devel] Why systemd-nspawn is slower than docker, podman and qemu?! how to Improve nspawn performance?

2021-01-28 Thread Badr Elmers
Problem solved, as  Mantas Mikulėnas said I had to use  export
SYSTEMD_SECCOMP=0, because nspawn will still be processing syscalls
when I whitelist them with  --system-call-filter. and I was using
systemd v241 of debian buster but SYSTEMD_SECCOMP was added in systemd
v247 (so it had no effect when I first test it) .
now nspawn is as quick as the baremetal host, perf and even the
context switch benchmark improved and now it is as the baremetal.

This is what I used (need systemd v247):
export SYSTEMD_SECCOMP=0
systemd-nspawn --capability=all --private-users=false -D ./bbusterboot --boot

Thank you very much for your help.
badr


On Mon, Jan 25, 2021 at 3:06 PM Greg KH  wrote:
>
> On Mon, Jan 25, 2021 at 11:56:09AM +0100, Badr Elmers wrote:
> > Hi,
> > Why nspawn is slow compared to docker podman and even qemu?!
> > CPU tasks take twice of the time it takes in docker, podman or qemu
> >
> > here I filled a request to improve nspawn performance which contain the
> > steps and the full test result:
> > https://github.com/systemd/systemd/issues/18370
> >
> > Do you know why systemd-nspawn is slower? how can I improve it?
>
> As I pointed out in the above "issue", the benchmark isn't measuring
> what anyone thinks it is measuring and should not be treated as a
> reliable indication of anything.
>
> thanks,
>
> greg k-h
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Questions about systemd's "root storage daemon" concept

2021-01-28 Thread Martin Wilck
Hi Lennart,

thanks again.

On Wed, 2021-01-27 at 23:56 +0100, Lennart Poettering wrote:
> On Mi, 27.01.21 21:51, Martin Wilck (mwi...@suse.com) wrote:
> 
> if you want the initrd environment to fully continue to exist,

I don't. I just need /sys and /dev (and perhaps /proc and /run, too) to
remain accessible. I believe most root storage daemons will need this.

> consider creating a new mount namespace, bind mount the initrd root
> into it recursively to some new dir you created. Then afterwards mark
> that mount MS_PRIVATE. then pivot_root()+chroot()+chdir() into your
> new old world.

And on exit, I'd need to tear all that down again, right? I don't want
my daemon to block shutdown because some file systems haven't been
cleanly unmounted.

Regards,
Martin


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


Re: [systemd-devel] Journalctl reading incorrect file

2021-01-28 Thread John Lane
I'm still stuck on this one, if anyone can offer any advice I'd really
appreciate it as I'm not sure how to troubleshoot it.

On 15/01/2021 09:17, John Lane wrote:
> Hello,
> 
> I've just set up a new system and have noticed a problem with journalctl
> where it appears to be reading from the incorrect journal. The journal
> is running and I can direct it at the correct file using -D, but I don't
> understand what is happening.
> 
> There is a journal in /run/log/journal which contains events up to the
> switch root. There is a journal in /var/log/journal which contains those
> same events plus the events following the switch root. Events appear to
> be written correctly to /var but journalctl appears to read from /run.
> 
> # ls -ld /{var,run}/log/journal
> drwxr-sr-x+  3 root systemd-journal 80 Jan 14 13:50 /run/log/journal
> drwxr-sr-x+ 18 root systemd-journal 19 Jan 14 13:25 /var/log/journal
> 
> $ journalctl > /tmp/journal
> $ journalctl -D /run/log/journal/e4a4799a826d44d9a6887e24025d54ae >
> /tmp/run_journal
> $ journalctl -D /var/log/journal/9c29e192f536402e9565718f3bb04983 >
> /tmp/log_journal
> 
> $ diff /tmp/journal /tmp/run_journal # same
> $ sdiff /tmp/run_journal /tmp/var_journal # latter is superset
> 
> I have not customised /etc/systemd/journald.conf (it only contains
> commented out settings). I have not done anything different on this
> install vs others except it being on a different device.
> 
> I tried to fix it by restarting systemd-journald but it fails to restart
> (and I can't get a log message to report why). I then have no journal
> until I reboot.
> 
> Not sure what to do to fix this, pointers appreciated...
> 
> Some details:
> 
> # systemctl --version && uname -a
> systemd 247 (247.2-1-arch)
> +PAM +AUDIT -SELINUX -IMA -APPARMOR +SMACK -SYSVINIT +UTMP
> +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +ZSTD +SECCOMP +BLKID
> +ELFUTILS +KMOD +IDN2 -IDN +PCRE2 default-hierarchy=hybrid
> Linux xx 5.10.6-arch1-1 #1 SMP PREEMPT Sat, 09 Jan 2021 18:22:35
> + x86_64 GNU/Linux
> (Arch Linux)
> 
> 
> 
> ___
> 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] udev and btrfs multiple devices

2021-01-28 Thread Greg KH
On Thu, Jan 28, 2021 at 01:32:03AM -0700, Chris Murphy wrote:
> On Thu, Jan 28, 2021 at 1:03 AM Greg KH  wrote:
> >
> > On Wed, Jan 27, 2021 at 05:19:38PM -0700, Chris Murphy wrote:
> > >
> > > Next, is it possible to enhance udev so that it can report the number
> > > of devices expected for a Btrfs file system? This information is
> > > currently in the Btrfs superblock found on each device in the
> > > num_devices field.
> > > https://github.com/storaged-project/udisks/pull/838#issuecomment-768372627
> >
> > It's not up to udev to report that, but rather have either the kernel
> > export that, or have the tool that udev calls determine that.
> 
> I mean expose in udevadm info, e.g.
> 
> E: ID_BTRFS_NUM_DEVICES=4

Again, that is up to either the kernel, or a tool that udev calls to do
that, udev itself doesn't know device-specific things, that's not what
it is designed to do.

thanks,

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


Re: [systemd-devel] udev and btrfs multiple devices

2021-01-28 Thread Chris Murphy
On Thu, Jan 28, 2021 at 1:03 AM Greg KH  wrote:
>
> On Wed, Jan 27, 2021 at 05:19:38PM -0700, Chris Murphy wrote:
> >
> > Next, is it possible to enhance udev so that it can report the number
> > of devices expected for a Btrfs file system? This information is
> > currently in the Btrfs superblock found on each device in the
> > num_devices field.
> > https://github.com/storaged-project/udisks/pull/838#issuecomment-768372627
>
> It's not up to udev to report that, but rather have either the kernel
> export that, or have the tool that udev calls determine that.

I mean expose in udevadm info, e.g.

E: ID_BTRFS_NUM_DEVICES=4


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


Re: [systemd-devel] udev and btrfs multiple devices

2021-01-28 Thread Greg KH
On Wed, Jan 27, 2021 at 05:19:38PM -0700, Chris Murphy wrote:
> 
> Next, is it possible to enhance udev so that it can report the number
> of devices expected for a Btrfs file system? This information is
> currently in the Btrfs superblock found on each device in the
> num_devices field.
> https://github.com/storaged-project/udisks/pull/838#issuecomment-768372627

It's not up to udev to report that, but rather have either the kernel
export that, or have the tool that udev calls determine that.

thanks,

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