Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to replicate LUKS installation 100%?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
jasu
n00b
n00b


Joined: 23 May 2022
Posts: 53

PostPosted: Sun Aug 06, 2023 3:39 pm    Post subject: How to replicate LUKS installation 100%? Reply with quote

Hi,

So I managed to somehow make my drive unbootable by removing it an inserting it back. Apparently my laptop has some secure features that make it unbootable if removed...(?)

Anyways the drive has following partitions
Code:

nvme1n1
    nvme1n1p1 <-- boot
    nvme1n1p2 <-- swap
    nvme1n1p3 <-- LUKS encrypted home
    nvme1n1p4 <-- LUKS encrypted partition



I plugged the M.2 drive to my PC which thankfully had second M.2 slot. I could mount the drive and I have 1TB of free storage on my HDD which could handle the 1TB SSD drive from the laptop.

Now, which would be the easiest way to duplicate the previous installation? It seems that I cannot install the M.2 to the laptop and do a clean install and then clone every bit since it would probably make it unbootable again. I also can't do an installation and then just copy everything since the GUIDs would have changed(?)...

I am fine even if I have to do a clean installation.. I guess I would save the most time if I just copy home after installation and copy /etc/portage...

Is there something else that I should take into account? I have not cloned an OS before and certainly not an encrypted one.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sun Aug 06, 2023 5:09 pm    Post subject: Reply with quote

jasu,

To make a complete bit image of the drive, use dd.

If you want to do a new install, the GUIDs of the partitions can be preserved. I'm less sure about the UUIDs of the filesystems.
A drive image will be encrypted, just like the original

Do you have a link to your laptop manual?
That security feature is new to me.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jasu
n00b
n00b


Joined: 23 May 2022
Posts: 53

PostPosted: Sun Aug 06, 2023 5:31 pm    Post subject: Reply with quote

Thank you, I'll try and see what happens.

It's this one: https://www.hp.com/us-en/shop/pdp/hp-dragonfly-folio-notebook-pc-customizable-5a2n1av-mb

Apparently it has some tamper lock: https://h20195.www2.hp.com/v2/getpdf.aspx/4AA7-8167ENW.pdf

But I don't know if that is the issue..
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21706

PostPosted: Sun Aug 06, 2023 5:34 pm    Post subject: Reply with quote

What did you see that leads you to believe the drive is unusable in the laptop now that it was removed? You seem to believe that you can rebuild the drive's contents from the desktop, then put it back in the laptop, and expect it to work. Is that so? If yes, why do you think it will work after the rebuild, but not before?

If I had to guess, I would suspect this is not a security feature, but an annoying firmware behavior I have seen referenced in other forum posts. Specifically, some firmware will "helpfully" delete all boot entries that are hosted on non-present drives. If this happened to you, then your boot entry would be forgotten if you started the laptop without the drive. Inserting the drive and regenerating the boot entry would be sufficient to recover from this. No reinstall would be needed.

Cloning an encrypted system is not meaningfully different, because in most cases you don't want to clone it bit-for-bit. If you approach this as filesystem level cloning, then the encryption is out of sight of the cloning tool.
Back to top
View user's profile Send private message
jasu
n00b
n00b


Joined: 23 May 2022
Posts: 53

PostPosted: Sun Aug 06, 2023 5:40 pm    Post subject: Reply with quote

I was thinking about cloning everything else except /boot.

That sounds extremely promising. Umm.. How I exactly would regenerate a boot entry?

I just remember that I also used rEFInd but that is probably not related to this.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54300
Location: 56N 3W

PostPosted: Sun Aug 06, 2023 6:22 pm    Post subject: Reply with quote

jasu,

If you can get into the firmware settings, it will show you a list of boot options that it know about.
As Hu says, Gentoo may have been removed, so the system cannot boot.

You recreate it , if that's the problem, just as you did when you installed first.

Boot your install media
Do NOT make partitions or filesystems. That would destroy your install.
Mount your partitions
Mount /sys /proc /dev and the other bits and pieces as per the handbook.
Do the chroot steps,

You are now in your own install on top of the boot media kernel and services.

Rewrite your boot entry, just as you did when you installed.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
jasu
n00b
n00b


Joined: 23 May 2022
Posts: 53

PostPosted: Sun Aug 06, 2023 8:56 pm    Post subject: Reply with quote

The drive wasn't in the firmware's boot options.

Ah! I wasn't familiar with the terminology, I thought I had to do something with firmware itself. The problem was exactly that, the firmware had wiped the boot entries.... Thanks a lot both of you, You saved countless of hours and a lot of frustration
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum