You are not logged in.

#476 2014-12-31 17:31:18

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

How can I assure ntp is starting *after* network is available?


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#477 2014-12-31 17:40:50

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

xanb wrote:

How can I assure ntp is starting *after* network is available?

If you are using the ntp-openrc package, you can look at /etc/init.d/ntp-client or /etc/init.d/ntpd, and can see that these services either use net, or run after it.

And if you look at the service that Lone_Wolf had posted about, it provides net.

Some information:
http://www.linuxhowtos.org/manpages/8/runscript.htm (dependencies section)

Offline

#478 2014-12-31 17:50:46

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

Thanks a lot. Before I read your post, I get it with POST_UP and PRE_DOWN in netcfg. But I like your solution.


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#479 2015-01-01 11:38:43

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

I experimented a problem with my clock but surely it's off-topic (not OpenRC related):
My clock is set to the future (2048 I think). I discovered an error:

rtc_cmos: 00:03: hctosys: invalid date/time

Then I have to manually set the date (with `date -s` command)

What can I do? Any suggestions? I have a HP Chromebook 14 (falco).

Thanks a lot,


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#480 2015-01-01 12:04:57

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

xanb wrote:

I experimented a problem with my clock but surely it's off-topic (not OpenRC related):
My clock is set to the future (2048 I think). I discovered an error:

rtc_cmos: 00:03: hctosys: invalid date/time

Then I have to manually set the date (with `date -s` command)

What can I do? Any suggestions? I have a HP Chromebook 14 (falco).

Thanks a lot,

I have no idea about a Chromebook, but maybe you could look at /etc/conf.d/hwclock
I have also written a script named timeset (OpenRC compatible), using which you could try to setup the date and time.

Offline

#481 2015-01-01 17:14:34

Lone_Wolf
Administrator
From: Netherlands, Europe
Registered: 2005-10-04
Posts: 13,069

Re: OpenRC & eudev on Arch

xanb wrote:

Thanks a lot, Lone_Wolf. But I need multiple profiles. I have my profiles in

NETWORKS =(@myprof @anotherprof)

in /etc/conf.d/netcfg

And surely I have no idea of adapting such thing. I'm newbee here :-) Can anyone help me? thanks in advance and happy new year!

#!/usr/bin/runscript

description="Start netcfg with a specific profile"

depend()
{
    need localmount
    after bootmisc
    use logger
    provide net
}

start() {
    /usr/bin/netcfg up $NETPROFILE
}

stop() {
    /usr/bin/netcfg down $NETPROFILE
}

I checked and this is the exact version i now use, only the first line has been changed.
afaict It should work fine with artoo  openrc.


Keep in mind this service is intended to start / stop ONE specific service .
If you want your system to choose between known networks,  you'll need to write other services, something like net-auto-wireless & net-auto-wired

I use this on a laptop :

net-auto-wireless

#!/usr/bin/runscript

depend()
{
    need localmount
    after bootmisc
    use logger
    provide net
}

start() {
    /usr/bin/netcfg-wpa_actiond $IFACE
}

stop() {
    /usr/bin/netcfg-wpa_actiond stop $IFACE
}

Basically netcfg service files for openrc set things up to correctly work with openrc, then call the netcfg scripts that do the real work.


Disliking systemd intensely, but not satisfied with alternatives so focusing on taming systemd.

clean chroot building not flexible enough ?
Try clean chroot manager by graysky

Offline

#482 2015-01-03 21:29:03

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

Thank you very very very much. This is exactly what I want.


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#483 2015-01-17 17:20:41

adambot
Member
Registered: 2012-01-24
Posts: 32

Re: OpenRC & eudev on Arch

I made an enhancement to the net-profiles rc script that will allow you to use the old netcfg config file.  it will be up on the AUR once i am completely done, but for now i thought i would share:

$ cat /etc/init.d/net-profiles
#!/usr/bin/runscript

depend()
{
    need localmount
    after bootmisc
    use logger
    provide net
}

