LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Slackware “Clean Upgrade” (with pre- and post-installation tasks) (https://www.linuxquestions.org/questions/slackware-14/slackware-%93clean-upgrade%94-with-pre-and-post-installation-tasks-4175445481/)

Lufbery 01-13-2013 10:21 PM

Slackware “Clean Upgrade” (with pre- and post-installation tasks)
 
Introduction

Slackware is perfectly usable from a fresh (full) installation with only two essential tasks to perform after the installation is complete:
  1. creating an initial RAM disk (using mkinitrd) so that one boots to the generic kernel, and
  2. creating at least one non-root user (using adduser).

Everything else — installing additional software, setting up e-mail, etcetera — is really personalizing and/or customizing to suit one’s own tastes and needs.

Upgrades, rather than clean installations, of Slackware are a slightly different story. An upgrade removes packages no longer needed, updates packages for the new version of Slackware, and adds new packages. What it does not do (and rightly so!) is move/delete/mangle/otherwise modify user data and settings. An upgrade also does nothing to installed packages that are not part of the default Slackware distribution.

I suspect that for most people under most circumstances, upgrading from one version of Slackware to the next, using the upgrade instructions that come with Slackware (or using Slackpkg to accomplish the same thing), is painless. In my experience, nearly all non-Slackware software that I’ve built and installed for one version of Slackware works perfectly well in the next version of Slackware. Similarly, nearly all user-specific settings translate well from the previous version to the next. The major exception seems to be KDE, which really benefits from deleting the users’ hidden configuration directories prior to launching the updated version because settings from a previous version can cause strange behavior in newer versions.

Over time, at my house, a particular Slackware installation becomes somewhat messy. I’ll install software that I end up not using. Sometimes I will uninstall it, sometimes I won’t. I tweak a setting here or there, make some changes to accommodate my wife’s needs on the computer, etc. The end result is that the users’ home directories get crowded with hidden directories and files that are orphaned or (at the very least) no longer useful. When a new Slackware version eventually comes out, I find that what I really want is a clean installation that preserves all user data and only certain important system and user settings — I call it a “clean upgrade.”

Here’s a way to do just that.

Brief Overview of Upgrade Methods

Leaving aside the very first, virgin installation of Slackware on one or more new partitions, where one creates the non-root user for the first time (which for me was with Slackware 11, right after Pat released it), there are a few ways to upgrade from one Slackware release to the next. There seem to be two major methods (upgrade and clean installation), with many variations. I will only cover the two major ones and a single variation:

1) Upgrade according to the instructions in UPGRADE.TXT.

In a nutshell, go down to telinit 1, run upgradepkg several times in a specific order, remove obsolete packages, and check one’s configuration files. This method works very well (as noted above).

However, this method does leave all the non-default applications and potentially useless settings intact.

Note: From what I understand, Slackpkg pretty much does the process outlined in UPGRADE.TXT as part of its upgrade routine, but the process is automated.

2) Do a clean installation on a freshly formatted partition, but keep your /home and /root directories on separate partitions.

During the installation process, point to those directories, but don’t format them. After the installation, you may need to recreate your non-root users, but if you give them the old /home directories (e.g. /home/drew), then you get them back with all their data and settings.

(As an aside, one way to avoid recreating your users that has worked in past versions of Slackware is to copy backed-up versions of /etc/group, /etc/passwd, and /etc/shadow over the new ones created during the clean installation.)

The advantage of this method is that it wipes out all the non-default packages that I installed _and_ all the non-default settings. It is, for me anyway, often much easier to reinstall additional packages that I need (sometimes recompiling and upgrading in the process), and set/reset a small handful of configuration files than to clean up the cruft from the prior year and half since the previous upgrade.

The problem is that most user-specific application and desktop settings are in hidden files in the /home/_user_ directory. So even a clean installation results in the retention of cruft

3) A modification of the second method, the “clean upgrade.”

For a “clean upgrade,” one backs up the /root, /home, and /etc directories, creates new ones as part of a clean install, and then copies back the data files (i.e. papers, photos, music, etc.) and a few very valuable configuration files.

After six upgrades from 11.0 to 13.37, on two different computers, I’ve found the third method is the one that I prefer.

Specific Procedures

Having said that, upgrades are few and far between. I usually upgrade a month or two after a new Slackware release comes out. I perform most of the same tasks each upgrade. Upgrades happen so infrequently that I have to make notes during one upgrade to remind me of tasks to do during the next upgrade.

I maintain two computers at home: a relatively powerful desktop that the whole family uses and an older Pentium III IBM laptop that I use when other people are on the desktop computer. I use SSL and X-forwarding (http://archive09.linux.com/feature/119744) to access the desktop from my laptop.

What follows are my notes on the pre- and post-installation tasks for Slackware_13.37 (32-bit) on my IBM A22m Laptop. The procedures for the desktop are similar, and most of these tasks haven’t changes much from one Slackware version to the next.

Pre-Installation Backup
First, I backed up to an external hard drive the /root, /home, and /etc directories from my 13.1 installation. This preserves all the data and hidden files. The most important (in my opinion) configuration files are listed below.

For each user:
  • .bashrc
  • .bash_profile
  • .emacs
  • .mozilla directory (preserves bookmarks and settings for Firefox and Seamonkey)
  • .thunderbird directory (preserves all my users’ e-mails)
  • GNUstep directory where I have my settings for WindowMaker.
  • /root also has the SBo packages I've compiled in the past.

There may be others, .opera for instance, that users need to maintain continuity between one version of Slackware and the next.

For the system as a whole, I’m most interested in preserving:
  • /etc/rc.d/rc.keymap
  • /etc/rc.d/rc.local
  • /etc/X11/xorg.conf.d/20-thinkpad.conf (activates the scroll button on my Thinkpad)
  • My customized emacs keymap (save in my /root directory), which changes the Caps Lock key to a Control key. It gets copied to /usr/share/kbd/keymaps/i386/qwerty/emacs2.map.gz after the clean installation.

Prior to installation, rename /home/user directories to /home/old-drew, etc.

During the Installation
Then I install Slackware as a clean installation.

The most important point is that I do not format /root and /home partitions, which I keep on separate partitions. That way, the clean installation does not alter or destroy my users’ data and settings. The back-up I made above is very useful, but it _is_ as backup. Restoring user data and the key settings should not require using the backup.

After-installation Tasks
With the clean installation completed and me safely booted into my brand new, sparkling fresh Slackware installation, there are a few tasks to finish the update, restore the user settings, and get back to work.

The third and fourth steps are where the bulk of the user and system settings and data are restored. The remainder of the steps are common post-installation tasks that I do for nearly every new Slackware installation, regardless of how I upgrade.

1. Create an initrd
Run /usr/share/mkinitrd/mkinitrd_command_generator.sh, then run the command that is generated. Edit lilo.conf so I can boot the generic kernel and my LFS installation.

2. Create my non-root user(s)
As root, I either use the adduser script, or I start X windows (using TWM, which is a dead simple WM, but has little overhead and doesn’t load a lot of processes) and use kuser to create my non-root users and assign them to groups. Be sure to check CHANGES_AND_HINTS.TXT to see if your users need to be part of any specific groups.

3. Copy over many (but not all) the data from my root and non-root users' home directories.
Log in as each non-root user and copy the data and configuration files (which are usually hidden) from the /home/old-USER to /home/USER directories. Although I’m not sure how much it matters, I prefer to stay out of X while doing this. Midnight Commander is a great tool for doing the copying from one directory to the other. I keep my /home/old_USER directories around for a while just in case I want or need a particular hidden file from the previous installation at a later date.

4. Install my custom console keymap.
First I copy my backed-up custom keymap (emacs3.map.gz) into the directory:

/usr/share/kbd/keymaps/i386/qwerty/

Then I copy my backed-up rc.keymap (that loads the custom key map) to /etc/rc.d/rc.keymap. Make sure that it’s executable.

Everything after this point is the basic post-installation routine that I’ve developed over time.

5. Install Wicd.
I use Wicd on my laptop. I may try Network Manager with Slackware 14, but I’m very happy with Wicd and am reluctant to change.

6. Use Slackpkg to get the latest updates.
By the time I install the latest version of Slackware, there are usually a few updates. Slackpkg makes quick work of getting and installing the latest updates after I’ve configured it to use a good repository for the proper Slackware version.

7. Install Sbopkg
Now is as good a time as any to install Sbopkg and set it up. There are some common software packages I like to build fresh each time I upgrade — especially the Nvidia drivers.

7. Video Setup Tasks
On my desktop computer, I install the Nvidia drivers using the SlackBuilds for them via Sbopkg.

With the upgrade to 13.37, KDE would not start on my laptop. As usual, CHANGES_AND_HINTS had the answer: I had to follow the instructions in to disable compositing with the correct LILO switch. I’m not sure if that will be needed with the latest version X in Slackware 14.

8. Setup the temperature, fan, and cpu sensors.
Run as root, 'sensors-detect'. The results gave me information on the type of drive to use.

This was the important part of that test.

Code:

Do you want to probe the I2C/SMBus adapters now? (YES/no): yes
Using driver `i2c-piix4' for device 0000:00:07.3: Intel 82371AB PIIX4 ACPI
Module i2c-dev loaded successfully.

I added that driver to my rc.local:

Code:

#!/bin/sh
#
# /etc/rc.d/rc.local:  Local system initialization script.
#
# Put any local startup commands in here.  Also, if you have
# anything that needs to be run at shutdown time you can
# make an /etc/rc.d/rc.local_shutdown script and put those
# commands in there.

# This clears the /tmp directory.
rm -R -f /tmp/*

# This is loads the module for temp. sensors.
modprobe i2c-piix4

Notice, I also clear out the /tmp directory.

9. Setup the firewall
The best way I’ve found to tackle this task is with Alien BOB’s firewall generator: http://www.slackware.com/~alien/efg/

10. Standard KDE preferences configuration
I disable Nepomuk, Akonadi, and Strigi using these instructions: (http://www.my-guides.net/en/guides/l...konadi-in-kde4)

With that done, KDE 4.x runs smoothly and quickly on my Pentium III laptop.

11. Install extra software
This is the realm of personal preference. Many of these packages I get from Slackbuilds.org. Others I get from Alien Bob’s or Robby Workman’s repositories. All Slackware users really owe Robby, Eric, Chess, and others a deep debt of gratitude for not only contributing to Slackware, but also maintaining all the extras. The following are what I consider essential packages:
  • Corefonts package (be sure to run fc-cache -f after installing it)
  • IcedTea/OpenJDK
  • Clamav
  • VLC (AlienBob’s unrestricted)
  • LibreOffice (Alien Bob or SlackBuild)
  • Tint2
  • Dosbox

12. Correct the documentation of coreutils
Replace fileutils, sh-utils, and textutils to coreutils in /usr/info/dir

13. Setup the IBM scroll button
Created /etc/X11/xorg.conf.d/20-thinkpad.conf based on the instructions at thinkwiki.org.

14. Set caps lock as a control key in WMs/DEs other than KDE
I sometimes have need of a very light-weight window manager. However, only KDE has a system setting for setting caps lock as another control key. So I cobbled together a very small script that I can run to get that setting no matter what WM I use:

Code:

#!/bin/bash
#caps_lock-to-ctrl_key.sh

/usr/bin/setxkbmap -option "ctrl:nocaps"

15. Fix the problem in XFCE where it shows the default icon for files and folders.
The fix is to specify an icon theme in the file, ~/.gtkrc-2.0. For example to use the Tango icon theme add a line:
gtk-icon-theme-name = "Tango"
to ~/.gtkrc-2.0 (just create the file if it does not exist).

More info on the issue is here.

I don’t know if this is a problem with the version of XFCE in Slackware 14.

That's it in a (somewhat large) nutshell. There are probably some steps that I missed, but I think these are the major ones. I hope this post is helpful.

Regards,

mostlyharmless 01-14-2013 05:21 PM

Helpful, maybe should be a sticky

TobiSGD 01-14-2013 05:33 PM

I disagree, this rather should be either in the LQ Wiki or in the SlackDocs.
Nice work, by the way.

Lufbery 01-14-2013 09:16 PM

I'm glad you two found this helpful.

Tobi, by SlackDocs, do you mean the Slackware Documentation Project?

TobiSGD 01-14-2013 09:47 PM

Exactly.

brianL 01-15-2013 04:03 AM

Quote:

Originally Posted by TobiSGD (Post 4870062)
this rather should be either in the LQ Wiki or in the SlackDocs.
Nice work, by the way.

Agree. Definitely SlackDoc material.

Lufbery 01-15-2013 07:44 AM

Got it.

I'll head over to Slackdocs and contribute this.

It's funny. The original post started out as brief notes I took during my last upgrade. Then I thought I should add some explanatory text. By the time I was done, I had a little over 2,000 words -- nearly the same length as the magazine articles I write.

Regards,

brianL 01-15-2013 08:57 AM

Some of the stuff might already be covered by howtos or articles on SlackDocs.

mina86 01-16-2013 03:59 AM

In case of user configuration files, the easiest is to keep them in a repository somewhere. I have mine at http://github.com/mina86/dot-files, With that, restoring my local configuration or adding it on other computers is a breeze.

Personally though, I hardly ever do anything other than “upgradepkg */*.t?z” followed by looking at the “find /etc -name \*.new” files.


All times are GMT -5. The time now is 05:01 AM.