Categories
Software

How to boot Parted Magic 2018 using PXE and NFS support!

Ahoy friends.

I’m a convinced user of Parted Magic, but now i wanted to use it on my GRUB PXE server.

Unfortunately it’s being really slow, because of lack of nfs support.

So i was searching for a solution and got the following idea.

I was able to boot Parted Magic using PXE but unfortunately it was really really slow, because the files are transfered by the TFTP protocoll only which is the slowest of all available options.

 

Why is there no nfs support and what it’s the cause?

The drivers which are necessary to boot a system are included in the initial ramdisk file, usually just called initrd.

In case of Parted Magic the drivers which are needed for a boot from a nfs root, or fetching a squashfs file, are not included.

So there is no easy way to get rid of it. Take care! Only for advanced users who know what they are doing.

 

Get NFS support for Parted Magic PXE

I have chosen the easy way, to get the Kernel file of an system which already supports NFS boot.

So Clonezilla was my option. It offers NFS root support as well as networking to fetch squashfs files by using http.

My first try was to replace the bzImage64 file from Parted Magic by the vmlinuz Kernel image of Clonezilla.

This didn’t work well, because of following problem.

Inside of the init file the Parted Magic initrd uses a different way to deal with paths. In this case it looks like this.

[pastacode lang=”bash” manual=”export%20PATH%3D%22%2Fbin%3A%2Fsbin%3A%2Fusr%2Fbin%3A%2Fusr%2Fsbin%22″ message=”” highlight=”” provider=”manual”/]

But in case of Clonezilla they look like that.

[pastacode lang=”bash” manual=”export%20PATH%3D%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fsbin%3A%2Fusr%2Fbin%3A%2Fsbin%3A%2Fbin” message=”” highlight=”” provider=”manual”/]

So there’s a difference. But now after all it works like i wanted it to work.

How to get rid of this Problem?

 

Get The newest Clonezilla image from https://clonezilla.org/downloads.php

After having downloaded the iso (!) file mount it on /mnt using

[pastacode lang=”bash” manual=”mount%20clonezilla.iso%20%2Fmnt” message=”” highlight=”” provider=”manual”/]

Unpack the initrd file into a new working directory.

First, create a temporary work directory and switch into it. This will be the location where the initramfs/initrd contents will be viewed, edited, and re-compressed if required.

[pastacode lang=”bash” manual=”mkdir%20%2Ftmp%2Finitrdclonezilla” message=”” highlight=”” provider=”manual”/]

First we need to check out which kind of compression our initrd file uses.

So we use:

[pastacode lang=”bash” manual=”file%20%2Fmnt%2Flive%2Finitrd.img” message=”” highlight=”” provider=”manual”/]

  • In case of a gzip file we switch into the newly working directory and use[pastacode lang=”bash” manual=”zcat%20%2Fmnt%2Flive%2Finitrd.img%20%7C%20cpio%20-idmv” message=”” highlight=”” provider=”manual”/]
  • However, if the file is using xz compression you have to use this command.[pastacode lang=”bash” manual=”xz%20-dc%20%3C%20%2Fmnt%2Flive%2Finitrd.img%20%7C%20cpio%20-idmv” message=”” highlight=”” provider=”manual”/]

To uncompress the initrd file.

Now we only care about the init file, let’s open it.

The first line is important, the part dealing with the paths.

[pastacode lang=”bash” manual=”%23!%2Fbin%2Fsh%0A%0A%23%20Default%20PATH%20differs%20between%20shells%2C%20and%20is%20not%20automatically%20exported%0A%23%20by%20klibc%20dash.%20Make%20it%20consistent.%0A%23%20Furthermore%2C%20this%20PATH%20ends%20up%20being%20used%20by%20the%20init%2C%20set%20it%20to%20the%0A%23%20Standard%20PATH%2C%20without%20%2Fsnap%2Fbin%20as%20documented%20in%0A%23%20https%3A%2F%2Fwiki.ubuntu.com%2FPATH%0A%23%20This%20also%20matches%20%2Fetc%2Fenvironment%2C%20but%20without%20games%20path%0Aexport%20PATH%3D%2Fusr%2Flocal%2Fsbin%3A%2Fusr%2Flocal%2Fbin%3A%2Fusr%2Fsbin%3A%2Fusr%2Fbin%3A%2Fsbin%3A%2Fbin” message=”” highlight=”” provider=”manual”/]

That’s the way how Clonezilla deals with paths, but we need to know how Parted Magic does.

So we need to do the same for the Parted Magic ISO file.

First we have to unmount the current Clonezilla ISO using

[pastacode lang=”bash” manual=”umount%20%2Fmnt” message=”” highlight=”” provider=”manual”/]

We’ll mount our Parted Magic ISO using the same way like we did before.

[pastacode lang=”bash” manual=”mount%20pmagic_2018_01_08.iso%20%2Fmnt” message=”” highlight=”” provider=”manual”/]

We’ll create another working directory for our Parted Magic initial ramdisk file.

[pastacode lang=”bash” manual=”mkdir%20%2Ftmp%2Finitrdpmagic” message=”” highlight=”” provider=”manual”/]

Let’s switch into the newly created directory using cd (i won’t mention this simple command here.)

So now we want to uncompress the Parted Magic initrd file as well, it’s called initrd.img as well.

To check out which command to use, to uncompress the file, check out our previous steps.

In this case we should have a gzip compressed initrd file, so we use:

