Re: [systemd-devel] systemd/hostnamed: setting the hostname and using it in the DHCP Discover
On Fri, Jul 28, 2017 at 10:46 PM, Mantas Mikulėnas wrote: > > > On Sat, Jul 29, 2017, 08:13 Andrei Borzenkov wrote: >> >> 28.07.2017 22:08, Andrey Yurovsky пишет: >> > >> > Is there a correct way to replace or otherwise set the hostname and >> > have systemd use it from the beginning and ensure that the DHCP client >> > specifies it in option 12? >> > >> >> Use generator to create /etc/hostname before systemd starts. > Thanks, I tried that and: > But afaik, generators only run before units are processed, but still after > applying the general config? That, I believe, is what I observed. > That said... Might the problem be that you only update the config in /etc > but don't apply it to the kernel via `hostname`? DHCP clients don't really > care about /etc/hostname. In my tests I have a shell script that generates the desired hostname string, writes it to /etc/hostname, and then runs hostname -F /etc/hostname which as I understand it will read that back and call hostname(2). That script is invoked by my unit that runs via the network-pre.target. However I see the DHCP client use the original hostname the first time my target boots (I captured traffic and checked the DHCP Discover contents). When I reboot the newly-booted system, /etc/hostname is already updated so everything looks right on the wire. It feels like systemd-networkd is using the hostname that was read at systemd init (in main.c) rather than checking what it's set to, but that's just speculation (I need to dig in further). > -- > > Mantas Mikulėnas > Sent from my phone > > > ___ > 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/hostnamed: setting the hostname and using it in the DHCP Discover
On Sat, Jul 29, 2017, 08:13 Andrei Borzenkov wrote: > 28.07.2017 22:08, Andrey Yurovsky пишет: > > > > Is there a correct way to replace or otherwise set the hostname and > > have systemd use it from the beginning and ensure that the DHCP client > > specifies it in option 12? > > > > Use generator to create /etc/hostname before systemd starts. > But afaik, generators only run before units are processed, but still after applying the general config? That said... Might the problem be that you only update the config in /etc but don't apply it to the kernel via `hostname`? DHCP clients don't really care about /etc/hostname. > -- Mantas Mikulėnas Sent from my phone ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd/hostnamed: setting the hostname and using it in the DHCP Discover
28.07.2017 22:08, Andrey Yurovsky пишет: > > Is there a correct way to replace or otherwise set the hostname and > have systemd use it from the beginning and ensure that the DHCP client > specifies it in option 12? > Use generator to create /etc/hostname before systemd starts. ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Two questions about logind and seats
Hi I hope this is the right place to ask this. I have two questions about logind and seats. First, when I attach a 2nd graphics card to seat1, it seems CanMultisession is set to 0. Is there a way to change that? or is that only supported on seat0, that supports the TTYs? Second, with systemd-run, and maybe a custom '-p PAMName=somepamfile' (if that is required), is there a way to spawn a process on seat1 if it exits? For seat0 sessions, they for instance can be started by specifying -pTTYPath=/dev/ttyX -pStandardOutput=tty -pStandardError=tty -pStandardInput=tty to systemd-run, which I know only seat0 supports ttys... I try to do weston --seat=seat1 and it says that seat1 does not match the session-seat. Is there a way to start a process with under a specific session-seat? Thanks ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemd/hostnamed: setting the hostname and using it in the DHCP Discover
I have an embedded target where the hostname is expected to be a string derived in part from the MAC address of an Ethernet interface. I've been looking at how to properly set the system's hostname and also have systemd-networkd use it in the DHCP request it sends out, however there seems to be an order of operations issue. 1. in systemd/core/main.c the /etc/hostname contents are unconditionally read 2. I can add a service that uses the special network-pre.target to override /etc/hostname with my generated string and I see that while the initial string is pickedup by systemd, the new hostname will in fact be used 3. I then have a .network file specifying DHCP on that Ethernet interface But then on initial boot I see that the DHCP Discover coming out has option 12 set to the original hostname that systemd picked up in main.c, even though the network-pre.target caused my unit to run. I can then reboot the system and this time main.c picks up the "new" hostname and option 12 is indeed set to this. One workaround I found was to have my unit write the Hostname= option to the .network file but that seems like the wrong approach. Is there a correct way to replace or otherwise set the hostname and have systemd use it from the beginning and ensure that the DHCP client specifies it in option 12? Thanks, -Andrey ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Debug hanging unit stop on shutdown?
Thanks, I'll check it out. Mantas Mikulėnas schrieb am Fr., 28. Juli 2017, 10:52: > On Thu, Jul 27, 2017 at 10:33 PM, Benno Fünfstück < > benno.fuenfstu...@gmail.com> wrote: > >> Hi, >> >> when shutting down my system, I sometimes get a "Stopping ..." from >> systemd, where it waits 90 seconds before it kills the affected session / >> unit / scope / ... . Is there any way to debug this live, without enabling >> persistent journal and hoping that the journal has enough information? >> >> Ideal would be a way to "interrupt" shutdown in this case and be able to >> correct the mistake / fix the error. >> > > Start debug-shell.service (or boot with "systemd.debug-shell"). During > shutdown, switch to tty9 and use `systemctl list-jobs`, then `systemctl > cancel` to flush all pending jobs. > > -- > Mantas Mikulėnas > ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Debug hanging unit stop on shutdown?
On Thu, Jul 27, 2017 at 10:33 PM, Benno Fünfstück < benno.fuenfstu...@gmail.com> wrote: > Hi, > > when shutting down my system, I sometimes get a "Stopping ..." from > systemd, where it waits 90 seconds before it kills the affected session / > unit / scope / ... . Is there any way to debug this live, without enabling > persistent journal and hoping that the journal has enough information? > > Ideal would be a way to "interrupt" shutdown in this case and be able to > correct the mistake / fix the error. > Start debug-shell.service (or boot with "systemd.debug-shell"). During shutdown, switch to tty9 and use `systemctl list-jobs`, then `systemctl cancel` to flush all pending jobs. -- Mantas Mikulėnas ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel