LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-05-2018, 08:54 PM   #1
gatsby
Member
 
Registered: Jan 2006
Posts: 59

Rep: Reputation: 16
Error in rpmbuild process: "cannot stat"


Hey there -

I'm trying to build a one file RPM, but I keep running into a problem where my file can't be found in the build process. The error I receive is as follows:

Code:
Executing(%build): /bin/sh -e /var/tmp/rpm-tmp.NcAnA1
+ umask 022
+ cd /root/rpmbuild/BUILD
+ exit 0
Executing(%install): /bin/sh -e /var/tmp/rpm-tmp.bzsZka
+ umask 022
+ cd /root/rpmbuild/BUILD
+ '[' /root/rpmbuild/BUILDROOT/myfile-1.0-1.x86_64 '!=' / ']'
+ rm -rf /root/rpmbuild/BUILDROOT/myfile-1.0-1.x86_64
++ dirname /root/rpmbuild/BUILDROOT/myfile-1.0-1.x86_64
+ mkdir -p /root/rpmbuild/BUILDROOT
+ mkdir /root/rpmbuild/BUILDROOT/myfile-1.0-1.x86_64
+ rm -rf /root/rpmbuild/BUILDROOT/myfile-1.0-1.x86_64
+ install -m 0755 -d /root/rpmbuild/BUILDROOT/myile-1.0-1.x86_64/opt/myfile
+ echo pwd
pwd
+ cp -a myfile.sh /root/rpmbuild/BUILDROOT/myfile-1.0-1.x86_64/opt/myfile/myfile.sh
cp: cannot stat 'myfile.sh': No such file or directory
error: Bad exit status from /var/tmp/rpm-tmp.bzsZka (%install)

RPM build errors:
    Bad exit status from /var/tmp/rpm-tmp.bzsZka (%install)
I put the single file into a tar file under rpmbuild/SOURCES, named myfile-1.0.tar.gz. Here is some info about the file:

# tar -tvf rpmbuild/SOURCES/myfile-1.0.tar.gz
drwxr-xr-x root/root 0 2018-02-26 16:47 myfile-1.0/
-rwxr-xr-x root/root 0 2018-02-23 16:50 myfile-1.0/configure
-rwxr-xr-x root/root 3080 2018-02-23 16:50 myfile-1.0/myfile.sh

Here is the spec file I'm using:

Code:
Name:           myfile
Summary:        This is the summary
Version:        1.0
Release:        1
License:        GPL
Group:          Miscellaneous
Vendor:         
Packager:       
URL:            
Source0:        myfile-1.0.tar.gz
BuildArch:      noarch
BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)

%description
This is my test description

%pre

%setup -q

%build

%install
rm -rf $RPM_BUILD_ROOT
install -m 0755 -d %{buildroot}/opt/myfile
echo pwd
cp -a myfile.sh %{buildroot}/opt/myfile/myfile.sh

%clean
rm -rf $RPM_BUILD_ROOT

%post

%files
%dir /opt/myfile
%defattr(-,root,root,-)
/opt/myfile.sh
It could be something simple. Thanks in advance for any help.
 
Old 03-05-2018, 09:01 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,271

Rep: Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495Reputation: 1495
Quote:
Originally Posted by gatsby View Post
...
+ cd /root/rpmbuild/BUILD
...
+ cp -a myfile.sh /root/rpmbuild/BUILDROOT/myfile-1.0-1.x86_64/opt/myfile/myfile.sh
cp: cannot stat 'myfile.sh': No such file or directory
The file myfile.sh does not exist in /root/rpmbuild/BUILD/ ?? That's how I'm reading the error.
 
Old 03-05-2018, 09:09 PM   #3
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: Currently OpenMandriva. Previously openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,420

Rep: Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769
You should be using a normal user account to build your package. NOT the root user account.

Like /home/yourusernamehere
 
Old 03-06-2018, 12:47 PM   #4
gatsby
Member
 
Registered: Jan 2006
Posts: 59

Original Poster
Rep: Reputation: 16
Thanks...the key question for me here is why isn't it finding the file, even though it exists in the tarball I put in SOURCES.
 
Old 03-06-2018, 01:45 PM   #5
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth? I would say I hope so but I'm not so sure about that... I could just be a figment of your imagination too.
Distribution: Currently OpenMandriva. Previously openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,420

Rep: Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769Reputation: 1769
Quote:
Originally Posted by gatsby View Post
Thanks...the key question for me here is why isn't it finding the file, even though it exists in the tarball I put in SOURCES.
Maybe instead of copying the file in question, try using the 'install' command to install it to the folders you want it in.

You can also use the 'rm' command to remove it from the folder you don't want it in.

If my understanding is correct, you have to either list each and every file in your tar.gz source file, or use the folder structure in your source file. (if there is a folder structure in your source archive)
 
Old 03-08-2018, 09:37 AM   #6
bgstack15
Member
 
Registered: Jul 2017
Distribution: korora
Posts: 72

Rep: Reputation: Disabled
Additionally, your statement in the %install, the "echo pwd" only shows the static string "pwd." You could use the pwd command, or possible the "echo $PWD" command.
 
Old 06-02-2019, 05:31 AM   #7
vipint_99
LQ Newbie
 
Registered: Jun 2019
Posts: 1

Rep: Reputation: Disabled
Lightbulb rpmbuild - file now found error

I have faced this issue of file now find. can not stat file : myfile.
I had 4-5 other files in same directory and they were accessible, then I tried same file name which was already copied earlier in .spec file, I replaced name of failing file with successfully installed file and found now even that is also saying can not stat.
So I had situation where once same file was installed and other time below it was not installed and stating no file found.
On close examination I found that since I was changing directories with cd command and probably I was not in current directory where actual file was available.
I changed my all
"cd something to some/thing/"
to "(cd something some/thing)"
now I always comeback to my original source folder and all source files are available for install or cp .

Regards
 
  


Reply

Tags
compile, rpm, rpmbuild


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
[SOLVED] Sendmail "user stat unknown error " while delivering error out sanjay87 Linux - Server 1 02-29-2012 10:54 AM
Need solution to "failed to fork PTY" and "error creating the child process" problems Gnusboy Linux - Newbie 4 01-02-2010 08:54 AM
ns:"error when calling class OldSim"&tclsh:"invalid command+child process exits abn." shojaru Linux - Newbie 0 03-05-2009 05:23 AM
"failed to execute child process" "Input/output error" fl.bratu Fedora 4 12-15-2008 05:03 AM
Can't run LILO error : Fatal:raid_setup:stat("/dev/hdi1") robban59 Linux - Newbie 4 05-31-2005 05:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 03:25 AM.

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