Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Wed 17 Oct 2018, 12:21
All times are UTC - 4
 Forum index » Off-Topic Area » Programming
How do you get rid of orphaned libraries?
Post new topic   Reply to topic View previous topic :: View next topic
Page 4 of 4 [56 Posts]   Goto page: Previous 1, 2, 3, 4
Author Message
technosaurus


Joined: 18 May 2008
Posts: 4841
Location: Blue Springs, MO

PostPosted: Mon 29 Aug 2016, 23:16    Post subject:  

TeX Dog wrote:
...
It was also used for the ordering of laying out files in the filesystem, when seek time was poor and that mattered. Knoppix was the last live distro to use such a idea, that is why a DVD sized anti-puppy colossus loads so quickly. Wish he will share HIS build system.

log all file accesses with lsof during startup, then add them to the squashfs in that order

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
technosaurus


Joined: 18 May 2008
Posts: 4841
Location: Blue Springs, MO

PostPosted: Tue 30 Aug 2016, 10:44    Post subject:  

If you want to find orphaned library dependencies for all binaries in your path (excluding those needed by dynamically loaded modules/plugins that are normally outside of PATH) you can use this little script that require objdump (it only lists direct dependencies, not everything that happened to be linked whether it was needed or not):
Code:
for x in ${PATH//://* }/* ; do [ -x "$x" ] && objdump -x $x 2>/dev/null & done|grep NEEDED|sort |uniq -c |sort -n >binaudit.txt


for each of the libraries in the list you'd want to get their dependencies also - repeat until no new dependencies are found (may take a while)

Then just iterate over all of the libraries in the library path and {re}move them if you can't grep them out of the audit file

I wrote that script a long time ago, these days I would use IFS=: instead of the ${PATH//://* } bashism ... which now that I look at it should have 2 for loops - 1 for each path in PATH and another for each binary in path/*
... I don't have a way to test it right now, so I hope this is enough for someone else to figure it out - if you try and get stuck, just post what you have and I'll help debug

_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
rufwoof

Joined: 24 Feb 2014
Posts: 2598

PostPosted: Tue 30 Aug 2016, 13:02    Post subject:  

You're likely the man to know technosaurus. Debian have utilities to remove unused libs (apt-get autoremove), and a script to run through and validate each file (crc type check so can pin down a possible virus for instance). But sadly I've not found a script/method to validate file permissions, to reset all system files back to correct permissions in the event of doing something silly like a recursive permissions change action (yep ... that's what I did). I ended up redoing from scratch ... newly install and all of the changes/updates ....etc.

Perhaps a new install should have a record made of all the system file permissions at the time kept back as a reference so at least a recursive change could be created to reset at least those files. Combined with adding to that record set when files were added/replaced.

???
Back to top
View user's profile Send private message 
amigo

Joined: 02 Apr 2007
Posts: 2641

PostPosted: Tue 30 Aug 2016, 13:16    Post subject:  

That info should be contained in the packages.
Back to top
View user's profile Send private message 
rufwoof

Joined: 24 Feb 2014
Posts: 2598

PostPosted: Tue 30 Aug 2016, 13:24    Post subject:  

technosaurus wrote:
TeX Dog wrote:
...
It was also used for the ordering of laying out files in the filesystem, when seek time was poor and that mattered. Knoppix was the last live distro to use such a idea, that is why a DVD sized anti-puppy colossus loads so quickly. Wish he will share HIS build system.

log all file accesses with lsof during startup, then add them to the squashfs in that order

Just discovered strace

strace -f -e trace=open -o process.trace <command to start process>

that will list what was opened by a run of a command. So if you know what files/programs are being run and in what order you could deduce the associated files. But technosaurus' lsof is probably better/easier.
Back to top
View user's profile Send private message 
TeX Dog

Joined: 06 Jul 2016
Posts: 341

PostPosted: Sat 03 Sep 2016, 03:35    Post subject:  

lsof that must have been the tool used. Not sure how it was evoked but I recall it was instigated so early in the boot process that the resulting tar tape at the end of process could be untarred on a fresh harddrive and get a working linux (unix) install. It was tared feeding the sorted access times file list.
The process worked well, and would work well to solve your issue, if the end result was a remaster 'thin' version of what you normally used puppy for.
Its a small dumb approach really, since there is no real value to id what to prune 'before' a real build. However its a REAL fix to remove unneeded bloat, secondly the speed to re-add missing libs never caused any problems in the real world. So I think it would be beneficial to rediscover method.
Since the construction of test cases is a big effort, not like we ever had a puppy QA team anyway (Like how would I know... my post count is SO low Wink ). There maybe a project idea send in your file access logs and trust us its used for auto trimming a thinner puppy for all, maybe the ten or so active people left here really does not use 2/3rd of whats included anyway.
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12805
Location: Gatineau (Qc), Canada

PostPosted: Sat 03 Sep 2016, 15:50    Post subject:  

rufwoof wrote:
(...) But sadly I've not found a script/method to validate file permissions, to reset all system files back to correct permissions in the event of doing something silly like a recursive permissions change action (yep ... that's what I did). I ended up redoing from scratch ... newly install and all of the changes/updates ....etc.

Perhaps a new install should have a record made of all the system file permissions at the time kept back as a reference so at least a recursive change could be created to reset at least those files. Combined with adding to that record set when files were added/replaced.

???
Hi rufwoof.

I don't know about the other items in your question, but about the
permissions -- Can you not use something like:
Code:
cd /usr/bin
chmod -R -x *
for each main directory, to correct the situation?

I say "for each main directory" because I know from experience that your
Puppy will freeze badly if you try to do that from "/" (the absolute top of
your directory hierarchy). Tentative explanation: chmod doesn't like
changing the permission for itself, goes beserk and halts everything?
Twisted Evil

It's none of my business to recommend that you do anything, but:
it never hurts to do frequent backups of your pupsave file, and in this
particular case, just before you do this kind of major operation! Wink

IHTH.

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)
Back to top
View user's profile Send private message 
technosaurus


Joined: 18 May 2008
Posts: 4841
Location: Blue Springs, MO

PostPosted: Sat 03 Sep 2016, 19:39    Post subject:  

musher0 wrote:
I don't know about the other items in your question, but about the
permissions -- Can you not use something like:
Code:
cd /usr/bin
chmod -R -x *
for each main directory, to correct the situation?

I say "for each main directory" because I know from experience that your
Puppy will freeze badly if you try to do that from "/" (the absolute top of
your directory hierarchy). Tentative explanation: chmod doesn't like
changing the permission for itself, goes beserk and halts everything?
Twisted Evil

It's none of my business to recommend that you do anything, but:
it never hurts to do frequent backups of your pupsave file, and in this
particular case, just before you do this kind of major operation! Wink
The worst part about it was that this likely caused them all to be copied into his save file/partition. It may be better to iterate over the mounted sfs in /initrd/pup_ro* (or wherever it is?) and just remove the files from the save file/partition directly (not wrt '/' but /initrd/pup_rw) ... possibly omitting some directories where things were intentionally changed like /root (which should not be populated at all BTW - everything there is wrong and likely belongs in /etc somewhere)
_________________
Check out my github repositories. I may eventually get around to updating my blogspot.
Back to top
View user's profile Send private message Visit poster's website 
johnywhy


Joined: 20 Aug 2011
Posts: 872

PostPosted: Fri 02 Mar 2018, 18:29    Post subject:  

any solution on this topic? would be awesome.

thx

_________________
Now: X-Tahr 2.0! StretchDog! DevuanDog!
Tops: TarhNOP Vlina-R2 Racy
Used: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
i ♥ Puppy
Back to top
View user's profile Send private message 
musher0

Joined: 04 Jan 2009
Posts: 12805
Location: Gatineau (Qc), Canada

PostPosted: Fri 02 Mar 2018, 21:16    Post subject:  

Hello johnywhy.

Yeah, it would be awesome.

If you have read the entire thread, you have seen that there are quite a few partial
solutions, shared by people who have a great logical mind and great imagination.

What we need is a similarly bright developer to put these partials in order so we can
come up with a reliable "whole entity". (*)

Would that be you, by any chance? Very Happy

BFN.

~~~~~~~~~~~~~

* (Please forgive the sort of philosophical wording. Words for a clear description
of this process are hard to come by. Probably the human mind finds detecting stuff
in reverse more difficult, less natural.)

_________________
musher0
~~~~~~~~~~
Fidèle elle commença, ainsi elle restera. (Prov. canadien) /
Faithful she began, so will she stay. (Canadian prov.)
Back to top
View user's profile Send private message 
johnywhy


Joined: 20 Aug 2011
Posts: 872

PostPosted: Fri 02 Mar 2018, 22:32    Post subject:  

musher0 wrote:
we need is a similarly bright developer to put these partials in order so we can come up with a reliable "whole entity". (*) Would that be you, by any chance? Very Happy


i wish Smile

_________________
Now: X-Tahr 2.0! StretchDog! DevuanDog!
Tops: TarhNOP Vlina-R2 Racy
Used: Puppeee Precise Lucid Wary Tahrpup Quirky Slacko MacPup Saluki Puppy Studio LxPupTarh Lina-Lite Lina
i ♥ Puppy
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 4 of 4 [56 Posts]   Goto page: Previous 1, 2, 3, 4
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » Off-Topic Area » Programming
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.1350s ][ Queries: 12 (0.0149s) ][ GZIP on ]