#[SOLVED] Migrate from dual boot with EFI from windows to single boot arch install

397 messages · Page 1 of 1 (latest)

split vine
#

My school laptop died just a few hours ago, and I am looking for a little help with making my install work on an older thinkpad my dad had lying around as I can't get my own laptop fixed before my exams.

I have tried looking into how to make a new EFI partition on the drive where my linux installation is, but I am very afraid of actually executing any commands and ruining something as I really don't want to lose my files on the drive.

My system was a dual boot arch and windows 11 system, with two separate drives where I had GRUB installed on my windows boot partition.
Any help would be much appreciated

delicate glade
#

Are you putting the arch drive from the school laptop into the thinkpad? My first suggestion would be to backup what you need to keep.

Assuming you're putting the linux drive in the thinkpad, you will likely need to resize [one of, if not the only] partition(s) to create an efi partition which can cause loss of data even if you take all appropriate precautions. Then you could create an efi partition, copy your bootfiles from the old EFI to the new EFI, chroot, install a bootloader and profit

split vine
#

What is the risk of losing files if i resize the home partition?

delicate glade
split vine
#

I was just think high vs low

delicate glade
split vine
#

I am willing to risk it as what i need the most is just a working computer rn

#

I realize that i dont remember if i made a seperate home partition or just a root partition

#

If that matters much

#

I would guess that i could find out with fdisk once i am connected to the system

#

Am currently driving out to get a usb stick for a linux install to use for partitioning the drive

near parcel
#

you can try chrooting into the system with a live usb and installing grub from there

split vine
near parcel
#

no, i can go through it no worries at all

split vine
#

After I have everything ready ofc

split vine
#

Thanks

split vine
#

I now have my arch install usb media ready

split vine
near parcel
#

yes

split vine
#

I just choose arch linux install option (the most upper option)

near parcel
#

yes

#

then when you boot you can check the partitions on your computer drive by running fdisk -l

split vine
#

I am now in root@archiso

#

I just fdisk from here

#

I seem to have the partitions Linux swap, and Linux filesystem

#

I can send a picture with my phone if that would help

#

Now I would assume that I have to resize the Linux filesystem partition to make room for the EFI partition?

near parcel
#

hm ok since you don't have an efi partition we can't just chroot into the system directly

#

we just need to make it ourselves

#

we are working on the nvme right? just to make absolute sure

split vine
#

yes

#

there is only the nvme and the usb in the laptop

near parcel
#

okay. run cfdisk /dev/nvme0n1

split vine
#

i removed the origional ssd as a precaution

#

Yes

#

sry was finding where the forwardspace key was on english locale (am scandinavian)

#

I see the menu and the resize option

#

Do I just hit enter on resize?

#

to be sure

near parcel
#

hold on 1 sec

#

okay so for safety's sake what we are going to do is resize swap

split vine
#

of course

#

thats fine

#

i made it way bigger than needed originally

near parcel
#

you can thank yourself for that. resizing the system partition could cause data loss if done improperly

split vine
#

Thank god I way overkilled out of caution

#

guess it helps to be paranoid sometimes

near parcel
#

anyway, since it's efi we only really need like 512mb ish

split vine
#

is it ok if i take more?

#

like 1g

near parcel
#

but for simplicity's sake do 1gb less than the size

#

yeah

split vine
#

i've heard that can be usefull later on

#

ok

#

I just hit enter with swap and resize highlighted right?

near parcel
#

yep

#

it will ask you for the new size and just do 1gb less

split vine
#

new size 39G

#

right?

near parcel
#

yup

split vine
#

1G free space now

#

i select new now?

near parcel
#

as expected. now you press enter with new selected

split vine
#

and enter again on 1G

near parcel
#

yes, no need to leave free unpartitioned space on the drive

split vine
#

write?

near parcel
#

it will make it and have linux filesystem as size

#

no

#

not yet

#

we wanna go to type

#

and change it to efi system, the very first one

split vine
#

EFI

#

now thats done

near parcel
#

after you do that it will show efi system on the left and we can then we can write

split vine
#

perfect

#

done writing it to the disk

near parcel
#

now we format the partition to exfat