[pastacode lang=”bash” manual=”zcat%20%2Fmnt%2Finitrd.img%20%7C%20cpio%20-idmv” message=”” highlight=”” provider=”manual”/]

Here we check out our init file as well, also the first line like we did before.

Now you should notice some difference, it should look like that.

[pastacode lang=”bash” manual=”export%20PATH%3D%22%2Fbin%3A%2Fsbin%3A%2Fusr%2Fbin%3A%2Fusr%2Fsbin%22″ message=”” highlight=”” provider=”manual”/]

So what now? We will just take this like and replace it by the old one in the Clonezilla init file.

After having done this part just save the Clonezilla init file.

Now we have to compress our newly created initrd file.

Just switch into the initrdclonezilla working directory and perform this command.

[pastacode lang=”bash” manual=”find%20.%20%7C%20cpio%20-o%20-c%20%7C%20gzip%20-9%20%3E%20%2Fhome%2Fnew.img” message=”” highlight=”” provider=”manual”/]

Now we have got a new initrd deploying NFS root support.

So in case of our PXE Parted Magic directory we replace the existing bzImage64 file by vmlinuz file from Clonezilla.

And also our initrd.img file from Parted Magic will be replaced with our newly created new.img initrd file. But don’t forget to rename it to initrd.img.

Because of the difference of Clonezilla how to deal with squashfs files, we need to copy the SQFS file from our currently mounted Parted Magic ISO.

We need to create a directory called live inside of our Parted Magic PXE directory.

Now we copy the SQFS file into this directory doing:

[pastacode lang=”bash” manual=”cp%20%2Fmnt%2Fpmodules%2F2018*.SQFS%20%2Fvar%2Flib%2Ftftpboot%2Fprograms%2Fpmagic%2Flive” message=”” highlight=”” provider=”manual”/]

Note: You may have to adjust the paths in your case. Common sense is necessary!

 

Now your grub.cfg or default file (in case of pxelinux) may look like this.

[pastacode lang=”bash” manual=”menuentry%20%22Parted%20Magic%20(64-Bit)%22%20%7B%0Aecho%20’Trying%20to%20boot%20via%20nfs%20…’%0Aload_video%0Ainsmod%20gzio%0Aif%20%5B%20x%24grub_platform%20%3D%20xxen%20%5D%3B%20then%20insmod%20xzio%3B%20insmod%20lzopio%3B%20fi%0Ainsmod%20part_msdos%0Ainsmod%20ext2%0Aecho%20’Loading%20Linux%20…’%0Alinux%20%2Fprograms%2Fpmagic%2FbzImage64%20root%3D%2Fdev%2Fnfs%20ip%3Ddhcp%20rw%20netboot%3Dnfs%20nfsroot%3D192.168.2.55%3A%2Fvar%2Flib%2Ftftpboot%2Fprograms%2Fpmagic%2F%20nomodeset%20rw%20boot%3Dlive%20username%3Duser%20union%3Doverlay%20config%20components%20noswap%0Afetch%3Dhttp%3A%2F%2F192.168.2.55%2Fpmagic%2Flive%2Ffilesystem.squashfs%0Ainitrd%20%2Fprograms%2Fpmagic%2Finitrd.img%0Aecho%20’Loading%20initial%20ramdisk%20…’%0A%7D” message=”” highlight=”” provider=”manual”/]

That’s just all you have to do to get Parted Magic booting properly on PXE systems.

By Knogle

I am a passionate individual who has been a dedicated user of Linux operating systems since 2014. My Linux journey began with FreeBSD, and I later transitioned to Debian, appreciating the flexibility and power that Linux offers.

To further enhance my skills, I undertook a preparatory course for the Red Hat Certified System Administrator (RHCSA) certificate, highlighting my commitment to continuous learning and professional development in the field of Linux system administration.

As the founder of Unix-Supremacy (formerly known as OpenKnogle Solutions or Knogle Industries), I have embarked on entrepreneurial endeavors in the realm of Unix-based systems. My expertise extends to programming in C and PAWN, allowing me to develop software solutions and contribute to the open-source community.

In addition to my technical pursuits, I am currently studying at RWTH Aachen University, majoring in Computer Science and Electrical Engineering. This academic background allows me to gain a comprehensive understanding of both software and hardware aspects in the field of computing.

Beyond my professional and academic endeavors, I am a curious individual who loves to explore and try out new technologies and innovative concepts. I am particularly passionate about supporting causes related to software freedom, the right to repair, and advocating for open-source software. I actively contribute to organizations such as the Software Freedom Conservancy, aiming to promote and protect these fundamental principles.

Overall, my journey as a Linux enthusiast, entrepreneur, programmer, and student has shaped my passion for technology and my commitment to making meaningful contributions to the open-source community.

3 replies on “How to boot Parted Magic 2018 using PXE and NFS support!”

The Parted Magic PXE client is designed such that any PXE server should be able to serve it. However the Parted Magic PXE server is optimized towards the Parted Magic PXE client:  

Thanks for your reply.
Unfortunately it’s not optimized. You have to load the image using the default TFTP protocoll which takes a very long time.
Clonezilla, GParted etc. are optimized and provide NFS supported, unfortunately Parted Magic still doesn’t.

The biggest difference with the “memdisk” method as mentioned above is that whereas there the complete Parted Magic menu is available, here there is no user menu – all options are determined by the pxelinux.cfg file. and follow the instructions as output on which files to copy to the PXE server and on how to edit the pxelinux.cfg file.

Leave a Reply

Your email address will not be published. Required fields are marked *