maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   rootfs full? Here's a temporary solution until more packages are optified (https://talk.maemo.org/showthread.php?t=33429)

ccooke 2009-10-24 21:09

rootfs full? Here's a temporary solution until more packages are optified
 
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)

attila77 2009-10-24 21:46

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by ccooke (Post 357407)
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.

ccooke 2009-10-24 21:57

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by attila77 (Post 357435)
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.

Quote:

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.

qgil 2009-10-25 07:03

Re: rootfs full? Here's a temporary solution until more packages are optified
 
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

ccooke 2009-10-25 09:52

Re: rootfs full? Here's a temporary solution until more packages are optified
 
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.

attila77 2009-10-25 10:25

Re: rootfs full? Here's a temporary solution until more packages are optified
 
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.

ccooke 2009-10-25 10:28

Re: rootfs full? Here's a temporary solution until more packages are optified
 
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.

qgil 2009-10-25 17:29

Re: rootfs full? Here's a temporary solution until more packages are optified
 
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 2009-10-25 21:05

Re: rootfs full? Here's a temporary solution until more packages are optified
 
@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:

lma 2009-10-25 21:08

Re: rootfs full? Here's a temporary solution until more packages are optified
 
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.

Nathan 2009-10-25 21:25

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Code:

dpkg-query -W -f='${Installed-Size}\t${Package}\n' '*' | sort -n | tail -50
can be used to show the top 50 space hogs.
Won't this just show the largest packages. But won't show if any of them are optified. For instance if you install libicu42 it is over 20 megs of libraries; but since the library is optified the amount of space in usr/lib is just the symlinks.

Nathan.

lma 2009-10-25 23:03

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by Nathan (Post 357859)
Won't this just show the largest packages. But won't show if any of them are optified.

Yes, it's just a quick way of looking for good candidates for further checking with something like this.

While on the subject, can we have exceptions for the openssh packages (and/or the dropbear equivalents)? They could come in handy for recovering from a broken /home partition so I would prefer to have them in the root filesystem (if that's also broken then it's probably time to reflash anyway).

qgil 2009-10-26 03:30

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Thanks a lot! Please keep these names of fat apps coming. Knowing about specific apps makes it easy to rationalize potential sensible exceptions. For instance, it is clear the difference between a user after openssh or a user after Fennec.

j.s 2009-10-26 04:11

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by attila77 (Post 357655)
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.

Once a few qt based apps have started up, won't the
qt libs be cached in RAM and performance just as fast
as if the libs were stored in nand?

buurmas 2009-10-26 04:29

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by attila77 (Post 357435)
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).

Should this thread be moved from General to N900 then?

linuxeventually 2009-10-26 04:31

Re: rootfs full? Here's a temporary solution until more packages are optified
 
I must have missed the memo.

a) From a developer perspective how are packages "optified"?

For example do you mean - instead of
$ configure --prefix=/usr --host arm
use
$ configure --prefix=/opt --host arm
???

b) From a [power] user perspective is there a more permanent way (a dpkg flag or such) to get packages to install into an alternative location rather than using this script to copy the contents of /usr to /opt (which I assume to be the desired behaviour)

c) What is the current partition structure of the N900 (and highlighting of the problem area would be appreciated)

Nathan 2009-10-26 04:35

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by linuxeventually (Post 358001)
I must have missed the memo.

a) From a developer perspective how are packages "optified"?

The easist method is to use maemo-optify as the step before the dh_mdgenerate in the rules.


Quote:

c) What is the current partition structure of the N900 (and highlighting of the problem area would be appreciated)
Wiki Link: http://wiki.maemo.org/Opt_Problem

Nathan

Bundyo 2009-10-26 05:57

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by Johnx (Post 357852)
Package: libwebkit-1.0-1
Files: 3
Size in /usr: 23104 blocks

And what exactly does this mean? Since this is the content of the Fremantle libwebkit package:

http://www.bundyo.com/things/libwebkit_contents.txt

It is optified from the day 1 it was posted there.

lma 2009-10-26 08:42

Re: rootfs full? Here's a temporary solution until more packages are optified
 
I can confirm that:
Code:

Nokia-N900-41-10:~# ./checkroot.sh libwebkit-1.0-1
4        /usr/share/webkit-1.0/webinspector/Breakpoint.js
4        /usr/share/webkit-1.0/webinspector/Images/dockButtons.png
4        /usr/share/webkit-1.0/webinspector/Images/domStorage.png
4        /usr/share/webkit-1.0/webinspector/Images/largerResourcesButtons.png
4        /usr/share/webkit-1.0/webinspector/Images/profileSmallIcon.png
4        /usr/share/webkit-1.0/webinspector/Images/resourceCSSIcon.png
4        /usr/share/webkit-1.0/webinspector/Images/resourceDocumentIconSmall.png
4        /usr/share/webkit-1.0/webinspector/Images/resourceJSIcon.png
4        /usr/share/webkit-1.0/webinspector/Images/resourcePlainIconSmall.png
4        /usr/share/webkit-1.0/webinspector/Images/splitviewDimple.png
4        /usr/share/webkit-1.0/webinspector/Images/splitviewDividerBackground.png
4        /usr/share/webkit-1.0/webinspector/Images/tipIcon.png
4        /usr/share/webkit-1.0/webinspector/Images/tipIconPressed.png
4        /usr/share/webkit-1.0/webinspector/Images/userInputIcon.png
4        /usr/share/webkit-1.0/webinspector/Images/userInputPreviousIcon.png
4        /usr/share/webkit-1.0/webinspector/Script.js
64        total


ccooke 2009-10-26 11:13

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Hmm. I'd guess from that that the script is following the symlinks into /opt. That's easily fixed - I'll post an update this evening, when I'm back from work.

twaelti 2009-12-14 11:04

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Did this thread fizzle out into nothing? Did ccooke ever come back from work? :-)

(My understanding of /opt according to Linux Filesystem Hierarchy: nothing to discuss, all apps should have gone into /opt from the beginning, we should never even have started to put things in rootfs... bad habit from older Maemo?)

mankir 2009-12-14 17:59

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Is it possible to use parts of the script at installation of packages? so that debian-packages could be installed on the 2gb-partition and symlinks automatically created on the 256mb-partition during installation? i think symlinks are the only solution for the problem with the small root-partition, without changing logical structure of the system (remove files for booting from /usr and move/symlink /usr to 2gb-partition) or bootloader configuration (to boot from 2gb-partition).

mankir 2009-12-15 22:46

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Have a look at: Repartition the internal drive

DrWilken 2009-12-25 20:32

Re: rootfs full? Here's a temporary solution until more packages are optified
 
subversion in -devel isn't optified...

debernardis 2009-12-27 09:00

Re: rootfs full? Here's a temporary solution until more packages are optified
 
While in the process of moving some packages with the script, I'm wondering what is going to happen when one of them is to be updated by the application manager (or apt-get).

It is going to install its new files in their pristine position, on the root filesystem, overwriting the links, and leaving parts of the old packages on /opt? Shall it get me into trouble? What am I going to do with those remnants on /opt?

Or I better undo optification of packages before I update the packages?

Thanks for your responses.

soramimi 2009-12-27 09:44

Re: rootfs full? Here's a temporary solution until more packages are optified
 
on my N900

:command not found
:command not found
'kgscan : line 9:syntax error near unexpected token `{
'kgscan : line 9: `{

DrWilken 2009-12-27 10:03

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by debernardis (Post 442770)
While in the process of moving some packages with the script, I'm wondering what is going to happen when one of them is to be updated by the application manager (or apt-get).

It is going to install its new files in their pristine position, on the root filesystem, overwriting the links, and leaving parts of the old packages on /opt? Shall it get me into trouble? What am I going to do with those remnants on /opt?

Or I better undo optification of packages before I update the packages?

Thanks for your responses.

I've been thinking about the same thing. If the updated package still isn't optified it will overwrite the links I believe. If it is optified it won't be a problem AFAIK. That would create links to the new files (in /opt) overwriting the old links AND files.

DrWilken 2009-12-27 10:18

Re: rootfs full? Here's a temporary solution until more packages are optified
 
1 Attachment(s)
Quote:

Originally Posted by soramimi (Post 442784)
on my N900

:command not found
:command not found
'kgscan : line 9:syntax error near unexpected token `{
'kgscan : line 9: `{

First of all shouldn't the name of the script have been pkgscan...? :)

When i downloaded the script by using the download function on pastebin the file had WinBlows newlines (^M) in it, so first I tried a search and replace in vi but that didn't work (%s/^M//g), so I ended up copy/pasting from the site instead.

I've attached the script. unpack with tar -xf pkgscan.sh.tar... The script is called pkgscan.sh because it's a shell script.

Saturn 2009-12-27 11:10

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by debernardis (Post 442770)
While in the process of moving some packages with the script, I'm wondering what is going to happen when one of them is to be updated by the application manager (or apt-get).

It is going to install its new files in their pristine position, on the root filesystem, overwriting the links, and leaving parts of the old packages on /opt? Shall it get me into trouble? What am I going to do with those remnants on /opt?

Or I better undo optification of packages before I update the packages?

Thanks for your responses.

Hi, I've seen too that an update or uninstall only updates the symlinks and leaves all files in /opt/relocated/.

In order to keep things clean I've done an "undo", then apt-get --purge remove of all the applications originally relocated, then apt-get autoremove (since there were some remanents) and re-installed those apps.

IMHO, people not really familiar with gnu/linux should stay away from this script for many reasons already mentioned plus that if one relocates an app already optified the "undo" will un-optify it. That is, the undo function is not a real undo.

Hope it helps.

debernardis 2009-12-27 15:30

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by DrWilken (Post 442804)
When i downloaded the script by using the download function on pastebin the file had WinBlows newlines (^M) in it....

Yes that's the problem. I changed from CR/LF newlines to LF only newlines in Scite, from easy debian.

soramimi 2009-12-28 13:02

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Thanks , I used pkgscan.sh.tar

It works good.

arkanoid 2009-12-30 05:26

Re: rootfs full? Here's a temporary solution until more packages are optified
 
If there is an upgrade available for any of the packages i "archived", do i need to "de-optify" (undo) before applying it?

debernardis 2009-12-30 05:34

Re: rootfs full? Here's a temporary solution until more packages are optified
 
See post #27 :)

arkanoid 2009-12-30 07:55

Re: rootfs full? Here's a temporary solution until more packages are optified
 
BTW after next reboot mc and dosbox icons (i "optified" both) were replaced with blue squares. It happens to desktop shortcuts only, icons the launcher are intact.

arkanoid 2009-12-30 08:31

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Is it save to archive huge libqt4-gui?

DrWilken 2009-12-30 08:56

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by arkanoid (Post 446345)
Is it save to archive huge libqt4-gui?

Personally I would *ONLY* archive apps I installed myself (I've archived subversion), but that's just me... ;)

Remember that this is a workaround. I'm sure Nokia/Maemo Community comes up with a solution to the "opt problem" (other than to *manually* optify packages before submitting them to the repositories - I'm thinking automatic opt checks when submitting a package to -devel/-testing) sooner or later... :D

Another thing; Before a firmware upgrade I would also undo whatever I have archived (just to be on the safe side)... You never know what that firmware might bring us... :)

Saturn 2009-12-30 12:20

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by DrWilken (Post 442793)
I've been thinking about the same thing. If the updated package still isn't optified it will overwrite the links I believe. If it is optified it won't be a problem AFAIK. That would create links to the new files (in /opt) overwriting the old links AND files.

Hi, I've missed this earlier post.

From what I see the above post describes how it should work but actually it works a little diferently.

If the updated application isn't optified it will overwrite the links and you'll end up with unessacery files leftover in /opt/relocated/.
The same will also happen if the updated application is optified too. It will not overwrite the old files simply because they are in a different folder from what the correct optification uses.

Basically, all the heavy-lifting in the script has been done but it is not complete so you should be carefull and willing to reflash if you decide to use it.

Hope it helps.

DrWilken 2009-12-30 12:36

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by Saturn (Post 446524)
It will not overwrite the old files simply because they are in a different folder from what the correct optification uses.

Makes sense... ;) So maybe the script should be edited to "archive" using the correct paths?

Quote:

Originally Posted by Saturn (Post 446524)
Basically, all the heavy-lifting in the script has been done but it is not complete so you should be carefull and willing to reflash if you decide to use it.

Or just undo before any update of a package You KNOW has been archived using the script...

Saturn 2009-12-30 13:33

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by DrWilken (Post 446538)
Makes sense... ;) So maybe the script should be edited to "archive" using the correct paths?

Maybe not, because it is simpler to find later which stuff have been moved by the script and undo them. The script looks in the /opt/relocated folder to provide the undo functionality.

Quote:

Originally Posted by DrWilken (Post 446538)
Or just undo before any update of a package You KNOW has been archived using the script...

Yes, at least that's what I did. Nevertheless, as it was mentioned in an earlier post, the undo of the script is not a real undo. Thus, IMHO the script should be used only for applications/libraries that can be re-installed easily from extras* repos.

Saturn 2009-12-30 13:47

Re: rootfs full? Here's a temporary solution until more packages are optified
 
Quote:

Originally Posted by arkanoid (Post 446324)
BTW after next reboot mc and dosbox icons (i "optified" both) were replaced with blue squares. It happens to desktop shortcuts only, icons the launcher are intact.

Yes, that's one of the side-effects of the script.
One more related is that the relocated applications don't appear any more in the list to add them as a sortcut in the desktop.

Haven't understood yet the reason but it might be related on the bootup sequence. That is, the /opt might be mounted after this info is being cached.


All times are GMT. The time now is 08:03.

vBulletin® Version 3.8.8