Attempting to rebuild my save.dat file

Post here if you are a new Porteus member and you're looking for some help.
User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Attempting to rebuild my save.dat file

Post#1 by Ed_P » 28 Jan 2014, 06:03

I'm trying to create a process that allows me to recreate my save.dat file. I'm looking to copy all my files from my old save.dat's /home/guest/ folder to my new fresh /home/guest/ folder then run another .sh file to complete the process.

To restore my old save.dat /home/guest/ folder I created this:

Code: Select all

#!/bin/sh

mloop  /mnt/sda6/porteussave.dat

cp -a /mnt/loop/home/guest/     /home/guest/
But when I run it I get this:

Code: Select all

guest@porteus:~$ sh /mnt/sda6/porteusfiles/RestoreBkups.sh
Please enter root's password below
Password: 
using /dev/loop6

Please wait while i gather some info ....



#################################
Your data file has been mounted at:
/mnt/loop

You can unmount it by typing uloop

Here is a list of the files:
etc  home  opt	root  usr  var

cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-03.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-06.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-04.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-09.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-07.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-15.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-17.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-16.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-21.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-19.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-28.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-27.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-30.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2013-12-29.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2014-01-12.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/bookmarkbackups/.wh.bookmarks-2014-01-09.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.places.sqlite-wal’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.places.sqlite-shm’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.cookies.sqlite-wal’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.cookies.sqlite-shm’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.sessionstore.js’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.urlclassifierkey3.txt’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.healthreport.sqlite-wal’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.healthreport.sqlite-shm’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.addons.sqlite-journal’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.webappsstore.sqlite-wal’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.mozilla/firefox/c3pp43bg.default/.wh.webappsstore.sqlite-shm’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.cache/mozilla/firefox/c3pp43bg.default/safebrowsing/.wh..wh..opq’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.cache/mozilla/firefox/c3pp43bg.default/startupCache/.wh..wh..opq’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.cache/mozilla/firefox/c3pp43bg.default/.wh.thumbnails’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.cache/mozilla/firefox/c3pp43bg.default/thumbnails/.wh..wh..opq’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.macromedia/Flash_Player/macromedia.com/support/flashplayer/sys/.wh..wh..opq’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.macromedia/Flash_Player/#SharedObjects/.wh.6YUW7Q4G’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/Desktop/.wh.Hibernate’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/Desktop/.wh.Suspend.desktop’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/Desktop/.wh.suspend.desktop’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/Downloads/.wh.acpi_handler.sh’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.wh.Touchpad.sh’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.wh.bookmarks-2013-12-04.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.wh.bookmarks-2013-12-17.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.wh.bookmarks-2013-12-21.json’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.wh.terminalmsgs.log’: Operation not permitted
cp: cannot create regular file ‘/home/guest/guest/.wh.bookmarks-2013-12-27.json’: Operation not permitted
guest@porteus:~$ 
I think I understand the guest/guest/ problem but not sure how I limit the restore to just the files in the /home/guest/ folder. I also don't understand the Operation not permitted problem.

Help!
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Attempting to rebuild my save.dat file

Post#2 by brokenman » 28 Jan 2014, 12:44

Code: Select all

cp -a /mnt/loop/home/guest     /home/
The operation not permitted is probably because they are whiteout files, the files created when a file is deleted. They mark a file as invisible (or whited out). You can just supress the error message.

Code: Select all

cp -a /mnt/loop/home/guest 2>/dev/null /home
The '2>/dev/null' will send error messages to null and they won't return.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Attempting to rebuild my save.dat file

Post#3 by Ed_P » 28 Jan 2014, 15:20

Thanks brokenman.

I think my cp options are wrong also which is contributing to the problem. Rather than -a I think I should be looking at -d -r. I basically only want the files in my /home/guest/ folder restored not all the subfolders also, especially the hidden ones, and certainly not deleted ones.

This latter point is a bit of a concern. My save.dat file is rather limited and I certainly don't want it's space used to store DELETED files!! Is there a command I can/should run to purge deleted files??
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Attempting to rebuild my save.dat file

Post#4 by brokenman » 28 Jan 2014, 17:23

Why don't you want any hidden folders? The /home/guest/.config folders is one of the most important config folders.
I also don't understand why you would want the folders in /home/guest/* copied, but none of their subfolders. Usually the subfolders of a configuration folder contain important config files.
Maybe some real world examples would clear things up for me.

Regarding whiteout files best to leave them in place. They are just a journal of files that ARE no longer. In a layered file system (aufs) you can have files on different layers. To make sure that when a files is deleted on one layer that no underlying files are visible also a whiteout file is placed on the top layer. It is like a kind of book keeping for deleted files. When you create another file with the same name the whiteout file will be removed. By checking their size you will see they don't take up any space.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Attempting to rebuild my save.dat file

