/etc/init.d/script not working at boot

Post here if you are a new Porteus member and you're looking for some help.
michalh
White ninja
White ninja
Posts: 13
Joined: 20 Mar 2017, 14:41
Distribution: Porteus Desktop
Location: Czech Rep.

/etc/init.d/script not working at boot

Post#1 by michalh » 23 Mar 2017, 09:05

Hi,

I have XZM module for starting dropbear ssh server. It work flawlessly, when activated from running mate, but is seems not to be run when placed in /porteus/modules.

Any idea?

Thanks, Michal

michalh
White ninja
White ninja
Posts: 13
Joined: 20 Mar 2017, 14:41
Distribution: Porteus Desktop
Location: Czech Rep.

Re: /etc/init.d/script not working at boot

Post#2 by michalh » 23 Mar 2017, 10:08

Hm,

moving script to /etc/rc.d did not help.

When added line
/etc/rc.d/dropbear start
into /etc/rc.d/rc.local, the scipt is run at boot and works, but I do not like this solution. I would prefer not having to edit system scripts, it all should be done in the XZM module. Where am I to put the module, or what should be in the module for script to be run at boot?

Thanks, Michal

User avatar
francois
Contributor
Contributor
Posts: 6434
Joined: 28 Dec 2010, 14:25
Distribution: xfce plank porteus nemesis
Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.

Re: /etc/init.d/script not working at boot

Post#3 by francois » 23 Mar 2017, 10:41

From what you write:
- put module into /porteus/modules folder
- make a module to start your script which will contain the start command to rc.d or include in your module the instructions to start rc.d.

Create /tmp/build-module folder and work from there. To understand the structure of a module:

Code: Select all

cd /tmp/build-module
mkdir dropbear-ssh.xzm
xzm2dir dropbear-ssh.xzm  dropbear-ssh   #look at the structure and add the necessary folders
add to the structure of dropbear-ssh.xzm /etc/rc.d/dropbear-ssh-script
dropbear-ssh being a script in which ther will be your only command:

Code: Select all

dropbear start
Then repack the directory into a module:

Code: Select all

dir2xzm dropbear-ssh
or simply make a simple and tiny module for starting dropbear-ssh as dropbear-start-rc.d in the same way.
Prendre son temps, profiter de celui qui passe.

Alpvax
White ninja
White ninja
Posts: 9
Joined: 11 Apr 2017, 10:41
Distribution: Porteus v4 x64
Location: England

Re: /etc/init.d/script not working at boot

Post#4 by Alpvax » 11 Apr 2017, 10:46

There is a comment in the activate script stating that rc.d scripts will not be activated by the OS, only by the activate script. Was there any resolution to this issue? Or any workaround without manually putting something into rc.local?

michalh
White ninja
White ninja
Posts: 13
Joined: 20 Mar 2017, 14:41
Distribution: Porteus Desktop
Location: Czech Rep.

Re: /etc/init.d/script not working at boot

Post#5 by michalh » 11 Apr 2017, 10:52

I ended with "overwriting" system scripts (/etc/rc.d/rc.M, rc.local, rc.inet1) by my package. I would prefer other solution, but this works for me.

Michal

Alpvax
White ninja
White ninja
Posts: 9
Joined: 11 Apr 2017, 10:41
Distribution: Porteus v4 x64
Location: England

Re: /etc/init.d/script not working at boot

Post#6 by Alpvax » 11 Apr 2017, 12:17

Thanks, I might modify linuxrc to look for a $modulename.init file and execute that on startup, then I can just tell that to activate my rc script(s), and it will be expandable.

Alternatively I guess I could just stick in rc.local I guess.

I'm surprised no-one else has had issues with this.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: /etc/init.d/script not working at boot

Post#7 by Bogomips » 11 Apr 2017, 14:47

@ Alpvax

Welcome to Porteus. BTW noticed a test version being used. :roll:

@ francois
What's the score with test version issues? :unknown:
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

Alpvax
White ninja
White ninja
Posts: 9
Joined: 11 Apr 2017, 10:41
Distribution: Porteus v4 x64
Location: England

Re: /etc/init.d/script not working at boot

Post#8 by Alpvax » 11 Apr 2017, 15:27

Bogomips wrote:@ Alpvax

Welcome to Porteus. BTW noticed a test version being used. :roll:

@ francois
What's the score with test version issues? :unknown:
Thanks, I am using it in a live-only setup (no saved changes) as a way to learn a lot about the linux structure. (All configuration has to be done from files or scripts, not from the GUI). I like to live on the bleeding-edge :shock:

I have created a module which will mount my work samba share and map shortcuts (in thunar), but unfortunately there is no way to get the startup script to run when it is loaded on boot. This does not seem to be a bug, as it has been well documented within the script files. It would be a useful feature, maybe with a cheatcode to enable/disable it.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: /etc/init.d/script not working at boot