split vine
#

still with cfdisk?

near parcel
#

nope

#

after you write it will go back to the terminal

#

which is what we want

#

can you run fdisk -l again

#

it will show the new efi partition under the other ones

split vine
#

yup

near parcel
#

we need to get the write path for it

#

is it /dev/nvme0n1p3?

split vine
#

exactly that

near parcel
#

okay so next command is: mkfs.fat -F 32 /dev/nvme0n1p3

split vine
#

done

near parcel
#

good! now we can mount the drives and chroot to the system

#

mount /dev/nvme0n1p2 /mnt

#

mount /dev/nmve0n1p3 /mnt/boot

#

swapon /dev/nvme0n1p1

split vine
near parcel
#

yes all of them

split vine
#

swapon failed

#

invalid argument

near parcel
#

weird

#

maybe what we can do for safety's sake is remake the swap partition as well

split vine
#

maybe cause i've already used the system before and turned swap on?

near parcel
#

umount -R /mnt

near parcel
#

i can't say for sure because i've never had swap

split vine
#

ok

near parcel
#

i have 32gb of ram so figured i wouldn't ever run out basically lol

split vine
#

haha

near parcel
#

yes let's unmount and go back to cfdisk

split vine
#

makes sense

split vine
near parcel
#

note that the command is umount not unmount

#

i sometimes get that one wrong myself

split vine
#

Done

#

now in cfdisk

near parcel
#

delete swap and then do new and make it the entire free space again

#

then change it's type to linux swap

split vine
#

ok

near parcel
#

after that you can write and try to mount the partitions again

split vine
#

does it have something to do with this?

near parcel
#

no, it's just another way to make it rather than using cfdisk

split vine
#

I see

near parcel
#

anyways, i don't know what the new paths will be so run fdisk -l again

split vine
#

its now back to linux swap

#

write and quit now?

near parcel
#

yeah

#

then you can run
mount /dev/whatevertheFILESYSTEMis /mnt
mount /dev/whateverEFIis /mnt/boot
swapon /dev/whateverSWAPis

split vine
#

failed again

#

same error

near parcel
#

my lack of experience with swap betrays me

#

one sec ill find out

split vine
#

should i just try for completions sake mkswap?

near parcel
#

you would need to delete the partition again on cfdisk i think

#

oh no you wont

#

sure go for it

#

mkswap /dev/whateverSWAPis

split vine
#

ok

#

swapon works now

near parcel
#

nice

#

did you also mount the other 2 partitions?

split vine
#

yes

#

can check again

near parcel
#

okay we can move on

split vine
#

swapon --show shows the swap

#

just fine

near parcel
#

nice

#

let's generate the new fstab for the repartitioned drive

#

genfstab -U /mnt >> /mnt/etc/fstab

split vine
#

just before that

#

where do I see the mount points?

#

lsblk

#

found it

#

it seems fine

pulsar oasis
near parcel
#

indeed, now i know

split vine
#

help is always welcome

near parcel
#

thanks @pulsar oasis 🙂

abstract cryptBOT
#

neveralegend received a thank you cookie!

near parcel
#

did you manage to generate the new fstab?

split vine
#

thanks @near parcel

abstract cryptBOT
#

neveralegend received a thank you cookie!

split vine
#

thanks @near parcel

abstract cryptBOT
#

You're thanking too much ó_ò

split vine
#

damn

split vine
near parcel
#

okay now we can do: arch-chroot /mnt

split vine
#

done

#

It looks a bit different now

#

in /

near parcel
#

yeah, you are now in your arch linux system again

split vine
#

so can i just reboot?

near parcel
#

we just need to get grub working and you'll be set

#

nope not yet

split vine
#

like normal?

#

ok

near parcel
#

since you had grub before you probably already have grub and efibootmgr installed i think

split vine
#

hmm?

#

I thought it was installed into the windows boot manager?

#

how can I check to be sure?

near parcel
#

yes but for you to somehow install into the windows boot manager you would need the package installed in your linux system first

split vine
#

I guess just grub --version to be sure

near parcel
#

you can check with pacman -Q grub efibootmgr

split vine
#

yup

#

i have those

near parcel
#

