Re-write 32bit chroot daemon in systemd service format?
I followed the Arch wiki instructions quite successfully and have been using the daemon script to use a 32bit chroot. I just switched over fully to systemd (at least I think so) and no longer have the ability to start it since rc.conf no longer exists in the 64bit system (and gets copied in the 32bit chroot daemon script).
Systemd is quite foreign and I find it a bit overwhelming at the moment, not having had time to digest it yet -- I was sort of forced in due to a recent upgrade.
In any case, are there suggestions of how to re-write this in systemd language and enable as a service?
#!/bin/bash
. /etc/rc.conf
. /etc/rc.d/functions
# Add '/var/run /var/lib/dbus' to the list to enable pulseaudio.
dirs=(/dev /dev/pts /dev/shm /tmp /home)
case $1 in
start)
stat_busy "Starting Arch32 chroot"
for d in "${dirs[@]}"; do
mount -o bind $d /opt/arch32$d
done
mount -t proc none /opt/arch32/proc
mount -t sysfs none /opt/arch32/sys
add_daemon arch32
stat_done
stop)
stat_busy "Stopping Arch32 chroot"
for (( i = ${#dirs[@]} - 1; i >= 0; i-- )); do
umount "/opt/arch32${dirs[i]}"
done
umount /opt/arch32/{proc,sys}
rm_daemon arch32
stat_done
restart)
$0 stop
sleep 1
$0 start
echo "usage: $0 {start|stop|restart}"
esac
exit 0
It looks like most of it is just bash code, but things like stat_busy and rm_daemon are no longer commands on my system (perhaps provided by initscripts or sysvinit?).
I can add this to the wiki page for other services once I have it figured out, as I'm guessing some others use it and will stumble into the same issue. I don't know what stat_done and others do; like I said, most of it would just be storing this somewhere and having systemd call it on boot, but I don't want to break something by missing an important step because I don't know any better (properly unmounting a drive on service shutdown, for instance).
Thanks for any suggestions/assistance.
jwhendy wrote:
Do you think that would affect my Lotus Notes issue? After following the script commands manually, here is the relevant info:
$ mount
dev on /opt/arch32/dev type devtmpfs (rw,nosuid,relatime,size=1986024k,nr_inodes=496506,mode=755)
devpts on /opt/arch32/dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /opt/arch32/dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /opt/arch32/tmp type tmpfs (rw,nosuid,nodev,relatime)
/dev/mapper/root on /opt/arch32/home type ext4 (rw,noatime,commit=600,data=ordered)
none on /opt/arch32/proc type proc (rw,relatime)
none on /opt/arch32/sys type sysfs (rw,relatime)
It looks like I hit the necessary files?
The one that stands out is /dev/mapper/root on /opt/arch32/home, but that's what results with:
$ sudo mount -o bind /home /opt/arch32/home
I'm a bit puzzled about that one... Doing `ls /opt/arch32/home` after mounting, however, does show my user folder in there, and `ls -l` shows they're my permissions (jwhendy:users).
I do appreciate the help!
The mount bind for home is actually the way it is supposed to be. This is the intended behaviour. It gives you verbatim access to whatever it is bound to.
Are you actually in the chroot when you start Lotus Notes? Even though the host architecture shouldn't matter, running 32-bit applications in the chroot should behave correctly. In the past 32-bit chroot's there was another bash binary called arch32 that did your chroot /opt/arch32, but you can still do that manually.
Last edited by nomorewindows (2012-11-02 20:03:54)
Similar Messages
-
[SOLVED] Trying to write HLDS systemd service file
Hey,
I want to write a systemd service file for my HLDS AUR package: https://aur.archlinux.org/packages/hlds/
My environment file looks like this:
HLDS_USER=root
HLDS_WORKINGDIR=/opt/hlds
HLDS_PARAMS="-game cstrike"
HLDS_LOGFILE=/var/log/hlds_cstrike
The service file like this:
After=network.target
[Service]
#EnvironmentFile=/etc/conf.d/hlds
#User=${HLDS_USER}
#WorkingDirectory=${HLDS_WORKINGDIR}
ExecStart=/opt/hlds/hlds_run -game cstrike
ExecStop=/bin/kill $MAINPID
[Install]
WantedBy=multi-user.target
But systemd fails to start the service:
hlds.service - Half-Life Dedicated Server
Loaded: loaded (/usr/lib/systemd/system/hlds.service; disabled)
Active: failed (Result: exit-code) since Thu, 2013-01-03 06:20:49 CET; 2s ago
Process: 567 ExecStop=/bin/kill $MAINPID (code=exited, status=1/FAILURE)
Process: 564 ExecStart=/opt/hlds/hlds_run -game cstrike (code=killed, signal=INT)
CGroup: name=systemd:/system/hlds.service
Jan 03 06:20:49 playground systemd[1]: Starting Half-Life Dedicated Server...
Jan 03 06:20:49 playground systemd[1]: Started Half-Life Dedicated Server.
Jan 03 06:20:49 playground hlds_run[564]: Invalid game type 'cstrike' sepecified.
Jan 03 06:20:49 playground hlds_run[564]: Thu Jan 3 06:20:49 CET 2013: Server Failed
Jan 03 06:20:49 playground kill[567]: usage: kill [ -s signal | -p ] [ -a ] pid ...
Jan 03 06:20:49 playground kill[567]: kill -l [ signal ]
Jan 03 06:20:49 playground systemd[1]: Unit hlds.service entered failed state
Running
/opt/hlds/hlds_run -game cstrike
manually works quote well
Someone knows how to proceed? Thanks
Last edited by onny (2013-01-03 05:43:49)Solved. It didn't recognized the workingdir correctly ...
-
Creating an IBus systemd service file
I currently start ibus-daemon with the following in my ~/.xprofile:
ibus-daemon --daemonize --xim
The thing is this does not display very nicely in the output of `systemctl status`; there're several ibus related processes listed, all in the same process Group ID. I figure if I write an ibus.service and manage it with systemctl, they would be grouped together in the output of `systemctl status`, correct?
In any case, I'm trying to write an IBus systemd service file. What I have so far:
[Unit]
Description=Intelligent Input Bus
Documentation=man:ibus-daemon(1)
[Service]
Type=dbus
BusName=org.freedesktop.IBus
ExecStart=/usr/bin/ibus-daemon --replace --xim --panel disable
ExecReload=/usr/bin/ibus restart
ExecStop=/usr/bin/ibus exit
[Install]
WantedBy=default.target
I put the above in file ~/.config/systemd/user/ibus.service and tried
% systemctl --user start ibus.service
For 90 seconds the command didn't return. In that time, ibus-daemon was in fact started, I used the command `ibus` to check that the Bus part was working normally. 90 seconds later systemd bailed out,
Job for ibus.service failed. See 'systemctl status ibus.service' and 'journalctl -xn' for details.
Nothing useful in the journal, really,
systemd[388]: Starting Intelligent Input Bus...
systemd[388]: ibus.service start operation timed out. Terminating.
systemd[388]: Failed to start Intelligent Input Bus.
systemd[388]: Unit ibus.service entered failed state.
What was not working during the 90 seconds was I couldn't actually use IBus to input anyting. I was able to switch engines with `ibus engine <foo>` but if then I started typing IBus was not used at all.
Compare the process tree between manually running ibus-daemon and using systemctl start,
ibus-daemon --replace --xim --panel disable
systemd,1,1
|-gnome-terminal-,485,440
| |-zsh,7299,7299
| | `-ibus-daemon,9732,9732 --replace --xim --panel disable
| | |-ibus-dconf,9736,9732
| | | |-{dconf worker},9743,9732
| | | |-{gdbus},9742,9732
| | | `-{gmain},9740,9732
| | |-{gdbus},9739,9732
| | `-{gmain},9733,9732
`-ibus-x11,9738,9732 --kill-daemon
|-{gdbus},9746,9732
`-{gmain},9745,9732
systemctl --user start ibus
systemd,1,1
`-systemd,388,388 --user
|-(sd-pam),390,388
`-ibus-daemon,9911,9911 --replace --xim --panel disable
|-ibus-dconf,9914,9911
| |-{dconf worker},9921,9911
| |-{gdbus},9919,9911
| `-{gmain},9917,9911
|-{gdbus},9920,9911
|-{gmain},9912,9911
`-{pool},9926,9911
I see two differences: 1) ibus-x11 is present only if ibus-daemon is run manually; 2) Note the {pool} process in the systemctl case.
UPDATE²
ibus-x11 will fail to start silently if the DISPLAY env is not set, which is the case in the systemd env. Damn. When I set Environment="DISPLAY=:0" ibus-x11 is started just fine.
So the question remaining here, is why Type=dbus does not work?
I also tried to comment use Type=simple without BusName= to the same result.
UPDATE
I forgot to systemctl daemon-reload!
With Type=simple ibus-daemon *is* started. BUT, ibus-x11, which is supposed to be started with the --xim option, is not started. I guess it's because it forks? I'll try something.
I do feel it should be Type=dbus though, and I also found a file, part of the gnome-settings-daemon package, /usr/share/dbus-1/services/org.freedesktop.IBus.service with the content:
[D-BUS Service]
Name=org.freedesktop.IBus
Exec=/usr/bin/ibus-daemon --replace --xim --panel disable
Any idea how to make systemd happy?
Last edited by lolilolicon (2014-07-31 14:10:37)The first post is too long... Let me update the status with a new post.
The user service file currently looks like this:
# [email protected]
[Unit]
Description=Intelligent Input Bus
Documentation=man:ibus-daemon(1)
[Service]
Environment="DISPLAY=%I"
ExecStart=/usr/bin/ibus-daemon --replace --xim --panel disable
ExecReload=/usr/bin/ibus restart
ExecStop=/usr/bin/ibus exit
[Install]
WantedBy=default.target
And you can enable it for the current DISPLAY via
% systemctl --user enable "ibus@$DISPLAY.service"
DISPLAY must be set for the --xim option to work.
According to systemd.exec(5), "processes started by user systemd instances inherit all environment variables from the user systemd instance". But at the time the user systemd instance is started, the DISPLAY env is not set yet, so I'm using the %I place holder here.
Although there doesn't seem to be much benefit, I still wonder why Type=dbus doesn't work. Is systemd looking for the wrong bus? -
[SOLVED] Launching systemd service as non-root user
I need to launch a systemd service as a non-root user. I've looked at this but I'm fairly confused. I don't have xorg or any desktop environment installed (this is a remote server I SSH into) but when I run
systemctl --user status
I get
Failed to get D-Bus connection: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11
What am I doing wrong?
Last edited by gsingh93 (2013-12-01 07:29:29)I was going in the wrong direction. All I had to do was add 'User=username' and 'Group=groupname' in the [Service] section.
-
Cannot start mpd as systemd service
Hi all,
I have installed mpd. If I run
mpd
from a terminal, then everything is normal; I can open
a client and use mpd. However, if I try to start it as a systemd service I get errors. That is, once I do
sudo systemctl enable mpd
and reboot, then
jorge@flamingo:~$ systemctl status mpd
● mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; enabled)
Active: failed (Result: signal) since Thu 2014-09-25 22:01:48 EDT; 2min 20s ago
Main PID: 1647 (code=killed, signal=ABRT)
Sep 25 22:01:48 flamingo mpd[1647]: ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
Sep 25 22:01:48 flamingo mpd[1647]: ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned erro...rectory
Sep 25 22:01:48 flamingo mpd[1647]: ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
Sep 25 22:01:48 flamingo mpd[1647]: ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
Sep 25 22:01:48 flamingo mpd[1647]: alsa_output: Error opening default ALSA device: No such file or directory
Sep 25 22:01:48 flamingo mpd[1647]: output: Attempting to detect a oss audio device
Sep 25 22:01:48 flamingo mpd[1647]: oss_output: Error opening OSS device "/dev/dsp": No such file or directory
Sep 25 22:01:48 flamingo mpd[1647]: oss_output: Error opening OSS device "/dev/sound/dsp": No such file or directory
Sep 25 22:01:48 flamingo mpd[1647]: output: Attempting to detect a pulse audio device
Sep 25 22:01:48 flamingo mpd[1647]: Assertion 'm' failed at pulse/thread-mainloop.c:236, function pa_threaded_mainloo...orting.
Hint: Some lines were ellipsized, use -l to show in full.
or,
jorge@flamingo:~$ sudo systemctl start mpd
[sudo] password for jorge:
jorge@flamingo:~$ systemctl status mpd
● mpd.service - Music Player Daemon
Loaded: loaded (/usr/lib/systemd/system/mpd.service; enabled)
Active: failed (Result: signal) since Thu 2014-09-25 22:09:13 EDT; 8s ago
Process: 2056 ExecStart=/usr/bin/mpd --no-daemon (code=killed, signal=ABRT)
Main PID: 2056 (code=killed, signal=ABRT)
Sep 25 22:09:13 flamingo mpd[2056]: ALSA lib confmisc.c:1251:(snd_func_refer) error evaluating name
Sep 25 22:09:13 flamingo mpd[2056]: ALSA lib conf.c:4259:(_snd_config_evaluate) function snd_func_refer returned erro...rectory
Sep 25 22:09:13 flamingo mpd[2056]: ALSA lib conf.c:4738:(snd_config_expand) Evaluate error: No such file or directory
Sep 25 22:09:13 flamingo mpd[2056]: ALSA lib pcm.c:2239:(snd_pcm_open_noupdate) Unknown PCM default
Sep 25 22:09:13 flamingo mpd[2056]: alsa_output: Error opening default ALSA device: No such file or directory
Sep 25 22:09:13 flamingo mpd[2056]: output: Attempting to detect a oss audio device
Sep 25 22:09:13 flamingo mpd[2056]: oss_output: Error opening OSS device "/dev/dsp": No such file or directory
Sep 25 22:09:13 flamingo mpd[2056]: oss_output: Error opening OSS device "/dev/sound/dsp": No such file or directory
Sep 25 22:09:13 flamingo mpd[2056]: output: Attempting to detect a pulse audio device
Sep 25 22:09:13 flamingo mpd[2056]: Assertion 'm' failed at pulse/thread-mainloop.c:236, function pa_threaded_mainloo...orting.
Hint: Some lines were ellipsized, use -l to show in full.
Here is the mpd config file:
jorge@flamingo:~$ cat ~/.mpd/mpd.conf
music_directory "/home/jorge/Multimedia/Audio/Music"
playlist_directory "/home/jorge/.mpd/playlists"
db_file "~/.mpd/mpd.db"
log_file "~/.mpd/mpd.log"
pid_file "~/.mpd/mpd.pid"
state_file "~/.mpd/mpdstate"
audio_output {
type "alsa"
name "MPD"
restore_paused "yes"
follow_inside_symlinks "no"
Any ideas what I'm doing wrong here?
Thanks in advance.
Last edited by geo909 (2014-09-26 02:12:30)Scimmia wrote:Yeah, you're out of date. Update your system and everything should work.
*facepalm*
Oh dear.. An update fixed the problem indeed, thank you.
HilmTye wrote: if you're starting mpd as a system service, then your user's config won't be used
You're right.. I just read the wiki more carefully. Indeed, I would like to run it for my user, so systemd is not
the best option for me. But I still have trouble.. The problem is that I can't autostart it the way it mentions
in the wiki. My mpd files are as follows:
jorge@flamingo:~$ ls ~/.mpd
mpd.conf mpd.db mpd.log mpd.pid mpdstate playlists
I tried this as per the wiki:
jorge@flamingo:~$ cat ~/.profile
# MPD daemon start (if no other user instance exists)
[ ! -s ~/.mpd/mpd.pid ] && mpd
but it didn't work. mpd was not running after reboot.
Then I tried /etc/profile:
jorge@flamingo:~$ cat /etc/profile
# /etc/profile
#Set our umask
umask 022
# Set our default path
PATH="/usr/local/sbin:/usr/local/bin:/usr/bin"
export PATH
# Load profiles from /etc/profile.d
if test -d /etc/profile.d/; then
for profile in /etc/profile.d/*.sh; do
test -r "$profile" && . "$profile"
done
unset profile
fi
# Source global bash config
if test "$PS1" && test "$BASH" && test -r /etc/bash.bashrc; then
. /etc/bash.bashrc
fi
# Termcap is outdated, old, and crusty, kill it.
unset TERMCAP
# Man is much better than us at figuring this out
unset MANPATH
export GPODDER_HOME="/home/jorge/Applications/Application Data/gpodder"
# MPD daemon start (if no other user instance exists)
[ ! -s ~/.mpd/mpd.pid ] && mpd
but it didn't work either.
In both cases, if I try to run mpd again from the terminal, I get:
jorge@flamingo:~$ mpd
server_socket: bind to '0.0.0.0:6600' failed: Address already in use (continuing anyway, because binding to '[::]:6600' succeeded)
and then mpd works.
Any ideas on how to startup mpd automatically on boot without systemd?
Last edited by geo909 (2014-09-26 04:03:15) -
[SOLVED] systemd : services failing to start on boot
I have removed sysvinit completely as per the systemd wiki pages.
I don't usually re-boot very often so I'm not sure exactly when the problem started.
I only noticed this problem about 4 or 5 days ago.
But now whenever I reboot my machine 2 services fail consistently.
adsl.service
colord.service
They both start flawlessly once I can log in at a console.
I'm using kde and in the last couple of days, while trying to fix my problem, the kdm service has failed to start a couple of times too - saying there is no X server.
Before switching to systemd I never had any of these problems using the old rc.conf method. My DAEMONS array had the adsl service start after the network service.
I need some help and advice to find out what is causing the problem and how to fix it.
Last edited by bhrgunatha (2012-10-25 05:44:22)Thanks. That seems plausible. So I've been snooping at the journal.
journalctl -ab
Oct 25 17:06:13 starch systemd[1]: Started Trigger Flushing of Journal to Persistent Storage.
Oct 25 17:06:14 starch systemd[1]: Started Recreate Volatile Files and Directories.
Oct 25 17:06:14 starch systemd[1]: Starting System Initialization.
Oct 25 17:06:14 starch systemd[1]: Reached target System Initialization.
Oct 25 17:06:14 starch systemd[1]: Starting CUPS Printing Service Sockets.
Oct 25 17:06:14 starch systemd[1]: Listening on CUPS Printing Service Sockets.
Oct 25 17:06:14 starch systemd[1]: Starting Console System Startup Logging...
Oct 25 17:06:14 starch systemd[1]: Starting Restore Sound Card State...
Oct 25 17:06:14 starch systemd[1]: Starting CUPS Printer Service Spool.
Oct 25 17:06:14 starch systemd[1]: Started CUPS Printer Service Spool.
Oct 25 17:06:14 starch systemd[1]: Starting D-Bus System Message Bus Socket.
Oct 25 17:06:16 starch ntpd[381]: ntpd [email protected] Tue Aug 21 15:06:24 UTC 2012 (1)
Oct 25 17:06:16 starch ntpd[413]: proto: precision = 0.156 usec
Oct 25 17:06:17 starch ntpd[413]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
Oct 25 17:06:17 starch ntpd[413]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
Oct 25 17:06:18 starch ntpd[413]: Listen and drop on 1 v6wildcard :: UDP 123
Oct 25 17:06:18 starch ntpd[413]: Listen normally on 2 lo 127.0.0.1 UDP 123
Oct 25 17:06:18 starch ntpd[413]: Listen normally on 3 lo ::1 UDP 123
Oct 25 17:06:18 starch ntpd[413]: peers refreshed
Oct 25 17:06:18 starch ntpd[413]: Listening on routing socket on fd #20 for interface updates
Oct 25 17:06:18 starch dbus[384]: [system] Activating systemd to hand-off: service name='org.freedesktop.ColorManager' unit='colord.service'
Oct 25 17:06:18 starch dbus[384]: [system] Successfully activated service 'org.freedesktop.systemd1'
Oct 25 17:07:03 starch dbus[384]: [system] Successfully activated service 'org.freedesktop.ColorManager'
Oct 25 17:07:03 starch dbus[384]: [system] Activating via systemd: service name='org.freedesktop.ColorManager' unit='colord.service'
Oct 25 17:07:03 starch dbus[384]: [system] Successfully activated service 'org.freedesktop.ColorManager'
Oct 25 17:07:04 starch kernel: r8169 0000:02:00.0: eth0: link down
Oct 25 17:07:03 starch systemd[1]: Starting Manage, Install and Generate Color Profiles...
Oct 25 17:07:03 starch systemd[1]: Started Manage, Install and Generate Color Profiles.
Oct 25 17:07:03 starch systemd[1]: colord.service: main process exited, code=killed, status=6
Oct 25 17:07:03 starch systemd[1]: Unit colord.service entered failed state.
Oct 25 17:07:04 starch kernel: r8169 0000:02:00.0: eth0: link down
Oct 25 17:07:04 starch kernel: IPv6: ADDRCONF(NETDEV_UP): eth0: link is not ready
Oct 25 17:07:04 starch kernel: PPP generic driver version 2.4.2
Oct 25 17:07:04 starch cupsd[380]: Unknown directive DefaultAuthType on line 26.
Oct 25 17:07:04 starch kernel: r8169 0000:02:00.0: eth0: link up
Oct 25 17:07:04 starch kernel: IPv6: ADDRCONF(NETDEV_CHANGE): eth0: link becomes ready
Oct 25 17:07:04 starch pppoe-start[382]: TIMED OUT
Oct 25 17:07:04 starch kernel: NET: Registered protocol family 24
Oct 25 17:07:04 starch pppoe-start[382]: /usr/sbin/pppoe-start: line 193: 394 Terminated $CONNECT "$@" > /dev/null 2>&1
That seems to confirm your theory.
eth0 link is not up when attempting to start colord and adsl
So the $64,000 question:
How do I defer them until eth0 is ready?
Or how can I force the eth0 link to be up before colord or adsl try to use it?
Last edited by bhrgunatha (2012-10-25 01:33:36) -
[SOLVED] Help with systemd .service script
Hello,
I have been using ArchLinux (ARM version) on some “plug computers” for over a year and love it. Recently I forced myself to move to systemd by upgrading all my computers from scratch. I migrated all my applications and learned new ways of doing things but am having trouble with one last migration. I run a c++ communication program that monitors a TCP port for traffic. In the past I started this program (daemon) from an entry in rc.conf. I have read all I can about systemd’s new approach to starting daemons (https://wiki.archlinux.org/index.php/Systemd and https://wiki.archlinux.org/index.php/Systemd/Services)
So far I created what I thought is the correct systemd .service file listed below.
[Unit]
Description=EQBCS
After=network.target
[Service]
Type=simple
ExecStart=/home/public/EQBCS/eqbcs -p 12947 -d &> /dev/null
[Install]
WantedBy=multi-user.target
I put this file in /usr/lib/systemd/system/eqbcs.service. I then ran the following commands in the following order:
systemctl daemon-reload
systemctl enable eqbcs.service (created a link in /etc/systemd/system/multi-user.target.wants)
systemctl start eqbcs.service
Here is output from systemctl (status)
eqbcs.service loaded failed failed EQBCS
I thought this would start the service but no luck. I also thought maybe a reboot would work but no luck. I verified I can start the daemon manually if I run /home/public/EQBCS/eqbcs -p 12947 -d &> /dev/null from the command line.
I think I am close, but after several hours of looking at examples of .service files and other posts, I am at a loss. I am not one of those types who posts a question without taking the time to read the wealth of information on these boards, but I am truly out of ideas and can’t figure out what to do next. I sincerely could use some help/advice.
Last edited by calzon65 (2013-06-01 21:18:20)Thank you for the suggestions, I believe I am getting closer to success. When I run systemctl start eqbcs.servcie it starts the service but the only way I can get out of systemctl is to ^c out.
Here is my current .service file:
[Unit]
Description=EQBCS
After=network.target
[Service]
ExecStart=/home/public/EQBCS/eqbcs -p 12947
Type=forking
[Install]
WantedBy=multi-user.target
Output from systemctl status eqbcs:
eqbcs.service - EQBCS
Loaded: loaded (/etc/systemd/system/eqbcs.service; enabled)
Active: failed (Result: timeout) since Sat 2013-06-01 12:48:43 PDT; 2min 11s ago
Process: 427 ExecStart=/home/public/EQBCS/eqbcs -p 12947 (code=killed, signal=TERM)
Main PID: 396 (code=killed, signal=KILL)
CGroup: name=systemd:/system/eqbcs.service
Jun 01 12:47:13 alarm systemd[1]: Starting EQBCS...
Jun 01 12:47:13 alarm eqbcs[427]: WARNING: Running as root NOT recommended.
Jun 01 12:47:13 alarm eqbcs[427]: EQ Box Chat Server 10.12.18
Jun 01 12:47:13 alarm eqbcs[427]: Waiting for connections on port: 12947...
Jun 01 12:48:43 alarm systemd[1]: eqbcs.service operation timed out. Terminating.
Jun 01 12:48:43 alarm systemd[1]: Failed to start EQBCS.
Jun 01 12:48:43 alarm systemd[1]: Unit eqbcs.service entered failed state.
Are there any other suggestions for settings in my .service file? -
[SOLVED] /usr/bin/echo from systemd .service
I use systemd to execute a shell script to change the status of an LED after boot when I reach multi-user state. It is working fine, but I wanted to execute the shell script lines from within my systemd .service file instead of the systemd .service file executing the shell script. Below is the systemd .service file but it’s not working. The systemctl status shows no issues, but I have a gut feeling my problem might be related to me redirecting the /usr/bin/echo to a device. Could someone lend a suggestion?
Description=Set Green LED
After=multi-user.target
[Service]
Type=oneshot
ExecStart=/usr/bin/echo none > /sys/class/leds/status\:blue\:health/trigger
ExecStart=/usr/bin/sleep 1
ExecStart=/usr/bin/echo default-on > /sys/class/leds/status\:green\:health/trigger
[Install]
WantedBy=multi-user.target
Here is my systemctl status output:
setgreenled.service - Set Green LED
Loaded: loaded (/etc/systemd/system/setgreenled.service; enabled)
Active: inactive (dead) since Tue 2013-06-04 14:12:52 PDT; 3s ago
Process: 273 ExecStart=/usr/bin/echo default-on > /sys/class/leds/status\:green\:health/trigger (code=exited, status=0/SUCCESS)
Process: 270 ExecStart=/usr/bin/sleep 1 (code=exited, status=0/SUCCESS)
Process: 268 ExecStart=/usr/bin/echo none > /sys/class/leds/status\:blue\:health/trigger (code=exited, status=0/SUCCESS)
Jun 04 14:12:51 pogoplug systemd[1]: Starting Set Green LED...
Jun 04 14:12:52 pogoplug echo[273]: default-on > /sys/class/leds/status\:green\:health/trigger
Jun 04 14:12:52 pogoplug systemd[1]: Started Set Green LED.
If I execute the lines below from the command-line it works fine.
/usr/bin/echo none > /sys/class/leds/status\:blue\:health/trigger
/usr/bin/echo default-on > /sys/class/leds/status\:green\:health/trigger
If I put the commands into a shell script and use systemd .service to execute the shell script, it works fine. Here is that .service script
[Unit]
Description=Set Green LED
After=multi-user.target
[Service]
Type=simple
ExecStart=/usr/bin/sh /home/public/setgreenled.sh
[Install]
WantedBy=multi-user.target
Last edited by calzon65 (2013-06-05 00:55:37)Systemd services are not shells. So redirects will not work in that way. You can use "bash -c '<command here>'" to accomplish this as that will create a shell for the command to run. But I think that berbae is right that there are better alternatives for this.
You can use tmpfiles (man tmpfiles.d) which you can use to simply write a value to the given path, or you can use a udev rule to run a command when that particular path is detected. Beware though that for some things, the tmpfiles way will sometimes try to run itself before the actual creation of the directory. So you may run into some pace conditions with that method. For some things, it is totally reliable though... so you'll just have to test and see.
A tmpfiles.d configuration is way easier to write than a udev rule. But what you are trying to do would be a pretty basic udev rule, so it would probably not take you very long to learn how to do it. It simply involves learning how to use the udevadm command really. -
Systemd service starts command twice
Hello,
i have a problem with systemd service for inotifywait check my mails.
service:
[Unit]
Description=Start mailnotify as a daemon
Requires=offlineimap.service
After=offlineimap.service
[Service]
User=matija
ExecStart=/home/matija/bin/mailnotify.sh
[Install]
WantedBy=multi-user.target
and when i start it:
sudo systemctl status mailnotify.service
mailnotify.service - Start mailnotify as a daemon
Loaded: loaded (/usr/lib/systemd/system/mailnotify.service; disabled)
Active: active (running) since Wed, 2012-12-12 15:46:00 CET; 6s ago
Main PID: 13650 (mailnotify.sh)
CGroup: name=systemd:/system/mailnotify.service
├─13650 /bin/bash /home/matija/bin/mailnotify.sh
├─13652 /bin/bash /home/matija/bin/mailnotify.sh
└─13653 inotifywait -e create -e moved_to /home/matija/Maildir/Archives.2012/new /home/matija/Maildir/Archives/new /hom...
Dec 12 15:46:00 workarch systemd[1]: Starting Start mailnotify as a daemon...
Dec 12 15:46:00 workarch systemd[1]: Started Start mailnotify as a daemon.
but it doesn't work.
when i start /home/matija/bin/mailnotify.sh it works as expected.
Could you please help me with that?
ThanksYou'll have to run journalctl as root. It should be logged as UNIT=bar.service, SYSLOG_IDENTIFIER=systemd, one example from me:
sudo systemctl start chrony.service
sudo systemctl stop chrony.service
sudo journalctl -o verbose --since today UNIT=chrony.service SYSLOG_IDENTIFIER=systemd
Sa 2014-09-06 01:19:32.432387 CEST [s=###########################;i=#####;b=###########################;m=#######;t=##########;x=#############]
PRIORITY=6
_UID=0
_GID=0
_MACHINE_ID=###########################
_HOSTNAME=pamobile
SYSLOG_FACILITY=3
SYSLOG_IDENTIFIER=systemd
_TRANSPORT=journal
_PID=1
_COMM=systemd
_EXE=/usr/lib/systemd/systemd
_CMDLINE=/sbin/init
_CAP_EFFECTIVE=3fffffffff
_SYSTEMD_CGROUP=/
CODE_FILE=src/core/job.c
CODE_LINE=721
CODE_FUNCTION=job_log_status_message
MESSAGE_ID=#######################
RESULT=done
UNIT=chrony.service
MESSAGE=Started Chrony Network Time Daemon.
_BOOT_ID=############################
_SOURCE_REALTIME_TIMESTAMP=###########
Sa 2014-09-06 01:19:40.538847 CEST [s=###############################;i=#####;b=###############################;m=########;t=############;x=#########################]
PRIORITY=6
_UID=0
_GID=0
_MACHINE_ID=###############################
_HOSTNAME=pamobile
SYSLOG_FACILITY=3
SYSLOG_IDENTIFIER=systemd
_TRANSPORT=journal
_PID=1
_COMM=systemd
_EXE=/usr/lib/systemd/systemd
_CMDLINE=/sbin/init
_CAP_EFFECTIVE=3fffffffff
_SYSTEMD_CGROUP=/
CODE_FILE=src/core/job.c
CODE_FUNCTION=job_log_status_message
RESULT=done
UNIT=chrony.service
CODE_LINE=729
MESSAGE_ID=###############################
MESSAGE=Stopped Chrony Network Time Daemon.
_BOOT_ID=###############################
_SOURCE_REALTIME_TIMESTAMP=################### -
Run custom systemd service before NetworkManager
Hi, I am trying to write a systemd service that runs and completes before NetworkManager.service starts.
I tried this:
[Unit]
Description=Custom service test
Before=NetworkManager.service
[Service]
Type=oneshot
ExecStart=/usr/bin/echo Custom service test 1
ExecStart=/usr/bin/sleep 5
ExecStart=/usr/bin/echo Custom service test 2
[Install]
WantedBy=network.target
While the custom service does start, I got this rather strange output:
Jan 22 00:12:46 localhost echo[1166]: Custom service test 1
Jan 22 00:12:48 localhost kernel: NVRM: GPU at 0000:02:00: GPU-(snip)
... some unrelated messages (acpid, kdm, etc) ...
Jan 22 00:12:49 localhost systemd-logind[1170]: Linked /tmp/.X11-unix/X0 to /run/user/1000/X11-display.
Jan 22 00:13:13 localhost echo[1254]: Custom service test 2
Jan 22 00:12:50 localhost systemd[1]: Started Custom service test.
Jan 22 00:12:50 localhost systemd[1]: Starting Network Manager...
As you can see, while everything appears in the expected order in the log, the timestamps look very wrong. The "Custom service test 2" says "00:13:13", yet it is in the middle of "00:12:49" and "00:12:50". What gives?
Also, notice that the first echo was at 00:12:46, but NetworkManager started at 00:12:50, which is only 4 seconds later. The "sleep" in the custom services should have made it start at 00:12:51 at the earliest. I don't understand why things are not being respected.
The output I'd expect to see is something like this:
Jan 22 00:12:46 localhost echo[1166]: Custom service test 1
Jan 22 00:12:51 localhost echo[1254]: Custom service test 2
Jan 22 00:12:51 localhost systemd[1]: Started Custom service test.
Jan 22 00:12:51 localhost systemd[1]: Starting Network Manager...
I have also made sure that it shows up in NetworkManager.service's After list:
$ systemctl show -p After NetworkManager.service
After=mycustomservice.service syslog.target systemd-journald.socket dbus.socket basic.targetfalconindy wrote:Sooooo this begs the question: what are you really trying to do?
I'm trying to write a script that changes the interface's MAC address before NetworkManager gets a chance to take over the network interface. I'm aware that there's a page about exactly that on the wiki. I started with the systemd service from the bottom of the page, which says "Before=dhcpcd@%i.service". I changed that line to use "NetworkManager.service", and I changed the ExecStart line to "/usr/bin/macchanger -A myinterface" in order to get a random MAC address, instead of setting a fixed one like the example shows. Then I saw that macchanger's output was being mixed with NetworkManager's output in the journal, so I decided to try and write a custom service just for testing, making it start before NetworkManager, in order to see if it really was systemd's fault or if it was something macchanger-specific. Then I noticed the strange behavior described in the OP, didn't really know what to do about it, so I posted this topic. That's the story so far...
Last edited by WindPower (2013-01-23 00:13:22) -
Running Multiple LIRC/[Other App] Instances in systemd Service
I'm trying to run multiple LIRC instances (one for each device) as a systemd service. This is what my service file looks like:
[Unit]
Description=LIRC Daemon
After=network.target
[Service]
Type=oneshot
EnvironmentFile=/etc/sysconfig/lirc
ExecStartPre=/bin/mkdir -p /run/lirc
ExecStartPre=/bin/rm -f /dev/lircd /dev/lircd1
ExecStartPre=/bin/rm -f /run/lirc/lircd /run/lirc/lircd1
ExecStartPre=/bin/ln -s /run/lirc/lircd /dev/lircd
ExecStartPre=/bin/ln -s /run/lirc/lircd1 /dev/lircd1
ExecStart=/usr/sbin/lircd --device=/dev/input/event12 --output=/run/lirc/lircd1 --pidfile=/run/lirc/lircd1.pid --driver=devinput --listen=8765 /etc/lirc/lircd.conf
ExecStart=/usr/sbin/lircd --device=/dev/input/event10 --output=/run/lirc/lircd --pidfile=/run/lirc/lircd.pid --driver=devinput --connect=localhost:8765 /etc/lirc/lircd.conf
ExecStopPost=/bin/rm -f /dev/lircd /dev/lircd1
ExecStopPost=/bin/rm -fR /run/lirc
[Install]
WantedBy=multi-user.target
I'm having some trouble with it as the service runs the first time but not properly. Restarting the service results in an Permissions error. I'm presuming because the socket is till running despite having manually deleted all LIRC sockets.
At the moment I'm thinking this is because service file excludes a PID assignment like:
PIDFile=/run/lirc/lircd.pid
Yet the two instances have their own PID assignments. What should I be putting or what's a better way to run two instances of LIRC as a service?
Last edited by archbawks (2013-04-13 16:58:59)Anyone?
-
[SOLVED] Systemd service files: sourcing other service files?
Is there a way to "source" one systemd service file from another, so that the service inherits all settings from the other file? The purpose would be to override or append select fields as a quasi-patch of the other file, e.g.
<source foo.service>
[section]
key=new_value
I was sure that I had seen this somewhere, but I can't find it. Did I make this up, or is my search-fu simply weak?I don't know that it is actually documented at this point in time. At least I haven't seen any. The only reason I know about it is beacuse I subscribe to [systemd-devel]. But it was briefly touched on in the announcement when it was first introduced.
I know that the .include method is documented very briefly in one of the man pages, but it doesn't really go into depth about how to use it. I do seem to recall a nice write up about it on Lennart's blog though. But it seems as though the intent of the systemd.unit.d (what they are calling "drop-in" modifications/replacements) is intended to replace the .include way. Though I am basing that statement off of the general attitude toward each on the mailing list, and I have seen no official word on this.
The nice thing about using .include is that you can use systemd-delta to see the changes made using that method. And while the systemd.unit.d changes are noted in that output, it is nothing more than simply indicating that there has been modification. The .include stuff actually has a full "diff -u" style output. -
[SOLVED] Running Systemd service on login (encrypted home partition)
Hi,
I have a dm-crypt/LUKS encrypted home partition that's mounted via PAM on login. I'm trying to use a systemd service (profile-sync-daemon), but the service tries to start and access the home partition before the partition is mounted. The service does seem to start successfully, but it doesn't gain access to necessary files on the home partition and malfunctions later on. Is there a sane hack to somehow delay the start of the service until the relevant partition gets mounted (basically after login)? Manually starting the service after login works just as intended in this case - I'm just looking for a way to automate this process.
I have an idea of starting the service via Openbox autostart, but I've currently failed in my attempts.
Last edited by ggg377 (2015-05-28 18:31:10)Things got quite complicated and hacky as I researched this so I went out of the box a bit (or took the easy way out, whichever you prefer) and reinstalled Arch with a full disk encryption. All is fine now and I also expect to see less problems overall in the future. If anyone wants to continue researching this it would probably be a good idea to start a new thread.
-
Is anyone able to launch java applets using Oracle Java 7 and Firefox in a 32bit chroot environment?
Whenever I browse to any site which opens a Java applet I instantly get the following exception:
java.lang.NullPointerException
at java.lang.ProcessEnvironment.validateValue(ProcessEnvironment.java:119)
at java.lang.ProcessEnvironment.access$400(ProcessEnvironment.java:61)
at java.lang.ProcessEnvironment$Value.valueOf(ProcessEnvironment.java:202)
at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:241)
at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:220)
at sun.plugin2.jvm.JVMLauncher.start(Unknown Source)
at sun.plugin2.main.server.JVMInstance.startImpl(Unknown Source)
at sun.plugin2.main.server.JVMInstance.start(Unknown Source)
at sun.plugin2.main.server.JVMManager.getOrCreateBestJVMInstance(Unknown Source)
at sun.plugin2.main.server.JVMManager.startAppletImpl(Unknown Source)
at sun.plugin2.main.server.JVMManager.startApplet(Unknown Source)
at sun.plugin2.main.server.JVMManager.startApplet(Unknown Source)
at sun.plugin2.main.server.MozillaPlugin.maybeStartApplet(Unknown Source)
at sun.plugin2.main.server.MozillaPlugin.setWindow(Unknown Source)
Exception in thread "main" java.lang.NullPointerException
at java.lang.ProcessEnvironment.validateValue(ProcessEnvironment.java:119)
at java.lang.ProcessEnvironment.access$400(ProcessEnvironment.java:61)
at java.lang.ProcessEnvironment$Value.valueOf(ProcessEnvironment.java:202)
at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:241)
at java.lang.ProcessEnvironment$StringEnvironment.put(ProcessEnvironment.java:220)
at sun.plugin2.jvm.JVMLauncher.start(Unknown Source)
at sun.plugin2.main.server.JVMInstance.startImpl(Unknown Source)
at sun.plugin2.main.server.JVMInstance.start(Unknown Source)
at sun.plugin2.main.server.JVMManager.getOrCreateBestJVMInstance(Unknown Source)
at sun.plugin2.main.server.JVMManager.startAppletImpl(Unknown Source)
at sun.plugin2.main.server.JVMManager.startApplet(Unknown Source)
at sun.plugin2.main.server.JVMManager.startApplet(Unknown Source)
at sun.plugin2.main.server.MozillaPlugin.maybeStartApplet(Unknown Source)
at sun.plugin2.main.server.MozillaPlugin.setWindow(Unknown Source)
I have installed jdk from AUR. I have my 32bit chroot environment set up exactly at described on the wiki.
This error only happens when I set LD_LIBRARY_PATH=/opt/java/jre/lib/i386 before launching Firefox. But without this, the libraries aren't found. For example, in the Java console I see errors like:
libjawt.so. No such file or directory
I've spent ages searching but I can't find a solution.Download the tar.gz installer and untar it to a location like /opt.
Once you untar the archive, add the bin directory to your PATH variable and your should be all set to use it from the terminal.
OR use sudo update-alternatives to set the java command to pick up your installed version. -
Several systemd services failed on fresh installation
Hi, I installed Arch with the latest iso a few weeks ago.
Now I saw services failing.
I disabled everything that refers to krb (kerberos), because I don't need it yet.
But there are 2 failed services left, I don't know how to solve them loading. Or If it is a good idea to disable them too, because I don't know what they are for:
mdadm.service
systemd-journal-upload.service
Thank you for your help.
JDmdadm is for RAID. And for all systemd services, you can read the relevant man page to see what it does.
Not a Sysadmin issue, moving to NC....
Maybe you are looking for
-
BB Tour has garbled HTML weird lettering random numbers symbols? What to do?
Hi, I was sent here by BB Help on Twitter. My BB Tour has worked fine with no problems receiving and being able to read emails. I have my AOL, GMail and Yahoo linked to my BB, and could view multiple posts with no problem. Now, I am a working act
-
I'm a photography student about to start University. And I need Adobe Bridge and Photoshop for me to edit my photographs. The cheapest Creative Cloud for students/teachers is £8.78 a month, does this include both Bridge and Photoshop? If not does tha
-
Samsung laser printer error msg on Mac Mini since update
samsung ml-2955DW laser printer throws error msg - rasterosec, filter - since recent update to OSX 10.8.3, but *only* when printing in Word for Mac. have deleted printer and reinstalled twice. no luck. any ideas?
-
How do I download streeming video that's NOT protected by copyright?
Hi, some amateur music sites I like have streeming videos in quick time. I would like to keep a feew of them in itunes and add them in presentations and such. Is there a simple way of doing this perhaps similar to making screen dump stills? Any good
-
Several application loading to Warehouse Builder 10g
Hi all, I have several applications based on DB2 and i will load and using extraction functionality. Have anyone experience to how using ETL in this case. Thanks in advance my email: [email protected]