Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request ? Or documentation ? About building old centos version. #118

Open
mickaeldotlambertatkontrondotcom opened this issue Jun 16, 2023 · 10 comments
Labels
CentOS enhancement New feature or request triaged Triaged to be addressed in a given cycle

Comments

@mickaeldotlambertatkontrondotcom

Hello Everyone,

I hope you're doing fine !

Just for the purpose of doing trials, I wanted to build old versions of centos like centos6.

But I got "YumRepo Error: All mirror URLs are not using ftp, http[s] or file." cause this distribution is deprecated and mirror are not available anymore at their usual addresses.

So then I tried to patch like this :

+ diff -rupN /home/me/packer-maas/centos6/http/centos6.ks /tmp/tmp.vBYuHcTep2/centos6.ks
--- /home/me/packer-maas/centos6/http/centos6.ks     2023-06-16 15:33:04.083062812 +0200
+++ /tmp/tmp.vBYuHcTep2/centos6.ks      2023-06-16 15:33:04.123062814 +0200
@@ -1,4 +1,4 @@
-url --url="http://mirror.centos.org/centos/6/os/x86_64"
+url --url="http://vault.centos.org/centos/6/os/x86_64"
 poweroff
 firewall --enabled --service=ssh
 firstboot --disable
@@ -12,8 +12,8 @@ timezone UTC --isUtc
 bootloader --location=mbr --driveorder="vda" --timeout=1
 rootpw --plaintext password

-repo --name="Updates" --mirrorlist="http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates"
-repo --name="Extras" --mirrorlist="http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras"
+repo --name="Updates" --mirrorlist="http://vault.centos.org/?release=6&arch=x86_64&repo=updates"
+repo --name="Extras" --mirrorlist="http://vault.centos.org/?release=6&arch=x86_64&repo=extras"
 repo --name="EPEL6" --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64"
 # CentOS 6 requires a newer version of cloud-init to use advanced features with MAAS.
 repo --name="cloud-init" --baseurl="http://copr-be.cloud.fedoraproject.org/results/@cloud-init/el-stable/epel-6-x86_64"
