[Sorry about breaking the thread structure - I read this group
via Usenet and e-mail replies.]

On Mon Dec  9 20:53:54 2024 David Wright <deb...@lionunicorn.co.uk> wrote:

> On Mon 09 Dec 2024 at 15:23:18 (-0800), Charlie Gibbs wrote:
>
>> Some of you may recall my account of trying to install a new disk (in
>> my case a 1TB NVMe stick) for use as a boot device.  There has been
>> another thread or two from other people dealing with the same issue,
>> so it seems to be a hot topic.
>>
>> I'm still unwilling to give up all my installed packages and
>> customizations and rebuild the system from scratch, when all I want
>> to do is copy existing directories to a new boot drive.  My own data
>> files all live in /home, a separate partition - no problem there.
>> But many binaries have been installed in places like /usr/bin; their
>> configuration files may or may not be in /home, but I'd rather not
>> lose them wherever they are.
>
> Why "But …"? Aren't most binaries (those that users run, anyway)
> installed in /usr/bin/.

Yes - and since I have a copy of the old /usr/bin, I should be able
to retain them by simply copying the old /usr over the new one,
rather than having to re-install them one by one.

>> Here's the process I've been trying so far:
>>
>> 1. Do a network install on the new drive; to be really belt-and-
>> suspenders, make sure everything is completely updated:
>>     sudo apt update
>>     sudo apt upgrade
>>
>> 2. Re-boot from the original drive and update everything:
>>     sudo apt update
>>     sudo apt upgrade
>> At this point the old and new systems' root partitions should be
>> as alike as possible, aside from my own customizations.
>
> At that point, I would compare sorted versions of /etc/passwd
> and /etc/group from both machines to make sure that they have
> matching lists of user/group names. (The numeric IDs can be
> different.) Otherwise rsync could mistranslate ownerships.

Good point.  I'll check out those files.

>> 3. Mount the new drive's root partition somewhere that I can access
>> from the original drive:
>>     sudo mount /dev/nvme0n1p2 /mnt/backup
>>
>> 4. Save the new system's /etc/fstab:
>>     sudo cp -p /mnt/backup/etc/fstab ~
>>
>> 5. Copy directories from the original drive to the new drive:
>>     sudo rsync -av /bin   /mnt/backup
>>     sudo rsync -av /etc   /mnt/backup
>>     sudo rsync -av /lib   /mnt/backup
>>     sudo rsync -av /lib64 /mnt/backup
>>     sudo rsync -av /opt   /mnt/backup
>>     sudo rsync -av /sbin  /mnt/backup
>>     sudo rsync -av /usr   /mnt/backup
>>     sudo rsync -av /var   /mnt/backup
>>     sudo rsync -av /home  /mnt/backup
>>
>> 6. Restore the new drive's /etc/fstab:
>>     sudo cp -p ~/etc/fstab /mnt/backup/etc
>                   ↑↑↑↑↑↑↑↑↑
> Where did that file come from? Not step 4.

Oops!  My bad.  That should be
    sudo cp -p ~/fstab /mnt/backup/etc
I'll try it again with the corrected command.

>> 7. Re-boot from the new drive and cross your fingers.
>>
>> The system comes up with an xfce login window, but I can't log in
>> using my regular user ID.  Sometimes the screen just goes black,
>> then after a couple of seconds re-displays a blank login screen.
>> Lately, though, I've been getting a window with the message:
>>     Xsession: warning: unable to write to /tmp;
>>     X session may exit with an error.
>> Clicking on "okay" makes the screen goes black; after a
>> couple of seconds it then returns to an empty login screen.
>> However, I can log in as root, which suggests some sort
>> of permissions issue, but it doesn't seem to be with /tmp:
>>
>> drwxrwxrwt  12 root root  4096 Dec  9 11:58 tmp
>>
>> To further muddy the waters, I can SSH in from another machine
>> using my regular user ID.
>>
>> I'd like to resolve this, but if not I can always fall back to the
>> original drive.  Anybody wanna buy a lightly used 1TB NVMe SSD?
>
> I've never used DMs and DEs. Do they squirrel away anything
> with ownerships attached (either by name or number) that might
> be mistranslated, seeing as your two disks likely have different
> ideas on the matter.

I don't know, but it seems like a good place to look next.

Thanks for the hints.  I'll run some more tests tomorrow and
let you know the results.  Right now it's bedtime...

--
/~\  Charlie Gibbs                  |  You can't save the earth
\ /  <cgibbs@kltpzyxm.invalid>      |  unless you're willing to
 X   I'm really at ac.dekanfrus     |  make other people sacrifice.
/ \  if you read it the right way.  |    -- Dogbert the green consultant

Reply via email to