{"id":1103,"date":"2024-12-09T13:16:22","date_gmt":"2024-12-09T19:16:22","guid":{"rendered":"https:\/\/thecweb.com\/?p=1103"},"modified":"2024-12-09T14:55:34","modified_gmt":"2024-12-09T20:55:34","slug":"arch-notes","status":"publish","type":"post","link":"https:\/\/thecweb.com\/index.php\/2024\/12\/09\/arch-notes\/","title":{"rendered":"Arch notes &#8211; basic setup"},"content":{"rendered":"\n<p><a href=\"https:\/\/wiki.archlinux.org\/title\/Installation_guide\">https:\/\/wiki.archlinux.org\/title\/Installation_guide<\/a><\/p>\n\n\n\n<p>Testing out minimal distros to run my hypervisor.  Debian is fine and light enough, but the server doesn&#8217;t come for at least another day, so I&#8217;ve got time.  I&#8217;ve been hearing about Arch for ever and I haven&#8217;t really looked into it, but it sounds exactly like what I&#8217;m looking for.  <\/p>\n\n\n\n<p>Arch boots into live cli environment, and then you have to manually partition the disk to start.  <\/p>\n\n\n\n<p>So, how do I want to do this?<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-content-justification-center is-layout-constrained wp-block-group-is-layout-constrained\" style=\"border-width:1px\">\n<p><strong>Update<\/strong> the first partition must be the efi partition, and it cannot be in LVM, so do that first<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fdisk \/dev\/sda\n# g to create GPT table, n to make new, t to change type, and w to write\ng\nn\n+1G\nt\nuefi\n# make LVM partition\nn\n\nw<\/code><\/pre>\n\n\n\n<p>We should end up with something like this<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"808\" height=\"460\" src=\"https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-4.png\" alt=\"\" class=\"wp-image-1110\" srcset=\"https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-4.png 808w, https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-4-300x171.png 300w, https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-4-768x437.png 768w\" sizes=\"auto, (max-width: 808px) 100vw, 808px\" \/><\/figure>\n<\/div>\n\n\n\n<p>Reddit has some ideas as usual.  <a href=\"https:\/\/www.reddit.com\/r\/sysadmin\/comments\/1e4xnmq\/linux_partition_scheme_recommendation_for_2024\/\">https:\/\/www.reddit.com\/r\/sysadmin\/comments\/1e4xnmq\/linux_partition_scheme_recommendation_for_2024\/<\/a><\/p>\n\n\n\n<p>Looks like this <a href=\"https:\/\/static.open-scap.org\/ssg-guides\/ssg-rhel9-guide-index.html\">list from open-scap<\/a> is a good start.  The rest is just standard linux crap. <\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\/boot &#8211; 2 GB<\/li>\n\n\n\n<li>swap &#8211; 4 GB<\/li>\n\n\n\n<li>\/ &#8211; 8 GB<\/li>\n\n\n\n<li>\/home &#8211; 2 GB<\/li>\n\n\n\n<li>\/var &#8211; 4 GB<\/li>\n\n\n\n<li>\/var\/log &#8211; 4 GB<\/li>\n\n\n\n<li>\/var\/audit &#8211; 4 GB<\/li>\n\n\n\n<li>\/var\/tmp &#8211; 2 GB<\/li>\n\n\n\n<li>\/tmp &#8211; 8 GB<\/li>\n<\/ul>\n\n\n\n<p>reminder:  pv = physical disk, vg = volume group, lv = logical volume<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># list all physical volumes\nlvmdiskscan\n\n# create pv\npvcreate \/dev\/sda2\n\n# display pv\npvdisplay\n\n# summary \npvscan<\/code><\/pre>\n\n\n\n<p>vg<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># create volume group\nvgcreate rootVG \/dev\/sda\n\n# add another pv to vg\nvgextend rootVG \/dev\/sdc<\/code><\/pre>\n\n\n\n<p>lv<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># create lv\nlvcreate -L 2G rootVG -n bootLV\nlvcreate -L 4G rootVG -n swapLV\nlvcreate -L 8G rootVG -n rootLV\nlvcreate -L 2G rootVG -n homeLV\nlvcreate -L 4G rootVG -n varLV\nlvcreate -L 4G rootVG -n varlogLV\nlvcreate -L 4G rootVG -n varauditLV\nlvcreate -L 2G rootVG -n vartmpLV\nlvcreate -L 8G rootVG -n tmpLV\n\n# create lv on specific pv\nlvcreate -L 10G VolGroup00 -n lvolhome \/dev\/sda<\/code><\/pre>\n\n\n\n<p>mkfs<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># boot partition is FAT32 - efi mandates as a standard\nmkfs.fat -F 32 \/dev\/sda1\nmkfs.fat -F 32 \/dev\/rootVG\/bootLV\n\n# swap\nmkswap \/dev\/rootVG\/swapLV\n\n# the rest\nmkfs.ext4 \/dev\/rootVG\/rootLV<\/code><\/pre>\n\n\n\n<p>mount shit under \/mnt.  This better get less do-it-yourself real soon or I&#8217;m going back to debian.  But, if I can slap these in a script I&#8217;ll be fine.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># mount root filesystem\nmount \/dev\/rootVG\/rootLV \/mnt\n\n# make all those mf mount points you just had to have\nmount --mkdir \/dev\/rootVG\/bootLV \/mnt\/boot\nmount --mkdir \/dev\/rootVG\/varLV \/mnt\/var\n      and so on...\n\n# enable swap\nswapon \/dev\/rootVG\/swapLV<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"120\" src=\"https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-2-1024x120.png\" alt=\"\" class=\"wp-image-1105\" srcset=\"https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-2-1024x120.png 1024w, https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-2-300x35.png 300w, https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-2-768x90.png 768w, https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-2.png 1339w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>Package list:<\/p>\n\n\n\n<p>base linux linux-firmware vim efibootmgr grub intel-ucode <br>networkmanager dosfstools exfatprogs e2fsprogs ntfs-3g lvm2<br>sshd sudo<br><br><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>pacstrap -K \/mnt base linux linux-firmware<\/code><\/pre>\n\n\n\n<p>fstab<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Generate an fstab file (use -U or -L for UUID or labels)\ngenfstab -L \/mnt &gt;&gt; \/mnt\/etc\/fstab<\/code><\/pre>\n\n\n\n<p>chroot to new install<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># fancy smancy arch version of chroot\narch-chroot \/mnt<\/code><\/pre>\n\n\n\n<p>set a bunch of shit you normally never have to&#8230;<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># time zone\nln -sf \/usr\/share\/zoneinfo\/America\/Chicago \/etc\/localtime\n\n# hw clock\nhwclock --systohc\n\n# Edit \/etc\/locale.gen and uncomment en_US.UTF-8 UTF-8\n# fuck, install vim with 'pacman -S vim' if you forget it\nlocale-gen\n\n# Create the locale.conf(5) file, and set the LANG variable accordingly\necho LANG=en_US.UTF-8 &gt;&gt; \/etc\/locale.conf\n\necho archkvm &gt;&gt; \/etc\/hostname<\/code><\/pre>\n\n\n\n<p>net config<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># install Network Manager - nmcli\npacman -S networkmanager\n\n# add this stuff to \/etc\/systemd\/network\/20-wired.network\n&#91;Match]\nName=en01\n\n&#91;Link]\nRequiredForOnline=routable\n\n&#91;Network]\nDHCP=yes<\/code><\/pre>\n\n\n\n<p>initramfs<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># because we are using LVM we need to create a new initramfs.  Also needed for encryption and RAID.\n# edit \/etc\/mkinitcpio.conf\n# remove udev and replace with systemd\n# insert vlm2 between block and filesystems\nHOOKS=(base <strong>systemd<\/strong> ... block <strong>lvm2<\/strong> filesystems)\n\n# rebuild image\nmkinitcpio -P\n\n# install lvm2 and rebuild again because it gave you an error about exactly that\npacman -S lvm2\nmkinitcpio -P<\/code><\/pre>\n\n\n\n<p>root password<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>passwd<\/code><\/pre>\n\n\n\n<p>install bootloader &#8211; I&#8217;m doing grub for now, but I may either put the \/boot partition outside of LVM and load directly from UEFI.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># install grub and efibootmgr (if you haven't already)\npacman -S grub efibootmgr\n\n# mount efi partition\nmount --mkdir \/dev\/sda1 \/boot\/efi\n\n# install grub\ngrub-install --target=x86_64-efi --efi-directory=\/boot\/efi --bootloader-id=GRUB\n\n# make grub config\ngrub-mkconfig -o \/boot\/grub\/grub.cfg<\/code><\/pre>\n\n\n\n<p><em><strong>NOTE:  <\/strong>it is here where you realize the efi partition can NOT be on an LVM partition, even though GRUB is fine with \/boot being there.  Starting over and updating notes.  fml<\/em><\/p>\n\n\n\n<p>cross fingers and reboot<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># exit chroot\nexit\n\numount -R \/mnt\n\nreboot<\/code><\/pre>\n\n\n\n<p>Aaaaannnd voila!!!<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"669\" height=\"300\" src=\"https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-5.png\" alt=\"\" class=\"wp-image-1111\" srcset=\"https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-5.png 669w, https:\/\/thecweb.com\/wp-content\/uploads\/2024\/12\/image-5-300x135.png 300w\" sizes=\"auto, (max-width: 669px) 100vw, 669px\" \/><\/figure>\n\n\n\n<p>The most basic-bitch linux distro I&#8217;ve ever seen.  Well, except for LFS, and I guess Gentoo was possibly worse because you had to wait five hours of compiling to realize you fucked up.  But this is what I wanted.  A Hypervisor should be very minimal.  <\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/wiki.archlinux.org\/title\/Installation_guide Testing out minimal distros to run my hypervisor. Debian is fine and light enough, but the server doesn&#8217;t come for at least another day, so I&#8217;ve got time. I&#8217;ve been hearing about Arch for ever and I haven&#8217;t really looked into it, but it sounds exactly like what I&#8217;m looking for. Arch boots into [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":1105,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[44,14],"class_list":["post-1103","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-arch","tag-linux"],"_links":{"self":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1103","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=1103"}],"version-history":[{"count":8,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1103\/revisions"}],"predecessor-version":[{"id":1119,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/posts\/1103\/revisions\/1119"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/media\/1105"}],"wp:attachment":[{"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=1103"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=1103"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/thecweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=1103"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}