[opensuse-factory] how to migrate from init.d to systemd
![](https://seccdn.libravatar.org/avatar/1091099af3cd8b684eaba8124c063c45.jpg?s=120&d=mm&r=g)
Hi All, I have decided to give a try to systemd... and it seems to work... after one waits 5 minutes or so (hope this bug gets fixed soon). However I have a small script that gets inserted in /etc/init.d/alsasound like this # See how we were called. case "$1" in start) if [ "$PREVLEVEL" = "N" ]; then test -d /proc/asound && start_rest else start_all fi /bin/bash /etc/imic.sh ;; what changes shall I do to make systemd do the same? Alin -- Without Questions there are no Answers! _____________________________________________________________________ Alin Marin ELENA Advanced Molecular Simulation Research Laboratory School of Physics, University College Dublin ---- Ardionsamblú Móilíneach Saotharlann Taighde Scoil na Fisice, An Coláiste Ollscoile, Baile Átha Cliath ----------------------------------------------------------------------------------- http://alin.elenaworld.net ______________________________________________________________________
![](https://seccdn.libravatar.org/avatar/f15a600d57849d9dc3e0d23539212583.jpg?s=120&d=mm&r=g)
On Wednesday, August 10, 2011 09:53:56 Alin Marin Elena wrote:
Hi All,
I have decided to give a try to systemd... and it seems to work... after one waits 5 minutes or so (hope this bug gets fixed soon).
Yeah, hope so as well ;). It does not happen for everybody.
However I have a small script that gets inserted in /etc/init.d/alsasound like this # See how we were called. case "$1" in start) if [ "$PREVLEVEL" = "N" ]; then test -d /proc/asound && start_rest else start_all fi /bin/bash /etc/imic.sh ;;
what changes shall I do to make systemd do the same?
None right now ;). systemd calls the "old" init scripts as long as there are no replacements - and there is no replacement for alsasound yet, so the init script is used as is. In general the above is a bad idea since you have to remember changing the file everytime alsasound gets updated, better create a separate file that is dependend on alsasound and starts afterwards Andreas -- Andreas Jaeger, Program Manager openSUSE aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org
![](https://seccdn.libravatar.org/avatar/1091099af3cd8b684eaba8124c063c45.jpg?s=120&d=mm&r=g)
strange it seems systemd does not want to run that script... or maybe it does it and fails [alin@abbaton:~]: cat /etc/imic.sh echo "Hacking the mic!!!" # ox12 activates left channel of the internal mic, 0x0c activates the right channel echo 0x12 0x03a15030 > /sys/class/sound/hwC0D0/user_pin_configs echo 1 > /sys/class/sound/hwC0D0/reconfig [alin@abbaton:~]: l /etc/imic.sh -rwxr-xr-x 1 root root 216 May 17 00:15 /etc/imic.sh*
In general the above is a bad idea since you have to remember changing the file everytime alsasound gets updated, better create a separate file that is dependend on alsasound and starts afterwards exactly... that is an issue... but I learnt no to forget... I can't remember now why the separate file solution did not work... when I tried... anyhow I added this as a temporary solution in the idea that the driver will be fixed but it seems become more a permanent fixture.
thought fcrozat works on the 5 min bug... I know at least another two people hit by it. Alin -- Without Questions there are no Answers! _____________________________________________________________________ Alin Marin ELENA Advanced Molecular Simulation Research Laboratory School of Physics, University College Dublin ---- Ardionsamblú Móilíneach Saotharlann Taighde Scoil na Fisice, An Coláiste Ollscoile, Baile Átha Cliath ----------------------------------------------------------------------------------- http://alin.elenaworld.net ______________________________________________________________________
![](https://seccdn.libravatar.org/avatar/f15a600d57849d9dc3e0d23539212583.jpg?s=120&d=mm&r=g)
On Wednesday, August 10, 2011 10:23:37 Alin Marin Elena wrote:
strange it seems systemd does not want to run that script... or maybe it does it and fails [alin@abbaton:~]: cat /etc/imic.sh echo "Hacking the mic!!!" # ox12 activates left channel of the internal mic, 0x0c activates the right channel echo 0x12 0x03a15030 > /sys/class/sound/hwC0D0/user_pin_configs echo 1 > /sys/class/sound/hwC0D0/reconfig [alin@abbaton:~]: l /etc/imic.sh -rwxr-xr-x 1 root root 216 May 17 00:15 /etc/imic.sh*
Indeed, there's alsa-store.service and alsa-restore.service and those will be used now, I didn't notice them before.
In general the above is a bad idea since you have to remember changing the file everytime alsasound gets updated, better create a separate file that is dependend on alsasound and starts afterwards
exactly... that is an issue... but I learnt no to forget... I can't remember now why the separate file solution did not work... when I tried... anyhow I added this as a temporary solution in the idea that the driver will be fixed but it seems become more a permanent fixture.
Did you file a bugreport against the driver?
thought fcrozat works on the 5 min bug... I know at least another two people hit by it.
Yep, he works on it - but was on vacation and is right now at Desktop Summit, Andreas -- Andreas Jaeger, Program Manager openSUSE aj@{suse.com,opensuse.org} Twitter/Identica: jaegerandi SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer, HRB 16746 (AG Nürnberg) GPG fingerprint = 93A3 365E CE47 B889 DF7F FED1 389A 563C C272 A126 -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org
![](https://seccdn.libravatar.org/avatar/1091099af3cd8b684eaba8124c063c45.jpg?s=120&d=mm&r=g)
Hi Andreas,
Did you file a bugreport against the driver? I did indeed... this is how I got the workaround for it... I think it i was Takashi...
the hardware in itself is kind of exotic (a macbook pro 7,1) so I do not know if it really deserves all the effort of a proper fix from the devs. Alin -- Without Questions there are no Answers! _____________________________________________________________________ Alin Marin ELENA Advanced Molecular Simulation Research Laboratory School of Physics, University College Dublin ---- Ardionsamblú Móilíneach Saotharlann Taighde Scoil na Fisice, An Coláiste Ollscoile, Baile Átha Cliath ----------------------------------------------------------------------------------- http://alin.elenaworld.net ______________________________________________________________________
![](https://seccdn.libravatar.org/avatar/5f188c5fb664dc110d55f04cd59a6e74.jpg?s=120&d=mm&r=g)
Le mercredi 10 août 2011 à 09:58 +0200, Andreas Jaeger a écrit :
On Wednesday, August 10, 2011 09:53:56 Alin Marin Elena wrote:
Hi All,
I have decided to give a try to systemd... and it seems to work... after one waits 5 minutes or so (hope this bug gets fixed soon).
Yeah, hope so as well ;). It does not happen for everybody.
However I have a small script that gets inserted in /etc/init.d/alsasound like this # See how we were called. case "$1" in start) if [ "$PREVLEVEL" = "N" ]; then test -d /proc/asound && start_rest else start_all fi /bin/bash /etc/imic.sh ;;
what changes shall I do to make systemd do the same?
None right now ;). systemd calls the "old" init scripts as long as there are no replacements - and there is no replacement for alsasound yet, so the init script is used as is.
In general the above is a bad idea since you have to remember changing the file everytime alsasound gets updated, better create a separate file that is dependend on alsasound and starts afterwards
Yes. Something like : cat << EOF > /etc/systemd/system/default.target.wants/imic.service [Unit] Description=Fix the mic After=alsasound.service [Service] Type=oneshot ExecStart=/bin/bash /etc/imic.sh EOF then systemctl daemon-reload and then test it with systemctl start imic.service I didn't test the service file, so errors are left to the readers as an exercice :) You can find more informations about how to write systemd unit files at : http://0pointer.de/blog/projects/systemd-for-admins-3.html -- Frederic Crozat <fcrozat@suse.com> SUSE -- To unsubscribe, e-mail: opensuse-factory+unsubscribe@opensuse.org For additional commands, e-mail: opensuse-factory+help@opensuse.org
![](https://seccdn.libravatar.org/avatar/1091099af3cd8b684eaba8124c063c45.jpg?s=120&d=mm&r=g)
thank you Frederic, somehow it worked... do not put me to explain why.. .you did the magic..
and then test it with systemctl start imic.service initially I got an error about too few parameters... but after reboot things were ok... and the script was applied...
thank you once more Alin -- Without Questions there are no Answers! _____________________________________________________________________ Alin Marin ELENA Advanced Molecular Simulation Research Laboratory School of Physics, University College Dublin ---- Ardionsamblú Móilíneach Saotharlann Taighde Scoil na Fisice, An Coláiste Ollscoile, Baile Átha Cliath ----------------------------------------------------------------------------------- http://alin.elenaworld.net ______________________________________________________________________
participants (3)
-
Alin Marin Elena
-
Andreas Jaeger
-
Frederic Crozat