Post#5 by Ed_P » 28 Jan 2014, 18:38

In my limited view of the system I'm only concerned about the files I created.

Code: Select all

guest@porteus:~$ ls /home/guest/
AnInitialLog.txt     bookmarks-2014-01-21.json  modules.sh*
Desktop/             boot.log@                  nustart.sh*
Downloads/           bootmode.sh*               rc.local*
PorteusNotes.txt*    cleanup*                   suspend.desktop
TouchpadInstall.log  en.dic@                    syslog
TouchpadRunCk.sh*    gtk-soundcard-select       test.sh*
acpi_handler.sh      logpurge.txt               test1.sh*
asound.conf          make.shexecute.sh*         test2.sh*
asound.sh*           make.shexecute.txt         touchpad.sh*
guest@porteus:~$ ls /home/guest/Desktop/
Home.desktop  System.desktop  Touchpad.desktop
guest@porteus:~$ ls /home/guest/Downloads/
jre-7u45-x86_64-1.xzm
guest@porteus:~$ 
Yes, I am aware of other files and folders but I don't create them, at least not directly. Porteus created them for me, automatically, and will recreate them automatically the next time I boot. SOME config files I've changed/updated and I have copies of those files in my /home/guest/ folder and once my /home/guest/ files are I will then update the various config files I have changed. Hopefully with this script:

Code: Select all

#!/bin/sh

if [ `whoami` != "root" ]; then
  ktsuss "$0"
fi

# http://forum.porteus.org/viewtopic.php?f=81&t=2982#p20762
cp -a /home/guest/cleanup         /mnt/live/
# http://forum.porteus.org/viewtopic.php?f=81&t=2926#p20365
cp -a /home/guest/asound.conf     /etc/
/etc/rc.d/rc.alsa restart
# http://forum.porteus.org/viewtopic.php?f=81&t=2894&p=20016#p20085
cp -a /home/guest/rc.local        /etc/rc.d/
# http://forum.porteus.org/viewtopic.php?f=81&t=2998&p=21365#p21253
cp -a /home/guest/syslog          /etc/logrotate.d/
# http://forum.porteus.org/viewtopic.php?f=81&t=3018&p=21466#p21466
cp -a /home/guest/acpi_handler.sh /etc/acpi/
# http://forum.porteus.org/viewtopic.php?f=81&t=1955&start=45#p13596
cp -a /home/guest/syndaemon.desktop  /home/guest/.config/autostart

echo B4
synclient | grep Palm
echo  
sh /home/guest/touchpad.sh
echo Aft
synclient | grep Palm
echo 
echo -en "PalmDetect = 1?\n"
read

exit
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Attempting to rebuild my save.dat file

Post#6 by brokenman » 28 Jan 2014, 21:49

Understood.

In this case it would make more sense to create a folder called /home/guest/configbackup and then copy all wanted configs into it like so:

Code: Select all

cp -a --parents /etc/rc.d/rc.local /home/guest/configbackup/
--parents will create the parents directories for you.

Then to restore your backups you will just need:

Code: Select all

