[SOLVED]Migrating Mageia4 to new laptop, But initrd won't

This forum is dedicated to basic help and support :

Ask here your questions about basic installation and usage of Mageia. For example you may post here all your questions about getting Mageia isos and installing it, configuring your printer, using your word processor etc.

Try to ask your questions in the right sub-forum with as much details as you can gather. the more precise the question will be, the more likely you are to get a useful answer

[SOLVED]Migrating Mageia4 to new laptop, But initrd won't

Postby jtwdyp » Jul 21st, '14, 03:26

Migrating running Mageia4 to new laptop, But initrd won't let me... It has to be the initrd because I use LABEL= not UUID= in all my {grub} menu.lst and all my fstab files. I have done so for years because I am vehemently opposed to non-human readable configuration files.

Yet after I carefully edited those files to reflect the LABELs on the new laptop. Mageia refuses to boot because it can't find some UUID based filesystem references...

My old laptop became unstable, so I bought a new one and temporarily installed a copy of PCLinuxOS I had laying around to be able to easily use:

Code: Select all
tar --numeric-owner -xzf backup-tarball.tgz restore-path


to "restore" my Linux installations to their new home. I started with my antiX installation. When it was time to try booting, it took a long time to decide it couldn't find something but let me continue to boot using the LABEL designations in the fstab on the partition identified by the LABEL designation in the menu.lst.

This took a long time, but once booted I was able to create a new initrd with update-initramfs, and now the antiX boots normally.

Next up was Mageia4. Same process. But it complains about the durned despicable UUID referenced filesystems, and drops me into a shell that doesn't even know which filesystem it was told to boot on by the kernel line in the menu.lst... Worse when I try to reboot (crl+alt+delete) or logout (exit) it becomes so unresponsive I need to use the power button to shutdown.

I also tried booting without the initrd line in the menu.lst entry. but evidently Mageia is so dependent on the initrd that booting without one leads to kernel panic...

Any suggestions {besides the clean install option} ???
Last edited by jtwdyp on Jul 22nd, '14, 03:20, edited 1 time in total.
--
JtWdyP
User avatar
jtwdyp
 
Posts: 88
Joined: Jun 10th, '13, 08:30

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby xboxboy » Jul 21st, '14, 05:42

Coling did something similar to what you're attempting I believe: http://colin.guthr.ie/2013/02/dances-with-laps/

I have never tried anything like this, I normally comit to a clean install. These days I have \home on a separate partition to make life easier though.
xboxboy
 
Posts: 400
Joined: Jun 2nd, '13, 06:41

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby jiml8 » Jul 21st, '14, 10:50

I am not sure how you did your original install...all of these issues should have been taken care of with that install. But whatever.

Boot into a live CD of any linux distro you like. Mount your drives, then mount /dev, /proc, /sys, and /tmp in the filesystem on the drives. Then chroot into the / on your hard drive, and run dracut to build a new initrd. That will work fine.

Alternatively, unzip the intramfs you currently have and manually edit it.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby jtwdyp » Jul 21st, '14, 15:18

Thanks for the quick response jim18.

jiml8 wrote:I am not sure how you did your original install...all of these issues should have been taken care of with that install. But whatever.


