You are not logged in.

#1301 2012-03-29 06:50:53

ron9
Member
From: Norway
Registered: 2011-02-02
Posts: 119

Re: systemd: Yet Another Init Replacement

bobwya wrote:

So I guess I have missed adding my user to a group with privileges needed to power down in a KDE session??

Systemctl poweroff and reboot need root privileges.

Edit your sudoers file

# "user" ALL=NOPASSWD: /bin/systemctl poweroff

lenovo w500 - huawei matebook 14 | archlinux | swaywm | alacritty | falkon

Offline

#1302 2012-03-29 09:15:21

bobwya
Member
Registered: 2012-01-09
Posts: 36

Re: systemd: Yet Another Init Replacement

ron9 wrote:
bobwya wrote:

So I guess I have missed adding my user to a group with privileges needed to power down in a KDE session??

Systemctl poweroff and reboot need root privileges.

Edit your sudoers file

# "user" ALL=NOPASSWD: /bin/systemctl poweroff

That works - on the commandline... Sadly won't solve the KDE session bug (post immediately before my previous one)...!! I guess I'll just wait till the fix rolls into stable. It' s hardly a big deal anyway.

Ta Bob

Offline

#1303 2012-03-29 15:06:28

broken pipe
Member
Registered: 2010-12-10
Posts: 238

Re: systemd: Yet Another Init Replacement

i can use systemctl poweroff without sudo.let's hope that the patch will be included in the next systemd/kde release. i think it's more a kde/kdm thing because the combination of xfce/lxdm/systemd works yikes

Last edited by broken pipe (2012-03-29 15:07:22)

Offline

#1304 2012-03-30 06:53:10

fuchs24
Member
Registered: 2011-07-05
Posts: 5

Re: systemd: Yet Another Init Replacement

I like systemd an the concept behind it. But nevertheless it could be more solid. For example, today I've got this bug: https://bugs.archlinux.org/task/29181
With systemd I couldn't login. With sysvinit it was no problem at all to login and downgrade the broken package.

Offline

#1305 2012-03-30 08:18:15

intgr
Member
Registered: 2009-10-02
Posts: 44

Re: systemd: Yet Another Init Replacement

fuchs24 wrote:

today I've got this bug: https://bugs.archlinux.org/task/29181

systemd caused your 3D acceleration to stop working? I think you got the wrong bug smile

Offline

#1306 2012-04-01 16:25:13

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: systemd: Yet Another Init Replacement

Hi

The entry for "/" mountpoint

# systemctl
......
-.mount                                                loaded active mounted       /
......

is being created by systemd automatically from fstab I believe.
But is there any way to get rid of fstab and mount "/" via a systemd unit file?

For the mountpoints other than "/" it is possible to just create home.mount unit file, for example. But it is not possible to create a "-.mount" custom file since it is an invalid filename.
How can systemd then directly address "/" without the help of fstab?

thanks

Offline

#1307 2012-04-01 16:46:47

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: systemd: Yet Another Init Replacement

aya wrote:

Hi

The entry for "/" mountpoint

# systemctl
......
-.mount                                                loaded active mounted       /
......

is being created by systemd automatically from fstab I believe.
But is there any way to get rid of fstab and mount "/" via a systemd unit file?

For the mountpoints other than "/" it is possible to just create home.mount unit file, for example. But it is not possible to create a "-.mount" custom file since it is an invalid filename.
How can systemd then directly address "/" without the help of fstab?

thanks

How is -.mount an invalid filename? What you actually trying to accomplish by this?

Offline

#1308 2012-04-01 22:50:07

bobwya
Member
Registered: 2012-01-09
Posts: 36

Re: systemd: Yet Another Init Replacement

@falconindy

Just about tearing out my hair!! I have been trying to correct a problem in the SystemD bash-completion script. I encountered this bug when using complex unit names (that contain any escaped characters using the \ character).

To reproduce create a SystemD Unit file for a mount point that contains a dash (represented as '\x2d'), bracket (represented as '\x28' or '\x29'), or any character which needs escaping, in the path of the mount-point.

Fix ('hack') against latest version of SystemD bash-completion script...

