LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 09-08-2019, 10:09 AM   #1
madmax25
Member
 
Registered: Aug 2018
Posts: 281

Rep: Reputation: Disabled
Xubuntu 18.04.3-32bit - Child process failed on executing bash


To make it easier to install a new kernel, I created the following bash:

Code:
 Kernel installation:
**********************

read -p "Please input kernel number: `echo '\n> '`" a
sleep 1
echo

sudo apt install linux-headers-"${a}" linux-headers-"${a}"-generic linux-image-"${a}"-generic linux-modules-"${a}"-generic linux-modules-extra-"${a}"-generic
sleep 2
echo

read -p "Hit Enter key to close ... " Enter
Execution of this script is granted, but still it doesn't work.

There's a message telling me
Code:
Child process failed! 
Child process cannot be executed. No privilege
How come and what can I do about it, please?
 
Old 09-08-2019, 10:27 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,505

Rep: Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314
is this the same issue? https://www.linuxquestions.org/quest...on-4175660310/

I would suggest you to use shellcheck to check your script,
also insert set -xv at the beginning of your script - which will help you debug what's happening.

Please do not drop in a general error message without any context, it is just pointless.
http://catb.org/~esr/faqs/smart-ques...html#beprecise
 
Old 09-08-2019, 12:50 PM   #3
madmax25
Member
 
Registered: Aug 2018
Posts: 281

Original Poster
Rep: Reputation: Disabled
No, it's not the same issue.
This message about the child process only happens in Xubuntu.

The only context here is when I start the bash, I get the mentioned message.

Last edited by madmax25; 09-08-2019 at 12:52 PM.
 
Old 09-08-2019, 03:19 PM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 13,505

Rep: Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314Reputation: 4314
no, see the link and answer all the relevant questions: http://catb.org/~esr/faqs/smart-ques...html#beprecise
The absolute minimum is:
exactly what did you type and exactly what's happened. Again, dropping in an [partial] error message is meaningless.
Again, this is not the complete error message, just a part of it, and important information is missing (line numbers of the original shell script and similar things).
Bash itself will never respond what you posted, there should be something else....

And what you posted is simply insufficient to help you.
 
Old 09-08-2019, 06:34 PM   #5
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
it seems you have observed a fragment of a script and changed it for your own ends
This is good

lets expand on that
The links should help you understand what is happening

The test on the input is *very* weak
see if you can come up with a better one


Code:
#!/bin/bash
# bash function
# https://mywiki.wooledge.org/BashGuide/CompoundCommands#Functions
kernel_pkgs() {
# here document
# https://mywiki.wooledge.org/HereDocument
cat <<EOF
linux-headers-${KerVersion}
linux-headers-${KerVersion}-generic
linux-image-${KerVersion}-generic
linux-modules-${KerVersion}-generic
linux-modules-extra-${KerVersion}-generic
EOF
}
GetKerVersion() {
while true;do
    read -p "Please input kernel number: $(echo '\n> ')" KerVersion
    # Parameter Expansion
    # https://mywiki.wooledge.org/BashGuide/Parameters#Parameter_Expansion
    if [[ ${KerVersion} == ${KerVersion// } ]]
    then
        echo apt install $(kernel_pkgs)
        break # gets us out of the loop
    else
        # consider putting some kind of loop counter here
        # and break if too many attempts
        echo "error, \"${KerVersion}\" has a space in it..please try again"
    fi
done
}

GetKerVersion
 
Old 09-09-2019, 03:59 PM   #6
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 13,223
Blog Entries: 9

Rep: Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617Reputation: 3617
Quote:
Originally Posted by madmax25 View Post
Code:
 Kernel installation:
**********************
Actually this bit should already error out with "line 1: Kernel: command not found" - so you're not showing us the full picture.
 
Old 09-09-2019, 05:20 PM   #7
Firerat
Senior Member
 
Registered: Oct 2008
Distribution: Debian sid
Posts: 2,683

Rep: Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783Reputation: 783
Quote:
Originally Posted by ondoho View Post
Actually this bit should already error out with "line 1: Kernel: command not found" - so you're not showing us the full picture.
that would explain it

I assumed that script header was added after for our benefit

The
Code:
*******************
bash would expand that to whatever happened to be in the $PWD

This would explain

Quote:
This message about the child process only happens in Xubuntu.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Difference between Child THREAD and Child PROCESS whho Linux - Newbie 12 02-16-2015 01:22 AM
Fedora 13 32bit and then Linux Mint 32bit and then Ubuntu 10.04 32bit ciao303 Linux - Newbie 3 08-10-2010 12:03 AM
Under which circumstances a child process creates another child process using fork? mitsulas Programming 3 12-08-2009 09:16 AM
How to kill a Child and all its subsequent child process in C shayer009 Programming 3 12-04-2007 01:40 AM
Killing a child process from another child marri Programming 6 10-01-2004 08:08 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 04:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration