Skip to content

Allow RHEL-like distros below version 8 #720

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

Merged
merged 1 commit into from
Mar 24, 2022

Conversation

alisson276
Copy link

This MR allows you create VMs using CentOS 7

My centos7.yaml file:

images:
- location: "https://cloud.centos.org/altarch/7/images/CentOS-7-x86_64-GenericCloud-2009.qcow2"
  arch: "x86_64"
  digest: "sha256:e38bab0475cc6d004d2e17015969c659e5a308111851b0e2715e84646035bdd3"
- location: "https://cloud.centos.org/altarch/7/images/CentOS-7-aarch64-GenericCloud-2009.qcow2"
  arch: "aarch64"
  digest: "sha256:51c0222aa4bc7d966fc044eb6ce9182993a1dc398eaa595e58abd0d361439baf"
containerd:
  system: false
  user: false
mounts:
- location: "~"
- location: "/tmp/lima"
  writable: true
firmware:
  legacyBIOS: true
cpuType:
  # Workaround for "vmx_write_mem: mmu_gva_to_gpa XXXXXXXXXXXXXXXX failed" on Intel Mac
  # https://bugs.launchpad.net/qemu/+bug/1838390
  x86_64: "Haswell-v4

@afbjorklund
Copy link
Member

afbjorklund commented Mar 11, 2022

This was rejected before, I think (support for CentOS 7)

@alisson276
Copy link
Author

alisson276 commented Mar 12, 2022

Yeah, you're right (unfortunately). I'm closing this one. I will just fork lima and use on my own repo since the maintainer doesn't want keep support for CentOS 7 and older Fedora that don't have dnf yet. I don't see any motivation to do not support CentOS below 8, since any, Ubuntu, basically is supported (including older and outdated/EOL Ubuntu) just because they use apt-get and apt-get is supported. Anyway.

@alisson276 alisson276 closed this Mar 12, 2022
@afbjorklund
Copy link
Member

afbjorklund commented Mar 12, 2022

I don't think using "yum" was the main issue, but yeah.

The main reason was that CentOS 7 is like Ubuntu 14.04 and it was too old... There was support for CentOS 8 and akin to Ubuntu 18.04, until it was discontinued (replaced in Lima with the RHEL clones Rocky/Alma)

I do have some Stream 8 and Stream 9 examples posted.

They just weren't that useful upstream, the Fedora 28 branch was better handled by the stable OS and the Fedora 34 branch was outdated for no good reason. Might as well look forward to Fedora 36, and also Ubuntu 22.04 ?

@afbjorklund
Copy link
Member

@alisson276 if you really want CentOS 7 to be supported, I think opening a new issue and describing why would be helpful

@alisson276
Copy link
Author

Never mind. I solved my problem doing this:

provision:
  - mode: system
    script: |
      #!/bin/bash
      set -eux -o pipefail
      pkgs=""
      yum_install_flags="-y"
      if ! rpm -ql epel-release > /dev/null 2>&1; then
          yum install ${yum_install_flags} epel-release
      fi
      if ! command -v dnf >/dev/null 2>&1; then
          pkgs="${pkgs} dnf"
      fi
      if ! command -v sshfs >/dev/null 2>&1; then
          pkgs="${pkgs} fuse-sshfs"
      fi
      if ! command -v mount.fuse3 >/dev/null 2>&1; then
          pkgs="${pkgs} fuse3"
      fi
      if [ -n "${pkgs}" ]; then
          yum install ${yum_install_flags} ${pkgs}
      fi

My use case is very particular, we still use CentOS7 in our company (we have a lot of work to migrate everything to AlmaLinux yet) and some people started to use Macs with Apple M1 chip, so we don't have vagrant and virtualbox available. Then we use lima to create test virtual machines, actually.

@jandubois
Copy link
Member

Never mind. I solved my problem doing this:

Note that this might break when #287 is implemented (run provisioning scripts after mounts have been set up).

@alisson276
Copy link
Author

Thank you for the warning @jandubois , actually I have a:

      until ls /srv/lima/provision &> /dev/null; do
          echo "Waiting for the filesystem to be mounted..."
          sleep 3
      done

in my provision code exactly to wait for this... It will break my machines 😭

@alisson276 alisson276 reopened this Mar 16, 2022
@alisson276
Copy link
Author

I'm reopening my PR with the hope of I will be listened and this can be implemented in the boot scripts🙏

@alisson276 alisson276 closed this Mar 16, 2022
@alisson276 alisson276 reopened this Mar 16, 2022
@jandubois
Copy link
Member

I've added a comment to #287 that we should support both kinds of provisioning scripts: the ones we have right now, that run as part of cloud-init, and the new kind that would be triggered by the hostagent once the mounts are setup.

@AkihiroSuda AkihiroSuda added priority/low enhancement New feature or request labels Mar 18, 2022
@AkihiroSuda AkihiroSuda added this to the V0.10.0 milestone Mar 18, 2022
@afbjorklund
Copy link
Member

afbjorklund commented Mar 18, 2022

Side note: EPEL needs to be enabled also for EL9, since it doesn't have "fuse-sshfs" in the regular repositories

dnf install epel-release epel-next-release

Separate issue, though.

Not convinced that modifying the standard config is a good thing, but...


Maybe config can be set up, to only install sshfs ? (from EPEL)

Or disable EPEL after install, but that will also block updates to sshfs

@AkihiroSuda
Copy link
Member

Side note: EPEL needs to be enabled also for EL9, since it doesn't have "fuse-sshfs" in the regular repositories

dnf install epel-release epel-next-release

Separate issue, though.

Not convinced that modifying the standard config is a good thing, but...

Maybe config can be set up, to only install sshfs ? (from EPEL)

Or disable EPEL after install, but that will also block updates to sshfs

Please open a separate issue/PR

@AkihiroSuda
Copy link
Member

Looks good but please squash commits (https://www.git-tower.com/learn/git/faq/git-squash)

@afbjorklund
Copy link
Member

afbjorklund commented Mar 18, 2022

Please open a separate issue/PR

I thought the plan was to ignore CentOS Stream and use Rocky etc instead ?

Just wondered if it was OK to add third-party repos like this, to the config ?

Even if EPEL is a "special" PPA

@AkihiroSuda
Copy link
Member

I thought the plan was to ignore CentOS Stream and use Rocky etc instead ?

We can unofficially support Stream (in another PR)

AkihiroSuda
AkihiroSuda previously approved these changes Mar 18, 2022
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@alisson276
Copy link
Author

Should I add the centos7.yaml?

@AkihiroSuda
Copy link
Member

Should I add the centos7.yaml?

The file name should be like deprecated-centos-7.yaml or deprecated/centos-7.yaml

AkihiroSuda
AkihiroSuda previously approved these changes Mar 18, 2022
Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@afbjorklund
Copy link
Member

@alisson276 do you think EPEL should be left enabled ? Or should the VM only have the OS repos ?

@alisson276
Copy link
Author

alisson276 commented Mar 18, 2022

@alisson276 do you think EPEL should be left enabled ? Or should the VM only have the OS repos ?

I don't see as a problem let it enabled. Most of the "good" packages come from there since EL, in general, has a more conservative approach, but I can set it to disable if you prefer. I can add a yum-config-manager --disable epel after installing fuse-sshfs

@afbjorklund
Copy link
Member

afbjorklund commented Mar 18, 2022

I wasn't sure, that is why I asked. I recall having two different templates, one "centos" and one "epel"...

So was more wondering what VM users would expect ?

If it was up to me, I would probably have installed but disabled. And use it with --enablerepo

But I haven't used CentOS actively in years, either 🙂

@alisson276
Copy link
Author

I wasn't sure, that is why I asked.

Just to be more conservative I've set to disabled epel right after installing fuse-sshfs. It can be enabled by the user anytime.

@AkihiroSuda
Copy link
Member

New changes since you last viewed
Merge branch 'lima-vm:master' into master

Still LGTM but please remove this

@alisson276
Copy link
Author

Still LGTM but please remove this

I think it's ok now.

@jandubois
Copy link
Member

I think it's ok now.

No, it is not; it has other commits merged in, and then squashed, e.g. 45c98e7.

See also the merge conflicts in go.{mod,sum}.

I would recommend to rebase the PR on latest master

@AkihiroSuda AkihiroSuda removed this from the v0.9.2 milestone Mar 24, 2022
Signed-off-by: Alisson R. de Oliveira <alisson.oliveira@farfetch.com>
@alisson276
Copy link
Author

No, it is not; it has other commits merged in, and then squashed, e.g. 45c98e7.

See also the merge conflicts in go.{mod,sum}.

I would recommend to rebase the PR on latest master

Sorry, I didn't check the "Files changed". I just rebased based on the upstream. Is this right now?

Copy link
Member

@AkihiroSuda AkihiroSuda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@AkihiroSuda AkihiroSuda added this to the v0.9.2 milestone Mar 24, 2022
@AkihiroSuda AkihiroSuda merged commit 9ebaa08 into lima-vm:master Mar 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request priority/low
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants