{"id":1815,"date":"2018-01-27T21:41:57","date_gmt":"2018-01-27T21:41:57","guid":{"rendered":"http:\/\/www.incredigeek.com\/home\/?p=1815"},"modified":"2018-07-24T16:29:43","modified_gmt":"2018-07-24T16:29:43","slug":"how-to-chroot-into-a-linux-drive","status":"publish","type":"post","link":"https:\/\/www.incredigeek.com\/home\/how-to-chroot-into-a-linux-drive\/","title":{"rendered":"How to chroot into a Linux drive"},"content":{"rendered":"<p>Chrooting can be super useful for changing things like the root password, repairing grub bootloader etc., things that require the system to be mounted.\u00a0 Typically if your chrooting into an OS drive you can boot up on a Live Linux distro, or use the Rescue feature on some Linux installers.<\/p>\n<p><strong>Mount main drive<\/strong><\/p>\n<p>Change sdb2 to the root partition of your drive.<\/p>\n<pre>mount \/dev\/sdb2 \/mnt<\/pre>\n<p><strong>Mount other stuff<\/strong><\/p>\n<pre>mount -t proc none \/mnt\/proc\r\nmount -o bind \/dev \/mnt\/dev\r\nmount -o bind \/sys \/mnt\/sys\r\nmount -o bind \/run \/mnt\/run<\/pre>\n<p>If you want to, you can mount the boot partition.\u00a0 Change sdb1 if your boot partition is something else.\u00a0 For efi, you may need to mount the boot partition then mount the efi partition inside \/boot\/efi.<\/p>\n<pre>mount \/dev\/sdb1 \/mnt\/boot<\/pre>\n<p><strong>Chroot<\/strong><\/p>\n<pre> chroot \/mnt<\/pre>\n<p>You should now be inside the chroot environment.\u00a0 To exit the chroot, hit control+d or type exit.<\/p>\n<p>If your having issues resolving DNS refer to <a href=\"http:\/\/www.incredigeek.com\/home\/dnf-yum-not-working-in-chroot-environment\/\">this<\/a> post.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Chrooting can be super useful for changing things like the root password, repairing grub bootloader etc., things that require the system to be mounted.\u00a0 Typically if your chrooting into an OS drive you can boot up on a Live Linux &hellip; <a href=\"https:\/\/www.incredigeek.com\/home\/how-to-chroot-into-a-linux-drive\/\">Continue reading <span class=\"meta-nav\">&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":[4,3],"tags":[386,249,7,380,387],"class_list":["post-1815","post","type-post","status-publish","format-standard","hentry","category-command-line","category-linux","tag-chroot","tag-drive","tag-linux-2","tag-mount","tag-os"],"_links":{"self":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1815","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/comments?post=1815"}],"version-history":[{"count":7,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1815\/revisions"}],"predecessor-version":[{"id":2074,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/posts\/1815\/revisions\/2074"}],"wp:attachment":[{"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/media?parent=1815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/categories?post=1815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.incredigeek.com\/home\/wp-json\/wp\/v2\/tags?post=1815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}