I was in the process of setting up a laptop to run Linux Mint Cinnamon 17.3. As described in a previous post, I had just completed the task of setting up a dual-boot installation with Windows 7. This post describes various efforts I made in the next step, which was to bring over the user settings that I had already configured on another machine, where I had installed the Xfce flavor of Mint.
Through multiple sessions of trial and error, I became familiar with certain issues that could arise in this process. First, comments suggested that it would not be practicable to simply copy many of the files and folders from the Xfce machine to this Cinnamon machine — that I would screw up the system if I tried. I had achieved some success with that sort of effort regarding files and folders in the /home directory, and package lists assembled by the Synaptic Package Manager, but a different approach would evidently be required for other things that one might wish to copy over.
Trying the Mint Backup Tool and Aptik
I found a somewhat better solution in the approach recommended in a Linux Mint community tutorial, involving the Backup Tool in Mint. The backup steps I used in that effort were as follows:
- Start > All > Backup Tool > Backup files > Source = Other: Home > Destination = external USB drive > Advanced Options > Description = your name for the backup, Output = .tar.gz file, check all except “Follow symlinks” > Forward > Forward > Apply. That resulted in “The backup completed successfully.”
- Start > All > Backup Tool > Backup software selection > Destination = external USB drive > Forward > Select all > Apply. That resulted in “Your software selection was backed up succesfully [sic].” Taskbar > File Manager confirmed that the external USB drive contained a backup .tar.gz file and a software_selection package.list file. (The archive format evidently protected certain Linux file information, in case the external USB drive or any other storage site along the way happened to be formatted for Windows.)
- Using the File Manager in the Xfce machine, I also copied the sources.list file and the sources.list.d folder from the /etc/apt folder. (I would have to use Ctrl-H to make sure I was viewing and copying hidden items where needed.)
The restore steps were similar, as detailed in that tutorial. But I was impressed with the more thorough results achieved by Aptik. As advised by a How-To Geek webpage, I installed Aptik on the Xfce machine with these commands in Terminal:
sudo apt-add-repository -y ppa:teejee2008/ppa sudo apt-get update sudo apt-get install aptik
With that done, I went to Start > System > System Migration Utility. That’s what they called Aptik in Xfce. Aptik indicated a willingness to back up Software Sources, Downloaded Packages, Installed Software, Themes and Icons, Filesystem Mounts, Users and Groups, Application Settings, Home Directory Data, and Schedule Tasks.
At the top, Aptik asked for a Backup Directory. For some reason, Aptik’s left panel was not displaying the name of a USB drive that was plainly visible to the Xfce File Manager, and it was also not providing the drop-down list offering various backup locations that Geek promised. But Aptik did recognize a SDHC card that I plugged in. Unfortunately, it was formatted as NTFS, and thus would probably lose or screw up some Linux details. I reformatted the USB drive as ext4, using GParted there on the Xfce machine, and then Aptik did recognize it, mounted in the /media/[user] folder.
I selected the One-Click Backup option at the bottom and Aptik ran. I could see pretty quickly that it was copying packages, not just package names, so this was quite different from the approaches I had tried previously. It took less than ten minutes to make a backup filling about 900MB of disk space.
I had to take the same steps to install Aptik on the Cinnamon machine, and then I ran it via Start > Administration > Aptik. I selected the USB drive as the Backup Directory, same as when I had created the backup, and then hit One-Click Restore. That worked: I had a working copy of the Xfce user account on the Cinnamon machine.
Can’t Easily Rename or Clone Users
Unfortunately, there was a problem. The username that Aptik had backed up, on the Xfce machine, was m1210 — an odd user name, admittedly. This was not the name of the user that I wanted to be using on the Cinnamon machine. There, the desired user was ray. So Aptik had given me a new user named m1210 on the Cinnamon machine, because that was the name of the only user on the Xfce machine. So there were questions of how to rename, clone, and delete various users on the two machines.
In experimenting with such tasks, I managed to waste a fair amount of time, and make a good mess of my Cinnamon installation. My confused and sometimes mistaken steps included these:
- Discover that the Mint login screen might not show the names of all available users for possible login.
- Go into Start > Administration > Users and Groups. Find that it could not delete user m1210. Fail to realize that this could be because m1210 was still logged in — which incomprehension was based, in turn, on the failure to understand that switching users was not the same as logging out of one and into the other.
- Use “sudo deluser m1210 –remove-home” to delete user m1210, as advised by TecAdmin. Discover that this produced an error: “user m1210 is currently used by process 14614.” I tried “sudo kill -9 14614.” That seemed to work, but now a repeat of the deluser command yielded a new process ID (PID): “user m1210 is currently used by process 14624.” And so forth, several times, still not realizing that this might have been because user 1210 was still logged in.
- Use extraordinary efforts (i.e., boot a live CD and wipe out the m1210 Home folder) to kill the half-dead user that I had attempted to delete. Back in the Cinnamon installation, discover that the live CD apparently added a new user known as partimag. Use “sudo rm -d partimag” to delete that partimag folder. A retry of the deluser command, at this point, provided only a warning that “group ‘m1210’ has no more members.” I thought I had probably better delete that empty group. But then I saw that the simple “groups” command showed there was no longer an m1210 group.
Having accomplished all that, I started over. I reinstalled Cinnamon on the target machine, creating a user with the name of ray, as before. I turned to the Xfce machine, and the project of cloning its m1210 user. A search led primarily to some of the sources that had helped/confused me previously. I was surprised: there really did not seem to be a simple way of cloning a user in Linux. I wound up trying to modify the set of commands that one site suggested. My attempt was as follows:
sudo useradd newuser sudo passwd newuser sudo mkdir /home/newuser sudo cp -R --preserve /home/olduser /home/newuser cd /home/newuser sudo chown -R newuser:newuser /home/newuser
where newuser = ray and olduser = m1210 (so, for example, what I actually typed for the last line was “sudo chown -R ray:ray /home/ray”), and the passwd assigned to newuser was the password I would be using as ray on the Cinnamon machine. The “cp” command seemed especially sensitive and took the longest to execute, as it copied the contents of the /home folder.
But now I realized that, of course, just copying over the home folder would not make ray a full clone of m1210. I tested that, after completing that set of commands, by switching users, to the “ray” account, and trying to run the IrfanView icon that had been on the desktop of the m1210 user. Well, surprise: the desktop didn’t even have that icon — and the evidently messed-up /home/ray folder contained a subfolder called m1210 which, of course, did have a desktop subfolder containing an icon for IrfanView (though not the right one) — and clicking on that icon didn’t work.
Still working on the Xfce machine, I logged out of the ray account, logged back into m1210, and went to Start > System > Users and Groups. There, I deleted the ray account and all of its files. A look into File System > Home confirmed they were gone.
For a complete (or at least relatively complete) clone of a user, Aptik looked like a good solution. But could Aptik clone m1210 onto this same Xfce machine under a different user name (i.e., ray)? If that could happen, then maybe I could use Aptik again, to back up that ray account on the Xfce machine and then overwrite the newly created ray account in the new reinstallation on the Cinnamon machine.
I tried designating /home/ray as the backup directory in Aptik (i.e., Xfce machine > Start > System > System Migration Utility), but then I realized that it was going to be putting all those listed items (not just the contents of the m1210 home directory) into the ray folder. That couldn’t be right. For instance, I was pretty sure the Users and Groups entry for the m1210 account was a system-level item that did not belong in the ray folder. It seemed this wasn’t the solution.
I had already investigated the idea of restoring the m1210 user to the Cinnamon machine and then renaming that user to be ray. Possibly the first step in that process would be to go into Users and Groups on the Cinnamon machine and create a user named m1210, so that hopefully this restored data would be linked up with that existing account. Then I could delete the ray account.
Unfortunately, my previous inquiries had not made clear how, or whether, I would then be able to rename the restored m1210 account as ray. For example, a search led to a StackExchange comment indicating that efforts to rename the user were “quite likely to cause trouble” and an AskUbuntu remark that “Renaming users is not a trivial task.” As a solution that perhaps inadvertently illustrated the complexity of the task, another AskBuntu remark informed me that the user name was different from the user identity. All absolutely fascinating, but regrettably providing no solution for my need.
The Apparent Solution
The conclusion seemed to be that, if I wanted to create and configure a user on one machine, and then copy that user onto other machines via Aptik (which presently appeared to offer by far the most comprehensive solution), I had better choose the name of the original user carefully, because Aptik would faithfully reproduce that account name on any other machine, and there would be no simple way of renaming it after the fact.
That didn’t necessarily mean that the users on all of my machines would have to be ray or m1210. One option was to start with a reasonable, generic user name (e.g., “generic”), and then just log in as “generic” on any of my Linux machines. Or I could treat that generic user as the starting point on other machines: create an individualized account (e.g., “ray”) on the target machine, and then copy the partially configured home folder (and perhaps other items) from the generic account to the new individualized account. Then the generic account would be preserved for future use, either to create more individualized accounts on that machine or to provide a starter generic account on a new Linux machine. But for simplicity, I would probably just have one “ray” account on each machine, keeping images of the entire installation in case something went wrong.
I also found myself reconsidering the starting point. I had been adding my software and making other adjustments on the 32-bit Xfce laptop, and then attempting to copy them over to the 64-bit Cinnamon laptop. It occurred to me that I might just as well proceed in the other direction, making the initial setup on the Cinnamon machine. Doing so might have some advantages. For one thing, I planned to pass the configured Cinnamon setup on to a 64-bit desktop machine that would run either Cinnamon or KDE environments. The 64-bit Cinnamon installation would be closer to that desktop’s requirements than the 32-bit Xfce machine would be. There would also be just one generational copy in either direction — from Cinnamon to Xfce, and from Cinnamon to desktop — meaning less risk of generational copying errors than in the two-step copying process from Xfce to Cinnamon to desktop. Where the Cinnamon machine installed 64-bit software, presumably it would not run on the 32-bit Xfce machine; but then, in the case of some software packages (for e.g., video editing), I might never notice, because no one would ever attempt to use them on the 32-bit machine. Or if they did, they would presumably just have to replace the nonworking program with a 32-bit alternative.
It occurred to me that there was another possibility: I could run Cinnamon on both laptops. There were both 32-bit and 64-bit versions of Cinnamon. Even the little old 32-bit laptop (barely) met the system requirements of Linux Mint 17.3 Cinnamon. I had seen advice, somewhere along the way, suggesting that it was better to start with the more refined version of Mint, if possible, and revert to the more bare-bones version only if necessary. I was not sure whether it would work to take an image of an entire Cinnamon installation on one machine and restore that image to another machine. If not, Aptik would apparently be the solution, assuming the materials saved in an Aptik backup were restorable to other members of the Mint (and Ubuntu?) family. I would be exploring such issues further in another post.