{"id":17073,"date":"2025-12-02T12:22:28","date_gmt":"2025-12-02T06:52:28","guid":{"rendered":"https:\/\/www.skynats.com\/?p=17073"},"modified":"2025-12-02T12:23:47","modified_gmt":"2025-12-02T06:53:47","slug":"fixing-you-are-in-emergency-mode-due-to-a-failed-var-www-mount-in-linux","status":"publish","type":"post","link":"https:\/\/www.skynats.com\/blog\/fixing-you-are-in-emergency-mode-due-to-a-failed-var-www-mount-in-linux\/","title":{"rendered":"Fixing \u201cYou Are in Emergency Mode\u201d Due to a Failed \/var\/www Mount in Linux"},"content":{"rendered":"\n<h2 class=\"wp-block-heading has-small-font-size\" id=\"h-introduction\">Introduction<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">When working with <a href=\"https:\/\/www.linux.org\/\" target=\"_blank\" rel=\"noopener\"><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-secondary-color\">Linux<\/mark><\/a> servers, especially cloud-based systems, you may sometimes encounter the message:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>You are in emergency mode. \nAfter logging in, type \"journalctl -xb\" to view system logs.<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This usually happens when the system cannot mount one or more filesystems during boot a common situation seen in Emergency Mode Linux.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A common cause is an incorrect entry inside \/etc\/fstab, which can break the boot process and force the server into emergency mode.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this blog, we will walk through a real-world scenario where the server failed to boot because \/etc\/fstab attempted to mount the wrong device on \/var\/www.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You\u2019ll learn how to identify the issue, correct the fstab file, and safely restore the system to normal operation.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-small-font-size\">Identifying the Issue<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">After logging into emergency mode, running:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl --failed<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">shows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>var-www.mount loaded failed failed \/var\/www<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This indicates that the system could not mount the \/var\/www directory during boot.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To determine why, check the \/etc\/fstab file:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>cat \/etc\/fstab<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Inside it, you may see an entry like:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/sdc  \/var\/www  ext4  defaults 0 0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">At first glance, this looks correct.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, upon deeper inspection, it becomes clear that \/dev\/sdc is not a filesystem \u2014 it is a disk with an MBR table.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Checking the disk with:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>file -s \/dev\/sdc<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">returns:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>DOS\/MBR boot sector, extended partition table<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">And the actual filesystem is located on the partition:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/sdc1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Verified using:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>file -s \/dev\/sdc1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">which shows:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Linux rev 1.0 ext4 filesystem data ...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This means the system was trying to mount the entire disk instead of the partition that actually contains the filesystem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because \/dev\/sdc had no filesystem, the mount failed \u2014 causing the emergency mode boot issue.<\/p>\n\n\n\n<h2 class=\"wp-block-heading has-small-font-size\">Correcting the fstab Entry<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To fix this, edit the fstab file inside emergency mode:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/fstab<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Locate the incorrect line:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\/dev\/sdc  \/var\/www  ext4  defaults 0 0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Comment it out:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>#\/dev\/sdc  \/var\/www  ext4  defaults 0 0<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Save the file and reboot:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>reboot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">The system should now boot normally without dropping into emergency mode.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Running Filesystem Check (Optional but Recommended)<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Because \/dev\/sdc1 showed:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>(needs journal recovery)<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">it is recommended to run an fsck to ensure the filesystem is clean.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">However, never run fsck on a mounted root filesystem.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Option 1: Force fsck on next boot<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>touch \/forcefsck\nreboot<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Option 2: Boot into recovery mode and manually run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>fsck -fy \/dev\/sdc1<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">This safely repairs any pending journal issues.<\/p>\n\n\n\n<h3 class=\"wp-block-heading has-small-font-size\">Conclusion<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Emergency mode in Linux often points to problems related to the filesystem, and incorrect fstab entries are one of the most common triggers.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">In this scenario, the system failed to boot because \/etc\/fstab attempted to mount the entire \/dev\/sdc disk instead of the actual partition \/dev\/sdc1.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By identifying the failed mount, correcting the fstab entry, and rebooting, the system returned to normal operation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Always ensure that fstab entries point to valid filesystems \u2014 not raw disks \u2014 to prevent similar boot failures.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you encounter this issue in the future, you now have a clear, step-by-step process to diagnose and fix it quickly.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you\u2019re still stuck in Emergency Mode Linux or facing recurring \/var\/www mount issues, our experts can help. Skynats offers reliable <a href=\"https:\/\/www.skynats.com\/linux-server-management\/\">Linux Server Management Services<\/a> and 24\/7 <a href=\"https:\/\/www.skynats.com\/server-management\/\">Server Management Services<\/a> to diagnose, repair, and fully secure your server. Contact us anytime for instant support and get your system back online quickly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction When working with Linux servers, especially cloud-based systems, you may sometimes encounter the message: This usually happens when the system cannot mount one or more filesystems during boot a common situation seen in Emergency Mode Linux. A common cause is an incorrect entry inside \/etc\/fstab, which can break the boot process and force the [&hellip;]<\/p>\n","protected":false},"author":13,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[1180,1182,1179,1010,1181,302],"class_list":["post-17073","post","type-post","status-publish","format-standard","hentry","category-blog","tag-var-www-mount-in-linux","tag-24-7-server-management-services","tag-emergency-mode-linux","tag-linux-server-management-services","tag-linux-servers","tag-server-management-services"],"_links":{"self":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/17073","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/comments?post=17073"}],"version-history":[{"count":3,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/17073\/revisions"}],"predecessor-version":[{"id":17086,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/posts\/17073\/revisions\/17086"}],"wp:attachment":[{"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/media?parent=17073"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/categories?post=17073"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.skynats.com\/blog\/wp-json\/wp\/v2\/tags?post=17073"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}