Hard Drive Failure rebuilding Debian from Backups
November 13, 2023
debianYesterday afternoon, my hard drive failed. I had made a comprehensive backup the day before, but it is still a pain to build a new system from scratch. The hard drive had been quite noisy and I had been toying with the idea of starting a new machine, but this event forced me to.
Starting with a new hard drive, i installed the latest Debian 12 os with a usb stick. It is far quicker than years ago, and i had an OS installed in less than an hour.
I also used an ansible playbook I made in the past, which installed browsers, text editors, games and more. This makes the process much easier, but I had to update it a little to add a few more apps to be installed and remove a couple that have disappeared from the debian repo. Another example is the rapid rate of new php versions. I have been using php 8.1 but now version 8.3 of php is available in the debian repo.
So after about an hour, ansible had installed all the software including a lamp server stack, including php versions 8.0, 8.1 and 8.2, apache and a maria/mysql database.
I keep regular backups of the /www directory with the 4 main projects I work on and backups of the databases are easy to reimport.
But one problem I found was the computer didnt sleep / suspend properly. I noticed that the kernel image was only 6.1 so I have decided to add a Kali Linux repo into the apt sources which should give me a 6.5 kernel which hopefully will let me fix the suspend problem. This was solved by changing the default display manager to gdm3 from lightdm as this was set in the install and it did work as I wanted
edit '/etc/X11/default-display-manager' and change it to
/usr/sbin/gdm3
in the setup process i had to chose between the window manager lightdm and gdm3. changing it to gdm3 fixed my shutdown, brightness and boot issue.
Ansible playbook improvements to look into
- check for deb repos existing in the sources. (duplicates seem to appear)
- install more browsers, opera, microsoft edge, palemoon
- add php 8.3
- browser extensions
- VS code extensions
- add mysql root user to the mysql setup
ALTER USER 'root'@'localhost' IDENTIFIED BY 'newPassword'; flush privileges; exit;
Backup improvements to do
- zip up the thunderbird archive, instead of thousands of files.
- browser extensions, install for each browser
- dump bookmarks from each browser
- automate a db dump of the key mysql dbs/tables
- create zips of the web server files without the 'node_modules' and 'vendor' directories
- ssh keys
If you would like to contact me with this form on londinium.com, ilminster.net or via Twitter @andylondon