{"id":45,"date":"2024-02-17T16:23:46","date_gmt":"2024-02-17T15:23:46","guid":{"rendered":"https:\/\/mariuszkoniarz.pl\/?p=45"},"modified":"2024-02-17T17:43:24","modified_gmt":"2024-02-17T16:43:24","slug":"gentoo-bcachefs-root-and-dracut","status":"publish","type":"post","link":"https:\/\/mariuszkoniarz.pl\/index.php\/2024\/02\/17\/gentoo-bcachefs-root-and-dracut\/","title":{"rendered":"Gentoo bcachefs root and dracut"},"content":{"rendered":"\n<p>I had some trouble getting the system to run with bcachefs as root, but eventually it worked:<\/p>\n\n\n\n<p>Prepare pendrive to boot from:<\/p>\n\n\n\n<p>Install gentoo on usb with following changes:<\/p>\n\n\n\n<p>Get the kernel 6.7.* or never and set required options:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>File Systems --->\n   &lt;*> bcachefs filesystem support\n&#91;*]   bcachefs POSIX ACL support \n\nemerge --ask sys-fs\/bcachefs-tools\n\nRun computer from that usb. \n\nprepare the disks on target machine:\nI have 2 nvme disks and one big hdd:\nmake partitions on \/dev\/nvme0n1 (p1 for UEFI) p2\nmake partition on \/dev\/nvme1n1\nmake partition on \/dev\/sda\n\nbcachefs format --compression=lz4 --label=ssd.ssd1 \/dev\/nvme0n1p2 --label=ssd.ssd2 \/dev\/nvme1n1 --label=hdd.hdd1 \/dev\/sda --foreground_target=ssd --promote_target=ssd --background_target=hdd > \/mnt\/bcache.log\n\n(I redirected the outpu to later usage -> notice first External UUID)\nmount:\nbcachefs mount UUID=&lt;paste external UUID here> \/mnt\/gentoo\n\nInstall gento as usual on \/mnt\/gentoo\n\nemerge --ask sys-kernel\/dracut\n\nAdd dracut custom module:\n\n\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>cd \/usr\/lib\/dracut\/modules.d\nmkdir 04bcachefs\ncd 04bcachefs\n\ncp \/sbin\/bcachefs .\nnano module-setup.sh\n\n#!\/bin\/bash\ncheck() {\nreturn 0\n}\n\ndepends() {\nreturn 0\n}\n\ninstall() {\ninst_hook cmdline 10 \"$moddir\/bcachefs.sh\"\n}\n\nnano bcachefs.sh\n\n#!\/bin\/sh\nroot=$(getarg root=)\necho \"root=$root\"\nbcachefs mount $root \/sysroot\numount \/dev \/proc \/sys\nexec switch_root \/sysroot \/sbin\/init\n\nnano \/etc\/dracut.conf\nadd_dracutmodules+=\" bcachefs \"\n\ndracut -f\ntry:\ngrub-mkconfig -o \/boot\/grub\/grub.cfg \n\n\/usr\/sbin\/grub-probe: error: failed to get canonical path of `\/dev\/nvme0n1p2:\/dev\/nvme1n1p1:\/dev\/sda1'.\nthis will propably fail, because bcachefs didn't appear in \/dev\/disk\/by-uuid so You have to create grub.cfg by hand or copy from usb and tweak a bit eg. \nedit the line \nlinux\t\/vmlinuz-6.7.4-gentoo rootfstype=bcachefs rootwait rootdelay=5 root=UUID=&lt;paste External UUID here> ro\n\nWrite it down and pray it works :)\n\nSo there are things that have to be done before Linux will normally boot from bcachefs root:\n\nmount command to natively support bcachefs\nkernel \/dev\/disk\/by-uuid issue\ngrub-probe\n\n\n\n\n\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I had some trouble getting the system to run with bcachefs as root, but eventually it worked: Prepare pendrive to boot from: Install gentoo on usb with following changes: Get the kernel 6.7.* or never and set required options:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","footnotes":""},"categories":[4],"tags":[],"class_list":["post-45","post","type-post","status-publish","format-standard","hentry","category-gentoo"],"_links":{"self":[{"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/posts\/45","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/comments?post=45"}],"version-history":[{"count":2,"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions"}],"predecessor-version":[{"id":48,"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/posts\/45\/revisions\/48"}],"wp:attachment":[{"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/media?parent=45"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/categories?post=45"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mariuszkoniarz.pl\/index.php\/wp-json\/wp\/v2\/tags?post=45"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}