start() {
    for i in "${NETWORKS[@]}"
    do
        /usr/bin/netcfg up $i
    done
}

stop() {
    for i in "${NETWORKS[@]}"
    do
        /usr/bin/netcfg down $i
    done
}

the config file:

$ cat /etc/conf.d/net-profiles
# Enable these netcfg profiles at boot time.
#   - prefix an entry with a '@' to background its startup
#   - set to 'last' to restore the profiles running at the last shutdown
#   - set to 'menu' to present a menu (requires the dialog package)
# Network profiles are found in /etc/network.d
NETWORKS=(loopback enp0s25)

# Specify the name of your wired interface for net-auto-wired
WIRED_INTERFACE="enp0s25"

# Specify the name of your wireless interface for net-auto-wireless
WIRELESS_INTERFACE="wlan0"

# Array of profiles that may be started by net-auto-wireless.
# When not specified, all wireless profiles are considered.
#AUTO_PROFILES=("profile1" "profile2")

config file is actually a link:

$ l -l /etc/conf.d/net-profiles
lrwxrwxrwx 1 root root 6 Jan 16 18:39 01;36m/etc/conf.d/net-profiles -> netcfg

script in action:

$ rc-service net-profiles restart
WARNING: you are stopping a boot service
loopback down [BUSY] [DONE]
enp0s25 down [BUSY] [DONE]
loopback up [BUSY] [DONE]
enp0s25 up [BUSY] [DONE]

Offline

#484 2015-01-21 13:19:17

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

@adambot. I will test it. What's the difference betwen your approximation and the solution provided by Lone_Wolf


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#485 2015-01-22 16:16:36

eNTi
Member
Registered: 2006-04-30
Posts: 109

Re: OpenRC & eudev on Arch

i'm having trouble with the latest openrc-misc update... it wants to install zfs-openrc which has some unresolved dependencies which actually can't be installed at all. it's all very intertwined. is there any "solution" to the problem, that all those openrc-* packages install every init script within and also overwrite former configurations? i have to reconfigure my system every other update, because i don't want certain init scripts to be run... for example the nfs init scripts are partly conflicting and are not all needed.

Offline

#486 2015-01-22 16:21:23

Alad
Wiki Admin/IRC Op
From: Bagelstan
Registered: 2014-05-04
Posts: 2,418
Website

Re: OpenRC & eudev on Arch

^ Use apg's "way"?


Mods are just community members who have the occasionally necessary option to move threads around and edit posts. -- Trilby

Offline

#487 2015-01-22 16:41:28

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

Another way: Dont use makepkg -i directly, first add the packages to a local repo and then install what you want.

https://wiki.archlinux.org/index.php/Ta … _and_eudev

Last edited by aaditya (2015-01-26 17:33:29)

Offline

#488 2015-01-23 22:18:30

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

Can anyone could help me to convert systemd unit to OpenRC from fake-hwclock-git:

$ cat /usr/lib/systemd/system/fake-hwclock.service 
[Unit]
Description=Fake Hardware Clock
Documentation=man:fake-hwclock(8)
DefaultDependencies=no
Before=systemd-journald.service
Conflicts=shutdown.target

[Service]
Type=oneshot
ExecStart=/usr/bin/fake-hwclock
ExecStop=/usr/bin/fake-hwclock
RemainAfterExit=yes

[Install]
WantedBy=local-fs-pre.target
[xan@argonia ~]$ 

Thanks in advance,


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#489 2015-01-24 06:39:57

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

xanb wrote:

Can anyone could help me to convert systemd unit to OpenRC from fake-hwclock-git:

$ cat /usr/lib/systemd/system/fake-hwclock.service 
[Unit]
Description=Fake Hardware Clock
Documentation=man:fake-hwclock(8)
DefaultDependencies=no
Before=systemd-journald.service
Conflicts=shutdown.target

[Service]
Type=oneshot
ExecStart=/usr/bin/fake-hwclock
ExecStop=/usr/bin/fake-hwclock
RemainAfterExit=yes

