View previous topic :: View next topic |
Author |
Message |
AutoBot l33t
Joined: 22 Apr 2002 Posts: 968 Location: Usually Out
|
Posted: Sat May 04, 2002 12:51 pm Post subject: Horrid Gentoolkit *Bug* = ? |
|
|
I emerged gentoolkit like normal, ran etc-update again like normal, and here is where the problem arose.....Now my entire /etc directory is completely empty and I have no idea what to do about this. I am rather disappointed this happened as I just re-installed from stage 1 and got fluxbox up and running again, if anyone knows what to get this issue resolved it would be much appreciated as it has me stumped. |
|
Back to top |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Sat May 04, 2002 3:23 pm Post subject: Re: Horrid Gentoolkit *Bug* = ? |
|
|
AutoBot wrote: | if anyone knows what to get this issue resolved it would be much appreciated as it has me stumped. |
Other folks have had similar troubles with etc-update. My recommendation is to resolve the /etc files by hand using diff. I know that doesn't help youi now, but hopefully it will help other folks in the future. /etc files are simply too critical, IMO.
Regarding your issue, specifically, you do have backups, don't you.
--kurt _________________ The problem with political jokes is that they get elected |
|
Back to top |
|
|
AutoBot l33t
Joined: 22 Apr 2002 Posts: 968 Location: Usually Out
|
Posted: Sat May 04, 2002 3:45 pm Post subject: |
|
|
Well I was trying to get my system back up to speed after re-installing from stage 1 instead of stage 3, so the answer is no I hadn't backed it up *yet*. I will reinstall again I suppose arggggg _________________ This message self destructed a long time ago. |
|
Back to top |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Sun May 05, 2002 12:09 pm Post subject: Thanks for the warning... |
|
|
Just put this in a file in /etc/init.d and added it to the default runlevel...
Code: | #!/bin/bash
# Script to backup /etc/* on startup, just in case.
echo "Backing up /etc/..."
rm -fr /var/backup/oldetc
mv /var/backup/etc /var/backup/oldetc
cp -R /etc /var/backup/etc |
and now I have two generations of /etc/ backed up automatically on start up. _________________ Cheers, MP |
|
Back to top |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Sun May 05, 2002 12:17 pm Post subject: Re: Thanks for the warning... |
|
|
mdpye wrote: | and now I have two generations of /etc/ backed up automatically on start up. |
That's a great idea -- thanks mdpye. One suggestion I would have is to use:
Code: | cp -pR /etc /var/backup/etc |
instead of just 'cp -R'. That way, you don't have to worry about ending up with /etc files that are world-writeable if you restore from backup.
--kurt _________________ The problem with political jokes is that they get elected |
|
Back to top |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Sun May 05, 2002 1:03 pm Post subject: Thanks... |
|
|
I've put the -p in so now the permissions are properly protected. I did think about dumping /etc/. I was thinking of changing the original to dump it in a tarball, but I don't want to slow down the boot sequence TOO much. The superfast boot is one of the things I love so much about gentoo... _________________ Cheers, MP |
|
Back to top |
|
|
AutoBot l33t
Joined: 22 Apr 2002 Posts: 968 Location: Usually Out
|
Posted: Sun May 05, 2002 11:49 pm Post subject: |
|
|
Thanks for the suggestion, I was going to do something similar to that when I get up to re-installing again _________________ This message self destructed a long time ago. |
|
Back to top |
|
|
arkane l33t
Joined: 30 Apr 2002 Posts: 918 Location: Phoenix, AZ
|
Posted: Mon May 06, 2002 4:48 am Post subject: |
|
|
Ya know, stuff like this you really don't think of until your bit like hell by it. I just put that bit of code into my startup just in case I get bit by that bug myself....
Thanks for the info! |
|
Back to top |
|
|
MarkG Tux's lil' helper
Joined: 28 Apr 2002 Posts: 90 Location: Dorset, UK
|
Posted: Mon May 06, 2002 7:03 am Post subject: |
|
|
Just a personal preference but I'd have used tar instead of cp
tar -czf /var/backup/etc.tar.gz /etc
On my system it used 550K instead of 4.5M, not a huge amount but every little helps.
MarkG |
|
Back to top |
|
|
arkane l33t
Joined: 30 Apr 2002 Posts: 918 Location: Phoenix, AZ
|
Posted: Mon May 06, 2002 7:23 am Post subject: |
|
|
Quote: |
tar -czf /var/backup/etc.tar.gz /etc
On my system it used 550K instead of 4.5M, not a huge amount but every little helps.
|
Just changed mine to tar now... figured what the hey...
Mine reads:
echo "Backing up /etc/..."
rm -rf /var/backup/oldetc.tar.gz
mv /var/backup/etc.tar.gz /var/backup/oldetc.tar.gz
tar -zcspf /var/backup/etc.tar.gz /etc
Just need to figure out how to get rid of that stupid line that keeps saying: "tar: Removing leading `/' from member names"
Side note: it seems that tar actually takes less time than copying, oddly enough. (on my system, which is a 450mhz with a 9ms 10 gig drive) |
|
Back to top |
|
|
Guest
|
Posted: Mon May 06, 2002 10:21 am Post subject: |
|
|
Quote: | Side note: it seems that tar actually takes less time than copying, oddly enough. (on my system, which is a 450mhz with a 9ms 10 gig drive) |
With any reasonably modern processor, your hard drive is going to be the bottleneck, so compressing the file means less to write which means less time. |
|
Back to top |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Mon May 06, 2002 11:13 am Post subject: |
|
|
Anonymous wrote: | With any reasonably modern processor, your hard drive is going to be the bottleneck, so compressing the file means less to write which means less time. |
Something I had considered, but not tested. I got an PIII 866, so it looks like it's tarballs for me after all... _________________ Cheers, MP |
|
Back to top |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Mon May 06, 2002 11:20 am Post subject: |
|
|
Quote: | Just need to figure out how to get rid of that stupid line that keeps saying: "tar: Removing leading `/' from member names" |
tar -zcspf /var/backup/etc.tar.gz /etc 2> /dev/null
Does the trick for me, and sends the note from tar straight to the bit bucket. _________________ Cheers, MP |
|
Back to top |
|
|
leaf n00b
Joined: 06 May 2002 Posts: 10 Location: England
|
Posted: Mon May 06, 2002 11:33 am Post subject: |
|
|
You can also use the -P option, which informs tar that you're using absolute paths
Code: | tar -Pzcspf /var/backup/etc.tgz /etc |
Here's a version that uses runscript.sh like the other init.d scripts, so now it has the pretty green asterisk...
Code: |
#!/sbin/runscript
# Backs up /etc/*
start() {
local BACKUPDIR="/var/backup"
ebegin "Backing up /etc/* to ${BACKUPDIR}/etc.tar.gz"
if [ ! -d ${BACKUPDIR} ]
then
mkdir ${BACKUPDIR}
fi
rm -rf ${BACKUPDIR}/oldetc.tar.gz
if [ -f ${BACKUPDIR}/etc.tar.gz ]
then
mv ${BACKUPDIR}/etc.tar.gz ${BACKUPDIR}/oldetc.tar.gz
fi
tar -Pzcspf ${BACKUPDIR}/etc.tar.gz /etc
eend $?
}
|
|
|
Back to top |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Mon May 06, 2002 2:02 pm Post subject: |
|
|
leaf wrote: | Here's a version that uses runscript.sh like the other init.d scripts, so now it has the pretty green asterisk... |
Ladies and gentlemen, welcome to open development and peer review on the smallest scale. Our /etc/ directories are now safe.
Thanks for the full gentoo bootscript version leaf.
MP _________________ Cheers, MP |
|
Back to top |
|
|
chadh Moderator
Joined: 21 Apr 2002 Posts: 137 Location: Atlanta, GA
|
Posted: Mon May 06, 2002 6:29 pm Post subject: |
|
|
This is good stuff. Make sure and request that it gets added to Gentoo's baselayout on https://bugs.gentoo.org . _________________ Chad |
|
Back to top |
|
|
MarkG Tux's lil' helper
Joined: 28 Apr 2002 Posts: 90 Location: Dorset, UK
|
Posted: Mon May 06, 2002 7:00 pm Post subject: |
|
|
No, don't add things like this to the base layout, this is just system tweaking. It's good stuff yess but don't force it on everyone since this is essentially a workaround to a bug in another package.
It wouldn't work for me as I rarely reboot my machine but tweak my /etc files daily at the moment; I prefer to make manual backups before upgrading. Our efforts should be concentrated on pinning down and fixing the bug that caused this discussion in the first place.
Just my £0.02 worth.
MarkG |
|
Back to top |
|
|
AutoBot l33t
Joined: 22 Apr 2002 Posts: 968 Location: Usually Out
|
Posted: Tue May 07, 2002 2:45 am Post subject: |
|
|
Back up and running again and am using your script leaf, thanks for the idea _________________ This message self destructed a long time ago. |
|
Back to top |
|
|
friedmud Apprentice
Joined: 18 Apr 2002 Posts: 258 Location: Austin, TX USA
|
Posted: Tue May 07, 2002 5:35 am Post subject: Very cool guys! |
|
|
Excellent work - this script should go back into Gentoo Proper and be part of the primary distribution. This could save lots of people headaches - and when people say "I've lost my etc directory" on IRC knowledgeable people will be able to tell them how to restore it.
Great work!
Derek |
|
Back to top |
|
|
Roy n00b
Joined: 15 Apr 2002 Posts: 55 Location: Australia
|
Posted: Tue May 07, 2002 5:46 am Post subject: |
|
|
Another suggestion
For those of you like me who has sometimes backed up a copy that doesn't work this version will keep an archive of your previous three backups. It does the same as the previous script except it dates the file and deletes the oldest backup if there are more than 3 backup files already.
I don't do much shell scripting so if anyone sees any major problems with it let me know.
Code: | #!/sbin/runscript
# Backs up /etc/*
start() {
local BACKUPDIR="/var/backup"
local DATE=`date +%Y%m%d`
local files=`ls -r ${BACKUPDIR}/etc*.tar.gz`
ebegin "Backing up /etc/* to ${BACKUPDIR}/etc-${DATE}.tar.gz"
if [ ! -d ${BACKUPDIR} ]
then
mkdir ${BACKUPDIR}
fi
backup=3
for arg in ${files}
do
if [ "${backup}" -le 0 ]
then
rm -f ${arg}
else
backup=$((${backup} -1))
fi
done
tar -Pzcspf ${BACKUPDIR}/etc-${DATE}.tar.gz /etc
eend $?
} |
_________________ /* Halley */
(Halley's comment.) |
|
Back to top |
|
|
fghellar Bodhisattva
Joined: 10 Apr 2002 Posts: 856 Location: Porto Alegre, BR
|
Posted: Tue May 07, 2002 6:30 am Post subject: |
|
|
I have two suggestions.
The first applies to leaf's code and to Roy's code:
Code: | mkdir -p ${BACKUPDIR} |
This is better if the parent dirs do not exist for some reason.
The second is only for leaf's code:
Code: | rm -rf ${BACKUPDIR}/oldetc.tar.gz |
Code: | rm -f ${BACKUPDIR}/oldetc.tar.gz |
The -r is only needed for directories. _________________ | www.gentoo.org | www.tldp.org | www.google.com | |
|
Back to top |
|
|
Guest
|
Posted: Thu May 09, 2002 1:26 am Post subject: |
|
|
Where do I put this script and how to get it to run at each boot, any help would be apprecitated. |
|
Back to top |
|
|
mdpye Tux's lil' helper
Joined: 18 Apr 2002 Posts: 102 Location: Nottingham, England
|
Posted: Thu May 09, 2002 3:24 pm Post subject: |
|
|
Anonymous wrote: | Where do I put this script and how to get it to run at each boot, any help would be apprecitated. |
Save it as backup-etc in /etc/init.d/, then run (as root)
# chmod 0755 /etc/inid.t/backupetc
# rc-update add backupetc default
And it should be fine. _________________ Cheers, MP |
|
Back to top |
|
|
klieber Bodhisattva
Joined: 17 Apr 2002 Posts: 3657 Location: San Francisco, CA
|
Posted: Thu May 09, 2002 3:32 pm Post subject: |
|
|
mdpye wrote: | Save it as backup-etc in /etc/init.d/, then run (as root)
Code: |
# chmod 0755 /etc/inid.t/backupetc
# rc-update add backupetc default
|
And it should be fine. |
Actually, that should be:
Code: |
# chmod 0755 /etc/init.d/backup-etc
# rc-update add backup-etc default
|
Assuming you do, in fact, name it backup-etc, with a hyphen. Also note the typo in the original, "inid.t". Not trying to be pedantic -- just making sure it works as expected.
--kurt _________________ The problem with political jokes is that they get elected |
|
Back to top |
|
|
Alutke n00b
Joined: 09 May 2002 Posts: 18
|
Posted: Thu May 09, 2002 11:36 pm Post subject: |
|
|
Excellent script guys
I don't actually bounce my machine often so I have decide to use it as a cron job instead. This way I get a daily backup without having to reboot!
Keep up the good work!
Thanks,
Alex |
|
Back to top |
|
|
|