live usb fsck not working on boot

Kernels & Hardware, configuring network, installing services

live usb fsck not working on boot

Postby boozer » 2014-05-31 05:01

I have been working on this for hours and hours.... and I am sure the solution is simple but I cant figure it out. I *think* I have a USB with a live image partition and partition for changes. I donwloaded and flashed the image to a usb.

I tried touch /forcefsck but the drive was not checked.

After searching I found that fsck reads the fstab and my fstab was fairly empty and had 0 set for fsck.. so I change the last 0 to 1 but the drive was still not checked.

Code: Select all
root@bill:/etc# uname -a
Linux bill 2.6.32-5-amd64 #1 SMP Sun May 6 04:00:17 UTC 2012 x86_64 GNU/Linux

user@bill:~$ sudo cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

aufs / aufs rw 0 0
tmpfs /tmp tmpfs nosuid,nodev 0 0



The specific partion I want to check is /dev/sda2 so I copied the information from /etc/mtab to fstab

Code: Select all
root@bill:/etc# cat fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

/dev/sda2 /live/cow ext2 noatime,errors=remount-ro 0 2

tmpfs /tmp tmpfs nosuid,nodev 0 0
aufs / aufs rw 0 0


But it was still not checked.

I searched and found tune2fs and it was set to check every 35 mounts or six months so I changed it to check every day and rebooted but fsck was still not run on startup.

Code: Select all
root@bill:/etc# tune2fs -l /dev/sda2
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   live-rw
Last mounted on:          <not available>
Filesystem UUID:          1c0d21c1-26df-4c39-992a-92cdb1845176
Filesystem magic number:  0xEF53
Filesystem revision #:    1 (dynamic)
Filesystem features:      ext_attr resize_inode dir_index filetype sparse_super large_file
Filesystem flags:         signed_directory_hash
Default mount options:    (none)
Filesystem state:         not clean
Errors behavior:          Continue
Filesystem OS type:       Linux
Inode count:              216000
Block count:              863232
Reserved block count:     43161
Free blocks:              257135
Free inodes:              170163
First block:              0
Block size:               4096
Fragment size:            4096
Reserved GDT blocks:      210
Blocks per group:         32768
Fragments per group:      32768
Inodes per group:         8000
Inode blocks per group:   500
Filesystem created:       Tue Apr  2 14:28:09 2013
Last mount time:          Fri Dec 20 06:21:49 2013
Last write time:          Fri May 30 23:44:08 2014
Mount count:              132
Maximum mount count:      35
Last checked:             Fri Dec 20 11:15:52 2013
Check interval:           86400 (1 day)
Next check after:         Sat Dec 21 11:15:52 2013
Reserved blocks uid:      0 (user root)
Reserved blocks gid:      0 (group root)
First inode:              11
Inode size:               256
Required extra isize:     28
Desired extra isize:      28
Default directory hash:   half_md4
Directory Hash Seed:      a693b6df-0922-4846-907b-c005f52d1ab0


I checked the rcS.d scripts and FSCKFIX=no so I changed it to FSCKFIX=yes

Code: Select all
root@bill:/etc/rcS.d# cat S08checkroot.sh (and S09checkfs.sh)
#! /bin/sh
### BEGIN INIT INFO
# Provides:          checkroot
# Required-Start:    mountdevsubfs hostname
# Required-Stop:
# Should-Start:      keymap hwclockfirst hdparm bootlogd
# Should-stop:
# Default-Start:     S
# Default-Stop:
# X-Interactive:     true
# Short-Description: Check to root file system.
### END INIT INFO

# Include /usr/bin in path to find on_ac_power if /usr/ is on the root
# partition.
PATH=/sbin:/bin:/usr/bin
FSCK_LOGFILE=/var/log/fsck/checkroot
[ "$FSCKFIX" ] || FSCKFIX=yes
[ "$SULOGIN" ] || SULOGIN=no
<snip>


I also checked /etc/default/rcS and FSCK was set to no there, so I changed it to "yes"

Code: Select all
root@bill:/etc# cat /etc/default/rcS
#
# /etc/default/rcS
#
# Default settings for the scripts in /etc/rcS.d/
#
# For information about these variables see the rcS(5) manual page.
#
# This file belongs to the "initscripts" package.

