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

Script Updates #6

Open
wants to merge 12 commits into
base: mainline
Choose a base branch
from
Open

Conversation

jason-oliveira
Copy link

@jason-oliveira jason-oliveira commented Jul 17, 2022

  • Now works on non-Gentoo LiveCD's.
  • GENTOO_STAGE3 profile changed to "amd64-openrc"
  • TARGET_DISK is now /dev/vda, because it should be.
  • /boot is 256M now.
  • Using Calculate Linux as optional binhost for faster install.
  • Genkernel is no longer needed - installing binary kernel packages.
  • make.conf should be a directory.
  • Licenses needed to be accepted.
  • dhcpcd added so network doesn't fail on reboot.
  • eix added/synced

@sormy
Copy link
Owner

sormy commented Jul 17, 2022

Looks like a completely different script.

I tested it a long time ago but what are absolutely necessary changes and what can be omitted?

Changing default boot size, disk name, pulling mandatory yandex binhost that could have availability problems due to sanctions, installing eix, using genkernel when it is not used to build the kernel, adding -g to use binary, adding shm and tmps that are supposed to be here already, --rbind - is it all required to make it work?

Pulling binary kernel is actually a good thing, LIVE_CD code path can be removed if binary kernel is working well and allow to build kernel extensions etc. Or live cd code path can be replaced with binary kernel. The whole purpose of LIVE CD KERNEL code path is to make install faster.

Using binary host is probably a good idea but we might need to pull it in separate script because it impacts code too much. Also, default server for packages should not point to yandex mirror if we wanted to make it work worldwide for sure. I would prefer to keep it more vanilla without using binhost but it is ok to use binary packages from gentoo repo.

@jason-oliveira
Copy link
Author

jason-oliveira commented Jul 17, 2022

Thanks for your responses.

  • 100MB holds exactly one kernel in /boot. du -sh shows 54MB on the dir after install. Even the Gentoo Handbook recommends 256MB for /boot.
  • Calculate Linux is a russian distribution, and the best source of Stage4 binaries. I would've chose CloverOS or Sabayon if the packages were current or closer to upstream Gentoo. The URL can be (should be) replaced with a generic roundrobin mirror.
  • emerge -g doesn't force binaries if they're not available. comment-out the binhost line, and everything installs from source without further modification. (TODO: comment this in script)
  • For many people (such as myself) running this script on a VPS inside a non-Gentoo LiveCD, the modifications to shm and tmpfs are essential to ensure chroots work.
  • More people are installing Gentoo on remote server/VPS instances rather than bare metal, which is why /dev/vda was chosen over /dev/sda. A comment for /dev/sda and /dev/nvme0n1 could also be included.
  • If this wasn't a server install script, then you wouldn't have included the ability to log in via pubkey only and delete root password (remote access only), so this is Reason Number 2 why /dev/vda is chosen.
  • There is no "amd64", so it would be changed to "amd64-openrc" at least, which is ridiculously vulnerable for a server-oriented install script, post heartbleed/retbleed. (TODO: comment other options available)
  • Disk name was not changed. If it was, that was an oversight.
  • If you're worried about --rbind, please note the Gentoo Handbook. I omitted the systemd-required lines, if you'll notice, but they could be added with little issue. I just don't like systemd, so I don't go out of my way to support.
  • I'll make deleting the genkernel lines a TODO. I left them in just in case someone preferred manual compilation, and merely commented out the genkernel build line. More than happy to remove them.

More than happy to compromise. it's your project. 👍

@jason-oliveira
Copy link
Author

jason-oliveira commented Jul 17, 2022

  • Removed eix, as it isn't necessary for base install.
  • Removed genkernel, as it isn't needed, due to binary kernel.
  • Added more documentation to top of script, including limitations (no UEFI support yet, GPT limitation)
  • Removed all emerge -g and PORTAGE_BINHOST references.
  • Removed ~amd64 kernel default. Stable is better.
  • GENTOO_STAGE3 set to amd64-openrc by default.

Ideas that likely deserve separate issues/PR's outside the scope of this script update:

@jason-oliveira
Copy link
Author

Gentoo Handbook Changes to Mount:

  • The -o bind behavior for mount is deprecated.
  • --rbind allows a recursive bind on mounts, eliminating two /dev mounts.
  • /dev/shm fixes given proper echoed heading for fixing broken LiveCD's.

@jason-oliveira
Copy link
Author

Alright, I think this as barebones as it can be now. Let me know if more changes are required.

@jason-oliveira
Copy link
Author

@sormy let me know if anything needs to be changed. Once this PR is merged, I'l begin working on the other issues.


emerge sys-kernel/gentoo-sources
# required to allow for linux-firmware (required for binary kernel).
echo "ACCEPT_LICENSE=\"*\"" >> /etc/portage/make.conf/default

if [ "$USE_LIVECD_KERNEL" = 0 ]; then
Copy link
Owner

Choose a reason for hiding this comment

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

So I suggest to have something like GENTOO_BINARY=0/1. This flag will help to install in fastest way all binary. Otherwise standard kernel installation and package compilation will be used. What do you think? And USE_LIVECD_KERNEL can be deprecated with relevant code that copies kernel.

Copy link
Author

@jason-oliveira jason-oliveira Jul 20, 2022

Choose a reason for hiding this comment

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

This is a very interesting question. Is the purpose of the script to install packages as fast as possible?

I would be inclined to say that the entire script should be focused on installing via binary, and that compilation should be avoided if at all possible. As OSU's OSL's Stage 4 exists and is considered official, the only logical reason for source building is if you wanted to enable -march=native in the CFLAGS for that extra 1-2% performance.

If you really wanted to include a GENTOO_BINARY flag, probably best to just set it to 1 internally. Otherwise, I'd just omit the variable entirely, and set it. This issue might be out of the scope of this update, and I'll do a separate PR for binary and emerge -g to keep this one simple to merge. We can absolutely remove USE_LIVECD_KERNEL, though.

Copy link
Owner

Choose a reason for hiding this comment

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

Building kernel from the source can be needed if you want to build custom kernel module.
This CR removes completely this option, i would keep it, the rest is good.

# /dev/sda is standard for most IDE/SATA drives.
# /dev/nvme0n1 is standard for NVME drives.
# /dev/mmcblk0 is standard for most eMMC and SD drives
TARGET_DISK=/dev/vda
Copy link
Owner

@sormy sormy Jul 20, 2022

Choose a reason for hiding this comment

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

Might make it TARGET_DISK=${TARGET_DISK:-/dev/sda}.
This script was created for installation in VirtualBox. We can keep default for backward compatibility but still allowing to override disk name.

Copy link
Author

Choose a reason for hiding this comment

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

The issue with this idea is the weird hybrid it creates with the script, where you're either expected to hand-edit it (GENTOO_STAGE3 and TARGET_DISK) to make sure it works, and issue envars while running the command afterwards. for the purposes of automation and being run from other scripts, hand-editing scripts is less desireable.

I'll change both TARGET_DISK and GENTOO_STAGE3 for now.

Copy link
Owner

Choose a reason for hiding this comment

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

Agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants