maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Maemo 5 / Fremantle (https://talk.maemo.org/forumdisplay.php?f=40)
-   -   miroroot.sh a script to clear rootfs has ruined my phone !! :( (https://talk.maemo.org/showthread.php?t=87383)

Ammar Hamdan 2012-10-13 09:16

miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
1 Attachment(s)
I found this ((((sh)))) script on a website, has codded to clear rootfs, but after using it ... I've noticed some widgets were disappeared .. and there are many bugs !!!

ps: this script made a folder called miroroot in this directory & contains two folders (var,usr) :

home/user/miroroot/


so what should I do to solve this problem :confused: :( :confused: :(

Dragoss91 2012-10-13 09:43

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
So what's the problem ?

1. That script deleted some system files ?
or
2. That script didn't delete all system files ?

Ammar Hamdan 2012-10-13 10:07

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
actually I think the script has deleted some unimportant system files & moved large files to this directory :

Code:

home/user/miroroot/

reinob 2012-10-13 13:52

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
@Ammar Hamdan,

You can either undo what the script has done (can be hard, but it is doable) OR completely reflash.

In view of your willingness to execute some script you found somewhere, I'd recommend the latter.

sifo 2012-10-13 16:03

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
1 Attachment(s)
This script edited by Amr.fayz you can find him here in Meecolay thread, anyway this is his script :
Code:

#!/bin/sh
# Miroroot script to safely free space on rootfs
# by Amr.fayz

if test "`id -u`" -ne 0; then
    echo "Error: This script must be run as root!"
    echo "Please make sure that the package rootsh from extras is installed"
    echo "and execute \"sudo gainroot\" and then \"$0\" in Terminal"
    exit 1
fi

echo rootfs before:
df -h /
chmod +x /home/Miroroot
chmod 775 /home/Miroroot
# move root stuff to /home/Miroroot
dirs="usr/share/icons usr/share/nokia-maps usr/share/fonts usr/share/locale usr/share/microb-engine usr/share/tutorial-applet usr/share/cherry usr/local/lib /usr/include usr/lib/locale usr/lib/microb-engine usr/lib/skyhost /usr/lib/browser/plugins usr/lib/pyshared/python2.5 usr/lib/python2.5/site-packages usr/lib/qt4/imports usr/lib/qt4/plugins usr/lib/debug/usr var/lib/dpkg var/lib/apt"
#optional: usr/share/themes  var/lib/dpkg
if test -d /home/var/cache/apt; then
  # keep existing apt cache
  rm -rf /var/cache/apt
  ln -s /home/var/cache/apt /var/cache/apt
else
  dirs="$dirs var/cache/apt"
fi
(cd / && du -sc $dirs)
for d in $dirs; do
    test -L /$d && continue
    echo moving /$d
    rm -rf /home/Miroroot/$d
    mkdir -p /home/Miroroot/$d
    cp -a /$d /home/Miroroot/$d/..
    mv /$d /$d.old
    ln -s /home/Miroroot/$d /$d
    rm -rf /$d.old
done
sync
echo "success"
echo "rootfs after (after a reboot the actual free space will be shown):"
df -h /

And here is the original copy of the script and i safely used it before (copyrights belongs to Thomas Tanner )
Code:

#!/bin/sh
# N900 script to safely free space on rootfs
# (c) 2010 by Thomas Tanner <maemo@tannerlab.com>
# licensed under GPLv3
# version 0.5 (16. May 2010)

if test "`id -u`" -ne 0; then
    echo "Error: This script must be run as root!"
    echo "Please make sure that the package rootsh from extras is installed"
    echo "and execute \"sudo gainroot\" and then \"$0\" in Terminal"
    exit 1
fi

echo rootfs before:
df -h /
# move root stuff to /home
dirs="usr/share/icons usr/share/nokia-maps usr/share/fonts usr/share/locale usr/lib/locale var/lib/apt"
#optional: usr/share/themes  var/lib/dpkg
if test -d /home/var/cache/apt; then
  # keep existing apt cache
  rm -rf /var/cache/apt
  ln -s /home/var/cache/apt /var/cache/apt
else
  dirs="$dirs var/cache/apt"
fi
(cd / && du -sc $dirs)
for d in $dirs; do
    test -L /$d && continue
    echo moving /$d
    rm -rf /home/$d
    mkdir -p /home/$d
    cp -a /$d /home/$d/..
    mv /$d /$d.old
    ln -s /home/$d /$d
    rm -rf /$d.old
done
sync
echo "success"
echo "rootfs after (after a reboot the actual free space will be shown):"
df -h /
#!/bin/sh
# N900 script to safely free space on rootfs
# (c) 2010 by Thomas Tanner <maemo@tannerlab.com>
# licensed under GPLv3
# version 0.5 (16. May 2010)

if test "`id -u`" -ne 0; then
    echo "Error: This script must be run as root!"
    echo "Please make sure that the package rootsh from extras is installed"
    echo "and execute \"sudo gainroot\" and then \"$0\" in Terminal"
    exit 1
fi

echo rootfs before:
df -h /
# move root stuff to /home
dirs="usr/share/icons usr/share/nokia-maps usr/share/fonts usr/share/locale usr/lib/locale var/lib/apt"
#optional: usr/share/themes  var/lib/dpkg
if test -d /home/var/cache/apt; then
  # keep existing apt cache
  rm -rf /var/cache/apt
  ln -s /home/var/cache/apt /var/cache/apt
else
  dirs="$dirs var/cache/apt"
fi
(cd / && du -sc $dirs)
for d in $dirs; do
    test -L /$d && continue
    echo moving /$d
    rm -rf /home/$d
    mkdir -p /home/$d
    cp -a /$d /home/$d/..
    mv /$d /$d.old
    ln -s /home/$d /$d
    rm -rf /$d.old
done
sync
echo "success"
echo "rootfs after (after a reboot the actual free space will be shown):"
df -h /

?

./sifo

reinob 2012-10-13 16:55

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
Quote:

Originally Posted by sifo (Post 1280098)
This script edited by Amr.fayz you can find him here in Meecolay thread, anyway this is his script :

The first script (the one by Amr.fayz) moves and symlinks a lot of directories that are not handled in the original script. That may be the cause of the problem.

Plus, the "Miroroot" folder is not created at the beginning of the script but the first time mkdir -p is used.

Nevertheless, the script does chmod +x and chmod 755 (which in itself makes me seriously doubt of the skills of this Amr.fayz) on that folder, before it is even created.

Don't want to blame anybody without being 100% but looking at the script my first thought would be "HANDS OFF", and *I* can read and write shell scripts and know my way around Unix. An inexperienced user should think "HANDS OFF" before even looking at the script.

Obviously the damage is reversible. By definition. But at least *I* will not do the hard work of reversing that. So either the original author of the script (Amr.fayz) comes to the rescue, or the OP does a complete reflash.

Ammar Hamdan 2012-10-15 15:04

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
thank u all 4 replies ... I doubt the author is alive to come to rescue :D ... I think he knew his script has bugs & cant find a solution or he's working on a solution to fix the bugs & need some time ... so there is no way except flashing my phone :(

J4ZZ 2012-10-16 06:59

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
I would sort everything via WinSCP.
Delete created symlinks and move all folders from home/user/miroroot/ (if it's actually present) back to /
Like reinob said the original script uses /home/ as destination (which is a system folder and already present) but the customized script wants to put everything into home/user/miroroot/ but forgot to create this folder.


;)

Ammar Hamdan 2012-10-16 12:35

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
@J4ZZ

I have a noob question :D :

how to delete created symlinks ??

pichlo 2012-10-17 11:56

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
Quote:

Originally Posted by Ammar Hamdan (Post 1281209)
how to delete created symlinks ??

Symlinks are just like ordinary files, you delete them with rm.

For example, your script did (amongst others)(expanded and simplified from parsing the script):

Code:

mv /usr/share/icons /home/Miroroot/usr/share/icons
ln -s /home/Miroroot/usr/share/icons /usr/share/icons

What that did was move usr/share/icons from root to /home/Miroroot and then replacing the original with a symlink to the new location. To reverse the change, you need to remove the symlink first and then move the folder back to the original location, like this:

Code:

rm /usr/share/icons
mv /home/Miroroot/usr/share/icons /usr/share/icons

Doing it for the rest of the moved folders is left as an exercise :)

Do not be tempted to use rm -r though. That will delete not just the symlink but also recursively all the files and folders the symlink points to, thus screwing up your phone irreversibly with a reflash the only way back.

Before embaring on any of this, I strongly suggest to check the folders actually exist under /home/Miroroot. Both J4ZZ and reinob have already warned you about that.

Ammar Hamdan 2012-10-18 15:02

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
@pichlo
thx 4 ur advice :) .. but I already flashed my phone :(

anyway everything is O.K .. but after installing some apps .... media player app & media player widget were disappeared !!

PLZ HEEEEEEEEELP !!!

:( :confused: :( :confused: :(

anthonie 2012-10-18 18:16

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
Start with a list of apps you installed after flashing your phone, as without it, there is no way of knowing what could possibly have gone wrong.

J4ZZ 2012-10-19 09:12

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
Quote:

Originally Posted by Ammar Hamdan (Post 1282156)
@pichlo
thx 4 ur advice :) .. but I already flashed my phone :(

anyway everything is O.K .. but after installing some apps .... media player app & media player widget were disappeared !!

PLZ HEEEEEEEEELP !!!

:( :confused: :( :confused: :(

Have you tried (in terminal)

Code:

sudo gainroot
apt-get install --reinstall mediaplayer mediaplayerhomeapplet

Regards,

J4ZZ

amr.fayz 2013-04-22 14:41

Miroroot script to safely free space on rootfs
 
1 Attachment(s)
Hi,

Miroroot is script to safely free space on rootfs To solve the problem of Low space

SHARP66 2013-04-22 15:11

Re: Miroroot script to safely free space on rootfs
 
why do not write more explicationes for noobs like me, or should I download and find out myself what will happen after running this script.
anyway thanks.

amr.fayz 2013-04-22 15:26

Re: Miroroot script to safely free space on rootfs
 
Quote:

Originally Posted by SHARP66 (Post 1337947)
why do not write more explicationes for noobs like me, or should I download and find out myself what will happen after running this script.
anyway thanks.


ok

Download script and put it on MyDocs

and run


HTML Code:

sh /home/user/MyDocs/miroroot.sh


the script will be given the space of rootfs before and In the end will be given the new space of rootfs Compare them :)

pichlo 2013-04-22 16:27

Re: Miroroot script to safely free space on rootfs
 
I've never used Miroroot but in view of this thread, I'd be very careful with it.

amr.fayz 2013-04-22 16:44

Re: Miroroot script to safely free space on rootfs
 
Quote:

Originally Posted by pichlo (Post 1337979)
I've never used Miroroot but in view of this thread, I'd be very careful with it.



thanks it is the first time I see this topic but Anyway It's a new version without any problems


The idea simply Transfer some files from root to opt In a file named miroroot SO If there is a problem Only Transfer files to its previous ther is No damage at all

reinob 2013-04-22 18:43

Re: Miroroot script to safely free space on rootfs
 
Quote:

Originally Posted by amr.fayz (Post 1337942)
Hi,

Miroroot is script to safely free space on rootfs To solve the problem of Low space

This script, in many variants (including from you) has already been discussed at length.

The only change I see in this "new" one is that you've selected a different set of folders, which probably most users don't even have (/usr/lib/debug, /usr/lib/gcc, etc.)

Plus you've shamelessly ripped this script from Thomas Tanner's original without even bothering to acknowledge that your work, if not a verbatim copy, is *heavily* based on Tanner's work.

Kerio 2013-04-22 19:38

Re: Miroroot script to safely free space on rootfs
 
The word "safely" is been thrown around way too much - plenty of things can fail, with this: return codes aren't checked, especially before and after the "rm" part; what happens if /home is full, and the copy fails? The original files are deleted, and there's no way to recover them. It doesn't handle the case of those directories already being optified, and it's susceptible to ^C.

Please avoid, this script will probably damage your system.

chemist 2013-04-22 20:02

Re: miroroot.sh a script to clear rootfs has ruined my phone !! :(
 
You have been merged!

Instead of using ridiculous scripts to free space think about what is needed on the phone and what not, I only ran out of space once with an OTA upgrade, never again! If you install stuff not optified properly you may want to use the very first version of this script to brick your beloved n900 finally! If you cannot wait for developers shipping software and want to have it at an early stage you might also accept to run out of space.


All times are GMT. The time now is 15:28.

vBulletin® Version 3.8.8