{"id":1521,"date":"2014-12-26T23:37:33","date_gmt":"2014-12-26T22:37:33","guid":{"rendered":"http:\/\/majek.mamy.to\/?p=1521"},"modified":"2015-02-20T11:48:19","modified_gmt":"2015-02-20T10:48:19","slug":"initrd-in-slackware","status":"publish","type":"post","link":"https:\/\/majek.sh\/en\/initrd-in-slackware\/","title":{"rendered":"Initrd in Slackware"},"content":{"rendered":"<p>There is small simple howto with <strong>Slackware<\/strong> package mkinitrd, man page says a little bit more, more is kind of mystery \ud83d\ude42<br \/>\nI switched from full kernel (in fact, my own compiled kernel) to initrd few years ago and since then I had learned a lot about it (sometimes in hard way) \ud83d\ude42<\/p>\n<p>So, this is my way (a little different than in man and readme) of doing initrd.<\/p>\n<h1>Installation<\/h1>\n<p>During Slackware installation you need to install:<\/p>\n<ul>\n<li>kernel-generic (not kernel-huge!)<\/li>\n<li>kernel-modules<\/li>\n<li>mkinitd<\/li>\n<\/ul>\n<p>and of course other packages you would like to have \ud83d\ude42<br \/>\nRemember NOT to install kernel-huge package.<\/p>\n<p>Install everything, setup lilo, timezones etc as usual. At the end DON&#8217;T reboot at the end of setup &#8211; system isn&#8217;t finished yet!<\/p>\n<p>Now, it&#8217;s time to prepare new initrd.<\/p>\n<ol>\n<li>Chroot to <strong>\/mnt<\/strong> (where new system should be already mounted)<\/li>\n<li>Make copy of default mkinitrd config:\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">cp \/etc\/mkinitrd.conf.sample \/etc\/mkinitrd.conf<\/div><\/div>\n<\/li>\n<li>Edit new <strong>\/etc\/mkinitrd.conf<\/strong> with your favourite editor and set few options:\n<ul>\n<li>uncomment and set <strong>MODULE_LIST<\/strong> and <strong>ROOTFS<\/strong> to type of your root filesystem, for example\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">ROOTFS=&quot;ext3&quot;<br \/>\nMODULE_LIST=&quot;ext3&quot;<\/div><\/div>\n<p>You don&#8217;t need to worry about all related modules, they will be added automatically.<\/li>\n<li>if you use software raid, uncomment and set\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">RAID=&quot;1&quot;<\/div><\/div>\n<\/li>\n<li>if you use lvm or encryption, uncomment and set\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">LVM=&quot;1&quot;<\/div><\/div>\n<\/li>\n<li>I strongly recommend to set <strong>SOURCE_TREE<\/strong> and <strong>OUTPUT_IMAGE<\/strong> to some more unique names, for example\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">SOURCE_TREE=&quot;\/boot\/initrd-tree-3.10.12&quot;<br \/>\nOUTPUT_IMAGE=&quot;\/boot\/initrd-3.10.12.gz&quot;<\/div><\/div>\n<p>You don&#8217;t have to do this if you don&#8217;t want to play with custom kernels etc.<\/li>\n<\/ul>\n<\/li>\n<li>make new initrd with <strong>mkinitrd -F<\/strong><\/li>\n<li>add initrd image to <strong>lilo.conf<\/strong> adding it just after &#8216;image&#8217; line, so it will look like this:\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">image = \/boot\/vmlinuz-generic-3.10.12<br \/>\n&nbsp;initrd = \/boot\/initrd-3.10.12.gz<\/div><\/div>\n<\/li>\n<li>get out of chroot and rebuild lilo with:\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">mount --bind \/dev \/mnt\/dev<br \/>\nmount --bind \/proc \/mnt\/proc<br \/>\nlilo -r \/mnt<\/div><\/div>\n<\/ol>\n<p>Right now you could reboot system and enjoy new <strong>Slackware<\/strong> with initrd:-)<\/p>\n<p>What&#8217;s an advantage of this way instead of running mkinitrd with many bizarre options? See next part.<\/p>\n<h1>Normal usage<\/h1>\n<p>Sometimes you need to change kernel, upgrade or something like that.<\/p>\n<p>There are 2 ways of maintaining <strong>Slackware<\/strong> with initrd:<\/p>\n<ol>\n<li>Use one initrd for all kernels<\/li>\n<li>Use separate initrd for every kernel or even every entry in lilo<\/li>\n<\/ol>\n<h2>One initrd for all<\/h2>\n<p>At start, make sure that you have commented out <strong>CLEAR_TREE<\/strong> or set it to <strong>0<\/strong> in <strong>mkinitrd.conf<\/strong>!<\/p>\n<p>After installation of new kernel and running still from old one, you need to to set <strong>KERNEL_VERSION<\/strong> to version of your new kernel, for example<\/p>\n<div class=\"codecolorer-container text railscasts\" style=\"overflow:auto;white-space:nowrap;width:550px;\"><div class=\"text codecolorer\">KERNEL_VERSION=&quot;3.17.4&quot;<\/div><\/div>\n<p>Then just run <strong>mkinitrd -F<\/strong><br \/>\nThat&#8217;s all about initrd &#8211; now image has required modules for both\/all your kernels.<br \/>\nOf course you need new entry in <strong>lilo.conf<\/strong> for new kernel with exactly the same initrd as old one.<br \/>\nIf you are making kernel upgrade (replace old kernel package) you don&#8217;t even need to touch <strong>lilo.conf<\/strong>. But in both cases, you must run <strong>lilo<\/strong> at the end.<\/p>\n<p>From time to time, you could clean initrd tree from old modules from kernel you don&#8217;t use anymore. In this case just remove all directory with that modules from <strong>\/boot\/initrd-tree\/lib\/modules\/old-kernel-version<\/strong> and regenerate initrd using as usual <strong>mkinitrd -F<\/strong>. And rerun <strong>lilo<\/strong> of course \ud83d\ude42<\/p>\n<p>Now, you probably see advantage of using mkinitrd.conf instead of remembering all those weird switches you used last time to generate this image.<\/p>\n<h2>Separate initrd for every kernel<\/h2>\n<p>This way have a little sense if you only use one root filesystem and only stock kernel which you sometimes only upgrade.<\/p>\n<p>Separate initrd is even easier than &#8216;one for all&#8217; attitude.<br \/>\nOne drawback is that mkinitrd with -F flag only reads one default \/etc\/mkinitrd.conf file, so each time you have to copy saved configuration back to this file.<br \/>\nSo, for first kernel you should customize at least <strong>SOURCE_TREE<\/strong>, <strong>OUTPUT_IMAGE<\/strong> and <strong>KERNEL_VERSION<\/strong>. Generate new initrd with <strong>mkinitrd -F<\/strong>, then make backup of <strong>mkinitrd.conf<\/strong> to for example <strong>mkinitrd.conf.3.10.17<\/strong>.<br \/>\nFor next kernel with different options customize <strong>mkinitrd.conf<\/strong> again, create new initrd, make backup and so on.<br \/>\nThat way you could have different initrds and saved all options to regenerate each of them. It&#8217;s safe attitude as playing with new kernel and initrd configuration you always have working old one.<\/p>\n<p>Ok, that was easy part:-)<br \/>\nNext time I&#8217;ll cover how to combine initrd with encrypted root and even root on encrypted lvm \ud83d\ude42<\/p>\n<h2>Update 2015.02.20<\/h2>\n<p>I found quite good article on the same topic at <a href=\"http:\/\/docs.slackware.com\/slackbook:booting?s[]=initrd\" target=\"_blank\">Slackware Documentation Project<\/a>. So, it looks like i didn&#8217;t do so much research before writing this post \ud83d\ude42<\/p>","protected":false},"excerpt":{"rendered":"<p>There is small simple howto with Slackware package mkinitrd, man page says a little bit more, more is kind of mystery \ud83d\ude42 I switched from full kernel (in fact, my own compiled kernel) to initrd few years ago and since <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/majek.sh\/en\/initrd-in-slackware\/\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[64,65],"_links":{"self":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts\/1521"}],"collection":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/comments?post=1521"}],"version-history":[{"count":30,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts\/1521\/revisions"}],"predecessor-version":[{"id":1597,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/posts\/1521\/revisions\/1597"}],"wp:attachment":[{"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/media?parent=1521"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/categories?post=1521"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/majek.sh\/en\/wp-json\/wp\/v2\/tags?post=1521"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}