[Install]
WantedBy=local-fs-pre.target
[xan@argonia ~]$ 

Thanks in advance,

This is a slightly tricky service there in case you dont understand.

I dont how it relates to the hwclock service (/etc/init.d/hwclock); ie, should it run before hwclock, after it, or should hwclock not run at all..

Anyway with the limited information, here is a script:

#!/usr/bin/openrc-run

description="Save/restore system clock on machines without working RTC hardware."

depend()
{
	provide clock
	need localmount
}

start()
{
	ebegin "Setting system clock using fake hardware clock"
	/usr/bin/fake-hwclock
	eend $?
}

You could save the above as hwclock-fake in /etc/init.d folder and make it executable (chmod +x hwclock-fake).

The hwclock service can be found in /etc/runlevels/boot. So your fake hwclock would also probably be needed to be in the boot runlevel,

sudo rc-update add hwclock-fake boot

I have not checked it on my system, so dont know if it works.

Last edited by aaditya (2015-01-24 10:49:16)

Offline

#490 2015-01-24 14:59:31

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

Thanks Aaditya for your answer. I do not know too the relation between hwclock and fake-hwclock
By the other hand, how can I know if I have internal hardware clock in my laptop (chromebook). How can I figure out? My dmesg is:

[xan@argonia ~]$ dmesg | grep rtc
[    0.320747] rtc_cmos 00:03: RTC can wake from S4
[    0.320916] rtc_cmos 00:03: rtc core: registered rtc_cmos as rtc0
[    0.320948] rtc_cmos 00:03: alarms up to one month, 242 bytes nvram, hpet irqs
[    0.323353] rtc_cmos 00:03: hctosys: invalid date/time
[xan@argonia ~]$ dmesg | grep clock
[    0.000000] hpet clockevent registered
[    0.201873] Switched to clocksource hpet
[    1.308378] tsc: Refined TSC clocksource calibration: 1396.766 MHz
[    2.308413] Switched to clocksource tsc
[xan@argonia ~]$

Owning one OpenRC (artoo way) and other three systemd machines

Offline

#491 2015-01-24 15:02:40

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

By the other hand, I experiment errors with the ntp-client:

$ cat /etc/init.d/ntp-client 
#!/usr/bin/openrc-run
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/net-misc/ntp/files/ntp-client.rc,v 1.13 2013/12/24 11:01:52 vapier Exp $

depend() {
	before cron portmap
	after net
	use dns logger
}

checkconfig() {
	if ! type "${NTPCLIENT_CMD}" >/dev/null 2>&1 ; then
		eerror "Please edit /etc/conf.d/ntp-client"
		eerror "Unable to locate the client command ${NTPCLIENT_CMD}!"
		return 1
	fi
	if [ -z "${NTPCLIENT_OPTS}" ] ; then
		eerror "Please edit /etc/conf.d/ntp-client"
		eerror "I need to know what server/options to use!"
		return 1
	fi
	return 0
}

start() {
	checkconfig || return $?

	ebegin "Setting clock via the NTP client '${NTPCLIENT_CMD}'"
	"${NTPCLIENT_CMD}" ${NTPCLIENT_OPTS}
	eend $? "Failed to set clock"
}
[xan@argonia ~]$ 
[xan@argonia ~]$ cat /etc/conf.d/ntp-client 
# /etc/conf.d/ntp-client

# Command to run to set the clock initially
# Most people should just leave this line alone ...
# however, if you know what you're doing, and you
# want to use ntpd to set the clock, change this to 'ntpd'
NTPCLIENT_CMD="sntp"
# estava a "ntpdate"

# Options to pass to the above command
# This default setting should work fine but you should
# change the default 'pool.ntp.org' to something closer
# to your machine.  See http://www.pool.ntp.org/ or
# try running `netselect -s 3 pool.ntp.org`.
NTPCLIENT_OPTS="-S 0.europe.pool.ntp.org 1.europe.pool.ntp.org 2.europe.pool.ntp.org 3.europe.pool.ntp.org"
# estava a "-s -b -u \
#	0.europe.pool.ntp.org 1.europe.pool.ntp.org \
#	2.europe.pool.ntp.org 3.europe.pool.ntp.org"