TMPTIME=0
SULOGIN=no
DELAYLOGIN=no
UTC=yes
VERBOSE=no
FSCKFIX=yes
RAMRUN=no
RAMLOCK=no



Code: Select all
root@bill:/etc# cat mtab
aufs / aufs rw 0 0
tmpfs /lib/init/rw tmpfs rw,nosuid,mode=0755 0 0
proc /proc proc rw,noexec,nosuid,nodev 0 0
sysfs /sys sysfs rw,noexec,nosuid,nodev 0 0
udev /dev tmpfs rw,mode=0755 0 0
tmpfs /dev/shm tmpfs rw,nosuid,nodev 0 0
devpts /dev/pts devpts rw,noexec,nosuid,gid=5,mode=620 0 0
/dev/sda1 /live/image vfat rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,shortname=mixed,errors=remount-ro 0 0
/dev/sda2 /live/cow ext2 rw,noatime,errors=continue 0 0
tmpfs /live tmpfs rw,relatime 0 0
tmpfs /tmp tmpfs rw,nosuid,nodev 0 0
fusectl /sys/fs/fuse/connections fusectl rw 0 0


Code: Select all
root@bill:/etc# df -kh
Filesystem            Size  Used Avail Use% Mounted on
aufs                  3.3G  2.3G  836M  74% /
tmpfs                 2.0G     0  2.0G   0% /lib/init/rw
udev                  2.0G  216K  2.0G   1% /dev
tmpfs                 2.0G  4.0K  2.0G   1% /dev/shm
/dev/sda1             442M  428M   14M  97% /live/image
/dev/sda2             3.3G  2.3G  836M  74% /live/cow
tmpfs                 2.0G     0  2.0G   0% /live
tmpfs                 2.0G  9.5M  2.0G   1% /tmp



I also tried adding fsck.mode=force to what I believe is the boot menu kernel option:

Code: Select all
root@bill:/live/image/syslinux# cat syslinux.cfg
include menu.cfg
default /syslinux/vesamenu.c32
prompt 0
timeout 50
root@bill:/live/image/syslinux# cat live.cfg

label live
        menu label Boot the BAMT
        kernel /live/vmlinuz
        append initrd=/live/initrd.img boot=live config persistent noprompt=usb splash vga=normal hostname=bamt-miner fsck.mode=force

label livefailsafe
        menu label Boot the BAMT (failsafe)
        kernel /live/vmlinuz
        append initrd=/live/initrd.img boot=live config persistent noprompt=usb splash vga=normal hostname=bamt-miner  noapic noapm nodma nomce nolapic nomodeset nosmp vga=normal





label memtest
        menu label Memory test
        kernel /live/memtest


#label floppy
#       localboot 0x00

#label disk1
#       localboot 0x80

#label disk2
#       localboot 0x81

#label nextboot
#       localboot -1


And I rebooted and the partition still shows "not clean" via tune2fs. There are nothing populated in the logs in the /var/log/fsck

dmsg just states a check is recommend :/

Code: Select all
[    0.000000] Command line: initrd=/live/initrd.img boot=live config persistent noprompt=usb splash vga=normal hostname=bamt-miner fsck.mode=force BOOT_IMAGE=/live/vmlinuz
[    0.000000] Kernel command line: initrd=/live/initrd.img boot=live config persistent noprompt=usb splash vga=normal hostname=bamt-miner fsck.mode=force BOOT_IMAGE=/live/vmlinuz
[   11.917215] EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended


Anything else I can do to determine why fsck is not being run? The box is remote so I cant just put the drive in a different machine to fsck it unless I drive out there, lol.
Last edited by boozer on 2014-06-03 08:02, edited 1 time in total.
boozer
 
Posts: 4
Joined: 2014-05-31 04:28

Re: fsck not working on boot

Postby kiyop » 2014-05-31 07:47

I think that I cannot give you a solution, but I am curious about your problem.
Could you please write concrete URL where you downloaded the live iso image?
Could you post all the results of the following commands?
Code: Select all
cat /etc/fstab
mount
sudo fdisk -l
sudo blkid
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/
User avatar
kiyop
 
Posts: 3984
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan

Re: fsck not working on boot

Postby boozer » 2014-05-31 11:26

Been a long time since I downloaded it, but I think this was the link:

http://files2.bitcointrading.com/bamt64_v05a.zip