Sorry 'bout my limited BASH scripting abilities lol Had to revert the patched script code back to the previous version. I can't figure out how to stop the new code (using read) from stripping forward slashes completely...

UPDATE: I must add that my patch doesn't correct the behaviour of calls to the function __filter_units_by_property() ... yet!! That is rather crucial since it's called when e.g. the user types:

systemctl start

to start a Unit.


Bob

Last edited by bobwya (2012-04-02 09:29:09)

Offline

#1309 2012-04-02 06:47:22

extofme
Member
From: here + now
Registered: 2009-10-10
Posts: 174
Website

Re: systemd: Yet Another Init Replacement

@aya (and others)

per your previous comments on network interface bindings, you DO NOT have to reference them directly by PCI path!

/lib/udev/rules.d/99-systemd.rules wrote:

# We need a hardware independent way to identify network devices. We
# use the /sys/subsystem path for this. Current vanilla kernels don't
# actually support that hierarchy right now, however upcoming kernels
# will. HAL and udev internally support /sys/subsystem already, hence
# it should be safe to use this here, too. [...]

... simply put, you can use:

sys-subsystem-net-devices-%i.device

... to reference physical network interfaces.  in fact, you can also setup want dependencies on it like any other unit file:

# ls -l etc/systemd/system/sys-subsystem-net-devices-eth0.device.wants/
total 0
lrwxrwxrwx 1 root root 24 Apr  2 01:03 net-dyn-phys@eth0.service -> ../net-dyn-phys@.service

lastly, here is the unit file i've used for about a year; this binds DHCP to a physical interface, but you can also do virtual interfaces by targeting:

sys-devices-virtual-net-%i.device

... i am working on a solution that brings up a PHY target (all physical devs online), which creates macvlans/macvtaps, which then triggers the VIRT targets! who needs networking scripts at all? :-) this unit file will auto restart DHCP every 10 seconds if it dies, but will kill the service if the interface disappears.  it waits until user-sessions are ready before trying to connect (my virtual machines use virtfs/9p2000.L passthru -- literally coldbooting in <3 seconds -- i was having a weird issue where systemd was starting stuff too soon).

# cat /var/lib/libvirt/assets/2c18068bfc0543f383b9fdc1a0472700.pool/vfs/etc/systemd/system/net-dyn-phys@.service
# Bindings to physical interfaces

[Unit]
Description=dyanamic inet interface [phys:%I]
StopWhenUnneeded=true
Wants=network.target
Before=network.target
BindTo=sys-sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
After=systemd-user-sessions.service rc-local.service

[Service]
Type=simple
TimeoutSec=0
Restart=always
RestartSec=10
PIDFile=/run/dhcpcd-%I.pid
ExecStart=-/usr/sbin/dhcpcd --nobackground --timeout 0 %I
ExecStop=-/usr/sbin/dhcpcd --exit %I

[Install]
Alias=sys-subsystem-net-devices-eth0.device.wants/net-dyn-phys@eth0.service

what am i but an extension of you?

Offline

#1310 2012-04-02 13:37:06

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: systemd: Yet Another Init Replacement

falconindy wrote:

How is -.mount an invalid filename? What you actually trying to accomplish by this?

Oops... Sorry about the filename. Of course it is ok. My bad.

I am trying to write a unit file that would allow me to mount my "/" without the help of fstab. Why do I want this? - just testing.

[root@myarch1 ~]# cat /etc/systemd/system/local-fs.target.wants/-.mount 
[Unit]
Description=Root directory mount

[Mount]
What=UUID=a14dc085-02fe-4b75-a014-45ff33295f0a
Where=/
Type=btrfs
Options=defaults,noatime,space_cache,inode_cache,subvol=active

Basically I can't figure out the 'Before=' timing when it should be mounted.

Offline

#1311 2012-04-02 14:02:36

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: systemd: Yet Another Init Replacement

Thanks extofme

extofme wrote:

... simply put, you can use:
sys-subsystem-net-devices-%i.device
... to reference physical network interfaces.

BindTo=sys-sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

indeed worked... though I don't have /sys/subsystem

Offline

#1312 2012-04-02 15:15:31

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: systemd: Yet Another Init Replacement

aya wrote:

indeed worked... though I don't have /sys/subsystem

No it did not after the second reboot.
Again the same problem - eth1 becomes ready after "Unit network@eth1.service entered failed state." as can be seen from the journal

Apr 03 00:12:11 myarch1 ip[214]: Cannot find device "eth1"
Apr 03 00:12:11 myarch1 systemd[1]: network@eth1.service: main process exited, code=exited, status=1
Apr 03 00:12:11 myarch1 systemd[1]: Unit network@eth1.service entered failed state.
Apr 03 00:12:11 myarch1 kernel: intel8x0_measure_ac97_clock: measured 53352 usecs (10289 samples)
Apr 03 00:12:11 myarch1 kernel: intel8x0: measured clock 192851 rejected
Apr 03 00:12:11 myarch1 /usr/sbin/crond[213]: (CRON) INFO (Syslog will be used instead of sendmail.): No such file or directory
Apr 03 00:12:11 myarch1 /usr/sbin/crond[213]: (CRON) INFO (running with inotify support)
Apr 03 00:12:11 myarch1 systemd-logind[216]: New seat seat0.
Apr 03 00:12:11 myarch1 kernel: intel8x0_measure_ac97_clock: measured 53191 usecs (10094 samples)
Apr 03 00:12:11 myarch1 kernel: intel8x0: measured clock 189768 rejected
Apr 03 00:12:11 myarch1 kernel: intel8x0: clocking to 48000
Apr 03 00:12:11 myarch1 kernel: e1000 0000:00:08.0: PCI INT A -> GSI 16 (level, low) -> IRQ 16
Apr 03 00:12:12 myarch1 kernel: e1000 0000:00:08.0: eth1: (PCI:33MHz:32-bit) 08:00:27:8b:26:92
Apr 03 00:12:12 myarch1 kernel: e1000 0000:00:08.0: eth1: Intel(R) PRO/1000 Network Connection
[root@myarch1 ~]# cat /etc/systemd/system/multi-user.target.wants/network@eth1.service