cp -a /home/guest/configbackup/* /
This way is a little more manageable, otherwise you will need to copy them individually (like you do in the script) as the target is different for each. If you prefer to stay with your current way just one change is needed.

if [ `whoami` != "root" ]; then
ktsuss "$0"
exit
fi

Otherwise the script will continue to run (as guest) even if ktsuss fails.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Attempting to rebuild my save.dat file

Post#7 by Ed_P » 28 Jan 2014, 22:32

brokenman wrote:In this case it would make more sense to create a folder called /home/guest/configbackup and then copy all wanted configs into it like so:

Code: Select all

cp -a --parents /etc/rc.d/rc.local /home/guest/configbackup/
--parents will create the parents directories for you.
Thanks brokenman. A clever option.

Just to be clear I have to do the cp -a --parents for each config file that I have changed. Yes? ie /etc/rc.d/rc.local AND /mnt/live/cleanup AND /etc/asound.conf and etc etc.
Then to restore your backups you will just need:

Code: Select all

cp -a /home/guest/configbackup/* /
This way is a little more manageable, otherwise you will need to copy them individually (like you do in the script) as the target is different for each.
But then I will need a script to create the configbackup folder. :D
If you prefer to stay with your current way just one change is needed.

if [ `whoami` != "root" ]; then
ktsuss "$0"
exit
fi

Otherwise the script will continue to run (as guest) even if ktsuss fails.
Thank you sir. :beer:

I'm hoping this approach will also work for restoring config changes to 3.0. A consideration is some of my config changes are Porteus patches and they should not be needed in the newer release.
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Attempting to rebuild my save.dat file

Post#8 by brokenman » 29 Jan 2014, 00:25

But then I will need a script to create the configbackup folder.
Yes of course. (slaps forehead). Stick with your current script. I would say that configs are be portable across versions. Certainly the ones you have listed should be for now.
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Attempting to rebuild my save.dat file

Post#9 by Ed_P » 29 Jan 2014, 04:57

Ok, this is what I have so far for restoring files.

Code: Select all

#!/bin/sh

if [ `whoami` != "root" ]; then
  ktsuss "$0"
  exit
fi

mloop  /mnt/sda6/porteussave.dat

#cp -r -d /mnt/loop/home/guest/*  2>/dev/null      /home/guest/
cp -r -d /mnt/loop/home/guest/*                    /home/guest/
cp -r -d /mnt/loop/home/guest/.config/autostart/*  /home/guest/.config/autostart/
cp -r -d /mnt/loop/home/guest/.config/spacefm/*    /home/guest/.config/spacefm/
/mnt/loop/home/guest/* reduces the error msgs and I did find a couple of .config files that I wanted restored.

Is there a file that contains network passwords that I can restore? :)
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Attempting to rebuild my save.dat file

Post#10 by brokenman » 29 Jan 2014, 12:49

If you are using networkmanager with just a basic setup (straightforward internet connection)
/etc/NetworkManager/NetworkManager.conf
/etc/NetworkManager/system-connections/*
How do i become super user?
Wear your underpants on the outside and put on a cape.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Attempting to rebuild my save.dat file

Post#11 by Ed_P » 29 Jan 2014, 20:48

brokenman wrote:/etc/NetworkManager/system-connections/*
Perfect. :good: :beer:

BTW Is there a way to customize the menu one sees when they Right click on a file with SpaceFM? 80% of the time when I want to display, or change, the contents of an .sh or .txt file I click on the Edit menu option rather than the Open option. Having worked in the Windows environment for so long it's kinda automatic for me.
Ed

User avatar
brokenman
Site Admin
Site Admin
Posts: 6105
Joined: 27 Dec 2010, 03:50
Distribution: Porteus v4 all desktops
Location: Brazil

Re: Attempting to rebuild my save.dat file

Post#12 by brokenman » 30 Jan 2014, 02:54

Yes. SpacemanFM is probably the most versatile file manager i have ever seen. Write click on your .sh file then move to 'open', then move into the flyout menu that appears and right click in there. You can then add whatever you want. All menus are customizable by right clicking on them.
How do i become super user?
Wear your underpants on the outside and put on a cape.

tome
Contributor
Contributor
Posts: 675
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Russia is causing the immense damage to humanity
Contact:

Re: Attempting to rebuild my save.dat file

Post#13 by tome » 30 Jan 2014, 09:36

And in View->Preferences ->Interface you can disable 'Click runs executables' option.
You have mind and feelings. Be wise and clever.

User avatar
Ed_P
Contributor
Contributor
Posts: 8341
Joined: 06 Feb 2013, 22:12
Distribution: Cinnamon 5.01 ISO
Location: Western NY, USA

Re: Attempting to rebuild my save.dat file

Post#14 by Ed_P » 30 Jan 2014, 19:51

Thanks guys.
brokenman wrote:Yes. SpacemanFM is probably the most versatile file manager i have ever seen. Write click on your .sh file then move to 'open', then move into the flyout menu that appears and right click in there. You can then add whatever you want. All menus are customizable by right clicking on them.
I'm missing something. I Right click on a .sh file, I select Edit, I move my mouse to the Edit menu and Right click but I don't see any option for adding LeafPad to it.

In my mind, Editing a file means changing the contents of the file, Opening means running the file if it's an executable or viewing it if it's readable. In the case of a script that would mean the opening of LXTerminal and running the script. But when I dbl click on a script LeafPad opens.
Ed

tome
Contributor
Contributor
Posts: 675
Joined: 26 Jun 2013, 14:03
Distribution: x64 Openbox
Location: Russia is causing the immense damage to humanity
Contact:

Re: Attempting to rebuild my save.dat file

Post#15 by tome » 31 Jan 2014, 08:01

I'm missing something. I Right click on a .sh file, I select Edit, I move my mouse to the Edit menu and Right click but I don't see any option for adding LeafPad to it.
It should be: right click -> Open -> Edit
In my mind, Editing a file means changing the contents of the file, Opening means running the file if it's an executable or viewing it if it's readable. In the case of a script that would mean the opening of LXTerminal and running the script. But when I dbl click on a script LeafPad opens.
Set correct permissions and Enable: View->Preferences -> 'Click runs executables'. The script is running in background, not in LXTerminal.
You have mind and feelings. Be wise and clever.

Post Reply