{"id":609,"date":"2021-02-09T20:19:59","date_gmt":"2021-02-09T19:19:59","guid":{"rendered":"https:\/\/www.joerg-seyfried.de\/alt\/?p=609"},"modified":"2021-02-09T20:19:59","modified_gmt":"2021-02-09T19:19:59","slug":"updating-debian-grub-trouble","status":"publish","type":"post","link":"https:\/\/www.joerg-seyfried.de\/alt\/en\/2021\/02\/updating-debian-grub-trouble\/","title":{"rendered":"Updating Debian: Grub trouble"},"content":{"rendered":"\n<p>That was one of those: updates you should&#8217;ve skipped. Unless you have a spare, lazy Sunday afternoon. As I just did. The update itself was Lenny 6.0.3 in my case, but this seems to happen in different places at different times &#8211; YMMV. Anyway, the package tool apt-get asked me where it should install Grub &#8211; and that&#8217;s when I got suspicious. I could choose between sda, sdb, md1 or md2 &#8211; any regardless of my choice (even multiples selected), the result was a bit disappointing:<\/p>\n<pre>\/usr\/sbin\/grub-setup: warn: This msdos-style partition label has no post-MBR gap; \n    embedding won't be possible!.\n\/usr\/sbin\/grub-setup: error: embedding is not possible, but this is required when \n    the root device is on a RAID array or LVM volume.<\/pre>\n<p>Just great. Aunt Google isn&#8217;t really helpful on this one, so here&#8217;s my little How-To.<\/p>\n<p><span style=\"color: #ff0000;\"><strong>Warning notice:<\/strong><\/span>&nbsp;please (pretty please) follow these instructions ONLY if you know what they mean. Any single command listed here is quite capable. Of messing up your whole system\u2026<\/p>\n<p>I had this scenario: RAID level 1 for \/boot and \/ (and the swap partition. I know, that&#8217;s stupid, so let&#8217;s change that in the process, too). Here&#8217;s my config for reference:<\/p>\n<pre>cat \/proc\/mdstat \nPersonalities : [raid0] [raid1] [raid6] [raid5] [raid4] \nmd2 : active raid1 sda3[0] sdb3[1]\n      726266432 blocks [2\/2] [UU]\n\nmd1 : active raid1 sda2[0] sdb2[1]\n      2104448 blocks [2\/2] [UU]\n\nmd0 : active raid1 sda1[0] sdb1[1]\n      4200896 blocks [2\/2] [UU]<\/pre>\n<p>The single disks are configured identically like this:<\/p>\n<pre>I\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\nDisk identifier: 0x0004be32\n\n   Device Boot      Start         End      Blocks   Id  System\n\/dev\/sda1               1     8401994     4200997   fd  Linux raid autodetect\n\/dev\/sda2         8401995    12611024     2104515   fd  Linux raid autodetect\n\/dev\/sda3        12611025  1465144064   726266520   fd  Linux raid autodetect<\/pre>\n<p>\u2026and that number \u201c1\u201d being the starting block of partition number 1 is the problem. However, I was really lucky: md0 consists of sda1 and sdb1, and md0 only holds my swap partition. So we have to change that one so that it starts \u201chigher\u201d than block 1.&nbsp;Let&#8217;s go:<\/p>\n<pre>swapoff -a<\/pre>\n<pre>mdadm --stop \/dev\/md0<\/pre>\n<pre>fdisk \/dev\/sda<\/pre>\n<p>\u2026and tinker with partition 1: delete (d, 1), re-create (n, p, 1, 63, [enter your maximum size here]), change type (t, 1, fd), write back (w). If you like, do the same with disk sdb (if you think it&#8217;s more aesthetically pleasing to have the RAID partitions the same size for example). Next, reassemble the RAID, this time using RAID-level 0 (striping) for swap (why shouldn&#8217;t we?):<\/p>\n<pre>mdadm --create \/dev\/md0 --level=0 --raid-devices=2 \/dev\/sda1 \/dev\/sdb1<\/pre>\n<p>And: beam me up, Scotty:<\/p>\n<pre>mkswap \/dev\/md0<\/pre>\n<p>accompanied by a:<\/p>\n<pre>swapon -a<\/pre>\n<p>That&#8217;s about it. Please don&#8217;t forget to re-setup Grub &#8211; hopefully without error messages this time. If you do forget, your next reboot might be a bit messy\u2026 ;-)<\/p>\n<p>Big thanks goes to the folks over at the Hetzner-forums &#8211; they had the solution (but inaccessible for Google, that&#8217;s why I put it here).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>That was one of those: updates you should&#8217;ve skipped. Unless you have a spare, lazy Sunday afternoon. As I just did. The update itself was Lenny 6.0.3 in my case, but this seems to happen in different places at different times &#8211; YMMV. Anyway, the package tool apt-get asked me where it should install Grub [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"footnotes":""},"categories":[37],"tags":[],"class_list":["post-609","post","type-post","status-publish","format-standard","hentry","category-nicht-kategorisiert-en"],"_links":{"self":[{"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/posts\/609","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/comments?post=609"}],"version-history":[{"count":1,"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/posts\/609\/revisions"}],"predecessor-version":[{"id":610,"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/posts\/609\/revisions\/610"}],"wp:attachment":[{"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/media?parent=609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/categories?post=609"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.joerg-seyfried.de\/alt\/wp-json\/wp\/v2\/tags?post=609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}