okay so we should smooth sail from here

#

first is there a boot folder when you run ls

#

just to make sure

split vine
#

yes

near parcel
#

okay nice

#

try running
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

split vine
#

in one line?

near parcel
#

yep all of that in one line

split vine
#

finished with no errors

near parcel
#

great

#

last command now

#

grub-mkconfig -o /boot/grub/grub.cfg

split vine
#

done it says

near parcel
#

now you can control d to get out of chroot

#

then just run reboot and you should be set

split vine
#

i've noticed that even thoughi chrooted into my system my locale didn't change

#

is that a problem?

near parcel
#

i don't think so

#

even though you chrooted i think that it sticks to what the live usb was set to

#

it means that the ttys in your system will probably be in the wrong locale though

split vine
#

i can only see UEFI Firmware Settings

#

that doesn't seem good

near parcel
#

wait so grub booted and it doesn't show arch?

split vine
#

exactly

near parcel
#

is there an additional thing that you can go into?

split vine
#

nope

near parcel
#

weird since we made the config with grub-mkconfig -o /boot/grub/grub.cfg

#

well boot back into the live usb

split vine
split vine
near parcel
#

once it's booted just mount again, with the same commands as before

#

this time what we will do is
cat /boot/grub/grub.cfg

split vine
near parcel
#

first do the
mount /dev/blablabla /mnt
mount /dev/blablabla /mnt/boot and swapon /dev/blablalba

#

then arch-chroot /mnt

split vine
#

ok

near parcel
#

then cat /boot/grub/grub.cfg

split vine
#

thats a lot of words

#

do i just send a picture?

near parcel
#

yeah

split vine
near parcel
#

you were using the linux kernel right?

#

not sure why it mkconfig wouldn't just work

#

you can go into /home/user and see your files like normal right?

split vine
split vine
#

yup

#

i see all my stuff

#

music maple2023 spotify

#

all the stuff that isn't pre-installed

near parcel
#

i mean you can try running it again and seeing if it changes anything

#

grub-mkconfig -o /boot/grub/grub.cfg by the way

split vine
#

yup

#

gonna do that

#

i the mean time i just found this issue that seems similar

#

i dont think it worked

near parcel
#

it's not finding your kernel

split vine
#

only talks about UEFI again

near parcel
#

oh i know

#

run this mkinitcpio -P

#

then run grub-mkconfig again

split vine
near parcel
#

okay so let's reinstall the kernel

#

first we need to connect to the internet

#

use iwctl

split vine
#

Before that, what does this tell you?

near parcel
#

wait maybe we need to go out of chroot first

#

you've got two different swaps that are trying to mount

#

but that doesn't make a difference for us

#

the problem is that the some of the kernel files are not being found

#

i don't even think we need to get out of chroot actually

split vine
near parcel
#

might be able to use what was in your previous system to connect to the internet

#

it's the same uid so it's just a redundancy

#

not multiple

split vine
#

also the /boot and /boot/EFI ?

near parcel
#

okay, if you are worried about that, you can rm /etc/fstab then genfstab -U /mnt >> /mnt/etc/fstab

#

that will fix the file

#

mkinitcpio wasn't able to build the kernel though, so that problem still remains

split vine
#

I mean if you say its fine ill trust you on that

near parcel
#

you can do it just to make sure it's ok

split vine
#

don't i have to leave chroot then?

near parcel
#

no no

#

i think we can maybe use whatever you had in your system to connect to wifi

#

i'll assume it was probably networkmanager

split vine
#

gimme a sec while i regen fstab

near parcel
#

go for it

split vine
#

/mnt/etc/fstab: no such file

near parcel
#

are you still in chroot?

split vine
#

yeah

#

i went out and back in

#

its done now

near parcel
#

okei, so kernel

split vine
#

ready

near parcel
#

i've never tried this in a live environment but i don't see why it wouldn't work

split vine
#

does it kill my home?

near parcel
#

try running nmtui

#

nope

#

it should come up with a thing that allows you to activate a wifi connection

split vine
#

could not contact networkmanager

near parcel
#

damn

#

try iwctl then

split vine
#

command not found

near parcel
#