[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target
#After=sys-devices-pci0000:00-0000:00:08.0-net-eth1.device
#BindTo=sys-devices-pci0000:00-0000:00:08.0-net-eth1.device
After=sys-subsystem-net-devices-%i.device
BindTo=sys-sys-subsystem-net-devices-%i.device

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev %I up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev %I
ExecStop=/sbin/ip addr flush dev %I
ExecStop=/sbin/ip link set dev %I down

[Install]
Alias=multi-user.target.wants/network@%I.service

When doing

systemctl start network@eth1.service

manually, it works.

Offline

#1313 2012-04-02 15:44:20

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: systemd: Yet Another Init Replacement

sys-sys-subsystem.... is a typo.

Offline

#1314 2012-04-02 16:05:36

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: systemd: Yet Another Init Replacement

falconindy wrote:

sys-sys-subsystem.... is a typo.

but without this 'typo' it fails for me even with manual start

Apr 03 01:01:52 myarch1 systemd[1]: Job sys-subsystem-net-devices-eth1.device/start timed out.
Apr 03 01:01:52 myarch1 systemd[1]: Job network@eth1.service/start failed with result 'dependency'.
Apr 03 01:01:52 myarch1 systemd[1]: Job sys-subsystem-net-devices-eth1.device/start failed with result 'timeout'.

Offline

#1315 2012-04-02 19:57:19

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: systemd: Yet Another Init Replacement

That's insane. The path is /sys/subsystem, not /sys/sys/subsystem.

Which one returns a device via systemctl status? i.e.

systemctl status sys-subsystem-net-devices-eth1.device

Offline

#1316 2012-04-03 14:15:22

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: systemd: Yet Another Init Replacement

falconindy wrote:

That's insane. The path is /sys/subsystem, not /sys/sys/subsystem.

Which one returns a device via systemctl status? i.e.

systemctl status sys-subsystem-net-devices-eth1.device

I got it. The typo just made the BindTo= directive to be ignored. That is why it worked. But without BindTo it may work one time and may not work another time (unless started manually)

Here is how device looks

[root@myarch1 ~]# systemctl --full -a | grep eth1
sys-devices-pci0000:00-0000:00:08.0-net-eth1.device   loaded active   plugged       82540EM Gigabit Ethernet Controller
sys-subsystem-net-devices-eth1.device                 loaded inactive dead          sys-subsystem-net-devices-eth1.device
network@eth1.service                                  loaded inactive dead          Network Connectivity

Having

...
BindTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
...

gives an error after a couple of minutes

[root@myarch1 ~]# systemctl start network@eth1.service
A dependency job failed. See system journal for details

and in the journal

Apr 03 22:54:19 myarch1 systemd[1]: Job sys-subsystem-net-devices-eth1.device/start timed out.
Apr 03 22:54:19 myarch1 systemd[1]: Job network@eth1.service/start failed with result 'dependency'.
Apr 03 22:54:19 myarch1 systemd[1]: Job sys-subsystem-net-devices-eth1.device/start failed with result 'timeout'.

Offline

#1317 2012-04-03 22:28:49

h31
Member
From: Russia
Registered: 2012-02-07
Posts: 4

Re: systemd: Yet Another Init Replacement

I managed to make KDM work with systemd. You need to apply this patch: http://cgit.freedesktop.org/systemd/sys … 7af2c82a29

Offline

#1318 2012-04-06 05:28:47

extofme
Member
From: here + now
Registered: 2009-10-10
Posts: 174
Website

Re: systemd: Yet Another Init Replacement

sys-sys ha ... smile amazingly it's done what i've wanted for 6mo+, probably because i used StopWhenUnneeded and *.device.wants/ ... more on that ...

that also explains why i added StopWhenUnneeded=true in the first place, since BindTo "wasn't working correctly" - thanks falconindy.

@ala ... it still works for me just fine after the correction.  i dont think systemctl usually shows internal aliases like "subsystem" unless queried directly; yours says failed because it was referenced directly and did in fact fail, though i dont know the precise reason.  mine:

# systemctl --full -a | grep subsys
#
# systemctl status sys-subsystem-net-devices-eth0.device
sys-devices-pci0000:00-0000:00:03.0-virtio0-net-eth0.device - Virtio network device
	  Loaded: loaded
	  Active: active (plugged) since Thu, 05 Apr 2012 23:37:12 -0500; 17min ago
	  Device: /sys/devices/pci0000:00/0000:00:03.0/virtio0/net/eth0

note: there are some differences to what we are doing ...

you are failing with a "dependency" error because your unit is misconfigured and rightfully failing. look at the [Install] section of the unit i posted above:

[Install]
Alias=sys-subsystem-net-devices-eth0.device.wants/net-dyn-phys@eth0.service

... i actually put the NETWORK unit inside the DEVICE.wants/ directory and ONLY there ... NOT multi-user.wants/!  device pulls network, not the other way around!  what you have is impossible to fulfill because multi-user is activated right off the bat and BindTo is the same as Requires ... thus your network unit tries to forcefully start eth1 before it's even discovered, and apparantly causes some kind of split personality in systemd.  this might be a bug to some degree (once device is found it should fulfill? systemd seems to "forget" they are linked), but in general you can't require a device like that, well, because it doesn't make a whole lot of sense (i suppose you can timeout, like you did :-)

have your devices trigger their network units like i originally posted.  initially, i was looking for a more generic way to do all of this, but it never occurred to me and i'm not putting much effort into it either ... the *.device.wants/ idiom works pretty well, and is explicit; BindTo networking works at that point because the services companion device is guaranteed to exist (since the network unit is directly triggered by it's presence)

... systemd is a bit tricky at times, but i think what i've said above is correct; otherwise, by all means, someone please correct.

edit: also, i explicitly tell my network unit to wait until:

After=systemd-user-sessions.service

... i added this because other device-dependent units were doing it -- like serial-getty -- IIRC user-sessions is implicitly enabled so my network is always stalled, allowing proper device discovery.

Last edited by extofme (2012-04-06 05:49:47)


what am i but an extension of you?

Offline

#1319 2012-04-06 05:39:48

extofme
Member
From: here + now
Registered: 2009-10-10
Posts: 174
Website

Re: systemd: Yet Another Init Replacement

... @ala another approach you could try is using:

[...]
ConditionPathExists=|/sys/class/net/eth1
[...]

... but that might be deprecated (class?) or frowned upon, i'm not 100%

you could also try a udev rule, eg (untested):

# cat /etc/udev/rules.d/10-network.rules 
SUBSYSTEM=="net", ATTR{address}=="00:23:54:16:74:82", NAME="eth1", TAG+="systemd", ENV{SYSTEMD_WANTS}="network@eth1.service"

... there is a way to make the WANTS part more dynamic and use the NAME variable, but i forget offhand.


what am i but an extension of you?

Offline

#1320 2012-04-06 07:04:32

ron9
Member
From: Norway
Registered: 2011-02-02
Posts: 119

Re: systemd: Yet Another Init Replacement

After systemd's official packages are moved to /usr/lib, I am left with dbus.service and dbus.socket in /lib.

I moved dbus files to /usr/lib, but I now wonder is there another preferred way to start the dbus?

.


lenovo w500 - huawei matebook 14 | archlinux | swaywm | alacritty | falkon

Offline

#1321 2012-04-06 12:13:35

bobwya
Member
Registered: 2012-01-09
Posts: 36

Re: systemd: Yet Another Init Replacement

h31 wrote:

I managed to make KDM work with systemd. You need to apply this patch: http://cgit.freedesktop.org/systemd/sys … 7af2c82a29

Hi all,

As a relatively new ARCH user : what would the recommended way to compile KDM from source? Should I update KDE and then download the source for the kdebase-workspace package and rebuild this with the linked patch applied?

This bug is big problem for me because currently it's not possible for me to shut down my ARCH (KDE) install cleanly, when using SystemD, at present...

Thanks
Bob

Offline

#1322 2012-04-06 12:39:37

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: systemd: Yet Another Init Replacement

bobwya wrote:
h31 wrote:

I managed to make KDM work with systemd. You need to apply this patch: http://cgit.freedesktop.org/systemd/sys … 7af2c82a29

Hi all,

As a relatively new ARCH user : what would the recommended way to compile KDM from source? Should I update KDE and then download the source for the kdebase-workspace package and rebuild this with the linked patch applied?

This bug is big problem for me because currently it's not possible for me to shut down my ARCH (KDE) install cleanly, when using SystemD, at present...

Thanks
Bob

systemd in extra has that patch applied.

Offline

#1323 2012-04-06 13:34:17

falconindy
Developer
From: New York, USA
Registered: 2009-10-22
Posts: 4,111
Website

Re: systemd: Yet Another Init Replacement

ron9 wrote:

After systemd's official packages are moved to /usr/lib, I am left with dbus.service and dbus.socket in /lib.

I moved dbus files to /usr/lib, but I now wonder is there another preferred way to start the dbus?

.

systemd is built with --enable-split-usr, allowing it to read from both /lib/systemd/system and /usr/lib/systemd/system. Even "broken" symlinks from enabled services in /etc/systemd/system will still continue to function (but you really should systemctl reenable these services anyways).

Last edited by falconindy (2012-04-06 13:34:31)

Offline

#1324 2012-04-06 15:32:21

aya
Member
From: Japan
Registered: 2011-06-12
Posts: 51

Re: systemd: Yet Another Init Replacement

@extofme
Thank you for your explanations. I understand the logic "device pulls network". It worked.
I wish there was some sort of manual explaining such logic and not just Lennart's blog articles.

Offline

#1325 2012-04-06 15:36:30

android_808
Member
Registered: 2011-10-17
Posts: 19

Re: systemd: Yet Another Init Replacement

After the recent update, all symlinks in /etc/ have been removed for the graphical.target.wants.  GDM readded fine but network manger doesn't seem to be there. I can't find any trace under /usr/lib. Trying to start nm-applet results in:

WARNING **: Failed to register as an agent: (32) Unit dbus-org.freedesktop.NetworkManager.service failed to load: No such file or directory. See system logs and 'systemctl status dbus-org.freedesktop.NetworkManager.service' for details.

Edit: Solved.  Managed to get it to enable. Not quite sure what went wrong there.

Last edited by android_808 (2012-04-06 17:44:00)

Offline

Board footer

Powered by FluxBB