The mount or mtab does not reflect the settings I have in fstab. Below are the commands you requested.

Code: Select all
root@bill:/live/image/syslinux# cat /etc/fstab
# /etc/fstab: static file system information.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

/dev/sda2 /live/cow ext2 noatime,errors=remount-ro 0 2

tmpfs /tmp tmpfs nosuid,nodev 0 0
aufs / aufs rw 0 0
root@bill:/live/image/syslinux# mount
aufs on / type aufs (rw)
tmpfs on /lib/init/rw type tmpfs (rw,nosuid,mode=0755)
proc on /proc type proc (rw,noexec,nosuid,nodev)
sysfs on /sys type sysfs (rw,noexec,nosuid,nodev)
udev on /dev type tmpfs (rw,mode=0755)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
devpts on /dev/pts type devpts (rw,noexec,nosuid,gid=5,mode=620)
/dev/sda1 on /live/image type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,shortname=mixed,errors=remount-ro)
/dev/sda2 on /live/cow type ext2 (rw,noatime,errors=continue)
tmpfs on /live type tmpfs (rw,relatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev)
fusectl on /sys/fs/fuse/connections type fusectl (rw)
root@bill:/live/image/syslinux# sudo fdisk -l

Disk /dev/sda: 7902 MB, 7902068736 bytes
4 heads, 32 sectors/track, 120576 cylinders
Units = cylinders of 128 * 512 = 65536 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f0d65

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1        7072      452607+  83  Linux
/dev/sda2            7073       61024     3452928   83  Linux

root@bill:/live/image/syslinux# sudo blkid
/dev/sda1: SEC_TYPE="msdos" LABEL="DEBIAN_LIVE" UUID="CE61-CBEF" TYPE="vfat"
/dev/sda2: LABEL="live-rw" UUID="1c0d21c1-26df-4c39-992a-92cdb1845176" TYPE="ext2"
/dev/loop0: TYPE="squashfs"

Last edited by boozer on 2014-05-31 16:56, edited 1 time in total.
boozer
 
Posts: 4
Joined: 2014-05-31 04:28

Re: fsck not working on boot

Postby kiyop » 2014-05-31 12:24

Thank you for replying :)
But ...
boozer wrote:http://files2.bitcointrading.com/bamt64_v05a.zip

I do not want to download such compressed file which may be not an image supported officially by debian teams.

boozer wrote:The mount or mtab does not reflect the settings I have in fstab.

Where do you put the fstab?

boozer wrote:
Code: Select all
/dev/sda1 on /live/image type vfat (rw,relatime,fmask=0022,dmask=0022,codepage=cp437,iocharset=utf8,shortname=mixed,errors=remount-ro)

(snip by kiyop)

Disk /dev/sda: 7902 MB, 7902068736 bytes

(snip by kiyop)

/dev/sda1   *           1        7072      452607+  83  Linux
/dev/sda2            7073       61024     3452928   83  Linux

There are strange things. For example, /dev/sda1 must have vfat (FAT32?) file system while it is marked as type 83 (linux).
Your system is not like a debian installed on a partition with usual method. I guess yours is like a live debian system.
What files are on /dev/sda1? If there is an initramfs file (such as initrd.???), you can expand it and analyze it.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/
User avatar
kiyop
 
Posts: 3984
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan

Re: fsck not working on boot

Postby boozer » 2014-05-31 17:11

No problem... I have done fine without the funcitonality for years but now just wanted to try and learn a bit more about linux so since I never solved this issue I decided I would try again. I failed and would like to go through the troubleshooting why to try and learn some more about linux.

I just noticed I did not provide the blkid you asked for. I edited my earlier post so it is in there now if you want to see it. The fstab is in the standard location /etc/fstab... is that what you were asking?

Yes it is a live debian running on USB.

This mount point has has what you asked about in a directory called "live"

Code: Select all
/dev/sda1             442M  428M   14M  97% /live/image

root@bill:/live/image/live# ls
filesystem.packages  filesystem.squashfs  initrd.img  memtest  vmlinuz


Boot menu stuff is here:

Code: Select all
root@bill:/live/image/syslinux# ls
exithelp.cfg  f1.txt  f3.txt  f5.txt  f7.txt  f9.txt    menu.cfg    splash.png   syslinux.bin  vesamenu.c32
f10.txt       f2.txt  f4.txt  f6.txt  f8.txt  live.cfg  prompt.cfg  stdmenu.cfg  syslinux.cfg