The original install was actually Mageia3 from a cd or dvd {can't remember which anymore} Then I used the online process from the wiki to upgrade it to Mageia4...

I also periodically use tar to back-up my Linux partitions. And as I said above, I used tar to "restore" a recent backup tarball, to it's new larger partition on a much newer laptop. Since the Mageia "installer" never saw this new laptop, it couldn't embed the correct UUID references in the initrd. And likewise the last time a kernel upgrade created a new initrd was on the old laptop.


Boot into a live CD of any linux distro you like. Mount your drives, then mount /dev, /proc, /sys, and /tmp in the filesystem on the drives. Then chroot into the / on your hard drive, and run dracut to build a new initrd. That will work fine.


I've never played with chroot... But since you said any distro, I'm thinking that dracut will use the info from the chrooted filesystem to build the initrd, and that the the fact that the PCLinuxOS live CD I have handy uses a different kernel won't affect the kernel specific initrd??

Also, I have no idea how to manually "mount" the /dev, /proc, /sys, and /tmp??

With the exception of some user mounted data partitions and the swap, I installed Mageia to a single large partition. ("/" only)

{I do use a separate, manually edited boot partition that I never let any distro automatically update. Mageia's grub is installed to it's "/" partition. I manually copy vmlinuz, and initrd files from there to my stand alone grub partition as needed...}

Alternatively, unzip the intramfs you currently have and manually edit it.


I didn't know it was human editable... But the concept is intriguing. Is there a howto? Can I use LABEL references instead of UUID in it?
--
JtWdyP
User avatar
jtwdyp
 
Posts: 88
Joined: Jun 10th, '13, 08:30

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby xboxboy » Jul 21st, '14, 15:31

jtwdyp, you can mount those directories as per the chroot wiki: https://wiki.mageia.org/en/Chroot#Mount_.2Fproc

I personally would be trying the chroot method rather than messing with the intramfs. I'll be interested to find out how you go.
xboxboy
 
Posts: 400
Joined: Jun 2nd, '13, 06:41

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby doktor5000 » Jul 21st, '14, 21:05

jtwdyp wrote:
Alternatively, unzip the intramfs you currently have and manually edit it.


I didn't know it was human editable... But the concept is intriguing. Is there a howto? Can I use LABEL references instead of UUID in it?


You can see the contents as root with
Code: Select all
lsinitrd /path/ot/initrd


You can also extract it via renaming it to end in .gz, then extract it via gzip and cpio. But you shouldn't try that IMHO.
This is what it looks like:
Code: Select all
[root@Mageia4 initrd]# cp /boot/initrd-3.12.21-desktop-2.mga4.img ./initrd-3.12.21-desktop-2.mga4.gz
[root@Mageia4 initrd]# LC_ALL=C gzip -dc initrd-3.12.21-desktop-2.mga4.gz | cpio -id
29691 blocks
[root@Mageia4 initrd]# ll
insgesamt 8020
lrwxrwxrwx  1 root root       7 Jul 21 21:03 bin -> usr/bin/
drwxr-xr-x  2 root root    4096 Jul 21 21:03 dev/
drwxr-xr-x 10 root root    4096 Jul 21 21:03 etc/
-rwxr-xr-x  1 root root   11098 Jul 21 21:03 init*
-rw-------  1 root root 8152474 Jul 21 21:03 initrd-3.12.21-desktop-2.mga4.gz
lrwxrwxrwx  1 root root       7 Jul 21 21:03 lib -> usr/lib/
lrwxrwxrwx  1 root root       9 Jul 21 21:03 lib64 -> usr/lib64/
drwxr-xr-x  2 root root    4096 Jul 21 21:03 proc/
drwxr-xr-x  2 root root    4096 Jul 21 21:03 root/
drwxr-xr-x  4 root root    4096 Jul 21 21:03 run/
lrwxrwxrwx  1 root root       8 Jul 21 21:03 sbin -> usr/sbin/
-rwxr-xr-x  1 root root    3017 Jul 21 21:03 shutdown*
drwxr-xr-x  2 root root    4096 Jul 21 21:03 sys/
drwxr-xr-x  2 root root    4096 Jul 21 21:03 sysroot/
drwxr-xr-x  2 root root    4096 Jul 21 21:03 tmp/
drwxr-xr-x  7 root root    4096 Jul 21 21:03 usr/
drwxr-xr-x  2 root root    4096 Jul 21 21:03 var/


chroot process is also explained here: http://wiki.centos.org/TipsAndTricks/CreateNewInitrd

You probably should first ensure that your bootloader config and fstab have the right labels/uuids or whatever you like to use.
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18039
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby jtwdyp » Jul 21st, '14, 21:27

xboxboy wrote:jtwdyp, you can mount those directories as per the chroot wiki: https://wiki.mageia.org/en/Chroot#Mount_.2Fproc


Thanks for the link... I think I understand, the reason to do this is so that dracut would use those directories from the running linux filesystem instead of trying to use the ones inside the chrooted filesystem???

I personally would be trying the chroot method rather than messing with the intramfs. I'll be interested to find out how you go.


Well we all have our own strengths and weaknesses. I'm still a little scared of chroot. So since I found a howto at:
http://www.thegeekstuff.com/2009/07/how-to-view-modify-and-recreate-initrd-img/

I gave it a whirl. I wasn't sure of anything except that there were some UUID references in the initrd that were no longer valid. And fortunately I still had a copy of the original installer created fstab to use to figure out which used to point at "/" and which at the swap... And I could get the new UUID references from /dev/disk/by-uuid of my running antiX system. then using "grep -r" on the uncompressed initrd I located the files I needed to modify and rename to reflect the current UUIDs. Made the changes via vim & mv, folowed the howto on putting the modified initrd back together, replaced the one in my boot partition, and rebooted into Mageia...

First time in was a little bumpy... It adjusted the screen brightness to something so dim I could hardly make anything out. But there is an "Fn" key for that. and the 2nd boot seemed to remember the change.

Now it's working great. :D :D :D

Thanks Guys!
--
JtWdyP
User avatar
jtwdyp
 
Posts: 88
Joined: Jun 10th, '13, 08:30

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby doktor5000 » Jul 21st, '14, 21:38

Please mark the thread accordingly by editing the topic of the first post and prefix it by [SOLVED], thanks
Cauldron is not for the faint of heart!
Caution: Hot, bubbling magic inside. May explode or cook your kittens!
----
Disclaimer: Beware of allergic reactions in answer to unconstructive complaint-type posts
User avatar
doktor5000
 
Posts: 18039
Joined: Jun 4th, '11, 10:10
Location: Leipzig, Germany

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby xboxboy » Jul 22nd, '14, 00:56

jtwdyp, nice one. Well done. You are correct about mounting those few directories from the host into the chroot.

@Doktor, thanks for that. You make it look so easy.
xboxboy
 
Posts: 400
Joined: Jun 2nd, '13, 06:41

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby jiml8 » Jul 22nd, '14, 01:46

I always like it best when all I have to do is point in the right direction, and the OP follows the path and finds the solution. :)