Post#9 by Bogomips » 11 Apr 2017, 17:06

michalh wrote: /etc/rc.d/dropbear start
into /etc/rc.d/rc.local, the scipt is run at boot and works, but I do not like this solution. I would prefer not having to edit system scripts, it all should be done in the XZM module.
Workaround
Alpvax wrote:There is a comment in the activate script stating that rc.d scripts will not be activated by the OS, only by the activate script.
For starters, do not put module in /porteus/modules. Then in rc.local script add line

Code: Select all

activate  /Path/to/Module.xzm
Do not know if just activation will suffice, as do not know make up of module. However we can take it from there. :wink:
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

Alpvax
White ninja
White ninja
Posts: 9
Joined: 11 Apr 2017, 10:41
Distribution: Porteus v4 x64
Location: England

Re: /etc/init.d/script not working at boot

Post#10 by Alpvax » 19 Apr 2017, 10:08

That solved most of the problem, however the module also added some thunar bookmarks, which did not seem to be replaced by the ones in the module, althought they were replaced correctly when the module was in modules. De-activating and re-activating does not seem to fix the issue.
I may just have to split this module into multiple modules.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: /etc/init.d/script not working at boot

Post#11 by Bogomips » 19 Apr 2017, 12:15

Alpvax wrote:the module also added some thunar bookmarks, which did not seem to be replaced by the ones in the module, althought they were replaced correctly when the module was in modules.
This is not very clear. Does not provide a good idea of the sequence followed.

What comes across is that the module contains these bookmarks in some file or other. So when in modules, script was not run and files remained intact. However upon activation from rc.local, script was run which changed data in these files?
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

Alpvax
White ninja
White ninja
Posts: 9
Joined: 11 Apr 2017, 10:41
Distribution: Porteus v4 x64
Location: England

Re: /etc/init.d/script not working at boot

Post#12 by Alpvax » 19 Apr 2017, 12:46

The module contains a settings file for thunar, and a script that changes additional settings based on access to a samba share.

When activated from modules, the settings from the file are applied, but the script is not executed.
When activated via "activate <module>.xzm", the settings file does not overwrite the existing settings file, but the script gets executed.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: /etc/init.d/script not working at boot

Post#13 by Bogomips » 19 Apr 2017, 13:17

Do not understand this, because settings file of module should have overlaid existing settings file (from changes?)

Try this and see what happens.
  • Create directory in module
  • Copy settings file of module to this directory as well
  • Append to script a statement to copy file from this directory to the directory required.
If this does not work, it is possible something else is clobbering the settings file later on.
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

Alpvax
White ninja
White ninja
Posts: 9
Joined: 11 Apr 2017, 10:41
Distribution: Porteus v4 x64
Location: England

Re: /etc/init.d/script not working at boot

Post#14 by Alpvax » 19 Apr 2017, 16:57

After doing what you said, the file has been replaced (~/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml) but the changes haven't taken effect in thunar itself. Maybe thunar needs to be reinitialised to read the file?

I think I will just move the module back to modules, and run the script from rc.local.

Bogomips
Full of knowledge
Full of knowledge
Posts: 2564
Joined: 25 Jun 2014, 15:21
Distribution: 3.2.2 Cinnamon & KDE5
Location: London

Re: /etc/init.d/script not working at boot

Post#15 by Bogomips » 19 Apr 2017, 20:19

Alpvax wrote:file has been replaced (~/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml) but the changes haven't taken effect in thunar itself. Maybe thunar needs to be reinitialised to read the file?
Don't know much about Thunar, but dare say would be analogous to way PaleMoon works.

Dug this up
xfce save thunar setting in

~/.config/xfce4/xfconf/xfce-perchannel-xml/thunar.xml

For example, to change an attribute of the window, as the width of the sidebar, type:

xfconf-query --channel thunar --property /last-separator-position --set 400

you can create a shell script that changes the values ​​first and then run thunar.
ie, create a file thunar.sh as:

#!/bin/bash

xfconf-query --channel thunar --property /last-side-pane --set ThunarTreePane
xfconf-query --channel thunar --property /last-separator-position --set 200
thunar &

and run it by typing:

sh thunar.sh
Seems clear Thunar will pick up the values needed at start up. So, one suggestion is to have in guiexec script:

Code: Select all

pkill thunar
thunar &
Or just give Boot Parameter (cheatcode) guiexec=pkill~thunar;thunar :wink:
Linux porteus 4.4.0-porteus #3 SMP PREEMPT Sat Jan 23 07:01:55 UTC 2016 i686 AMD Sempron(tm) 140 Processor AuthenticAMD GNU/Linux
NVIDIA Corporation C61 [GeForce 6150SE nForce 430] (rev a2) MemTotal: 901760 kB MemFree: 66752 kB

Post Reply