+ diff -rupN /home/me/packer-maas/centos6/centos6.pkr.hcl /tmp/tmp.vBYuHcTep2/centos6.pkr.hcl
--- /home/me/packer-maas/centos6/centos6.pkr.hcl     2023-06-16 15:33:04.079062812 +0200
+++ /tmp/tmp.vBYuHcTep2/centos6.pkr.hcl 2023-06-16 15:33:04.107062813 +0200
@@ -16,12 +16,12 @@ variable "filename" {

 variable "centos6_iso_url" {
   type    = string
-  default = "https://mirrors.edge.kernel.org/centos/6.10/isos/x86_64/CentOS-6.10-x86_64-netinstall.iso"
+  default = "https://vault.centos.org/centos/6.10/isos/x86_64/CentOS-6.10-x86_64-netinstall.iso"
 }

 variable "centos6_sha256sum_url" {
   type    = string
-  default = "https://mirrors.edge.kernel.org/centos/6.10/isos/x86_64/sha256sum.txt"
+  default = "https://vault.centos.org/centos/6.10/isos/x86_64/sha256sum.txt"
 }

 source "qemu" "centos6" {

But I still got the same issue.
Is there any easy way to move from iso install in place of network install, if that may be a way to easily solve the issue ?
Or any easy way to provide the network installer with the correct info about the mirrors for the image to be able to build ?
Or even, did I miss something somewhere ?

Have a nice day,
Best Regards,
Mickaël.

@mickaeldotlambertatkontrondotcom mickaeldotlambertatkontrondotcom changed the title Feature Request ? Or documentation ? Feature Request ? Or documentation ? About building old centos version. Jun 16, 2023
@mickaeldotlambertatkontrondotcom
Copy link
Author

Hello Everyone,
Doing fine ?

Here is a patch which makes the build process of a centos6 image pass again.
Could you please reveiw it and then take it into account ?

Thanks in advance,
Nice day !
Mickaël.

diff -rupN /tmp/packer-maas/centos6/centos6.pkr.hcl packer-maas/centos6/centos6.pkr.hcl
--- /tmp/packer-maas/centos6/centos6.pkr.hcl    2023-06-29 14:30:43.180942644 +0200
+++ packer-maas/centos6/centos6.pkr.hcl 2023-06-29 14:45:31.320982229 +0200
@@ -16,12 +16,12 @@ variable "filename" {
 
 variable "centos6_iso_url" {
   type    = string
-  default = "https://mirrors.edge.kernel.org/centos/6.10/isos/x86_64/CentOS-6.10-x86_64-netinstall.iso"
+  default = "https://vault.centos.org/centos/6.10/isos/x86_64/CentOS-6.10-x86_64-netinstall.iso"
 }
 
 variable "centos6_sha256sum_url" {
   type    = string
-  default = "https://mirrors.edge.kernel.org/centos/6.10/isos/x86_64/sha256sum.txt"
+  default = "https://vault.centos.org/centos/6.10/isos/x86_64/sha256sum.txt"
 }
 
 source "qemu" "centos6" {
diff -rupN /tmp/packer-maas/centos6/http/centos6.ks packer-maas/centos6/http/centos6.ks
--- /tmp/packer-maas/centos6/http/centos6.ks    2023-06-29 14:30:43.180942644 +0200
+++ packer-maas/centos6/http/centos6.ks 2023-06-29 16:24:10.805246066 +0200
@@ -1,4 +1,4 @@
-url --url="http://mirror.centos.org/centos/6/os/x86_64"
+url --url="http://vault.centos.org/centos/6/os/x86_64"
 poweroff
 firewall --enabled --service=ssh
 firstboot --disable
@@ -12,11 +12,16 @@ timezone UTC --isUtc
 bootloader --location=mbr --driveorder="vda" --timeout=1
 rootpw --plaintext password
 
-repo --name="Updates" --mirrorlist="http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates"
-repo --name="Extras" --mirrorlist="http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras"
-repo --name="EPEL6" --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64"
+%pre
+rm -f /etc/yum.repos.d/*
+%end
+
+repo --name="base"    --baseurl="https://vault.centos.org/6.10/os/x86_64/"
+repo --name="updates" --baseurl="https://vault.centos.org/6.10/updates/x86_64/"
+repo --name="extras"  --baseurl="https://vault.centos.org/6.10/extras/x86_64/"
+repo --name="EPEL6"   --baseurl="https://dl.fedoraproject.org/pub/archive/epel/6/x86_64/"
 # CentOS 6 requires a newer version of cloud-init to use advanced features with MAAS.
-repo --name="cloud-init" --baseurl="http://copr-be.cloud.fedoraproject.org/results/@cloud-init/el-stable/epel-6-x86_64"
+repo --name="cloud-init" --baseurl="http://copr-be.cloud.fedoraproject.org/results/@cloud-init/el-stable/epel-6-x86_64/"
 
 zerombr
 clearpart --all --initlabel

@alexsander-souza
Copy link
Contributor

Hey, can you submit this as a Pull Request? It would be easier for us to review it and eventually merge it

@mickaeldotlambertatkontrondotcom
Copy link
Author

Hey !
I just tried.
But I can't seem to be able to push my newly created branch centos6EOLsupport.
I got :

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/canonical/packer-maas/'

So I won't go through this useless security storm overhead burden.

Any web way with doc on how to do what you call a pull request ?

Have a nice day.
Best Regards,
Mickaël.

@r00ta
Copy link
Contributor

r00ta commented Jul 10, 2023

Hey ! I just tried. But I can't seem to be able to push my newly created branch centos6EOLsupport. I got :

remote: Support for password authentication was removed on August 13, 2021.
remote: Please see https://docs.github.com/en/get-started/getting-started-with-git/about-remote-repositories#cloning-with-https-urls for information on currently recommended modes of authentication.
fatal: Authentication failed for 'https://github.com/canonical/packer-maas/'

So I won't go through this useless security storm overhead burden.

Any web way with doc on how to do what you call a pull request ?

Have a nice day. Best Regards, Mickaël.

Hi @mickaeldotlambertatkontrondotcom ,

First of all thank you very much for your effort on this!

In order to open a pull request to this repository you have to follow this guide: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request-from-a-fork

In short, you have to

  1. fork this repository
  2. create a branch on your repository and push the code there
  3. open a pull request from your fork to this repository.

Let me know if you need any additional help!

@SK1Y101 SK1Y101 added enhancement New feature or request CentOS triaged Triaged to be addressed in a given cycle labels Aug 17, 2023
@SK1Y101
Copy link
Member

SK1Y101 commented Aug 17, 2023

Hey @mickaeldotlambertatkontrondotcom!
I notice it's ben a few weeks, are you still working on this at all?
If yes (and that would be awesome) I'd be happy to review a PR containing the necessary changes when you create one!

@mickaeldotlambertatkontrondotcom
Copy link
Author

Hello SK1Y101,

I hope you're doing fine ; - )

I was on leave ; - )

I am still working on this from time to time.
I thinks I may be able to tests produced image under MAAS this week.

But I won't open a PR due to many technical, network, security, knowledge, about using github from our lab.

If you are interested into, after testing, for sure, I could post the diff here.
So you could do the PR and launch the review.
So then all that is "out of date" and not working on this projet tree, will be usable agin.

Have a nice day,
Best Regards,
Mickaël.

@SK1Y101
Copy link
Member

SK1Y101 commented Aug 22, 2023

Hey @mickaeldotlambertatkontrondotcom!
Thanks for the reply, That would be great!
Have a nice day yourself :)

@mickaeldotlambertatkontrondotcom
Copy link
Author

Hello SK1Y101,

I hope your doing fine !

Here is my patch for CentOS6 :

diff -rupN /home/user/packer-maas/centos6/centos6.pkr.hcl /home/user/packer-maas/centos6/centos6.pkr.hcl
--- /home/user/packer-maas/centos6/centos6.pkr.hcl      2023-09-01 18:42:11.971726148 +0200
+++ /home/user/packer-maas/centos6/centos6.pkr.hcl      2023-09-01 18:42:11.975826560 +0200
@@ -16,12 +16,12 @@ variable "filename" {
 
 variable "centos6_iso_url" {
   type    = string
-  default = "https://mirrors.edge.kernel.org/centos/6.10/isos/x86_64/CentOS-6.10-x86_64-netinstall.iso"
+  default = "https://vault.centos.org/centos/6.10/isos/x86_64/CentOS-6.10-x86_64-netinstall.iso"
 }
 
 variable "centos6_sha256sum_url" {
   type    = string
-  default = "https://mirrors.edge.kernel.org/centos/6.10/isos/x86_64/sha256sum.txt"
+  default = "https://vault.centos.org/centos/6.10/isos/x86_64/sha256sum.txt"
 }
 
 source "qemu" "centos6" {
diff -rupN /home/user/packer-maas/centos6/http/centos6.ks.in /home/user/packer-maas/centos6/http/centos6.ks.in
--- /home/user/packer-maas/centos6/http/centos6.ks.in   2023-06-29 14:30:43.180942644 +0200
+++ /home/user/packer-maas/centos6/http/centos6.ks.in   2023-06-29 16:24:10.805246066 +0200
@@ -1,4 +1,4 @@
-url --url="http://mirror.centos.org/centos/6/os/x86_64" ${KS_PROXY}
+url --url="http://vault.centos.org/centos/6/os/x86_64" ${KS_PROXY}
 poweroff
 firewall --enabled --service=ssh
 firstboot --disable
@@ -12,11 +12,16 @@ timezone UTC --isUtc
 bootloader --location=mbr --driveorder="vda" --timeout=1
 rootpw --plaintext password
 
-repo --name="Updates" --mirrorlist="http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=updates" ${KS_PROXY}
-repo --name="Extras" --mirrorlist="http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=extras" ${KS_PROXY}
-repo --name="EPEL6" --mirrorlist="https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64" ${KS_PROXY}
+%pre
+rm -f /etc/yum.repos.d/*
+%end
+
+repo --name="base"    --baseurl="https://vault.centos.org/6.10/os/x86_64/" ${KS_PROXY}
+repo --name="updates" --baseurl="https://vault.centos.org/6.10/updates/x86_64/" ${KS_PROXY}
+repo --name="extras"  --baseurl="https://vault.centos.org/6.10/extras/x86_64/" ${KS_PROXY}
+repo --name="EPEL6"   --baseurl="https://dl.fedoraproject.org/pub/archive/epel/6/x86_64/" ${KS_PROXY}
 # CentOS 6 requires a newer version of cloud-init to use advanced features with MAAS.
-repo --name="cloud-init" --baseurl="http://copr-be.cloud.fedoraproject.org/results/@cloud-init/el-stable/epel-6-x86_64" ${KS_PROXY}
+repo --name="cloud-init" --baseurl="http://copr-be.cloud.fedoraproject.org/results/@cloud-init/el-stable/epel-6-x86_64/" ${KS_PROXY}
 
 zerombr
 clearpart --all --initlabel

The build work, but then the deployment does not.
I'll open another case when this patch is merged.
Read the patch and you'll see how simple it is ; - )

Nice day,
Regards,
Mickaël.

@alanbach
Copy link
Contributor

alanbach commented Dec 6, 2023

I tested this patch and was able to build and then import a successful CentOS 6.10 image. However on MAAS 3.3.5 the deployments fail with the following error:

running /tmp/tmp3c3n_zya/target/curtin/curtin-hooks
Running command ['/tmp/tmp3c3n_zya/target/curtin/curtin-hooks'] with allowed return codes [0] (capture=False)
/tmp/tmp3c3n_zya/target/curtin/curtin-hooks.py:308: SyntaxWarning: 'str' object is not callable; perhaps you missed a comma?
  "WARN: unsupported family %s, "
Traceback (most recent call last):
  File "/tmp/tmp3c3n_zya/target/curtin/curtin-hooks.py", line 393, in <module>
    main()
  File "/tmp/tmp3c3n_zya/target/curtin/curtin-hooks.py", line 376, in main
    grub_root = get_grub_root(target)
  File "/tmp/tmp3c3n_zya/target/curtin/curtin-hooks.py", line 208, in get_grub_root
    return regex.groups()[0]
AttributeError: 'NoneType' object has no attribute 'groups'
finish: cmd-install/stage-curthooks/builtin/cmd-curthooks: FAIL: curtin command curthooks
Traceback (most recent call last):
  File "/curtin/curtin/commands/main.py", line 202, in main
    ret = args.func(args)
  File "/curtin/curtin/commands/curthooks.py", line 1883, in curthooks
    if util.run_hook_if_exists(target, 'curtin-hooks'):
  File "/curtin/curtin/util.py", line 979, in run_hook_if_exists
    subp([target_hook])
  File "/curtin/curtin/util.py", line 275, in subp
    return _subp(*args, **kwargs)
  File "/curtin/curtin/util.py", line 139, in _subp
    raise ProcessExecutionError(stdout=out, stderr=err,
curtin.util.ProcessExecutionError: Unexpected error while running command.
Command: ['/tmp/tmp3c3n_zya/target/curtin/curtin-hooks']
Exit code: 1

Function:

def write_interface_config(target, iface, data):
    """Writes config for interface."""
    family = data['family']
    if family != "inet":
        # Only supporting ipv4 currently
        print(
            "WARN: unsupported family %s, "
            "failed to configure interface: %s" (family, iface))
        return
    config = get_ipv4_config(iface, data)
    path = os.path.join(
        target, 'etc', 'sysconfig', 'network-scripts', 'ifcfg-%s' % iface)
    with open(path, 'w') as stream:
        stream.write(config + '\n')

I think we need more fixes.

@mickaeldotlambertatkontrondotcom
Copy link
Author

Hello Alan,
I hope you're doing fine.
Thanks for your feedback.

CentOS 6 is EOL from end 2020.
So it is not "that" far, for company that are trying to provide cyber security by other means than updates, to their IP (Intellectual Property) solutions assets.

That would be great if someone could break the neck of this issue.

Form the error you have mentionned, it seems to us that "family = data['family']" may not be the correct method to get 'family' from "data".
And from the code extract provided, we can't tell how to use "data".

Thanks in advance,
Have a nice day,
Best Regards,
Mickaël.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CentOS enhancement New feature or request triaged Triaged to be addressed in a given cycle
Projects
None yet
Development

No branches or pull requests

5 participants