Well done.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby jiml8 » Jul 22nd, '14, 02:00

Oh...also...chroot...

When you chroot into a filesystem, you are changing the location of your root filesystem for that session. You have to mount /sys, /proc, and /dev so that the contents of those "directories" are available within the chrooted filesystem; if you don't, many things won't work. I will usually mount /tmp also just to avoid any problems. To mount them, there are a few different syntaxes you can use, and which is correct varies a bit from distro to distro which is why I was not more specific. But, for instance, this syntax for /dev is usually correct (assume the filesystem you will chroot to is located at /mnt):

mount devfs -t devfs /mnt/dev

You might need to use the syntax:

mount -o bind /dev /mnt/dev

It just depends. Similarly for /sys (sysfs) and /proc (procfs).

Just try one syntax, and if you get an error try the other. The bind option is available on some versions of mount to let you mount the same filesystem in more than one place.

After doing this, you chroot into the filesystem (chroot /mnt) and now /mnt is your new / for this session and everything you do - compilers, commands, dracut - whatever - occurs using the facilities in that filesystem. You can do anything your running kernel (which is NOT from that filesystem) will support.
jiml8
 
Posts: 1254
Joined: Jul 7th, '13, 18:09

Re: Migrating running Mageia4 to new laptop, But initrd won'

Postby jtwdyp » Jul 22nd, '14, 03:19

doktor5000 wrote:
jtwdyp wrote:I didn't know it was human editable... But the concept is intriguing. Is there a howto? Can I use LABEL references instead of UUID in it?


You can see the contents as root with
Code: Select all
lsinitrd /path/ot/initrd


You can also extract it via renaming it to end in .gz, then extract it via gzip and cpio. But you shouldn't try that IMHO.


Thanks for the clue(s) But my strengths are perhaps different than yours...
Cause THAT I tried with good results...

chroot process is also explained here: http://wiki.centos.org/TipsAndTricks/CreateNewInitrd


Thanks, can always use good tutorial links...

You probably should first ensure that your bootloader config and fstab have the right labels/uuids or whatever you like to use.


Yes I started there. I have relocated my Linux installations to different partitions with tar before. Just not usually on a different computer.

doktor5000 wrote:Please mark the thread accordingly by editing the topic of the first post and prefix it by [SOLVED], thanks


I shall, generally do, though it sometimes takes me a few days to get around to it...

xboxboy wrote:jtwdyp, nice one. Well done. You are correct about mounting those few directories from the host into the chroot.


jiml8 wrote:I always like it best when all I have to do is point in the right direction, and the OP follows the path and finds the solution. :)

Well done.


Thanks guys, "attaboys" from smart people like you mean a lot to me.

jiml8 wrote:Oh...also...chroot...

{{ excellent tutorial omitted }}


And thanks for the great tutorial. Sooner or later I'm bound to actually need to use chroot... I just hope I remember where to find your description of the process when that happens.
--
JtWdyP
User avatar
jtwdyp
 
Posts: 88
Joined: Jun 10th, '13, 08:30


Return to Basic support

Who is online

Users browsing this forum: No registered users and 1 guest