You are not logged in.

#1 2012-06-09 18:03:44

Gwasanaethau
Member
From: Baile Átha Clíath, Éire
Registered: 2009-11-20
Posts: 12

[Solved] Separate /usr, initramfs and forcefsck

Hi all,

I’ve been using Arch Linux for a few years now. I’m currently having problems with the latest installation on a desktop computer. Arch has installed completely, but I am having problems when booting the system when an fsck procedure occurs: namely that fsck attempts to run on an already mounted /usr partition. I know this is probably related to the ‘/usr’ hook in ‘/etc/mkinitcpio.conf’, but removing it results in the system not booting (or shutting down) at all.

I have read through various wiki entries, forum posts and posts on the arch mailing system, but I’m still unsure as to why this is occurring. Please can anyone help?

/etc/fstab:

# 
# /etc/fstab: static file system information
#
# <file system>   <dir>            <type>   <options>                                                 <dump> <pass>
proc              /proc            proc     defaults                                                  0      0
sysfs             /sys             sysfs    defaults                                                  0      0
devpts            /dev/pts         devpts   defaults                                                  0      0
shm               /dev/shm         tmpfs    defaults                                                  0      0

/dev/sr0          /media/optical   auto     ro,user,noauto,unhide                                     0      0
/dev/fd0          /media/floppy    auto     rw,user,noauto,unhide,sync                                0      0

LABEL=Swap        swap             swap     defaults,pri=1                                            0      0
LABEL=ArchRoot    /                ext4     defaults,journal_checksum,data=journal,noatime            0      1
LABEL=Boot        /boot            ext2     defaults,noatime                                          0      2
LABEL=ArchUsr     /usr             ext4     defaults,journal_checksum,data=journal,noatime            0      3
LABEL=ArchVar     /var             ext4     defaults,journal_checksum,data=journal,noatime            0      4
LABEL=Home        /home            ext4     defaults,journal_checksum,data=journal,noatime            0      5
LABEL=WindowsXP  /media/xp        ntfs-3g   noatime,auto,nodev,noexec,nosuid,rw,sync,users,nls=utf8   0      0

/boot/grub/menu.lst:

# Begin /boot/grub/menu.lst
# NB: root (hdx,y) is the partition where the relavent kernel is situated.
# root=/dev/sdax is the partition to act as root.

timeout 10
default 0
color blue/black cyan/black

# 0 – Arch Linux
title Arch Linux
root (hd1,0)
kernel /vmlinuz-linux root=/dev/disk/by-label/ArchRoot ro 5 vga=0x303 logo.nologo rootflags=data=journal
initrd /initramfs-linux.img

# 1 – Arch Linux Command Line
title Arch Linux CLI
root (hd1,0)
kernel /vmlinuz-linux root=/dev/disk/by-label/ArchRoot ro 3 vga=0x303 logo.nologo rootflags=data=journal
initrd /initramfs-linux.img

# 2 – Arch Linux Fallback
title Arch Linux Fallback
root (hd1,0)
kernel /vmlinuz-linux root=/dev/disk/by-label/ArchRoot ro 5 vga=0x303 logo.nologo rootflags=data=journal
initrd /initramfs-linux-fallback.img

# 3 – Windows XP Home
title Windows XP Home
root (hd0,0)
makeactive
chainloader +1

# End /boot/grub/menu.lst

/etc/mkinitcpio.conf ‘HOOKS’ array:

HOOKS="consolefont keymap base fsck shutdown udev autodetect pata scsi sata filesystems usbinput usr"

Last edited by Gwasanaethau (2012-06-11 19:54:13)

Offline

#2 2012-06-09 18:08:10

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 5,265

Re: [Solved] Separate /usr, initramfs and forcefsck

This may not be the cause of your problem, but what do 3, 4, and 5 mean for <pass>?

man fstab

Sakura:-
Mobo: ASUS P8Z77-V PRO // Processor: Intel Core i7-3770K 3.4GHz // GFX: nVidia GeForce GTX 970 Ti // RAM: 32GB (4x 8GB) Corsair DDR3 (@ 2133MHz) // Storage: 1x 3TB Seagate SATAII 5x 1TB Samsung SATAII, 2x 120GB Corsair SSD

Offline

#3 2012-06-09 18:18:02

Gwasanaethau
Member
From: Baile Átha Clíath, Éire
Registered: 2009-11-20
Posts: 12

Re: [Solved] Separate /usr, initramfs and forcefsck

WorMzy wrote:

This may not be the cause of your problem, but what do 3, 4, and 5 mean for <pass>?

man fstab

Ah, I was sure that you were meant to put the order you wanted the partitions to be checked in here. No idea where I picked that up from; was this the case in a previous version? As you predicted, it doesn’t have any effect on the problem.

Offline

#4 2012-06-09 18:20:18

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [Solved] Separate /usr, initramfs and forcefsck

Did you remember to re-generate your initramfs after editing mkinitcpio.conf?

$ sudo mkinitcpio -p linux

"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#5 2012-06-09 18:23:40

Gwasanaethau
Member
From: Baile Átha Clíath, Éire
Registered: 2009-11-20
Posts: 12

Re: [Solved] Separate /usr, initramfs and forcefsck

DSpider wrote:

Did you remember to re-generate your initramfs after editing mkinitcpio.conf?

$ sudo mkinitcpio -p linux

I did indeed – apologies for not mentioning that in the original post.

Offline

#6 2012-06-11 19:53:45

Gwasanaethau
Member
From: Baile Átha Clíath, Éire
Registered: 2009-11-20
Posts: 12

Re: [Solved] Separate /usr, initramfs and forcefsck

For anyone else that might be struggling with this, I have found an answer that allows the system to boot. As I have ‘fsck’ and ‘usr’ in the ‘HOOKS’ array of /etc/mkinitcpio.conf (see above), it seems that including /usr in the ‘pass’ column of /etc/fstab is no longer necessary as the /usr partition (along with /) is now checked during the initramfs stage of each boot. Changing the relevant line in /etc/fstab to:

LABEL=ArchUsr     /usr             ext4     defaults,journal_checksum,data=journal,noatime            0      0

(note final ‘0’) seems to have fixed the issue (in fact it seems obvious now that I think about it).

However, it still seems odd that / is mounted read-only at the time of the fsck, but /usr is mounted read/write (and thus fails the fsck).

Offline

#7 2012-06-11 20:25:14

DSpider
Member
From: Romania
Registered: 2009-08-23
Posts: 2,273

Re: [Solved] Separate /usr, initramfs and forcefsck

However, it still seems odd that / is mounted read-only at the time of the fsck, but /usr is mounted read/write (and thus fails the fsck).

Yes. That's what "ro" from the "kernel" line in GRUB is for. "Read-Only", so that fsck can do its thing. Running fsck on a mounted ("read/write") partition is a bad idea.

Just try it. I dare you!

$ sudo fsck /dev/sda2
fsck from util-linux 2.21.2
e2fsck 1.42.3 (14-May-2012)
/dev/sda2 is mounted.  


WARNING!!!  The filesystem is mounted.   If you continue you ***WILL***
cause ***SEVERE*** filesystem damage.


Do you really want to continue<n>? 

Basically, when the time comes, your root partition will be mounted Read-Only, "fsck'ed", and then remounted as writeable. The /usr partition needs a "2" at the end. Only for "/" do you need "1" (which is the highest priority). It's covered in the wiki, in at least three places that I know of:

https://wiki.archlinux.org/index.php/Fs … efinitions
https://wiki.archlinux.org/index.php/Fsck#fstab_options
https://wiki.archlinux.org/index.php/Be … tc.2Ffstab

Last edited by DSpider (2012-06-11 20:34:01)


"How to Succeed with Linux"

I have made a personal commitment not to reply in topics that start with a lowercase letter. Proper grammar and punctuation is a sign of respect, and if you do not show any, you will NOT receive any help (at least not from me).

Offline

#8 2012-06-12 18:44:53

Gwasanaethau
Member
From: Baile Átha Clíath, Éire
Registered: 2009-11-20
Posts: 12

Re: [Solved] Separate /usr, initramfs and forcefsck

DSpider wrote:

Yes. That's what "ro" from the "kernel" line in GRUB is for. "Read-Only", so that fsck can do its thing. Running fsck on a mounted ("read/write") partition is a bad idea.

Just try it. I dare you

Basically, when the time comes, your root partition will be mounted Read-Only, "fsck'ed", and then remounted as writeable. The /usr partition needs a "2" at the end. Only for "/" do you need "1" (which is the highest priority)…

Thanks for the reply. I understand all this happens to /, but is there any way to ensure that /usr goes through this same process as / does during the initramfs stage of booting?

If I put a ‘2’ at the end of the /usr line of /etc/fstab, fsck then tries to run on a /usr partition that was mounted rw by the initramfs. It notices, aborts and then throws the system to the repair console every time. I understand that actually running fsck on a partition mounted read/write is a very bad thing, so I’m trying to stop it from happening during boot. The only way I can see to do this at the moment is to disable fsck from running on /usr completely by inserting the ‘0’ at the end of the /usr line in /etc/fstab and just allow it to run on all the other partitions as they don’t get mounted by initramfs.

Offline

Board footer

Powered by FluxBB