Tiny Core Linux

Tiny Core Base => TCB Q&A Forum => Topic started by: sblass92 on October 22, 2012, 09:38:34 AM

Title: tc persistent .profile
Post by: sblass92 on October 22, 2012, 09:38:34 AM
Hi all,

I'm have a problem getting .profile to persist between boots.  I've enabled the persistent home and opt directories in the boot codes (home=sda1, opt=sda1)

I'm trying add this line: export PKG_CONFIG_PATH=~/opencv/unix-install to .profile.

However, adding it to ~/.profile and rebooting loads the default .profile.  I tried adding to /mnt/sda1/home/tc/.profile, but it also loads the default .profile.

I'm running TC 4.6.2 and am relatively new to linux.  As this seems to be a persistent problem, I am thinking it is related to a lack of understanding tiny core rather than a lack of understanding linux.

Thanks
Title: Re: tc persistent .profile
Post by: gerald_clark on October 22, 2012, 09:42:06 AM
When you have the home= and opt= boot codes, you must remove home and opt from /opt/.filetool.lst.
You are restoring .profile from your last backup.
Title: Re: tc persistent .profile
Post by: sblass92 on October 22, 2012, 09:57:25 AM
Thanks for the quick response.

I've deleted the lines home and opt from /opt/.filetool.lst.  However, it is restoring /opt/.filetool.lst upon reboot despite the persistent opt directory.   

Thanks
Title: Re: tc persistent .profile
Post by: gerald_clark on October 22, 2012, 10:33:39 AM
You need to make your changes and do a backup so you don't keep reloading the same old backup.
Title: Re: tc persistent .profile
Post by: sblass92 on October 23, 2012, 06:08:04 AM
I added "norestore" to the boot options, and it meets my needs.

Thanks
Title: Re: tc persistent .profile
Post by: Rich on October 23, 2012, 07:06:25 AM
Hi sblass92
That will work for now, but if you install an application that has a config file that you wish to customize, you will
need to back it up.
Title: Re: tc persistent .profile
Post by: gerald_clark on October 23, 2012, 07:12:11 AM
We see the same problem over and over here.
Core is not your normal Linux.
You need to learn to walk with core before you can run.
Start with only the waitusb= and tce= boot options until you get persistence and backup working.
Then you can add more advanced options like opt= and home= after reading the applicable wiki pages.
Title: Re: tc persistent .profile
Post by: tinypoodle on October 23, 2012, 07:32:55 AM
We see the same problem over and over here.
Core is not your normal Linux.
You need to learn to walk with core before you can run.
Start with only the waitusb= and tce= boot options until you get persistence and backup working.
Then you can add more advanced options like opt= and home= after reading the applicable wiki pages.

Amongst other this means many users would not peruse the search function of this forum before posting.

Wondering if perhaps upper would deserve a "sticky" subject... (and with an attention grabbing title)
Title: Re: tc persistent .profile
Post by: sblass92 on October 23, 2012, 08:43:43 PM
First off, thanks for everyone's responses, they are well appreciated.

You need to make your changes and do a backup so you don't keep reloading the same old backup.
Hi sblass92
That will work for now, but if you install an application that has a config file that you wish to customize, you will
need to back it up.

The above quotes and this experience lead me to believe I need to manually execute a backup whenever I change certain files (.profile, config files, others?), or else I'll just keep reloading the backed-up files. 