okay, go out of chroot then iwctl

split vine
#

yessir

#

in

near parcel
#

first type device list

#

then you want to do
station (device) scan

#

where device will be what came out in your first command, something like wlan0

#

then finally station (device) connect (networkname)

split vine
#

should be done

#

nope

#

gimme a sec

near parcel
#

if you have symbols in your wifi password the wrong locale might be annoying

split vine
#

nope

#

just changed router recently

#

found it

#

works now

near parcel
#

nice control d to get out of iwd

#

then chroot back in

split vine
#

ping works

near parcel
#

then pacman -Sy linux linux-headers

split vine
#

sudo?

near parcel
#

you are logged into root

#

so shouldn't need it

split vine
#

ah

#

creating initcpio image

near parcel
#

nice

#

after that generating the grub config should do it

split vine
#

image gen succesful

near parcel
#

perfect

split vine
#

i am guessing grubcfg gets a second go?

near parcel
#

yep

split vine
#

nope

#

error mkdir /var/lock/dmraid

#

found linux image and initrd omage though

#

so thats something

near parcel
#

are you arch-chrooted or chrooted?

split vine
#

arch-chrooted i think

#

someone says to just reinstall grub for safety

near parcel
#

sure you can do that

#

same command as before

#

it will add another efi entry to bios though

split vine
#

huh

#

lets not then

near parcel
#

try running it again just to see if it was a one-off?

split vine
#

sure

near parcel
#

same error?

split vine
#

no error

near parcel
#

oh?

split vine
#

still only uefi

#

i can try to reboot to be sure though?

near parcel
#

didn't you say it detected linux image though?

split vine
#

it does

#

no

#

actually

#

just says it finds them

near parcel
#

maybe that's all it outputs to console? try rebooting let's check if it's there

split vine
#

guess ill just reboot and see

#

AYYYYY

#

were in

near parcel
#

did everything load right?

split vine
#

it just crashed?

near parcel
#

oh

split vine
#

i saw my firefox load my last tabs though

near parcel
#

wdym it just crashed though

split vine
#

it just immidiatly went black after firefox launched

#

i just rebooted it now it seems fine

near parcel
#

video drivers?

split vine
#

closed firefox before it loaded to be sure

split vine
#

everythink looks visually fine?

near parcel
#

maybe a one-off again?

split vine
#

maybe

#

its an old pc

near parcel
#

anyways the system is now working so whatever comes next doesn't need the live usb to fix

#

and it means your files are safe and sound 🙂

split vine
#

thank you so much!

#

just to be safe

#

would yay be enough for the system to update drivers and stuff to this "new" pc?

near parcel
#

so linux has basic drivers for most of the stuff that you plug in directly on the kernel

#

video drivers is one exception that i know of

split vine
#

but thats only nvidia right?

near parcel
#

if this new pc is a different brand of graphics you will need new drivers

#

no

#

it's all video drivers

split vine
#

hmm

#

the last one also had intel graphics

#

wouldn't that be fine as is then?

near parcel
#

if it's the same brand it's ok

#

and intel only has one driver package anyway

#

so you should be fine

#

should be able to pacman -Syu and yay -Syu to update stuff when you need to

split vine
#

doesn't yay default to -Syu?

near parcel
#

oh yeah it does

#

i never knew that

split vine
#

thanks @near parcel

abstract cryptBOT
#

luigiarc received a thank you cookie!

near parcel
#

anyway, i think we can probably mark this as solved

split vine
#

Yup

near parcel
#

... solved

woeful zodiacBOT
#

#9742 📣 If there is nothing else that we can do for you, please close this thread by adding "[SOLVED]" to the title.

  • You can do this on desktop by clicking the three dots on the top right of the page, and pressing "Edit Post".
  • You can also do this on Android / iOS by long tapping your post in the text channel list, and tapping "Edit Post".

Your title should be like so: https://cdn.discordapp.com/attachments/503224329191030787/1039841700417384498/image.png
Thank you

split vine
#

Thank you so much btw

#

you saved my school life just now

near parcel
#

no worries i love to help

split vine
#

You are fucking awsome

#

have the greatest day!

#

the best support i've ever had