Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
error: failed to stat ./new: No such file or directory
Note that in post #3, under "Conventions" I already told you that a RPM should not execute processes trivially during install. Running 'test', when not explicitly advertised, is unexpcted behaviour that compromises the trust we put in packaging. Besides that the name 'test' could lead to unexpected results since on default installation there already is a 'test' binary (see '[', ']', 'test'). So you really should correct your mistakes, uninstall the "test" package, rename it and the .spec file and the binary to "mypackage" or something like that before continuing.
That said, and provided you have the package "test-1-1.i386.rpm" still installed, post:
- the output of 'rpm -ql test 2>&1',
- 'rpm -q --scripts test 2>&1'
- contents of your test .spec file.
Post complete information and output and do not leave out any details.
Now if we try to install by giving the command rpm -ivh sample-1-1.i386.rpm it is giving
an error as follows
error: can't create transaction lock on /var/lib/rpm/__db.000
If we login as a root user and try to install by giving the command rpm -ivh sample-1-1.i386.rpm it is giving output as follows
error: failed to stat ./new: No such file or directory
Preparing... ########################################### [100%]
1:sample ########################################### [100%]
And finally the ouput of 'rpm -ql sample 2>&1' is
/usr/local/bin/sample
And if we type rpm -q --scripts sample 2>&1
it is printing nothing.It is also not giving any errors.The cursor is just coming to the next line.
So now i want you to solve two errors.
1)if i login with my own user account instead of root and try to install the binary package , i am getting the error as
error: can't create transaction lock on /var/lib/rpm/__db.000
2)if i login as a root user and try to install the binary package , i am getting the error as
error: failed to stat ./new: No such file or directory
And one more small confirmation i need from ur side.
Is it mandatory to login as a root user inorder to install or uninstall the binary rpm packages?
Now if we try to install by giving the command rpm -ivh sample-1-1.i386.rpm it is giving an error as follows
error: can't create transaction lock on /var/lib/rpm/__db.000
That's not an error. You must be root account user (or be allowed to use sudo) to install packages.
Quote:
Originally Posted by ukbhan
If we login as a root user and try to install by giving the command rpm -ivh sample-1-1.i386.rpm it is giving output as follows
error: failed to stat ./new: No such file or directory
Preparing... ########################################### [100%]
1:sample ########################################### [100%]
So the install runs OK. I can't see where the reference to the item called "new" comes from.
- Uninstall the sample package. List your installed packages ('rpm -q test') and see if there's any "test" package left to uninstall.
- If there is none, list the database contents: 'rpm -q --dump|grep -i new' and post the output.
- If there is none, try running 'rpm -i -v -v -v sample-1-1.i386.rpm' and post the output.
Quote:
Originally Posted by ukbhan
And if we type rpm -q --scripts sample 2>&1
it is printing nothing.It is also not giving any errors.The cursor is just coming to the next line.
That is good.
Quote:
Originally Posted by ukbhan
So now i want you to solve two errors.
Please be careful how you ask for assistance. Try "Can you help me solve these two errors please?".
I am extremely sorry for not asking your help in a pleasing manner.Here after i shall not do like that.I kindly request you to forgive me.
The output for rpm -i -v -v -v sample-1-1.i386.rpm is as follows
D: ============== sample-1-1.i386.rpm
D: Expected size: 4007 = lead(96)+sigs(180)+pad(4)+data(3727)
D: Actual size: 4007
D: sample-1-1.i386.rpm: Header SHA1 digest: OK (ee890b5b9b93855567066b620631b30d a3a4c7c9)
D: added binary package [0]
D: found 0 source and 1 binary packages
D: opening db environment /var/lib/rpm/Packages joinenv
D: opening db index /var/lib/rpm/Packages rdonly mode=0x0
D: locked db index /var/lib/rpm/Packages
D: ========== +++ sample-1-1 i386/linux 0x1
D: opening db index /var/lib/rpm/Depends create mode=0x0
D: opening db index /var/lib/rpm/Providename rdonly mode=0x0
D: opening db index /var/lib/rpm/Pubkeys rdonly mode=0x0
D: read h# 334 Header sanity check: OK
D: ========== DSA pubkey id b44269d0 4f2a6fd2 (h#334)
D: read h# 183 Header V3 DSA signature: OK, key ID 4f2a6fd2
D: Requires: libc.so.6 YES (db provides)
D: Requires: libc.so.6(GLIBC_2.0) YES (db provides)
D: Requires: rpmlib(CompressedFileNames) <= 3.0.4-1 YES (rpmlib provides )
D: Requires: rpmlib(PayloadFilesHavePrefix) <= 4.0-1 YES (rpmlib provides )
D: opening db index /var/lib/rpm/Conflictname rdonly mode=0x0
D: closed db index /var/lib/rpm/Pubkeys
D: closed db index /var/lib/rpm/Depends
D: closed db index /var/lib/rpm/Conflictname
D: closed db index /var/lib/rpm/Providename
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm/Packages
D: ========== recording tsort relations
D: ========== tsorting packages (order, #predecessors, #succesors, tree, depth, breadth)
D: 0 0 0 0 1 0 +sample-1-1.i386
D: installing binary packages
D: opening db environment /var/lib/rpm/Packages joinenv
D: opening db index /var/lib/rpm/Packages create mode=0x42
D: mounted filesystems:
D: i dev bsize bavail iavail mount point
error: failed to stat ./new: No such file or directory
D: sanity checking 1 elements
D: opening db index /var/lib/rpm/Name create mode=0x42
D: running pre-transaction scripts
D: computing 1 file fingerprints
Preparing packages for installation...
D: computing file dispositions
D: opening db index /var/lib/rpm/Basenames create mode=0x42
D: ========== +++ sample-1-1 i386-linux 0x1
D: Expected size: 4007 = lead(96)+sigs(180)+pad(4)+data(3727)
D: Actual size: 4007
D: sample-1-1: Header SHA1 digest: OK (ee890b5b9b93855567066b620631b30da3a4c7c9)
D: install: sample-1-1 has 1 files, test = 0
sample-1-1
D: ========== Directories not explicitly included in package:
D: 0 /usr/local/bin/
D: ==========
D: fini 100755 1 ( 0, 0) 4582 /usr/local/bin/sample;48574678
GZDIO: 1 reads, 4844 total bytes in 0.000127 secs
D: +++ h# 931 Header SHA1 digest: OK (ee890b5b9b93855567066b620631b30da3a4 c7c9)
D: adding "sample" to Name index.
D: adding "sample" to Basenames index.
D: opening db index /var/lib/rpm/Group create mode=0x42
D: adding "Utilities/System" to Group index.
D: opening db index /var/lib/rpm/Requirename create mode=0x42
D: adding 4 entries to Requirename index.
D: opening db index /var/lib/rpm/Providename create mode=0x42
D: adding 2 entries to Providename index.
D: opening db index /var/lib/rpm/Dirnames create mode=0x42
D: adding "/usr/local/bin/" to Dirnames index.
D: opening db index /var/lib/rpm/Requireversion create mode=0x42
D: adding 4 entries to Requireversion index.
D: opening db index /var/lib/rpm/Provideversion create mode=0x42
D: adding 2 entries to Provideversion index.
D: opening db index /var/lib/rpm/Installtid create mode=0x42
D: adding 1 entries to Installtid index.
D: opening db index /var/lib/rpm/Sigmd5 create mode=0x42
D: adding 1 entries to Sigmd5 index.
D: opening db index /var/lib/rpm/Sha1header create mode=0x42
D: adding "ee890b5b9b93855567066b620631b30da3a4c7c9" to Sha1header index.
D: opening db index /var/lib/rpm/Filemd5s create mode=0x42
D: adding 1 entries to Filemd5s index.
D: opening db index /var/lib/rpm/Triggername create mode=0x42
D: running post-transaction scripts
D: closed db index /var/lib/rpm/Filemd5s
D: closed db index /var/lib/rpm/Sha1header
D: closed db index /var/lib/rpm/Sigmd5
D: closed db index /var/lib/rpm/Installtid
D: closed db index /var/lib/rpm/Provideversion
D: closed db index /var/lib/rpm/Requireversion
D: closed db index /var/lib/rpm/Dirnames
D: closed db index /var/lib/rpm/Triggername
D: closed db index /var/lib/rpm/Providename
D: closed db index /var/lib/rpm/Requirename
D: closed db index /var/lib/rpm/Group
D: closed db index /var/lib/rpm/Basenames
D: closed db index /var/lib/rpm/Name
D: closed db index /var/lib/rpm/Packages
D: closed db environment /var/lib/rpm/Packages
D: May free Score board((nil))
And the output for rpm -q --dump|grep -i new is
rpmq: no arguments given for query
It is not listing out the contents of the database.I think there is something wrong in the expression.
D: sanity checking 1 elements
D: computing 1 file fingerprints
D: adding 1 entries to Filemd5s index.
Your output of 'rpm -i -v -v -v sample-1-1.i386.rpm' shows there's just one file in the package, which is good. You listed the .spec file before and it shows there you didn't use any scripts, which is good. Still the "error: failed to stat ./new: No such file or directory" warning is shown, so something must have gone wrong earlier. Try removing the temp files: 'rm -f /var/lib/rpm/__db.00?', then try again. If it still shows the warning you don't need to post the output.
And the output for rpm -qa --dump|grep -i new is very huge number of lines.Shall i post it ?
No thanks. Let's try Something Completely Different:
Quote:
Originally Posted by ukbhan
I have removed the temp files.But it still shows the warning.
OK, one final thing to try and that's a rebuild of the RPMDB:
0. Be root.
1. Make a backup of the original database so it can be restored: 'tar --xattrs -c -f /var/lib/rpm_original.tar /var/lib/rpm && echo OK || echo "FAILED ($?)".
* If it doesn't return "OK" for whatever reason don't proceed but post the errors.
2. Run 'rpm -v --rebuilddb >/var/lib/rpm_rebuilddb.log 2>&1'. Output is directed to a log (use 'tail -f /var/lib/rpm_rebuilddb.log' to see what's going on while it's running).
* This operation may take a while.
3. When finished, check the log for errors.
4. If no errors try the sample rpm again.
If you find the time do try a 'rpm --rebuilddb', because now you don't know if it would have fixed it plus it's good to practice troubleshooting and recovery.
Intially there was a sample.c sourcefile which prints "hello world".
We have written sample.spec file to create source and binary rpm packages.
The corresponding source package is sample-1-1.src.rpm and
the corresponding binary package is sample-1-1.i386.rpm.
Now the sample.c source file is modified to print "how are you".
Also I have modified the Version and Release to 2 in the sample.spec file.
So now i have created the source package sample-2-2.src.rpm
and binary package sample-2-2.i386.rpm.
I had first installed the sample-1-1.i386.rpm and run it.
It prints "hello world".
Next i had updated the sample-1-1.i386.rpm with sample-2-2.i386.rpm.
It should print "how are you".
But it is not doing so.It's printing "hello world " only.
The content of /usr/local/bin/sample is "hello world".It's not getting updated to "how are you".
i got my issue solved.i havent placed the spec file in the right directory on this new unix machine.
Intially we have packed only one sample.c file.Now i want to pack say 5 files.let them be sample1.c ,sample2.c,sample3.c,sample4.c,sample5.c.
where should i make changes in my spec file?
I kindly request you to post how should my complete spec file look or else
what changes should i make to my previous spec file.
In general what would be the timelines for packing 5files ,25 files and 100 files?
The amount of source files really does not matter, though it is easier to keep them together in a %source0 tarball, else you'll have to specify them all separately like %source0, %source1, %source2, etc cetera. The amount of %files really does not matter, what matters is how you install them. If you use a "makefile install" type of install it's easier to just output with something like
Code:
find $RPM_BUILD_DIR -not -type d -printf "%%attr(%m,root,root) %p\n"
, else you'll have to specify installs manually or succumb to %files globbing like "/usr/share/packagename/*".
In short: make source tarball, make install script and use that in your .spec. Try it and post errors if any.
i have created the source tarball sample.tar containing 5 files sample1.c,sample2.c,sample3.c,sample4.c,sample5.c .These files prints different outputs.
But i am stuck up in writing the make install script.I havent ever written it before.My experience on linux is just 2 months.So i kindly request you to post how my make install script looks like so that i can Know exactly how to write the install scripts.I have googled a lot to write the makeinstall script.But it seems difficult to me to put it into practice for my program.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.