LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   mounting root file system at boot: error w/ fstab (not fdisk) (https://www.linuxquestions.org/questions/linux-general-1/mounting-root-file-system-at-boot-error-w-fstab-not-fdisk-917833/)

Drone4four 12-08-2011 11:18 PM

mounting root file system at boot: error w/ fstab (not fdisk)
 
I recently installed a Oneiric based Linux distro. It booted fine until I changed my fstab. I altered my fstab so I could access my ntfs and other Linux partitions. Now when I boot in recovery mode, it hangs after 2 or 3 seconds with this message:

Code:

Begin: Running /scripts/init-premount … done
Begin:  Mounting root file system ...

And then it just hangs there forever until I press the reset button on my PC. I figure that I am getting this error because I didn’t configure my fstab correctly. Here is what my fstab looks like:

Code:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    nodev,noexec,nosuid 0      0
# / was on /dev/sda7 during installation
/dev/sda7        /              reiserfs notail          0      1
# / was on UUID=ef73f69f-1518-4c85-967d-2ed64c157ef1 after installation
# swap was on /dev/sda6 during installation
UUID=7208caa3-3b2a-4134-a114-23cf92c1238d none            swap    sw              0      0
/dev/sda3        /home/winxp    ntfs-3g        defaults    0 0
/dev/sdb1        /home/ntfs2tb    ntfs-3g        defaults    0 0
/dev/sda2        /home/slack/    ext4        noatime    0 0
# deleted: /dev/sda5        /home/gentoo    ext3        noatime        0 0

Even if ‘/dev/sda7’ is replaced with ‘UUID=ef73f69f-1518-4c85-967d-2ed64c157ef1’, I get the same error message on boot. I foolishly didn't back up my fstab before changing it so I have nothing to revert back to.

I tried adding # to the beginning of all the lines in my fstab except the line for swap and for root. My fstab therefore looks like this:

Code:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    nodev,noexec,nosuid 0      0
# / was on /dev/sda7 during installation
#UUID=ef73f69f-1518-4c85-967d-2ed64c157ef1
/dev/sda7        /              reiserfs notail          0      1
# swap was on /dev/sda6 during installation
UUID=7208caa3-3b2a-4134-a114-23cf92c1238d none            swap    sw              0      0
# /dev/sda3        /home/winxp    ntfs-3g        defaults    0 0
# /dev/sdb1        /home/ntfs2tb    ntfs-3g        defaults    0 0
# /dev/sda2        /home/slack/    ext4        noatime    0 0
# deleted: /dev/sda5        /home/gentoo    ext3        noatime        0 0

With this fstab, it still chokes at boot at around the 3 second mark with the same error message.

Here is the output of parted -l and fdisk -l from my LiveDVD:

Code:

mint@mint ~ $ sudo parted -l
Model: ATA WDC WD3200AAKS-0 (scsi)
Disk /dev/sda: 320GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End    Size    Type      File system    Flags
1      32.3kB  321MB  321MB  primary  ext2            boot
2      321MB  39.3GB  39.0GB  primary  ext4
3      39.3GB  78.3GB  39.0GB  primary  ntfs
4      78.3GB  320GB  242GB  extended
6      78.3GB  94.3GB  16.0GB  logical  linux-swap(v1)
7      94.3GB  218GB  124GB  logical  reiserfs
5      218GB  320GB  102GB  logical  ntfs


Model: ATA WDC WD20EARS-00J (scsi)
Disk /dev/sdb: 2000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos

Number  Start  End    Size    Type    File system  Flags
1      32.3kB  2000GB  2000GB  primary  ntfs


Warning: Unable to open /dev/sr0 read-write (Read-only file system).  /dev/sr0
has been opened read-only.
Error: /dev/sr0: unrecognised disk label                                 

mint@mint ~ $ sudo fdisk -l

Disk /dev/sda: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625140335 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00087335

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63      626534      313236  83  Linux
/dev/sda2          626535    76790699    38082082+  83  Linux
/dev/sda3        76790700  152954864    38082082+  7  HPFS/NTFS/exFAT
/dev/sda4      152954878  625135615  236090369    5  Extended
/dev/sda5      426477568  625135615    99329024    7  HPFS/NTFS/exFAT
/dev/sda6      152954880  184205311    15625216  82  Linux swap / Solaris
/dev/sda7      184207360  426477567  121135104  83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000cc3

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              63  3907024064  1953512001    7  HPFS/NTFS/exFAT
mint@mint ~ $

What am I doing wrong?

I tried posting in the Linux Mint forums, but no one has replied with a solution so I thought I would try here. I hope that's not a problem.

smallpond 12-09-2011 08:05 AM

Good idea to comment out the unneeded lines in fstab, but the partition you are missing is:

Code:

1      32.3kB  321MB  321MB  primary  ext2            boot
This most likely contains your ram image and kernel, and is the only one marked bootable in your partition table. It's usually mounted on /boot. My guess is you accidentally deleted the line when you made your edits. Should look something like:

Code:

/dev/sda1 /boot                  ext2    defaults        1 2

Drone4four 12-09-2011 02:26 PM

fdisk says that /dev/sda1 is set as the bootable partition. So it would be reasonable to assume that it contains my ram image and kernel....but upon closer analysis -- with that drive mounted using my LiveCD -- the contents of /dev/sda1 mounted as /boot show that all the files are dated from early 2010, when I was playing around with Gentoo. Check it:

Code:

mint@mint ~ $ sudo mount /dev/sda1 /boot
mint@mint ~ $ cd /boot/
mint@mint /boot $ ls
boot
grub
grub.bak
initramfs-genkernel-x86_64-2.6.30-gentoo-r4
kernel-genkernel-x86_64-2.6.30-gentoo-r4
lost+found
splash
System.map-genkernel-x86_64-2.6.30-gentoo-r4
mint@mint /boot $ cd grub
mint@mint /boot/grub $ ls
default          grub.conf.bak                  stage1
device.map        grub.conf.bakapril4-2010.conf  stage2
e2fs_stage1_5    iso9660_stage1_5              stage2_eltorito
fat_stage1_5      jfs_stage1_5                  ufs2_stage1_5
ffs_stage1_5      menu.lst                      vstafs_stage1_5
grub.conf        minix_stage1_5                xfs_stage1_5
grub.conf~        reiserfs_stage1_5
grub.conf.backup  splash.xpm.gz
mint@mint /boot/grub $ ls -l
total 340
-rw-r--r-- 1 root root    197 2010-02-25 21:27 default
-rw-r--r-- 1 root root    30 2010-02-25 21:11 device.map
-rw-r--r-- 1 root root  8760 2010-02-25 21:27 e2fs_stage1_5
-rw-r--r-- 1 root root  7836 2010-02-25 21:27 fat_stage1_5
-rw-r--r-- 1 root root  7112 2010-02-25 21:27 ffs_stage1_5
-rw-r--r-- 1 root root    464 2010-03-09 01:20 grub.conf
-rw-r--r-- 1 root root    580 2010-03-09 01:20 grub.conf~
-rw-r--r-- 1 root root    527 2010-03-07 21:59 grub.conf.backup
-rw-r--r-- 1 root root    593 2010-03-08 02:14 grub.conf.bak
-rw-r--r-- 1 root root    464 2010-04-04 21:56 grub.conf.bakapril4-2010.conf
-rw-r--r-- 1 root root  7104 2010-02-25 21:27 iso9660_stage1_5
-rw-r--r-- 1 root root  8692 2010-02-25 21:27 jfs_stage1_5
lrwxrwxrwx 1 root root      9 2010-02-25 21:11 menu.lst -> grub.conf
-rw-r--r-- 1 root root  7328 2010-02-25 21:27 minix_stage1_5
-rw-r--r-- 1 root root  9732 2010-02-25 21:27 reiserfs_stage1_5
-rw-r--r-- 1 root root  33856 2010-02-25 21:10 splash.xpm.gz
-rw-r--r-- 1 root root    512 2010-02-25 21:27 stage1
-rw-r--r-- 1 root root 107892 2010-02-25 21:27 stage2
-rw-r--r-- 1 root root 107892 2010-02-25 21:10 stage2_eltorito
-rw-r--r-- 1 root root  7368 2010-02-25 21:27 ufs2_stage1_5
-rw-r--r-- 1 root root  6712 2010-02-25 21:27 vstafs_stage1_5
-rw-r--r-- 1 root root  9532 2010-02-25 21:27 xfs_stage1_5
mint@mint /boot/grub $ cd ..
mint@mint /boot $ ls -l
total 7776
lrwxrwxrwx 1 root root      1 2009-09-05 17:14 boot -> .
drwxr-xr-x 2 root root    1024 2010-04-04 21:56 grub
drwxr-xr-x 2 root root    1024 2010-02-25 21:05 grub.bak
-rw-r--r-- 1 root root 3491923 2010-03-08 02:01 initramfs-genkernel-x86_64-2.6.30-gentoo-r4
-rw-r--r-- 1 root root 2816128 2010-02-24 03:55 kernel-genkernel-x86_64-2.6.30-gentoo-r4
drwx------ 2 root root  12288 2009-09-05 16:36 lost+found
drwxr-xr-x 2 root root    1024 2010-03-07 21:59 splash
-rw-r--r-- 1 root root 1600763 2010-02-24 03:55 System.map-genkernel-x86_64-2.6.30-gentoo-r4
mint@mint /boot $

smallpond: I will go ahead with your advice anyways and add this entry to my fstab:

Code:

/dev/sda1 /boot                  ext2    defaults        1 2
My new fstab therefore looks like this:

Code:

# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>  <type>  <options>      <dump>  <pass>
proc            /proc          proc    nodev,noexec,nosuid 0      0
/dev/sda1 /boot                  ext2    defaults        1 2
# / was on /dev/sda7 during installation
UUID=1ad64730-ac97-42a3-8420-8e8707456937 /              ext4    errors=remount-ro 0      1
# swap was on /dev/sda6 during installation
UUID=7208caa3-3b2a-4134-a114-23cf92c1238d none            swap    sw              0      0
/dev/sda3                /home/winxp    ntfs-3g                defaults        0 0
/dev/sdb1                /home/ntfs2tb        ntfs-3g                defaults        0 0
/dev/sda2                /home/slack/    ext4                noatime        0 0
# deleted: /dev/sda5                /home/gentoo        ext3                noatime                0 0

I will now reboot my computer and see what happens. I will report back here with the results.

btw, the contents of /boot in my lisa partition on /dev/sda7 looks like this:

Code:

mint@mint ~ $ cd /mnt/lisa/boot/
mint@mint /mnt/lisa/boot $ ls -l
total 21898
-rw-r--r-- 1 root root  730503 2011-10-07 20:02 abi-3.0.0-12-generic
-rw-r--r-- 1 root root  134754 2011-10-07 20:02 config-3.0.0-12-generic
drwxr-xr-x 3 root root    6288 2011-12-02 23:01 grub
-rw-r--r-- 1 root root 13804061 2011-12-03 01:31 initrd.img-3.0.0-12-generic
-rw-r--r-- 1 root root  176764 2011-05-02 23:07 memtest86+.bin
-rw-r--r-- 1 root root  178944 2011-05-02 23:07 memtest86+_multiboot.bin
-rw------- 1 root root  2694177 2011-10-07 20:02 System.map-3.0.0-12-generic
-rw------- 1 root root    1367 2011-10-07 20:08 vmcoreinfo-3.0.0-12-generic
-rw-r--r-- 1 root root  4658096 2011-11-24 19:13 vmlinuz-3.0.0-12-generic
mint@mint /mnt/lisa/boot $


Drone4four 12-09-2011 02:47 PM

I can conclusively say that adding this to my fstab:

Code:

/dev/sda1 /boot                  ext2    defaults        1 2
...doesn't allow me to get past the error I reported initially. Recovery mode still hangs at the 3 second mark. What else could I try?

smallpond 12-09-2011 05:55 PM

Well. Not having any bootable partition seems like a problem. Shouldn't one of the others be marked bootable, then?

Drone4four 12-09-2011 07:25 PM

Not having a bootable partition does seem like a problem, yes. But my theory is that it’s separate from the problem I am having with my fstab. The initial error that I reported and the error I continue to experience despite my troubleshooting efforts is that the O/S can’t mount the root file system. My O/S loads premount init scripts and does a lot of other things which means, in my humble opinion, that it has nothing to do with GRUB. Since GRUB activates at boot allowing me to load Windows 7, Slackware 1337, Lisa and Lisa (recovery mode) I think the problem is with my fstab. If the bootable flag wasn’t set properly, as you suggest smallpond, then GRUB should be giving me one of it’s famous errors that can be found here: http://www.uruk.org/orig-grub/errors.html

Maybe I really don’t know know what I’m talking about. Maybe you’re right, smallpond. Question: How would I go about marking /dev/sda7 as bootable? Answer: Using fdisk. Since /dev/sda7 is the drive which has a fresh install of 64-bit Lisa, that’s the drive I want to mark bootable. My problem is I don’t know how to use fdisk. Here are the input, output and errors I get whilst using fdisk with my LiveDVD:

Code:

mint@mint ~ $ sudo fdisk -l

Disk /dev/sda: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625140335 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00087335

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63      626534      313236  83  Linux
/dev/sda2          626535    76790699    38082082+  83  Linux
/dev/sda3        76790700  152954864    38082082+  7  HPFS/NTFS/exFAT
/dev/sda4      152954878  625135615  236090369    5  Extended
/dev/sda5      426477568  625135615    99329024    7  HPFS/NTFS/exFAT
/dev/sda6      152954880  184205311    15625216  82  Linux swap / Solaris
/dev/sda7      184207360  426477567  121135104  83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000cc3

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              63  3907024064  1953512001    7  HPFS/NTFS/exFAT
mint@mint ~ $ sudo fdisk /dev/sda7

Command (m for help): m
Command action
  a  toggle a bootable flag
  b  edit bsd disklabel
  c  toggle the dos compatibility flag
  d  delete a partition
  l  list known partition types
  m  print this menu
  n  add a new partition
  o  create a new empty DOS partition table
  p  print the partition table
  q  quit without saving changes
  s  create a new empty Sun disklabel
  t  change a partition's system id
  u  change display/entry units
  v  verify the partition table
  w  write table to disk and exit
  x  extra functionality (experts only)

Command (m for help): a
Partition number (1-4): 1
Warning: partition 1 has empty type

Command (m for help): a
Partition number (1-4): 2
Warning: partition 2 has empty type

Command (m for help): a
Partition number (1-4): 3
Warning: partition 3 has empty type

Command (m for help): a 
Partition number (1-4): 4
Warning: partition 4 has empty type

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 22: Invalid argument.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
mint@mint ~ $ sudo fdisk -l

Disk /dev/sda: 320.1 GB, 320071851520 bytes
255 heads, 63 sectors/track, 38913 cylinders, total 625140335 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00087335

  Device Boot      Start        End      Blocks  Id  System
/dev/sda1  *          63      626534      313236  83  Linux
/dev/sda2          626535    76790699    38082082+  83  Linux
/dev/sda3        76790700  152954864    38082082+  7  HPFS/NTFS/exFAT
/dev/sda4      152954878  625135615  236090369    5  Extended
/dev/sda5      426477568  625135615    99329024    7  HPFS/NTFS/exFAT
/dev/sda6      152954880  184205311    15625216  82  Linux swap / Solaris
/dev/sda7      184207360  426477567  121135104  83  Linux

Partition table entries are not in disk order

Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes
255 heads, 63 sectors/track, 243201 cylinders, total 3907029168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000cc3

  Device Boot      Start        End      Blocks  Id  System
/dev/sdb1              63  3907024064  1953512001    7  HPFS/NTFS/exFAT
mint@mint ~ $

What does that “Warning: partition ‘x’ has empty type” mean? And what does error 22: Invalid argument mean? I Googled it but I can’t figure out what it means. What should I try next?

Drone4four 12-09-2011 09:21 PM

I asked in ##Linux on FreeNode and a number of idlers came forward and said that you are out to lunch, smallpond. Here is the dialogue (cropped):

Quote:

<Drone4four> question: how would i go about marking /dev/sda7 as bootable? answer: use fdisk. my problem is i don’t know how to use fdisk. Instead of using a pastebin, you can check out the ugly error message i have run into at this forum thread: http://www.linuxquestions.org/questi...-fdisk-917833/
<[R]> Drone4four: why do you think youi need to make a partition as "bootable"?
<[R]> mark*
<Drone4four> [R]: b/c fdisk says that /dev/sda1 is marked as bootable and i haven't used it in at least a year. i'm trying to get grub to load linux now on a different partition
<[R]> Drone4four: grub does not care about the bootable flag
<[R]> thats just for windows nonsense
<Drone4four> [R]: that's what i thought....but someone in my forum thread thought otherwise
<[R]> Drone4four: obviously that person is full of crap and/or just plain is a moron
<Drone4four> diegoviola, [R]: i think that your both being a little harsh...maybe he is just new to linux in comparison
<Drone4four> =D
<tsolox> be kind to animals
<[R]> if you are talking our your bum
<[R]> you shouldn't be giving advice
<br0adcast> lol
<br0adcast> thats the internet fellas, opinions are like assholes, everybody has one
<phobos_anomaly> Drone4four: If he is new, he wouldn't be trying to help with boot issues.
<phobos_anomaly> ergo since hes trying to help and giving out bad advice, hes a damn fool.
<[R]> br0adcast: giving retarded advice isn't an opinion...
<br0adcast> well sure it is
<phobos_anomaly> br0adcast: watch the language
<br0adcast> his opinion is that... yadda yadda..
<br0adcast> his advice surely is his opinion
<br0adcast> sorry phobos_anomaly, wont happen again.
<diegoviola> Drone4four: well that person then should come here to learn, in that case
<Drone4four> well could you folks take a look at my thread and offer some advice....I think what i need to do to solve my problem is to generate a default fstab from a LiveCD. how would I go about doing that?
<br0adcast> but regardless, be it an opinion or not, no excuse for giving useless info
<br0adcast> ok, then my apologies phobos ^

smallpond 12-10-2011 02:39 PM

Your friends are correct that the Linux bootloader does not need the boot flag. However, if you have dual-boot with Windows 7, your MBR now contains the Windows bootloader. Since you don't like my information, have a look here:

http://linux.ioerror.us/2006/01/30/w...-install-grub/

"If you intend to dual-boot Windows, then you should avoid installing GRUB to the MBR. The reason for this is that Windows occasionally overwrites the MBR, for instance, when you reinstall it, and that could be quite often. When that happens, your Linux system will seem to disappear as your system starts booting directly into Windows, bypassing the boot menu altogether. To avoid this, install GRUB to the boot sector of the active partition instead."


The active partition is the one marked with the boot flag. You can use cfdisk "b" command to set this.

impert 12-10-2011 03:06 PM

Have you checked that the UUID's correspond to the devices? Some installers re-format swap, for instance, and change the UUID in the process. And maybe you should check them in grub.cfg also. Also make sure you have ro in the kernel line, or linux line, since it's grub2.

Drone4four 12-14-2011 02:37 PM

After bashing my head against the wall for several days and after troubleshooting on 3 different forums and also in ##linux on FreeNode, the only solution was to reinstall Lisa. Ugh.

The experts in ##Linux hypothesized that my problem could have been ReiserFS related, so I went with ext4 upon reinstall. No problems so far.


All times are GMT -5. The time now is 09:04 AM.