LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   I've trashed my slackpkgs and need help! (https://www.linuxquestions.org/questions/slackware-14/ive-trashed-my-slackpkgs-and-need-help-4175626000/)

mfoley 03-21-2018 01:54 AM

I've trashed my slackpkgs and need help!
 
I ran a program (vbetool) which somehow trashed numerous sector of my hard drive. fsck was finding too many problems. So, I wiped the drive and restored from a full backup of two weeks ago, then a differential backup from yesterday. I noticed some problems (couldn't find firefox) and saw that e.g. /usr/bin/firefox was linked to the wrong version executable. Hmmm. So, I ran `slackpkg upgrade firefox'.

That gave me a list of package errors and asked if I wanted to remove or ignore. I answered "remove", which then proceeded to remove LOTS of packages, most of which I actually needed. running 'slackpkg upgrade-all' wouldn't do anything.

To get slackpkg to do anything at all (slackpkg update) I had to copy cp, scp, wget, libssl.so.1 and libcrypto.so.l from another system.

I've since probably compounded the problem. I renamed existing and created empty /var/log/packages and /var/lib/slackpkg directories. Re-ran 'slackpkg update' (which appeared to work), then tried 'slackpkg upgrade-all' again. That gives me:
Code:

# slackpkg upgrade-all

Checking local integrity... DONE
ls: cannot access '/var/log/packages/*': No such file or directory
Looking for packages to upgrade. Please wait... DONE

No packages match the pattern for upgrade. Try:

        /usr/sbin/slackpkg install|reinstall

Perhaps I've already fatally killed my system, but is there a possibility I can recover from this? How?

Didier Spaier 03-21-2018 03:21 AM

backup && reinstall from scratch, formatting at least the root partition with an ext4 file system.

mfoley 03-22-2018 08:53 AM

I was able to work around this problem. I could do e.g. 'slackpkg install openssl' and it would work and put that one package into /var/log/packages.

So, I listed the packages in /var/log/packages from my end-of-month full backup, then listed the newer packages from the most recent differential. Then did 'comm -3 olderPkgs newerPkgs' which produced a merged list like:
Code:

/var/log/packages/ModemManager-1.4.14-x86_64-1
/var/log/packages/NetworkManager-1.2.2-x86_64-2
        /var/log/packages/NetworkManager-1.8.4-x86_64-1_slack14.2
/var/log/packages/PyQt-4.11.4-x86_64-1
:
:

where the indented line is from the differential backup and therefore the newer package. I hand-edited this resulting file (which I called doit) and removed the older package (in the above example I removed the NetworkManager-1.2.2-x86_64-2 line). This wasn't that tedious as there were only 44 newer packages. I then ran the following command to install each package:
Code:

egrep -v "^#|SBo*|alien" doit | cut -d/ -f5 | while read; do slackpkg -postinst=off -dialog=off -batch=on -default_answer=y -spinning=off install "$REPLY"; done
and rebooted. All was well!

Lesson:

When doing a restore to a wiped disk from a full plus differential backup, do the restore per normal. When doing the differential, restore everything excluding the /var/log/packages directory (tar --exclude /var/log/packages). Then, go through the list of new packages (tar -tvf tarfile | grep var/log/packages) and manually upgrade each one.

ALSO - it would be a very good idea to do a full backup after any package update! That would have saved me the trouble in the first place.

chemfire 03-26-2018 08:44 AM

I would also plug BTRFS here and having your root inside a subvolume. That way you can make a snapshot before you upgrade packages. If a package upgrade does not go well rolling back is as easy as passing subvolume=xx param for your rootfs argument in ELILO at boot time.

BTRFS also is probably the easiest way to make full backups of a stand alone Linux box now and everything need to restore to bear metal is on the Slackware install CD.

mfoley 03-28-2018 11:24 PM

Thanks for the BTRFS info chemfire. I'm reading about that now and perhaps will stage that on a test platform at some point.


All times are GMT -5. The time now is 11:55 PM.