Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Debug application stuck in start script ?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Wed Aug 08, 2018 4:00 pm    Post subject: Debug application stuck in start script ? Reply with quote

Hello,

I have application which works fine when it is called from shell.
I need to be called in startup script, so I've put it in /etc/local.d
Yet, now the system hangs in boot, and I have no clue what happened , because there are no prints in terminal on boot.

Is there a way to debug what happened ?

Thanks,
ran
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Aug 08, 2018 4:24 pm    Post subject: Re: Debug application stuck in start script ? Reply with quote

ranran wrote:
I need to be called in startup script, so I've put it in /etc/local.d. Yet, now the system hangs in boot, and I have no clue what happened , because there are no prints in terminal on boot.

ranran ... difficult to tell without knowing what the "application" is, or what the script contains ... you should provide both. However, it sounds like said application doesn't background itself, or your script isn't doing so, and so the controlling tty is held. You could use 'start-stop-daemon' if the former (see: 'man start-stop-daemon').

best ... khay
Back to top
View user's profile Send private message
ranran
Tux's lil' helper
Tux's lil' helper


Joined: 11 Jul 2018
Posts: 75

PostPosted: Wed Aug 08, 2018 4:36 pm    Post subject: Reply with quote

Hi,

Thanks for the reply.
What do you mean that it "doesn't background itself", can you give more details ?

I have /etc/local.d/start.sh -> which all it has inside is:
/home/myapp start

What does it mean "doesn't background itself" ?
How can I debug what happens and where it is stuck ?

I understand that it is more "a linux question" than specific gentoo,

Thanks again,
ranran
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Wed Aug 08, 2018 6:40 pm    Post subject: Reply with quote

ranran wrote:
What do you mean that it "doesn't background itself", can you give more details?

ranran ... ummm? ... when you run a process it is attached to a TTY, or "terminal" device. This terminal is much like a pipeline and consists of stdin ("standard input"), stdout ("standard output"), and stderr ("standard error"), with taps/switches (ie, ^Z, ^C, etc) allowing the control of the process (flowing through the tty). So, when some process is passing through the tty it effectively holds the tty until the process has completed, however, process can be suspended (^Z), killed (^C), backgrounded, etc, and so the tty is returned (ie, to the shell). This allows for processes to be run as 'daemons' (ie, apache, sshd, mysql, etc), these are not started via an interactive shell as such (and so hold the tty) but by another process (ie, init, or a script run from init.d or local.d). The concept is the same however, for the script to come to completion any long running processes must run in the background as otherwise they are holding the tty. Most daemons (such as sshd, apache, etc) know to background themselves, others are not so cognisant of their place in this schema, but can generally be made to do the right thing via various means (again, see: 'man start-stop-daemon').

ranran wrote:
I have /etc/local.d/start.sh -> which all it has inside is: /home/myapp start

That should be 'name.start' (see: /etc/local.d/README), but anyhow, I hate having to guess ... what is 'myapp'? If this is some x11 app then it's going to expect USER, DISPLAY, and XAUTHORITY, which won't be available in the env where rc is running. Otherwise, if it's a unix like 'command', or daemon, then '/home/myapp start &' should suffice to background ... though start-stop-daemon is probably the better option.

ranran wrote:
How can I debug what happens and where it is stuck?

For 'myapp' then 'strace' (dev-util/strace) should give some idea of what it's doing, and what it expects, when run from a shell.

best ... khay
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum