Re: [systemd-devel] Testing if timesyncd is synced
> From: Mantas Mikulenas [mailto:graw...@gmail.com] > > Call adjtimex(2) and check whether buf.status has STA_UNSYNC > (should be unset when clock is synchronized). > > The systemd-timedated helper service > (org.freedesktop.timedate1) exposes the same flag as the > org.freedesktop.timedate1.NTPSynchronized property on > /org/freedesktop/timedate1. That looks pretty simple. I'll try it out. This is my own Yocto-based embedded system with a recent kernel, so there are no issues of compatibility, as others warned about. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Testing if timesyncd is synced
What's the simplest way to test if systemd-timesyncd is currently synced to the network, from within an embedded application (running with root privileges)? Is there some single dbus transaction that will give me this answer? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Using udev to notify application of device insertion/removal
System: Yocto-based RT Linux 4.10.17, systemd 232, 32-bit x86, no GUI. I've created the following "midiUSB.rules" file: ACTION=="add", KERNEL=="midiC*", SUBSYSTEM=="sound", SYMLINK+="snd/midi%b", RUN="/bin/touch /media/sda1/share/devchg" ACTION=="remove", KERNEL=="midiC*", SUBSYSTEM=="sound", RUN="/bin/touch /media/sda1/share/devchg" (pardon the spurious email line breaks) When I plug in a MIDI device, this gives me a device path like "/dev/snd/midi1-8.3:1.0" based on what USB port I plugged it into, in addition to the usual "/dev/snd/midiC1D0". When I unplug it, both names go away. Perfect. What's the "touch" command for? My "application" firmware needs to be notified of any such change. It's already using an inotify to monitor that directory for other reasons, so having it bump the timestamp on a dummy file allows me to detect the change with one added line of code in my app. The problem is, it's touching the timestamp when I insert the device, but not when I remove it. I used "udevadmin monitor", and got this (among other events) for the insertion: KERNEL[6175.279426] add /devices/pci:00/:00:1d.7/usb1/1-8/1-8.3/1-8.3:1.0/sound/card1/midi C1D0 (sound) ACTION=add DEVNAME=/dev/snd/midiC1D0 DEVPATH=/devices/pci:00/:00:1d.7/usb1/1-8/1-8.3/1-8.3:1.0/sound/ca rd1/midiC1D0 MAJOR=116 MINOR=40 SEQNUM=1781 SUBSYSTEM=sound and this for the removal: KERNEL[6181.373765] remove /devices/pci:00/:00:1d.7/usb1/1-8/1-8.3/1-8.3:1.0/sound/card1/midi C1D0 (sound) ACTION=remove DEVNAME=/dev/snd/midiC1D0 DEVPATH=/devices/pci:00/:00:1d.7/usb1/1-8/1-8.3/1-8.3:1.0/sound/ca rd1/midiC1D0 MAJOR=116 MINOR=40 SEQNUM=1784 SUBSYSTEM=sound Looks okay, right? I used "udevadmin test" with the DEVPATH shown above, and (after stripping all the boilerplate) I got this for the insertion: GROUP 29 /lib/udev/rules.d/50-udev-default.rules:39 LINK 'snd/midi' /etc/udev/rules.d/midiUSB.rules:1 RUN '/bin/touch /media/sda1/share/devchg' /etc/udev/rules.d/midiUSB.rules:1 handling device node '/dev/snd/midiC1D0', devnum=c116:40, mode=0660, uid=0, gid=29 preserve permissions /dev/snd/midiC1D0, 020660, uid=0, gid=29 preserve already existing symlink '/dev/char/116:40' to '../snd/midiC1D0' found 'c116:40' claiming '/run/udev/links/\x2fsnd\x2fmidi' creating link '/dev/snd/midi' to '/dev/snd/midiC1D0' preserve already existing symlink '/dev/snd/midi' to 'midiC1D0' created db file '/run/udev/data/c116:40' for '/devices/pci:00/:00:1d.7/usb1/1-8/1-8.3/1-8.3:1.0/sound/card1/mid iC1D0' ACTION=add DEVLINKS=/dev/snd/midi DEVNAME=/dev/snd/midiC1D0 DEVPATH=/devices/pci:00/:00:1d.7/usb1/1-8/1-8.3/1-8.3:1.0/sound/ca rd1/midiC1D0 MAJOR=116 MINOR=40 SUBSYSTEM=sound USEC_INITIALIZED=4019498530 run: '/bin/touch /media/sda1/share/devchg' Unload module index Unloaded link configuration context. and this for the removal: RUN '/bin/touch /media/sda1/share/devchg' /etc/udev/rules.d/midiUSB.rules:2 no reference left, remove '/dev/snd/midi' ACTION=remove DEVLINKS=/dev/snd/midi DEVNAME=/dev/snd/midiC1D0 DEVPATH=/devices/pci:00/:00:1d.7/usb1/1-8/1-8.3/1-8.3:1.0/sound/ca rd1/midiC1D0 MAJOR=116 MINOR=40 SUBSYSTEM=sound USEC_INITIALIZED=4019498530 run: '/bin/touch /media/sda1/share/devchg' Unload module index Unloaded link configuration context. So it looks like it believes it's going to run my touch command when it's removed, but when I actually do it, I don't see the timestamp change. Any ideas on what's wrong, or how to debug this further? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd vs udev automount
> From: Mantas Mikulenas [mailto:graw...@gmail.com] > > Just configure "/dev/disk/by-label/FOOBAR" (or possibly > "LABEL=FOOBAR") as the mount source. Duh. I never noticed LABEL in the fstab man page. Pretty simple. Thanks. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] systemd vs udev automount
> From: Zbigniew Jedrzejewski-Szmek [mailto:zbys...@in.waw.pl] > > I don't see why you'd need to use automounting for a partition on the > main disk. Just put it in /etc/fstab in the usual manner, and it'll > get mounted very early in boot. As I recall, I added udev-extraconf a couple of years ago when I wanted one of my systems to be portable to different motherboards or different mass storage devices. I didn't want the user to have to edit fstab somehow before putting the system together. If I get rid of udev-extraconf, is there a way to use a mount unit to specify a partition by some sttributes, e.g., a FAT file system with a volume name of FOOBAR? Or is there a way to do this directly with a udev rule? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] systemd vs udev automount
I've got a system (actually two similar systems) built with Yocto that use systemd, but also have the udev-extraconf package, which includes a udev rule and associated mount.sh script for automounting. It's doing strange things, like mounting an additional partition on my main disk (which is good), and then quietly unmounting it unless it is also listed in /etc/fstab (which is bad). When it works, I see systemd messages in journalctl about automounting, in addition to the messages generated by the udev mount.sh, making me think these two systems are fighting with each other. Is it possible that after mount.sh mounts it, systemd kicks in, finds it's not in fstab, and unmounts it without logging anything? But if I have systemd, should I even be using the udev automount rules in the first place, or should I just create mount and automount units and ditch udev-extraconf entirely? (Or are the autonet rules important?) My ultimate goal is to have this additional partition on my main disk to be automounted as early in the boot process as possible. I don't need (or want) removable drives to be automounted anyway. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Questions about nmb.service
Yocto-based non-GUI Raspberry Pi 3 system using systemd and Samba 4. I think these are more systemd questions than Samba questions, though. My /etc/hostname is symlinked to a file on a different volume, so that I can (eventually) use a readonly rootfs, yet still change the hostname. However, that volume doesn't get mounted in time for the kernel to read it, so I end up with the hostname "localhost". Since I want to use the hostname as the default netbios name, I supplied my own version of nmb.service, which adds the line "RequiresMountsFor=/run/media/mmcblk0p1" to the [Unit] section, and the line "ExecStartPre=/bin/hostname -F /etc/hostname" to the [Service] section. This ensures that nmbd doesn't get started until the hostname file is visible, and forces the hostname to be set first. When I boot up, I get an error starting nmb.service. systemctl status nmb shows: Aug 06 01:59:18 localhost systemd[1]: Starting Samba NMB Daemon... Aug 06 01:59:18 CHROMA3 nmbd[440]: [2017/08/06 01:59:18.576291, 0] ../lib/util/become_daemon.c:135(daemon_status) Aug 06 01:59:18 CHROMA3 nmbd[440]: STATUS=daemon 'nmbd' : No local IPv4 non-loopback interfaces available, waiting for interface ...NOTE: NetBIOS name resolution is not supported for Internet Protocol Version 6 (IPv6). (CHROMA3 is the real hostname I've set.) After five seconds, it tries again, and it works: Aug 06 01:59:23 CHROMA3 nmbd[440]: [2017/08/06 01:59:23.582234, 0] ../lib/util/become_daemon.c:124(daemon_ready) Aug 06 01:59:23 CHROMA3 systemd[1]: Started Samba NMB Daemon. Aug 06 01:59:23 CHROMA3 nmbd[440]: STATUS=daemon 'nmbd' finished starting up and ready to serve connections I can see my shared files across the network. However, if I manually restart the service, I get the following warning in the second line: Aug 06 02:06:45 CHROMA3 systemd[1]: Starting Samba NMB Daemon... Aug 06 02:06:45 CHROMA3 systemd[1]: nmb.service: Supervising process 503 which is not our child. We'll most likely not notice when it exits. Aug 06 02:06:45 CHROMA3 nmbd[503]: [2017/08/06 02:06:45.748754, 0] ../lib/util/become_daemon.c:124(daemon_ready) Aug 06 02:06:45 CHROMA3 nmbd[503]: STATUS=daemon 'nmbd' finished starting up and ready to serve connections Aug 06 02:06:45 CHROMA3 systemd[1]: Started Samba NMB Daemon. If I restart it again, something does indeed "notice", and kill process 503 and give me another one, so it's not really a problem. But there are two things that look like I might be doing something wrong: 1) Why does it initially find "No local IPV4 non-loopback interfaces available", and is there something I can do to change the startup order until the ethernet device is ready, or is this just normal? 2) Why does systemd think it doesn't own the nmbd process, and should I do something about that, or is that normal? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Serial getty on USB dongle insertion
> From: Andrei Borzenkov [mailto:arvidj...@gmail.com] > > Yes, set ENV{SYSTEMD_WANTS}="serial-getty@ttyUSB2.service" property on > your device in udev rule; this will trigger starting of this service > when device appears. You probably also want to add > "BindsTo=dev-ttyUSB2.device" (or whatever name of your device unit is) > so systemd stops it when dongle is unplugged and does not attempt to > restart. Works like a charm. Thanks. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Serial getty on USB dongle insertion
I've created a serial-getty@ttyUSB2.service file, which is basically a copy of serial-getty@.service with a specific device name and a fixed baud rate. It works fine when I plug in a serial dongle that gets assigned that name. (I have permanent ttyUSB0 and ttyUSB1 devices which don't use getty.) If I logout, it just offers me a new login prompt. If I unplug the dongle, the automatic retrying fails, and plugging it in again doesn't bring it back to life. If I use Restart=no, then I can terminate it either by logging out or yanking the dongle, but it naturally won't restart if I plug the dongle in again. Is there a way of configuring the service to start every time the dongle is inserted, whether I logged out before yanking the dongle or not? Or does this require some special udev rule? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Trying to come up with udev rule for USB geographic naming
> From: Andrei Borzenkov > > Please copy-paste actual command invocation and its output. No need. I had used = instead of == on the DRIVERS. Works fine now. Thanks for your assistance. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Trying to come up with udev rule for USB geographic naming
> From: Andrei Borzenkov [mailto:arvidj...@gmail.com] > > > KERNEL=="midiC*", DRIVERS=="snd-usb-audio", SYMLINK+="midi%k" > > You probably want %b instead of %k here which should refer to device > name matched by DRIVERS. > > Start with "udevadm test" to verify. I tried the following rule: ACTION=="add", KERNEL=="midiC*", DRIVERS=="snd-usb-audio", SYMLINK+="snd/midi%b" and "udevadm test" complains about an "invalid DRIVERS option". What could be invalid about it? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Trying to come up with udev rule for USB geographic naming
> From: Andrei Borzenkov [mailto:arvidj...@gmail.com] > > > There is already a symlink > > "/dev/snd/by-path/platform-3f98.usb-usb-0:1.2:1.0", but > > it refers to > > the useless "controlC1" interface. It also doesn't appear > > to be generated > > by an explicit rule anywhere that might show me what to do. > > It is created by 60-persistent-alsa.rules that explicitly restricts > processing to controlC*. Ahah! The systemd man page only mention /usr/lib, /etc, and /run as locations for udev/rules.d subdirectories, but apparently there's also one in /lib that's full of rules I didn't see. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Trying to come up with udev rule for USB geographic naming
That is, I want a rule for creating a symlink that describes the USB port something is plugged into, rather than the specific device plugged into it. Linux USB has a way of representing the location of each physical jack, even when hubs are involved. For devices like USB serial and USB MIDI, I'd like apps to be able to refer to devices by where they're plugged in. I used udevadm to generate the info for a USB MIDI converter. The first three levels look like this: looking at device '/devices/platform/soc/3f98.usb/usb1/1-1/1-1.2/1-1.2:1.0/sound/card1/m idiC1D0': KERNEL=="midiC1D0" SUBSYSTEM=="sound" DRIVER=="" looking at parent device '/devices/platform/soc/3f98.usb/usb1/1-1/1-1.2/1-1.2:1.0/sound/card1': KERNELS=="card1" SUBSYSTEMS=="sound" DRIVERS=="" ATTRS{id}=="XMidi1X1" ATTRS{number}=="1" looking at parent device '/devices/platform/soc/3f98.usb/usb1/1-1/1-1.2/1-1.2:1.0': KERNELS=="1-1.2:1.0" SUBSYSTEMS=="usb" DRIVERS=="snd-usb-audio" ATTRS{authorized}=="1" ATTRS{bAlternateSetting}==" 0" ATTRS{bInterfaceClass}=="01" ATTRS{bInterfaceNumber}=="00" ATTRS{bInterfaceProtocol}=="00" ATTRS{bInterfaceSubClass}=="01" ATTRS{bNumEndpoints}=="00" ATTRS{supports_autosuspend}=="1" (There may be spurious line breaks in there, due to email.) I'd like an alias for this device to be "/dev/midi1-1.2:1.0". I tried the following: KERNEL=="midiC*", DRIVERS=="snd-usb-audio", SYMLINK+="midi%k" It did bupkis. The man page seems to imply that, while a single rule can't match items from different parents, it's okay to match something in the device and then something else in a parent. So I would expect the KERNEL key would match the device itself, DRIVERS would match a parent, but what then does %k refer to, the kernel name in the device or the kernel name in the parent? But it not only didn't create a "midi1-1.2:1.0", it didn't create a "midimidiC1D0" either, so it doesn't look like the rule matched at all. There is already a symlink "/dev/snd/by-path/platform-3f98.usb-usb-0:1.2:1.0", but it refers to the useless "controlC1" interface. It also doesn't appear to be generated by an explicit rule anywhere that might show me what to do. What am I doing wrong? Do I need a rule that just matches the MIDI device, and then runs a script that searches for the parent name? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Restarting nmb.service from within a program
> From: Mantas Mikulenas [mailto:graw...@gmail.com] > > Pretty sure it's documented: > > http://www.freedesktop.org/wiki/Software/systemd/dbus/ > > http://www.freedesktop.org/wiki/Software/systemd/hostnamed/ > > and so on. Thanks. D-Bus looks like the correct way to do it. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Restarting nmb.service from within a program
I have a Yocto embedded system running a simple Samba 4 server, using systemd. I'm relying on the system hostname being the default netbios name, and I need to be able to change the hostname, and therefore the netbios name, from within my main application. I write the new hostname to /etc/hostname, and also call sethostname(), but in order for the change to take effect, the nmbd daemon (that is, nmb.service) needs to be restarted. Since systemd is managing this service, it seems I should be accomplishing this by telling systemd to restart the service. Is there a documented way to do this from within a program? There must be some way, since systemctl does it. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] What's mounting this partition?
I have a Yocto-built x86 system, running off a USB flash drive that has two partitions on it. /dev/sda1 is a small FAT file system that I use for persistent data storage, and isn't bootable. /dev/sda2 is the root file system, which boots via Syslinux. I use a mount unit to mount /dev/sda1 on /media/chroma. However, it finds that /dev/sda1 is already mounted on /media/sda1. It goes ahead and mounts it anyway, with a warning, but my mount options (noatime,tz=UTC) are ignored. I tried putting the /media/chroma mount in fstab. Now it fails entirely, perhaps because systemd-fstab-generator won't create a mount unit for something that's already mounted somewhere else. But what I can't figure out is what the heck is mounting /dev/sda1 on /media/sda1 in the first place. None of the generators in /lib/systemd/system-generators seem to be to blame, according to their docs. How do I make it not do that, so that I can mount it with my own options, either in fstab or with an explicit mount unit? The version of the system I did a couple of years ago, with an earlier Yocto, an earlier systemd, and an earlier kernel, didn't have this behavior. And while we're at it, is there a way to control what mount options it uses for the root? I'd like to use noatime, so that it doesn't abuse my flash drive needlessly. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to automount
> From: Mantas Mikulenas [mailto:graw...@gmail.com] > > > I don't think there's any way to have something auto-unmount > > There certainly is - udev has been unmounting unplugged > drives for many years. It's done by default. Sure, you can get it to unmount after you've removed it, but that's too late if you haven't synced it. You have to do an explicit sync in advance to avoid data loss. The only alternative is to disable write buffering, which makes things slow, and stresses the drive. In my case, it's better to mount and unmount explicitly around each user-requested operation. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] How to automount
> From: Umut Tezduyar Lindskog [mailto:u...@tezduyar.com] > > I am not sure if automount is really the right way to go. In the end, > your automount path will fail if your device is not plugged in. A little experimenting showed you're right. > You could always use udev rules (ENV{SYSTEMD_WANTS}='media-ext.mount') > to mount the volume. > http://www.freedesktop.org/software/systemd/man/systemd.device.html I was thinking about udev, too, but I don't think there's any way to have something auto-unmount. But I'm overcomplicating things. In my system, the only accesses made to this external flash drive are in response to a user command. So the simpler solution is just to have my application mount and unmount the drive, instead of trying to get the operating system to do it. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] How to automount
I want a removable flash drive to be automatically mounted when I plug it in, and unmounted when I unplug it. I've done what seems to be required by the systemd.automount man page, but it's not working. The physical drive appears as /dev/sdb1 (it is a partitioned drive). The mount point (which exists) is /media/ext. I created a media-ext.mount file: [Mount] What=/dev/sdb1 Where=/media/ext Options=noatime,exec,umask=0,sync,errors=continue and a media-ext.automount file: [Automount] Where=/media/ext Initially it doesn't work at all. If I manually restart media-ext.automount, then it puts into the mount table: systemd-1 on /media/ext type autofs ... but when I plug in the drive, nothing else happens. When I try to access the drive, it just hangs until I hit ctrl-C. I'm guessing that media-ext.automount should mount systemd-1 on startup, and it should be automagically changed to /dev/sdb1 when I plug something in. How do I get these two things to happen? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] WiFi device starting a service
I'm working with a Gumstix, and I want to run an "ifup" command when the WiFi device becomes available. I'm not sure why, but it always seems to become available after the boot process is complete, so I can't use a regular service unit tied to something like multi-user.target. So I'm trying to have a udev rule launch a service instead. My first guess is this: /etc/udev/rules.d/wlan0-ifup.rules: SUBSYSTEM=="net", KERNEL=="wlan0", \ ENV{SYSTEMD_WANTS}+="wlan0-ifup.service" /etc/systemd/system/wlan0-ifup.service: [Unit] Description=Bring wlan0 up DefaultDependencies=false [Service] ExecStart=/sbin/ifup wlan0 Naturally, the service never runs, so it doesn't work. After logging in, I can manually start the service, and the WiFi connects, so the problem has to be in my udev rule. I ask here, because this seems more systemd-specific than udev-specific. There's also a rule in 99-systemd.rules: SUBSYSTEM=="net", KERNEL!="lo", TAG+="systemd", \ ENV{SYSTEMD_ALIAS}+="/sys/subsystem/net/devices/$name" I suspect that there's a way to hook something to that, but I can't figure out how. So what's the right way to do this? Is there a man page specifically for this situation? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Starting touchscreen cal after touchscreen device starts
I've got a Gumstix system that uses an LCD and a touchscreen, but without a desktop manager. I've created a service to load touchscreen cal data, or launch the calibrator program if it doesn't exist, but I can't figure out how to ensure that it starts after the touchscreen device appears. I think the standard Gumstix build has the desktop manager launch it, so there's probably a pretty long chain of dependencies involved when doing it that way. My boot log shows the following line when the touchscreen is recognized. [9.447113] input: ADS7846 Touchscreen as /devices/platform/omap2_mcspi.1/spi_master/spi1/spi1.0/input/input0 Unfortunately, this happens after my touchscreen calibrator service starts up (and fails). There doesn't appear to be any automatically generated systemd unit for this device. What's the best way to ensure that my service is launched after this device comes online? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Using busybox-udhcpc
I have a Yocto-based embedded system (poky-dylan on a Cedartrail Atom), which has been modified to use systemd. I've also added Samba 3.6.8 from OpenEmbedded. The system has available busybox-udhcpc for a DHCP client, but nothing is starting it. If I start it manually, then Samba works fine. I suppose I could create a simple systemd unit that starts udhcpc with the ethernet port's name, but I'd also like to support an external WiFi dongle. I've googled and googled, but I can't find out the "right" way to start udhcpc, so that it is invoked whenever some new device is detected. Can anyone point me to an example, or some document on the web that explains how this is normally done? I also have a Gumstix system with a Yocto-based distro, and it somehow starts up its DHCP client, but I can't figure out how. It uses dhclient, instead of busybox-udhcpc, but if I knew how dhclient is invoked by the networking system, perhaps that would apply to busybox-udhcpc as well. Any pointers would be greatly appreciated. It's the last thing I need to fix (famous last words) before I have fully functioning networking. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Quick ? about ExecStartPre and Restart
> From: Jan Alexander Steffens [mailto:jan.steff...@gmail.com] > > On Thu, Jul 4, 2013 at 2:04 AM, Paul D. DeRocco > wrote: > > 1) I want my service executable to be copied from flash to > > RAM disk, and > > then executed from there, so that the original can be > > updated while the copy is running. > > You don't need to copy it to somewhere else. You can replace an > executable without the running process being disturbed, by deleting > the file and creating (or moving) a new one in its place. Most tools > (like "cp") will do this when they overwrite a file. Then simply > restart the service (or have it exec() itself), and the new version > will be running. > > The old version of the executable will continue to exist-even though > it has no file name-until nothing uses it anymore. Is that true on all filesystems? This is a FAT16 volume on a flash drive in an embedded system. It's also possible that the power might get yanked while it's in this state, leaving an orphan file. Finally, since it will be updated via a Samba file share, I don't know what sort of command will be used to change it; it might be an overwrite plus lengthen or truncate operation. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Quick ? about ExecStartPre and Restart
> From: Reindl Harald [mailto:h.rei...@thelounge.net] > > so make *two* services while the first replaces ExecStartPre > and it's "ExecStartPost=/usr/bin/systemctl start service2.service" > > "but I want the service to be restarted on success" is generally > very uncommon and you can hardly have two commands in a single > service with the opposite behavior I suppose I could do that. Perhaps there is a cleaner way. All I want to do is this: 1) I want my service executable to be copied from flash to RAM disk, and then executed from there, so that the original can be updated while the copy is running. 2) I want the service to be able to stop itself, and have systemd repeat the copy operation and run the new copy. 3) If the service actually fails due to a bad configuration, it should die and stay dead, since restarting it would just fail again. Seems like a simple pattern that someone must have done before, and it shouldn't take two services to do it. I thought that the ExecStartPre would be a good way to do the copy. I suppose I could also rewrite my service so that it returns a zero exit code if its initialization fails, and a nonzero exit code if it ever wants to restart itself, and then use Restart=on-failure. Does that sound sensible? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
Re: [systemd-devel] Quick ? about ExecStartPre and Restart
> From: Reindl Harald [mailto:h.rei...@thelounge.net] > > Am 04.07.2013 00:38, schrieb Paul D. DeRocco: > > I'm new to systemd, and I'm confused about something. The > > docs include the > > following sentence under the Restart directive: > > > > "Configures whether the service shall be restarted when the > > service process > > exits, is killed, or a timeout is reached. The service > > process may be the > > main service process, but also one of the processes specified with > > ExecStartPre=, ExecStartPost=, ExecStopPre=, ExecStopPost=, > > or ExecReload=." > > > > Read literally, this suggests that if I set this to "on-success" or > > "always", and I have an ExecStartPre that runs a quick > > command (in my case, > > to copy my main service executable from a flash drive to a > > RAM drive), then > > as soon as that completes, systemd will say, "Hey, the service has > > terminated, time to restart it" and never get around to the > > ExecStart that > > really does the work. > > > > Is that really true? Or is that just a mistake in the docs? > > If it's not a > > mistake, how do I configure it so that it won't restart > > when the command > > launched by ExecStartPre terminates with a 0 exit code, but > > will restart if > > the actual service started by ExecStart terminates with a 0 > > exit code? > > it is not true and the documentation ha sno mistake > > systemd does *not* consider the service as failed if ExecStartPre > terminates with a clean 0 exit code - it is considered as failed > if the ExecStartPre command does return a *non zero* code and > even that can be avoided with ExecStartPre=-/path/to/bin as the > doc states I understand that, but I want the service to be restarted on success, not on failure. By that I mean that if my ExecStart process (the actual service) ever terminates with a 0 exit code, I want the whole thing to restart, beginning with the ExecStartPre. But I DON'T want the 0 exit code from ExecStartPre to restart anything, because that's not the actual service. -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel
[systemd-devel] Quick ? about ExecStartPre and Restart
I'm new to systemd, and I'm confused about something. The docs include the following sentence under the Restart directive: "Configures whether the service shall be restarted when the service process exits, is killed, or a timeout is reached. The service process may be the main service process, but also one of the processes specified with ExecStartPre=, ExecStartPost=, ExecStopPre=, ExecStopPost=, or ExecReload=." Read literally, this suggests that if I set this to "on-success" or "always", and I have an ExecStartPre that runs a quick command (in my case, to copy my main service executable from a flash drive to a RAM drive), then as soon as that completes, systemd will say, "Hey, the service has terminated, time to restart it" and never get around to the ExecStart that really does the work. Is that really true? Or is that just a mistake in the docs? If it's not a mistake, how do I configure it so that it won't restart when the command launched by ExecStartPre terminates with a 0 exit code, but will restart if the actual service started by ExecStart terminates with a 0 exit code? Or is there another preferable way to do this? -- Ciao, Paul D. DeRocco Paulmailto:pdero...@ix.netcom.com ___ systemd-devel mailing list systemd-devel@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/systemd-devel