# If you use hostnames above, then you should depend on dns
# being up & running before we try to run.  Otherwise, you
# can disable this.
rc_use="dns"
[xan@argonia ~]$ 

It nevers runs. rc-status always gets me "stopped". How can I triage this bug?

Thanks,


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#492 2015-01-24 15:08:04

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

For hardware clock you could try hwclock -D

I have similar output:

$ dmesg | grep rtc
[    2.033638] rtc_cmos 00:07: RTC can wake from S4
[    2.033760] rtc_cmos 00:07: rtc core: registered rtc_cmos as rtc0
[    2.033789] rtc_cmos 00:07: alarms up to one month, y3k, 242 bytes nvram, hpet irqs
[    2.034639] rtc_cmos 00:07: setting system clock to 2015-01-23 21:23:13 UTC (1422048193)
$ dmesg | grep clock
[    0.000000] hpet clockevent registered
[    1.949014] Switched to clocksource hpet
[    2.034639] rtc_cmos 00:07: setting system clock to 2015-01-23 21:23:13 UTC (1422048193)
[    3.013600] tsc: Refined TSC clocksource calibration: 2494.335 MHz
[    4.014905] Switched to clocksource tsc

I think you probably need to check any changes you made in /etc/conf.d/ntp-client
For example I have:

$ cat /etc/conf.d/ntp-client 
# /etc/conf.d/ntp-client

# Command to run to set the clock initially
# Most people should just leave this line alone ...
# however, if you know what you're doing, and you
# want to use ntpd to set the clock, change this to 'ntpd'
NTPCLIENT_CMD="ntpdate"

# Options to pass to the above command
# This default setting should work fine but you should
# change the default 'pool.ntp.org' to something closer
# to your machine.  See http://www.pool.ntp.org/ or
# try running `netselect -s 3 pool.ntp.org`.
NTPCLIENT_OPTS="-s -b -u \
	0.gentoo.pool.ntp.org 1.gentoo.pool.ntp.org \
	2.gentoo.pool.ntp.org 3.gentoo.pool.ntp.org"

# If you use hostnames above, then you should depend on dns
# being up & running before we try to run.  Otherwise, you
# can disable this.
rc_use="dns"

You could also try the ntpd service rather than ntp-client.

Offline

#493 2015-01-24 15:17:15

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

I get:

$ hwclock -D
hwclock from util-linux 2.25.2
Using the /dev interface to the clock.
Last drift adjustment done at 2381832217 seconds after 1969
Last calibration done at 2381832217 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2040/05/28 00:21:23
Hw clock time : 2040/05/28 00:21:23 = 2221777283 seconds since 1969
Mon May 28 02:21:23 2040  -0.641288 seconds
[xan@argonia ~]$ date
Sat Jan 24 16:16:39 CET 2015
[xan@argonia ~]$ 

Owning one OpenRC (artoo way) and other three systemd machines

Offline

#494 2015-01-24 15:19:26

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

xanb wrote:

I get:

$ hwclock -D
hwclock from util-linux 2.25.2
Using the /dev interface to the clock.
Last drift adjustment done at 2381832217 seconds after 1969
Last calibration done at 2381832217 seconds after 1969
Hardware clock is on UTC time
Assuming hardware clock is kept in UTC time.
Waiting for clock tick...
...got clock tick
Time read from Hardware Clock: 2040/05/28 00:21:23
Hw clock time : 2040/05/28 00:21:23 = 2221777283 seconds since 1969
Mon May 28 02:21:23 2040  -0.641288 seconds
[xan@argonia ~]$ date
Sat Jan 24 16:16:39 CET 2015
[xan@argonia ~]$ 

You could try syncing your system time to hardware clock with:

sudo hwclock --systohc

Offline

#495 2015-01-24 15:24:57

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

How can I know why the ntp-client is stopped?

[xan@argonia ~]$ rc-status 
Runlevel: default
 acpid                                                             [  started  ]
 dbus                                                              [  started  ]
 consolekit                                                        [  started  ]
 ufw                                                               [  started  ]
 net-auto-wireless                                                 [  started  ]
 netmount                                                          [  started  ]
 alsasound                                                         [  started  ]
 ntp-client                                                        [  stopped  ]
 udev-postmount                                                    [  started  ]
 local                                                             [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
 xdm-setup                                                         [  started  ]
Dynamic Runlevel: manual
[xan@argonia ~]$ 

In systemd, systemctl status process.

Thanks,


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#496 2015-01-24 15:28:37

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

xanb wrote:

How can I know why the ntp-client is stopped?

[xan@argonia ~]$ rc-status 
Runlevel: default
 acpid                                                             [  started  ]
 dbus                                                              [  started  ]
 consolekit                                                        [  started  ]
 ufw                                                               [  started  ]
 net-auto-wireless                                                 [  started  ]
 netmount                                                          [  started  ]
 alsasound                                                         [  started  ]
 ntp-client                                                        [  stopped  ]
 udev-postmount                                                    [  started  ]
 local                                                             [  started  ]
Dynamic Runlevel: hotplugged
Dynamic Runlevel: needed
 xdm-setup                                                         [  started  ]
Dynamic Runlevel: manual
[xan@argonia ~]$ 

In systemd, systemctl status process.

Thanks,

There is rc-service ntp-client status but I think that only shows the status, not why it failed.
You could try looking at /var/log/rc.log for clues.

Offline

#497 2015-01-24 15:30:40

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

aaditya wrote:

There is rc-service ntp-client status but I think that only shows the status, not why it failed.
You could try looking at /var/log/rc.log for clues.

/var/log/rc.log is very simple. How can I get more output?
In the booting screen there is much info than in rc.log!


Owning one OpenRC (artoo way) and other three systemd machines

Offline

#498 2015-01-24 15:34:49

xanb
Member
Registered: 2012-07-24
Posts: 419

Re: OpenRC & eudev on Arch

Sometimes, when I run rc-service ntp-client start I get

sntp 4.2.8@1.3265-o Sat Dec 20 02:07:08 UTC 2014 (1)
kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod: No such file or directory
2015-01-24 16:33:24.902830 (-0100) +0.028513 +/- 0.060370 0.europe.pool.ntp.org 37.34.57.151 s2

Owning one OpenRC (artoo way) and other three systemd machines

Offline

#499 2015-01-24 15:35:48

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

xanb wrote:
aaditya wrote:

There is rc-service ntp-client status but I think that only shows the status, not why it failed.
You could try looking at /var/log/rc.log for clues.

/var/log/rc.log is very simple. How can I get more output?
In the booting screen there is much info than in rc.log!

As far as I know the output is the same, but you could try starting the service manually to see the output, ie,

sudo rc-service ntp-client start

Offline

#500 2015-01-24 15:37:20

aaditya
Member
Registered: 2013-09-01
Posts: 174

Re: OpenRC & eudev on Arch

xanb wrote:

Sometimes, when I run rc-service ntp-client start I get

sntp 4.2.8@1.3265-o Sat Dec 20 02:07:08 UTC 2014 (1)
kod_init_kod_db(): Cannot open KoD db file /var/db/ntp-kod: No such file or directory
2015-01-24 16:33:24.902830 (-0100) +0.028513 +/- 0.060370 0.europe.pool.ntp.org 37.34.57.151 s2

Why are you using sntp btw?

Default ntpdate seems to be working for me..

$ sudo rc-service ntp-client start
[sudo] password for aaditya: 
 * Setting clock via the NTP client 'ntpdate' ...                                                                                [ ok ]

Offline

Board footer

Powered by FluxBB