As for how I ended up using home= and opt=, I started based on these quotes from the wiki (http://wiki.tinycorelinux.net/wiki:persistence_for_dummies (http://wiki.tinycorelinux.net/wiki:persistence_for_dummies))

Quote
By using the Backup Utility
The default mode of saving your docs and settings is via the backup utility, which comes up when you do a shutdown. This backup utility creates a file called by default mydata.tgz (if it doesn't already exist), which contains your entire $HOME directory contents, and the /opt directory, both compressed. The file mydata.tgz is stored in /tce. So, once you start using the /tce directory, automatically all your stuff becomes persistent.
Quote
Executive summary

To make everything persistent, use the Set button in Appbrowser to set a location for /tce. If using the built-in installer, this is taken care of.
To create permanent /home and /opt directories and reduce backup and restore times, use the boot option ”home=xxx” and optionally, ”opt=xxx” where “xxx” are any valid linux partitions. Manually edit /opt/.filetool.lst to remove the home entry and most /opt entries.

I understood this to mean preservation of /home and /opt would happen automatically upon using /tce and the mydata.tgz file.  My reasoning was that since my apps we're being restored between boots (and I used the GUI installer to install tiny core to sda1 from a USB pendrive), I was using the /tce directory (I did not specify a boot code).  When /home wasn't being backed up, I resorted to using home= and opt= which seemed to fix my problem.  Will setting "tce=sda1" and removing "home=" and "opt=" boot codes maintain my changes to .profile and config files?  My understanding of "home=" & "opt=" vs "tce=" is that "tce=" will read and write a mydata.tgz file from disk on boot and shutdown and therefore can be slower. 


Amongst other this means many users would not peruse the search function of this forum before posting.

Wondering if perhaps upper would deserve a "sticky" subject... (and with an attention grabbing title)

I might suggest updating/improving the wiki page as that is where I usually check first for solutions, but this is a personal preference and some people prefer forums first. 
Title: Re: tc persistent .profile
Post by: gerald_clark on October 23, 2012, 09:01:03 PM
The home= and opt= do not stop the tce directory from containing the backup and the installed extensions.
If you do not specify a tce= option, the first tce directory found on any of your drives will be used.
If you are using USB or any other slow to initialize drive, you will need the waitusb=5 option for your tce directory to be found and used.
http://wiki.tinycorelinux.net/wiki:start#persistence
Title: Re: tc persistent .profile
Post by: sblass92 on October 23, 2012, 09:23:31 PM
So in summary, I think I want the following:
home= and opt= for persistent directories, but I'll need to remove them from filetool.lst and perform a manual backup once for the changes to filetool.lst to take effect.
Afterwards, all changes made to opt and home should be saved to my specified partition (including .profile and config files)

Correct?

Thanks
Title: Re: tc persistent .profile
Post by: Rich on October 23, 2012, 09:27:53 PM
Hi sblass92
Correct. You are prompted to run a backup when you shut down or restart, doing it then is sufficient.
Title: Re: tc persistent .profile
Post by: gerald_clark on October 23, 2012, 09:53:22 PM
Or you can just run 'backup'  at any time.
Title: Re: tc persistent .profile
Post by: sblass92 on October 24, 2012, 12:20:27 PM
I'm still having trouble.  Here are the exact steps I've taken:

1. modify /mnt/sda1/tce/boot/extlinux/extlinux.conf so the only code I've added is 'home=sda1' 'opt=sda1'
2. modify /opt/.filetool.lst to remove 'home' and 'opt' from the files to backup
3. perform a backup using the command: filetool.sh -b
4. sudo poweroff

Upon reboot, my changes to .filetool.lst have been reverted to include home and opt, changes to .profile have been overridden. 

Advice?

Thanks

Title: Re: tc persistent .profile
Post by: gerald_clark on October 24, 2012, 12:25:57 PM
Show the output of 'ls -l /etc/sysconfig/tcedir'
It sounds like you still have not accomplished step 1:
Get a persistent tce directory working.
Title: Re: tc persistent .profile
Post by: sblass92 on October 24, 2012, 12:41:15 PM
Code: [Select]
tc@box:~$ ls -l /etc/sysconfig/tcedir
lrwxrwxrwx    1 root    root        13 Oct 25 02:38 /etc/sysconfig/tcedir -> /mnt/sda1/tce/
Title: Re: tc persistent .profile
Post by: gerald_clark on October 24, 2012, 01:17:04 PM
What user are you running filetool.sh -b as?
Who owns /mnt/sda1/tce/mydata.tgz?
Is /mnt/sda1 mounted rw or ro?
What filesystem type is /mnt/sda1?
Title: Re: tc persistent .profile
Post by: sblass92 on October 24, 2012, 06:31:52 PM
What user are you running filetool.sh -b as?
Who owns /mnt/sda1/tce/mydata.tgz?
Is /mnt/sda1 mounted rw or ro?
What filesystem type is /mnt/sda1?

I'm running filetool.sh -b as the default 'tc' user.
I would think the 'tc' user owns /mnt/sda1/tce/mydata.tgz since thats the only user on the system, but how do I confirm this?  Our project doesn't require multiple users. 
/mnt/sda1 is mounted as whatever the default settings are upon installation to a hard drive, how can I determine if its rw or ro?
/mnt/sda1 was configured as ext4 on install. 

Thanks
Title: Re: tc persistent .profile
Post by: Rich on October 24, 2012, 06:58:46 PM
Hi sblass92
Quote
I would think the 'tc' user owns /mnt/sda1/tce/mydata.tgz since thats the only user on the system, but how do I confirm this?
Code: [Select]
ls -l /mnt/sda1/tce/mydata.tgz
Quote
/mnt/sda1 is mounted as whatever the default settings are upon installation to a hard drive, how can I determine if its rw or ro?
Code: [Select]
mount | grep sda1
Please show the result of:
Code: [Select]
showbootcodes
Title: Re: tc persistent .profile
Post by: sblass92 on October 25, 2012, 06:14:08 AM
Code: [Select]
tc@box:~$ ls -l /mnt/sda1/tce/mydata.tgz
-rw-rw-r--    1 tc    staff    544226817 Oct 25 03:07 /mnt/sda1/tce/mydata.tgz

Code: [Select]
tc@box:~$ mount | grep sda1
/dev/sda1 on /mnt/sda1 type ext4 (rw,relatime,barrier=1,data=ordered)
/dev/sda1 on /home type ext4 (rw,relatime,barrier=1,data=ordered)
/dev/sda1 on /opt type ext4 (rw,relatime,barrier=1,data=ordered)

Code: [Select]
tc@box:~$ showbootcodes
initrd=/tce/boot/core.gz quiet waitusb=5:UUID="8e4e7647-a9e2-4f94-82f9-6f5395ad02dd" tce=UUID="8e4e7647-a9e2-4f94-82f9-6f5395ad02dd" home=sda1 opt=sda1 BOOT-IMAGE=/tce/boot/vmlinuz
Title: Re: tc persistent .profile
Post by: Rich on October 25, 2012, 06:30:12 AM
Hi sblass92
What exactly are you backing up? Your  mydata.tgz  is 500Mb.
Title: Re: tc persistent .profile
Post by: sblass92 on October 25, 2012, 06:52:57 AM
just home and opt.  Home is quite large.  Ideally, I want to have them persistent on sda1 so I don't have to back them up and can modify .profile and config files. 
Title: Re: tc persistent .profile
Post by: Rich on October 25, 2012, 07:07:29 AM
Hi sblass92
From what I can see, your  /home  and  /opt  are persistent, they are on sda1. It must take a long time to shutdown
and boot with 500Mb in your backup. Remove home from your .filetool.lst and run a backup. Restart your machine.
As far as I can tell, your  /home  should be intact when your machine comes up.
Title: Re: tc persistent .profile
Post by: sblass92 on October 25, 2012, 07:34:18 AM
Hi sblass92
From what I can see, your  /home  and  /opt  are persistent, they are on sda1. It must take a long time to shutdown
and boot with 500Mb in your backup. Remove home from your .filetool.lst and run a backup. Restart your machine.
As far as I can tell, your  /home  should be intact when your machine comes up.

I hope you can appreciate my confusion :)
Here are the steps I took earlier, which resulted in .filetool.lst restoring itself to a version that listed home and opt:

1. modify /mnt/sda1/tce/boot/extlinux/extlinux.conf so the only code I've added is 'home=sda1' 'opt=sda1'
2. modify /opt/.filetool.lst to remove 'home' and 'opt' from the files to backup
3. perform a backup using the command: filetool.sh -b
4. sudo poweroff

Upon reboot, my changes to .filetool.lst have been reverted to include home and opt, changes to .profile have been overridden. 

I tried this this time, using the same bootcodes (home=sda1 and opt=sda1):
1. modify /opt/.filetool.lst to remove 'home', but leave 'opt'
2. perform a backup using the command: filetool.sh -b
3. sudo poweroff

When it boots up, .filetool.lst remains as I left it and .profile is persistent with my changes.
I suppose this solves my problem, but I still don't totally understand why this was happening.

.profile was getting restored from backup on boot, but all my directories and files were not.  Nothing in .xfiletool.lst explicitly ignores this file.
.filetool.lst was getting restored if left blank, but not if I specified opt to be restored. 

Thank you to everyone who assisted


Title: Re: tc persistent .profile
Post by: Rich on October 25, 2012, 07:51:53 AM
Hi sblass92
Quote
I hope you can appreciate my confusion
Yes I can.
Quote
but I still don't totally understand why this was happening.
I don't either. Maybe it was due to .filetool.lst being empty. I run persistent  /home  and  /opt  on my machines, but
they all have some config files listed in .filetool.lst. If you wish to experiment, you can confirm this.
Replace opt  with  etc/passwd  in your .filetool.lst, do a backup and restart. Verify that  /opt  and  /home are intact.
Replace etc/passwd with a carriage return in your .filetool.lst, do a backup and restart. Verify that  /opt  and  /home are intact.
Delete the carriage return in your .filetool.lst, do a backup and restart. Verify that  /opt  and  /home are intact.
Title: Re: tc persistent .profile
Post by: sblass92 on October 25, 2012, 08:08:48 AM
replacing opt with /etc/passwd keeps /opt and /home (specifically .profile and .filetool.lst)

I replaced /etc/passwd with a carriage return and /opt and /home were preserved

I deleted everything from .filetool.lst and /opt and /home were preserved

So it looks like maybe it requires a backup/reboot cycle with opt in .filetool.lst before it works like normal?  Odd.
Title: Re: tc persistent .profile
Post by: Rich on October 25, 2012, 08:23:25 AM
Hi sblass92
That would be a rather odd quirk, but I doubt that's the case. Running a backup to purge mydata.tcz of the  /home
and  /opt  contents should have been sufficient. At any rate, thanks for trying that experiment.
Title: Re: tc persistent .profile
Post by: sblass92 on October 25, 2012, 08:35:16 AM
I'm not certain that the system is creating a backup when I poweroff.  Can I confirm this somehow?

[edit]
I confirmed this in an atypical way.

I made changes to a file in /usr/local/etc/ssh and added usr/local/etc/ssh to /opt/.filetool.lst

Changes only persist when I execute filetool.sh -b before I shutdown.
Simply making a change and powering off will restore everything before the change.
Title: Re: tc persistent .profile
Post by: tinypoodle on October 25, 2012, 09:00:31 AM
Uhmm... as expected?
Title: Re: tc persistent .profile
Post by: gerald_clark on October 25, 2012, 09:11:08 AM
You should never just power off a linux computer.
Core keeps most of the filesystem in RAM, but unless you have the copy2fs.flg set, and no persistent opt or home, there will still be open files on your hard/flash drive.

The proper way to shutdown is either to use the exit button, or exitcheck.sh.
Title: Re: tc persistent .profile
Post by: sblass92 on October 25, 2012, 10:18:35 AM
When I say poweroff, I mean executing the command 'sudo poweroff'  I'm not physically pulling the power.

I tried shutting down with exitcheck.sh, but it still does not perform a backup.

Using the GUI button performs a backup on shut down. 

Title: Re: tc persistent .profile
Post by: roberts on October 25, 2012, 10:49:34 AM
For cli users there is the command backup
Title: Re: tc persistent .profile
Post by: sblass92 on October 26, 2012, 08:42:46 AM
Ok.  Issue resolved.  Thanks for everyone's help in fixing the problem and explaining the cause of it.