this post was submitted on 19 Nov 2023
49 points (96.2% liked)

Linux

48333 readers
660 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

I have a simple wish, with a probably not so simple solution.

I recently started with linux (Arch kde), I'm loving it, I quickly realized that this OS and almost all apps, are highly customizable, I'm laving that as well. My problem is the unavoidable reinstalls and that I have a laptop.

Is there any way that I can save all my configs, apps and my apps' configs, and transfer them over to my laptop, while almost having a very quick back-up. I realize that I could turn it into an ISO somehow, but that wouldn't work (I think) because my laptop has vastly different hardware. I also realize the partitioning problem. So in my idealistic world, there should be a solution that requires a clean install (from scripts or manual) and some .sh file, that installs all my apps, pastes all my configs and reboots.

So is this possible? and if yes, how should I go about this? did someone make a tool for this already? Or(!) can I burn it to a flash and the drivers will correct themselves/I'll deal with them later?

For final words I'd like to say that I'm far from finished configurating, but I'd like to know the proccess, to not shoot myself in the foot somewhere along the way of configing, thanks!

you are viewing a single comment's thread
view the rest of the comments
[–] bizdelnick@lemmy.ml 32 points 1 year ago (3 children)

Reinstall? Why?

Create a separate partition for /home and don't format it when reinstalling, so you will keep all your stuff.

[–] lemmy_user_838586@lemmy.ml 11 points 1 year ago (2 children)

This is the way, I've kept a 7 year old install going this way, through 3 laptops and even LUKS encryption.

[–] 30p87@feddit.de 2 points 1 year ago

I just copied my whole root partition to a new Laptop over netcat. It still has close hardware (Intel CPU, no extra GPU, etc.), but some differences in interfaces etc.

Things one might have to consider:

  • /etc/fstab will need to be redone
  • All interfaces changed, so network configs may need to be updated
  • Other programs relying on hardware or paths that don't exist anymore need to be updated (eg. conky did not work due to i8k being not supported, other interface ids etc.)

But literally nothing that would break anything. Because Arch is usually installed manually, one knows what needs to be cared for, what could break or could cause certain issues.

[–] reminder9754@techhub.social 1 points 1 year ago (1 children)
[–] UnRelatedBurner@sh.itjust.works 5 points 1 year ago (1 children)

Analyzing your comment in a different light. What your saying is if I copy my /home (someone said /etc too) over to my laptop, and back it up as well, I'm golden?

would different hostnames and usernames make a problem? As far as my knowledge goes it won't as long as I also bring /etc over, but I have no Idea if /etc is connected to something deeper or not.

And also also, might seem like a dumb question but I had to edit a file to automount my other disks at startup, won't it like break everything if my system only gets /home after boot or something? Caz I have enought free space to copy over my existing /home, delete it, partition, and mount it back. What'd the benefits and dangers be?

[–] lemmyvore@feddit.nl 13 points 1 year ago (1 children)

if I copy my /home (someone said /etc too) over to my laptop, and back it up as well, I'm golden?

/home yes., but ideally only files and dirs starting with a dot (so called "dotfiles" under your home dir. tar cvfa homedots.tar.gz /home/username/.??* should take care of it.

Please note it will include some large stuff that's probably not needed, like .cache, or some individual caches for other apps that don't use .cache, like the browsers.

Don't copy /etc, it's usually machine-specific.

would different hostnames and usernames make a problem?

Hostname no (if you don't bring etc). Username technically yes, you may want to rename the home dir. The user id and group id are important too but usually off it's the first user on the same distro it will receive the same ids (typically 1000 nowadays). If not, you can change that manually and recursively chown 1000:1000 -r /home/username.

[–] UnRelatedBurner@sh.itjust.works 2 points 1 year ago (1 children)

I'd love to upvote you multiple times, you cleared it up for me. Thank you.

[–] lemmyvore@feddit.nl 4 points 1 year ago

You're welcome.

To clarify, /etc can have things that are relevant for the machine so you may want to back it up, but it's not usually transferrable directly to another machine because it probably doesn't play the exact same role. It has things like service configs, network configs etc.

Even if you're trying to migrate a machine to new hardware and the machine will play the same role it's best to pick and choose files from /etc/ on a case by case basis. What I do is grab a tarball of /etc and set it aside, then if I need to redo something the same way it was on the old machine I can dig through the tarball and only use the relevant files.

Like I said it's extremely specific. For example if I want to reconfigure the SSH daemon that's usually a couple of lines which I know by heart (turn root login and password logins off) which I can do by hand; if I want to reconfigure CUPS printing it's best to use the CUPS admin interface to autodetect the printer, you don't usually want to mess with its config files; for some things like /etc/fstab or NFS or RAID I may want to copy some stuff but edit the disk UUIDs; for some things like Samba I could in theory copy the config straight over. It varies.

The list of installed packages may also be relevant when you migrate to a new machine. Different distros have different commands for obtaining a list of installed packages, and different ways of using that on the new machine to restore the same package selection. This is useful and typically can get you started much faster on the new machine.

[–] nous@programming.dev 2 points 1 year ago

You dont even need a separate partition, just dont format and dont delete the /home folder. You can even keep the /etc folder as well to keep system wide settings.