Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

xargs boot error

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
44 posts
  • Previous
  • 1
  • 2
Author
Message
cebewee
n00b
n00b
User avatar
Posts: 22
Joined: Tue Jun 17, 2003 6:40 am

  • Quote

Post by cebewee » Tue Jun 24, 2003 7:51 pm

Ok, correction: The problem is that there are too many functions declared in the various startup scripts, as all functions are also stored in the environment.
Top
no usernames left
n00b
n00b
User avatar
Posts: 72
Joined: Sun Feb 09, 2003 11:03 am

  • Quote

Post by no usernames left » Sat Jun 28, 2003 3:58 am

A better solution to this problem is the following line:

Code: Select all

( find /var/lock -type f -exec rm -f -- {} \; 1>&2 )
Basically it does the same the new line does (it doesn't change the current directory) but uses the old -exec method for deleting the files.
Image
Top
jukka
Apprentice
Apprentice
Posts: 249
Joined: Thu Jun 06, 2002 8:02 pm
Location: Zurich, Switzerland

  • Quote

Post by jukka » Sat Jun 28, 2003 11:20 am

no usernames left wrote:A better solution to this problem is the following line:

Code: Select all

( find /var/lock -type f -exec rm -f -- {} \; 1>&2 )
That's not a solution, that's a hack which conceals that there is too much exported to the environment. And BTW it's almost exactly what bootmisc 1.24 did.
Top
CRC
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 90
Joined: Sun Mar 30, 2003 2:34 am
Location: Dallas, TX, USA
Contact:
Contact CRC
Website

Why XARGS

  • Quote

Post by CRC » Sun Jun 29, 2003 7:38 am

I'm curious as to why the change was made to use xargs anyway?

It seems like you are just adding yet another process into the mix needlessly when the -exec argument to find does what is required. Isn't this similar to using "cat file | command" instead of "command <file" ??

-- Evan
aka Taro
Unix/Linux Consulting & Hosting
We Support Gentoo!
http://CoolRunningConcepts.com

Freenode: Taro!
Top
jukka
Apprentice
Apprentice
Posts: 249
Joined: Thu Jun 06, 2002 8:02 pm
Location: Zurich, Switzerland

Re: Why XARGS

  • Quote

Post by jukka » Sun Jun 29, 2003 10:24 am

CRC wrote:I'm curious as to why the change was made to use xargs anyway?
'find $dir | xargs $cmd' is generally faster than 'find $dir -exec $cmd {} \;' if 'find' finds lot of files, because $cmd is executed for a set of files (vs. $cmd is executed for every single file).
CRC wrote:It seems like you are just adding yet another process into the mix needlessly when the -exec argument to find does what is required. Isn't this similar to using "cat file | command" instead of "command <file" ??
Correct. As long as execution time does not matter (what generally is the case while booting...) one should use finds -exec action. And, BTW, a common /var/lock does not contain thousands of files, so 'find | xargs' won't be much faster...
Top
quattro
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 80
Joined: Wed Jan 22, 2003 11:02 pm
Location: Olathe, Kansas

  • Quote

Post by quattro » Mon Jun 30, 2003 6:25 am

I know this is a rehash of what has already been said, but I am repeating it for my sanity's sake.

I have been researching this for a different thread and I realized that I had not run etc-update and I had a number of outstanding changes that needed to be merged; one of them was /etc/init.d/bootmisc. I made a backup of /etc to make sure I could recover if I hosed anything and I merged the xargs change to study what was going on.

As it turns out, on my system the environment will grow to about 50K at the point that particular xargs statement is run durning init. The environment drops down to only 2K once init is complete.

From what I can tell, the original code to delete stale locks worked fine, I didn't see anything in the CVS to indicate why the code was changed to use xargs. As it has already been mentioned, the simple fix is to change the line in /etc/init.d/bootmisc from:

Code: Select all

( find /var/lock -type f -print0 | xargs -0 rm -f -- 1>&2 )
to:

Code: Select all

( cd /var/lock && find . -type f -exec rm -f -- {} \; 1>&2 )
Top
quattro
Tux's lil' helper
Tux's lil' helper
User avatar
Posts: 80
Joined: Wed Jan 22, 2003 11:02 pm
Location: Olathe, Kansas

  • Quote

Post by quattro » Mon Jun 30, 2003 8:09 am

From what I understand, xargs uses the exec() system call to run the command. Linux limits the amount of space for exec() to 128K total for the environment and arguments.

What I don't understand is, my experiments show that during init, my environment was approximately 50K. xargs limits the command line to 20K. Add those two up and you get approx 70K. What happened to the other 58K? Is xargs broken? Is the system limited to only 128K for all processes? What don't I understand?
Top
Eyecannon
n00b
n00b
Posts: 26
Joined: Sat Jun 21, 2003 8:38 pm
Contact:
Contact Eyecannon
Website

  • Quote

Post by Eyecannon » Mon Jun 30, 2003 11:55 pm

geg wrote:Just found that a backup of /etc/init.d was made in /etc/init_d.old. Replace in your /etc/init.d/bootmisc

Code: Select all

( find /var/lock -type f -print0 | xargs -0 rm -f -- 1>&2 )
by

Code: Select all

( cd /var/lock && find . -type f -exec rm -f -- {} \; 1>&2 )
It worked for me. :o

Ciao
Worked great, thanks!
Top
Arkanjo
n00b
n00b
User avatar
Posts: 24
Joined: Sat May 24, 2003 9:02 pm
Location: Portugal
Contact:
Contact Arkanjo
Website

  • Quote

Post by Arkanjo » Tue Jul 22, 2003 11:39 am

worked here too
There are 10 types of people in the world; those who understand binary, and those who don't
Top
jukka
Apprentice
Apprentice
Posts: 249
Joined: Thu Jun 06, 2002 8:02 pm
Location: Zurich, Switzerland

  • Quote

Post by jukka » Tue Jul 22, 2003 1:13 pm

quattro wrote:From what I understand, xargs uses the exec() system call to run the command. Linux limits the amount of space for exec() to 128K total for the environment and arguments.

What I don't understand is, my experiments show that during init, my environment was approximately 50K. xargs limits the command line to 20K. Add those two up and you get approx 70K. What happened to the other 58K? Is xargs broken? Is the system limited to only 128K for all processes? What don't I understand?
GNU xargs first determines the max arg list length (128kB on Linux) and then subtracts 2kB (POSIX requires this). If the result is >20kB it is set to 20Kb. From this the env size is subtracted. If this result is <=0 xargs gives up complaining about "environment is too large for exec".
The Gentoo boot problem (I don't know if it still exists) was caused by this problem: the environment was >=20kB what caused xargs to fail.
For details see xargs.c from your GNU findutils source archive.

HTH, Jukka
Top
watersb
Apprentice
Apprentice
User avatar
Posts: 297
Joined: Wed Sep 04, 2002 5:10 am
Location: take a left turn in Tesuque

  • Quote

Post by watersb » Thu Jul 24, 2003 7:20 am

jukka wrote:Not to call xargs works of course, but the real problem is IMHO that the environment is about 28k during boot, at least on my box.

To get the size of the environment during boot i executed the following program from /etc/init.d/bootmisc:
...snip...
My env size was 28261...
Jukka;

That's a very nice bit of code-spelunking, thanks! :)
Top
atescha
n00b
n00b
Posts: 1
Joined: Sat Jul 26, 2003 3:57 am
Location: finland
Contact:
Contact atescha
Website

  • Quote

Post by atescha » Sat Jul 26, 2003 4:04 am

I accidently did a find instead of a cd where the fix of the error message was. Now, nothing is at it used to be :| . Something´s seems to be deleted, anyone know a fix for this, or is it reinstall?
Top
jukka
Apprentice
Apprentice
Posts: 249
Joined: Thu Jun 06, 2002 8:02 pm
Location: Zurich, Switzerland

  • Quote

Post by jukka » Tue Jul 29, 2003 6:21 pm

atescha wrote:I accidently did a find instead of a cd where the fix of the error message was. Now, nothing is at it used to be :| . Something´s seems to be deleted, anyone know a fix for this, or is it reinstall?
If I understand correctly your /etc/init.d/bootmisc contained the line

Code: Select all

( find /var/lock && find . -type f -exec rm -f -- {} \; 1>&2 )
while it was executed...
If you were lucky and /var/lock did not exist nothing was deleted. But I'm sure /var/lock did exist, i.e. you deleted all files from the current working directory while the cwd was / and you were root...

I think the fastest way to fix your problem is to reinstall the OS.

Jukka
Top
quixoticsycophant
n00b
n00b
Posts: 16
Joined: Fri Jan 10, 2003 1:44 am

  • Quote

Post by quixoticsycophant » Sat Aug 02, 2003 3:57 am

I have the most recent baselayout yet this problem still appears.

Was there a resolution? It looks to me like the -exec solution is the right thing to do, but this change hasn't been commited for some reason.

Jeff
Top
ikeaman
n00b
n00b
User avatar
Posts: 3
Joined: Sun Jul 13, 2003 9:02 pm
Location: SG, Switzerland

  • Quote

Post by ikeaman » Thu Aug 14, 2003 8:55 pm

geg wrote:

Code: Select all

( cd /var/lock && find . -type f -exec rm -f -- {} \; 1>&2 )
It worked for me. :o

Ciao
This might work. But what happens, if /var/lock can not be found for any reason? Don't ask me what the reason could be!!! Then rm will kill all files in the current directory, right?

Why not using:

Code: Select all

( find /var/lock -type f -exec rm -f -- {} \; 1>&2 )
This would make sure, that nothing happens at all if the directory does not exist for any reason.

:arrow: Btw. i haven't tried it yet.
Top
jukka
Apprentice
Apprentice
Posts: 249
Joined: Thu Jun 06, 2002 8:02 pm
Location: Zurich, Switzerland

  • Quote

Post by jukka » Fri Aug 15, 2003 10:08 am

ikeaman wrote: [...]

Code: Select all

( cd /var/lock && find . -type f -exec rm -f -- {} \; 1>&2 )
This might work. But what happens, if /var/lock can not be found for any reason? Don't ask me what the reason could be!!! Then rm will kill all files in the current directory, right?
No.
man bash wrote:The control operators && and || denote AND lists and OR lists, respectively. An AND list has the form

command1 && command2

command2 is executed if, and only if, command1 returns an exit status of zero.
If /var/lock doesn't exist, cd returns 1.
Top
andersbk
n00b
n00b
User avatar
Posts: 35
Joined: Sat Aug 16, 2003 7:06 pm

Not fixed yet.

  • Quote

Post by andersbk » Sat Aug 23, 2003 3:49 pm

I just did an emerg sync and an emerge -puD world to see what was new (I have installed 1.4rc4.)

Nothing in etc is updated...so the problem still persists.

Has this been logged to the bug database so the developer responsible can fix it?

-anders.
Top
quixoticsycophant
n00b
n00b
Posts: 16
Joined: Fri Jan 10, 2003 1:44 am

Re: Not fixed yet.

  • Quote

Post by quixoticsycophant » Sat Aug 23, 2003 4:25 pm

andersbk wrote:I just did an emerg sync and an emerge -puD world to see what was new (I have installed 1.4rc4.)

Nothing in etc is updated...so the problem still persists.

Has this been logged to the bug database so the developer responsible can fix it?

-anders.
It has already been fixed in baselayout-1.8.6.9.ebuild. See the end of http://bugs.gentoo.org/show_bug.cgi?id=21438.

You just aren't seeing it because it's masked out for whatever reason. I have it installed and the problem is gone. If you want to install it,

Code: Select all

emerge /usr/portage/sys-apps/baselayout/baselayout-1.8.6.9.ebuild
The real question is why is it still masked.
-qs
Top
andersbk
n00b
n00b
User avatar
Posts: 35
Joined: Sat Aug 16, 2003 7:06 pm

Re: Not fixed yet.

  • Quote

Post by andersbk » Sun Aug 24, 2003 7:31 pm

quixoticsycophant wrote:

Code: Select all

emerge /usr/portage/sys-apps/baselayout/baselayout-1.8.6.9.ebuild
The real question is why is it still masked.
-qs
I'm a bit dubious about emerging the whole package, as it affects all init scripts. So, I will just be hacking my "bootmisc" script until the next baselayout ebuild is released.

I also notice that there's a baselayout-1.8.6.10.ebuild.

Maybe they will skip releaseing the .9 ebuild in favor of the .10 ebuild??

/shrug

-anders.
Top
Post Reply

44 posts
  • Previous
  • 1
  • 2

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic