Active Topics

 


Reply
Thread Tools
Posts: 7 | Thanked: 34 times | Joined on Oct 2009 @ London, UK
#1
I was a little irritated this afternoon with a full rootfs, so I've knocked up a quick solution: http://pastebin.com/f1355fe1f

This is a simple script that calculates which packages are taking up the largest number of blocks in /usr on the filesystem and can relocate portions of them to /opt. It does this in a safe manner - every operation is atomic and it will verify the files are identical before the final switch. It can also undo the relocation, if needed.

The first run will take ages - leave the device on power for fifteen minutes or so while it churns through all your packages and works out which ones use up most space in /usr. Subsequent runs will use a cache, unless you start it with the --clean option.

A few caveats:
* The script does *NOT* make sure /opt is in a sensible location. Make sure it actually is referring to a different partition!
* There's no blacklisting of packages. It *WILL* be possible to damage your system with this script if you relocate something that is needed before the partition holding /opt is mounted. Only relocate packages you believe to be safe! Anything you know you've installed yourself is a good bet, or anything which is entirely GUI based. The n900's nokia-maps app is a prime candidate. 'busybox' is *NOT*, even though it will probably be detected as the largest package.
* The script has been tested and works on my Ubuntu box and my n900. There is no reason it won't work for the n8x0 on Maemo 4 or Mer.
* Technically, there's a race condition when switching files, so I suggest everyone disables multi-user logins on their tablets and makes sure there's no malicious software installed. Or in other words: It's not really a problem in this case.
* The script will only relocate normal files in /usr. Nothing from elsewhere, no directories, links, special files, etc.

Use:

Get root on your tablet.
Make sure bash is installed.
Download the script.

Code:
# bash pkgscan
Loading from cache...
Sorting...done
Ready.


Package: busybox
Files:   2
Size in /usr: 18792
Type 'arc' to archive:

Package: libqt4-core
Files:   1
Size in /usr: 9988
Currently archived in /opt
Type 'undo' to undo:
(anything other than 'arc' or 'undo' will skip that package)
__________________
--
for((P=10**8,Q=P/100,X=320*Q/(`tput cols`-1),Y=210*Q/`tput lines`,y=-105*Q,v=-2\
20*Q,x=v;y<105*Q;x=v,y+=Y));do for((;x<P;a=b=i=k=c=0,x+=X));do for((;a*a+b*b<4*\
P*P&&i++<99;a=((c=a)*a-b*b)/P+x,b=2*c*b/P+y));do :;done;(((j=(i<99?i%16:0)+30)>\
37?k=1,j-=8:0));echo -ne "\E[$k;$j"mE;done;echo -e \\E[0m;done # Charles Cooke
 

The Following 30 Users Say Thank You to ccooke For This Useful Post:
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#2
Originally Posted by ccooke View Post
I
* The script has been tested and works on my Ubuntu box and my n900. There is no reason it won't work for the n8x0 on Maemo 4 or Mer.
A few notes:

Maemo 4 does not have an ext3 partition on the built-in card so it's a no-go unless you repartition (at which point you are better off cloning the whole root).

Also, I have not analyzed your script, but be VERY careful about moving /usr/lib stuff around - that can cause serious breakage.
 

The Following User Says Thank You to attila77 For This Useful Post:
Posts: 7 | Thanked: 34 times | Joined on Oct 2009 @ London, UK
#3
Originally Posted by attila77 View Post
A few notes:

Maemo 4 does not have an ext3 partition on the built-in card so it's a no-go unless you repartition (at which point you are better off cloning the whole root).
A loopback filesystem would do the job there, of course. They're not at all difficult to work with.

Also, I have not analyzed your script, but be VERY careful about moving /usr/lib stuff around - that can cause serious breakage.
Yeah, that's why I stuck a big caveat in. It's also why the script only moves individual files: that way, you isolate the relocations to just the packages you want.
__________________
--
for((P=10**8,Q=P/100,X=320*Q/(`tput cols`-1),Y=210*Q/`tput lines`,y=-105*Q,v=-2\
20*Q,x=v;y<105*Q;x=v,y+=Y));do for((;x<P;a=b=i=k=c=0,x+=X));do for((;a*a+b*b<4*\
P*P&&i++<99;a=((c=a)*a-b*b)/P+x,b=2*c*b/P+y));do :;done;(((j=(i<99?i%16:0)+30)>\
37?k=1,j-=8:0));echo -ne "\E[$k;$j"mE;done;echo -e \\E[0m;done # Charles Cooke
 
qgil's Avatar
Posts: 3,105 | Thanked: 11,088 times | Joined on Jul 2007 @ Mountain View (CA, USA)
#4
Thanks! So... which were the applications contributing to the load of your rootfs? Please share them here.

See also http://wiki.maemo.org/Opt_Problem
 

The Following User Says Thank You to qgil For This Useful Post:
Posts: 7 | Thanked: 34 times | Joined on Oct 2009 @ London, UK
#5
Well, according to the script itself, here's what I've moved:

libqt4-core 9,988k
hildon-theme-alpha 7,668k
nokia-maps-ui 6,876k
adobe-flashplayer 6,700k
nokia-maps-core 5,316k
nokia-maps-maplets 2,608k

I'll probably move more stuff as and when I need it - for instance, microb can be moved, and that will free up another 20 meg or so counting all its packages. Really, it should be safe to relocate anything wholly gui-based - so gtk, libpurple and so on are candidates.
__________________
--
for((P=10**8,Q=P/100,X=320*Q/(`tput cols`-1),Y=210*Q/`tput lines`,y=-105*Q,v=-2\
20*Q,x=v;y<105*Q;x=v,y+=Y));do for((;x<P;a=b=i=k=c=0,x+=X));do for((;a*a+b*b<4*\
P*P&&i++<99;a=((c=a)*a-b*b)/P+x,b=2*c*b/P+y));do :;done;(((j=(i<99?i%16:0)+30)>\
37?k=1,j-=8:0));echo -ne "\E[$k;$j"mE;done;echo -e \\E[0m;done # Charles Cooke
 
Posts: 3,319 | Thanked: 5,610 times | Joined on Aug 2008 @ Finland
#6
Don't forget the eMMC is slower and also the device you swap to. From what I understand that's why originally Nokians did not optify qt and libs in general.
 

The Following User Says Thank You to attila77 For This Useful Post:
Posts: 7 | Thanked: 34 times | Joined on Oct 2009 @ London, UK
#7
Yeah. But I'm happy with that as a temporary solution. It's improtant to remember that the right answer is to get packages optified properly.
__________________
--
for((P=10**8,Q=P/100,X=320*Q/(`tput cols`-1),Y=210*Q/`tput lines`,y=-105*Q,v=-2\
20*Q,x=v;y<105*Q;x=v,y+=Y));do for((;x<P;a=b=i=k=c=0,x+=X));do for((;a*a+b*b<4*\
P*P&&i++<99;a=((c=a)*a-b*b)/P+x,b=2*c*b/P+y));do :;done;(((j=(i<99?i%16:0)+30)>\
37?k=1,j-=8:0));echo -ne "\E[$k;$j"mE;done;echo -e \\E[0m;done # Charles Cooke
 

The Following User Says Thank You to ccooke For This Useful Post:
qgil's Avatar
Posts: 3,105 | Thanked: 11,088 times | Joined on Jul 2007 @ Mountain View (CA, USA)
#8
ccooke, this is an (interesting) list of pre-installed packages but what I was asking was the apps you have downloaded getting your rootfs full.

You won't believe it but I'm asking this question to anybody here that gets in this situation and still nobody has given names of apps to follow and fix. It would be appreciated.
 
Johnx's Avatar
Posts: 643 | Thanked: 628 times | Joined on Mar 2007 @ Seattle (or thereabouts)
#9
@qgil: Working on the list. Will update as it goes along. Repos enabled: extras-testing and extras-devel.
Package: libwebkit-1.0-1
Files: 3
Size in /usr: 23104 blocks
Type 'arc' to archive: arc
(lots of microb/busybox)
Package: python2.5
Files: 3
Size in /usr: 10456 blocks
Type 'arc' to archive: arc

Package: libas-storage-0
Files: 1
Size in /usr: 5292 blocks
Type 'arc' to archive:

Package: libpurple0
Files: 2
Size in /usr: 4792 blocks
Type 'arc' to archive:

Package: canola2
Files: 2
Size in /usr: 1924 blocks
Type 'arc' to archive: arc

Package: fbreader
Files: 2
Size in /usr: 1640 blocks
Type 'arc' to archive: arc

Package: openssh-client
Files: 2
Size in /usr: 1104 blocks
Type 'arc' to archive:

Last edited by Johnx; 2009-10-25 at 21:24.
 

The Following User Says Thank You to Johnx For This Useful Post:
Posts: 2,802 | Thanked: 4,491 times | Joined on Nov 2007
#10
Going from memory, fennec/xulrunner were particularly bad, but they're long gone now. From the stuff that's still installed, the worst are (omitting smaller files for brevity) mplayer:

Code:
-rwxr-xr-x    1 root     root      8514264 Sep 17 22:43 /usr/bin/mencoder
-rwxr-xr-x    1 root     root      8683832 Sep 17 22:43 /usr/bin/mplayer
pc-connectivity-manager:

Code:
-rw-r--r--    1 root     root      4866193 Oct 20 21:04 /usr/share/maemo-pc-connectivity/manual.pdf
and bluemaemo:
Code:
-rwxr-xr-x    1 root     root      2018258 Aug 24 16:09 /usr/share/bluemaemo/themes/bluemaemo.edj
BTW, this command:
Code:
dpkg-query -W -f='${Installed-Size}\t${Package}\n' '*' | sort -n | tail -50
can be used to show the top 50 space hogs.
 

The Following 11 Users Say Thank You to lma For This Useful Post:
Reply

Tags
n800, n810, n900, optification, optifying, rootfs


 
Forum Jump


All times are GMT. The time now is 02:18.