Well, I recently learned something very interesting, and even though the following is probably something very basic to most people reading this, I thought that I would share it anyway, in case it might help someone else in the future.
Recently, I broke my desktop login screen by upgrading my nvidia driver to a newer driver which was not compatible with my video card. So instead of seeing my normal login screen, I was stuck at a black screen with a frozen cursor in the upper left hand corner.
After unsuccessfully monkeying around in a second terminal (Ctrl+Alt+F2) I decided that my only option was to do a fresh reinstallation of the operating system, and to restore all of my packages and settings from a backup I had made earlier.
At first, this new installation of FreeBSD seemed to work well, and I did not have any problems until after I tried to restore from a backup I had created just a few days prior. At this point I should probably mention that I have a line within the script that I use to restore my backup, and this particular line tells the script to use a text file list to reinstall all of my packages. The line I’m referring to is shown below.
The problem with the above line is that it doesn’t necessarily download and install exactly the same version of the package which was in use when the above package_list.txt text file was first created. Instead, it seems to download and install whatever package name happens to be residing in the repository. (If I’m wrong about this, please let me know.)
In my case, this was a problem because, originally my installation of FreeBSD was using Nvidia driver 580.119.02, but when I invoked the package upgrade command, my Nvidia driver got upgraded to driver-580-580.142, and this particular driver did not seem to work with my video card (NVIDIA GeForce GT 1030).
Also, once again when I tried to restore my packages using the list of packages on contained within package_list.txt, the newer incompatible driver got installed, instead of the original driver which had been in use when I created my backup. Hmmm...So after restoring from my backup, I was still looking at a black screen instead of my normal login screen.
Luckily I had another internal hard drive sitting on in a box, and this particular drive just happened to have a nearly identical installation of FreeBSD on it using the correct Nvidia driver. I had forgotten about this drive, and really hadn’t planned on using as a backup to restore my system.
I then used the dd command to clone the installation of FreeBSD contained on my spare drive onto drive ada0 inside my computer, and when I rebooted, I now had a working installation that was only about a month or two out of date.
However, I realized that if I were to issue the package upgrade at this point, then I would probably destroy this installation as well. So the next thing I did was to issue the below command to create a backup of all of my installed packages, and also of all of their dependencies as well.
Running the above command took approximately half an hour, and when it was finished, the backup pkg folder turned out to be considerably larger than the original working pkg folder located at /var/cache/pkg.
Next I changed the line within my restore script file into the below line, so that it would no longer referenced the list of packages contained within my text file, and it would instead just add all of the packages contained within the backup pkg folder.
As a test, I did another fresh reinstallation of FreeBSD on my spare hard drive, I ran my restore script, and it worked! All of my packages were reinstalled from my backup pkg folder I had created on /diskbkp, and I was not stuck with upgrading to the newer Nvidia driver. This was a huge achievement for a numpty like me.
At this point, I no longer invoke the package upgrade command without first doing a dry run and diverting the output of the command to a text file in my temp folder. Something similar
That way I can now look through the new text file I have just created, and then I can upgrade packages manually, or create a new package upgrade list without any mentions of Nvidia packages in it.
Well, I realize that this is differently not the most efficient way to get things done, and eventually I will have to come up with a better strategy, (such as snapshots) but for the time being it seems to work for me.
Recently, I broke my desktop login screen by upgrading my nvidia driver to a newer driver which was not compatible with my video card. So instead of seeing my normal login screen, I was stuck at a black screen with a frozen cursor in the upper left hand corner.
After unsuccessfully monkeying around in a second terminal (Ctrl+Alt+F2) I decided that my only option was to do a fresh reinstallation of the operating system, and to restore all of my packages and settings from a backup I had made earlier.
At first, this new installation of FreeBSD seemed to work well, and I did not have any problems until after I tried to restore from a backup I had created just a few days prior. At this point I should probably mention that I have a line within the script that I use to restore my backup, and this particular line tells the script to use a text file list to reinstall all of my packages. The line I’m referring to is shown below.
Code:
pkg install $(cat /diskbkp/backup/package_list.txt)
(Above line from my restore script file used to reinstall packages)
The problem with the above line is that it doesn’t necessarily download and install exactly the same version of the package which was in use when the above package_list.txt text file was first created. Instead, it seems to download and install whatever package name happens to be residing in the repository. (If I’m wrong about this, please let me know.)
In my case, this was a problem because, originally my installation of FreeBSD was using Nvidia driver 580.119.02, but when I invoked the package upgrade command, my Nvidia driver got upgraded to driver-580-580.142, and this particular driver did not seem to work with my video card (NVIDIA GeForce GT 1030).
Also, once again when I tried to restore my packages using the list of packages on contained within package_list.txt, the newer incompatible driver got installed, instead of the original driver which had been in use when I created my backup. Hmmm...So after restoring from my backup, I was still looking at a black screen instead of my normal login screen.
Luckily I had another internal hard drive sitting on in a box, and this particular drive just happened to have a nearly identical installation of FreeBSD on it using the correct Nvidia driver. I had forgotten about this drive, and really hadn’t planned on using as a backup to restore my system.
I then used the dd command to clone the installation of FreeBSD contained on my spare drive onto drive ada0 inside my computer, and when I rebooted, I now had a working installation that was only about a month or two out of date.
However, I realized that if I were to issue the package upgrade at this point, then I would probably destroy this installation as well. So the next thing I did was to issue the below command to create a backup of all of my installed packages, and also of all of their dependencies as well.
Code:
pkg create -a -o /diskbkp/backup/var/cache/pkg/
(diskbkp is the mount point for a second internal hard drive inside my computer)
Running the above command took approximately half an hour, and when it was finished, the backup pkg folder turned out to be considerably larger than the original working pkg folder located at /var/cache/pkg.
Next I changed the line within my restore script file into the below line, so that it would no longer referenced the list of packages contained within my text file, and it would instead just add all of the packages contained within the backup pkg folder.
Code:
pkg add /diskbkp/backup/var/cache/pkg/*
As a test, I did another fresh reinstallation of FreeBSD on my spare hard drive, I ran my restore script, and it worked! All of my packages were reinstalled from my backup pkg folder I had created on /diskbkp, and I was not stuck with upgrading to the newer Nvidia driver. This was a huge achievement for a numpty like me.
At this point, I no longer invoke the package upgrade command without first doing a dry run and diverting the output of the command to a text file in my temp folder. Something similar
Code:
pkg upgrade -n >/home/Steven/Temp/packages.txt
That way I can now look through the new text file I have just created, and then I can upgrade packages manually, or create a new package upgrade list without any mentions of Nvidia packages in it.
Well, I realize that this is differently not the most efficient way to get things done, and eventually I will have to come up with a better strategy, (such as snapshots) but for the time being it seems to work for me.