There are also intrd images in /boot/

Code: Select all
root@bill:/boot# ls
config-2.6.32-5-amd64  initrd.img-2.6.32-5-amd64  System.map-2.6.32-5-amd64  vmlinuz-2.6.32-5-amd64




I'll figure out how to I "expand and analyze" the initrd.img and let you know if I'm successful or not. Any place in particular in there I should be looking?

If you wanted, I could get you ssh access to mine, but like I said, I would kinda like to learn about troubleshooting it myself :)

Thanks for the help on this completely random issue :D
boozer
 
Posts: 4
Joined: 2014-05-31 04:28

Re: fsck not working on boot

Postby kiyop » 2014-06-01 01:37

Thank you for replying :)
I read your earlier post about the result of blkid.
boozer wrote:The fstab is in the standard location /etc/fstab... is that what you were asking?

Yes.

boozer wrote:
Code: Select all
filesystem.packages  filesystem.squashfs  initrd.img  memtest  vmlinuz

As you may know the filesystem.squashfs contains original files and directories in the mounted (chroot'ed) root partition of booted live debian.
As you may know, the files and the directories on /dev/sda2 overwrite the original ones.

boozer wrote:I'll figure out how to I "expand and analyze" the initrd.img

Code: Select all
mkdir initrd
cd initrd
gzip -dc /live/image/initrd.img | cpio -i

There may be init and files in directory "script", which may be executed at the boot time before (and just after) mounting the root partition of booted live debian.
Search by the following may give useful information:
Code: Select all
grep -R -n fsck *

Refer
Code: Select all
man grep


Maybe my terminology is wrong.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/
User avatar
kiyop
 
Posts: 3984
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan

Re: fsck not working on boot

Postby boozer » 2014-06-02 16:31

this is what it came back with:

Code: Select all
root@bill:~/initrd# grep -R -n -i fsck *
Binary file lib/modules/2.6.32-5-amd64/kernel/fs/ext3/ext3.ko matches
Binary file lib/modules/2.6.32-5-amd64/kernel/fs/ext2/ext2.ko matches
Binary file lib/modules/2.6.32-5-amd64/kernel/fs/reiserfs/reiserfs.ko matches
Binary file lib/modules/2.6.32-5-amd64/kernel/fs/ext4/ext4.ko matches
scripts/live:105:                       forcepersistentfsck)
scripts/live:106:                               FORCEPERSISTENTFSCK="Yes"
scripts/live:107:                               export FORCEPERSISTENTFSCK
scripts/live:1300:                      if [ "${FORCEPERSISTENTFSCK}" = "Yes" ]
scripts/live:1302:                              fsck -y ${cowdevice}
scripts/live:1792:      # if we do not unmount the ISO we can't run "fsck /dev/ice" later on


Nothing jumps out at me there..... should there be an additional fsck -y in there by chance?
boozer
 
Posts: 4
Joined: 2014-05-31 04:28

Re: live usb fsck not working on boot

Postby kiyop » 2014-06-03 11:56

How about reading the lines around the line shown in the above output, such as around the 1302th line of scripts/live?
I guess that there is case command above the 105th line of scripts/live. You may be able to give "forcepersistentfsck" as kernel parameter (kernel command line? kernel option?), which can be given in the line involving the kernel at the end, to force fsck for COW at boot time.

To add kernel parameter, you can search for the files the name of which ends with .cfg such as txt.cfg in a directory the name of which is like syslinux (or isolinux) in /live/image (/dev/sda1, vfat), if the kernel loader is one of them.
Refer http://www.syslinux.org/wiki/index.php/SYSLINUX or so.

P.S. I have not downloaded http://files2.bitcointrading.com/bamt64_v05a.zip . Maybe I should in order to analyze by myself, although I do not want to.
Openbox, JWM: Jessie, Sid, Arch / Win XP (on VirtualBox), 10
http://kiyoandkei.bbs.fc2.com/
User avatar
kiyop
 
Posts: 3984
Joined: 2011-05-05 15:16
Location: Where persons without desire to improve themselves fear to tread, in Japan


Return to System configuration

Who is online

Users browsing this forum: No registered users and 18 guests

fashionable