0

I tried to install git through the command line,

sudo apt install git.

I put that process into the background by pressing Ctrl-Z. This also stops the process's execution so I tried to resume with

bg 1

but jobs yields stopped.

How can I resume the execution of this process?


Update: I put the process in the foreground but unfortunately I don't get an output of the execution progress. Is there any way to send a signal to apt to get the progress as an output?

7
  • What is the output of stty -a | grep -o '.tostop' in that terminal? – Hauke Laging Jun 10 '20 at 13:13
  • -tostop @HaukeLaging – Themelis Jun 10 '20 at 13:16
  • You mean you tried to resume with fg instead of bg, right? – Quasímodo Jun 10 '20 at 13:19
  • I tried both @Quasímodo – Themelis Jun 10 '20 at 13:21
  • 1
    You could attach to the stopped process with strace before you run bg %1: strace -p $PID In order to see what happens. Whether the process is started at all. – Hauke Laging Jun 10 '20 at 13:21
2

The process was expecting input from the terminal and apparently I missed any output messages in this regard. The problem was revealed after inspecting the process with strace (thanks @Hauke Laging) yielding,

--- stopped by SIGTTIN ---

A description of this signal is provided in gnu.org,

A process cannot read from the user’s terminal while it is running as a background job. When any process in a background job tries to read from the terminal, all of the processes in the job are sent a SIGTTIN signal. The default action for this signal is to stop the process.

After I inserted some random input the execution continued until termination.

0

And option is to use screen:

$ screen      # to create the screen
$ sudo apt install git
ctrl-A d      # to detach the screen
$ screen -r   # to reattach
2
  • I guess this helps monitor the progress of the execution? – Themelis Jun 10 '20 at 13:13
  • Running the applications under screen means that the session does not terminate – only the now-defunct terminal gets detached – so applications don't even know the terminal has detached, and allows the user to reattach the session later and continue working from where they left off. – Alberto Reyes Jun 11 '20 at 3:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.