linuxrc - btrfsck command not found (initrd)

Post here if you are a new Porteus member and you're looking for some help.
User avatar
duungustl
White ninja
White ninja
Posts: 9
Joined: 24 Aug 2015, 22:54
Distribution: Porteus 3.1
Location: vienna

linuxrc - btrfsck command not found (initrd)

Post#1 by duungustl » 02 Sep 2015, 18:41

Hello,
i have the Porteus on a btrfs filesystem and i will check it on boot.
So i extract the initrd.xz and modifiy the linuxrc file:

Code: Select all

<--------- start by line 143 -----------
## Let's start!
mount -nt devtmpfs none /dev

bcheck=`find / -name "btrfsck"`
# Perform filesystem check:
# if param fsck; then
    echo "performing linux filesystem check on all available devices:"
#    draw
    for x in `blkid | grep 'TYPE="ext4"' | cut -d: -f1`; do e2fsck -C 0 -p $x; echo "Filecheck on $x"; wait; done
    for x in `blkid | grep 'TYPE="btrfs"' | cut -d: -f1`; do $bcheck --repair $x; echo "Filecheck on $x"; wait; done
    #   draw
# fi
---- cut ------>
the filecheck on ext4 perform with no errors.
The blkid command found my partition on /dev/mmcblk0p2, but the busybox returns: /usr/bin/btrfsck command not found ???

hmm, i copy the btrfs files in usr/bin/ there is also the e2fsck & blkid binary.

Code: Select all

root@porteus:/mnt/live/bin/busybox
BusyBox v1.21.1 (2014-01-18 12:05:40 UTC) multi-call binary.
Currently defined functions:
	ash, basename, bash, cat, chmod, chown, chroot, clear, cp, cut, df,
	dmesg, egrep, find, free, grep, halt, ifconfig, kill, killall, ln,
	losetup, ls, lsmod, lsof, lspci, md5sum, mkdir, mknod, modinfo,
	modprobe, mount, mv, ping, pivot_root, poweroff, ps, reboot, rev, rm,
	rmdir, route, sed, sh, sleep, sort, switch_root, sync, tac, tail,
	touch, tr, udhcpc, umount, uname, uniq, usleep, vi
thx for you help
P.S.: sorry for my poor english i'm from austria :)
Last edited by duungustl on 04 Sep 2015, 02:31, edited 3 times in total.

KnallKopf
Samurai
Samurai
Posts: 134
Joined: 18 Sep 2012, 20:56
Distribution: Porteus 64bit KDE4
Location: Absurdistan

Re: linuxrc - btrfsck command not found

Post#2 by KnallKopf » 02 Sep 2015, 20:58

hmm, i copy the btrfs files in usr/bin/ there is also the e2fsck & blkid binary.
what are btrfs files ?

1.) I'm not sure but I think, only static binarys work, or binarys that was compiled against uclibc (from initrd).
look at the /lib directory of linuxrd /lib dir.

2.) there are a lot of mount --bind ... in the linuxrc be shure that btrfs files on the right places, when it will need.
P.S.: sorry for my poor english i'm from austria
I am shure my englisch are worster. :lol:

User avatar
duungustl
White ninja
White ninja
Posts: 9
Joined: 24 Aug 2015, 22:54
Distribution: Porteus 3.1
Location: vienna

Re: linuxrc - btrfsck command not found

Post#3 by duungustl » 02 Sep 2015, 22:20

Servas Knallkopf :-)
KnallKopf wrote: what are btrfs files ?
1.) I'm not sure but I think, only static binarys work, or binarys that was compiled against uclibc (from initrd).
look at the /lib directory of linuxrd /lib dir.

Code: Select all

root@porteus:/mnt/live/bin# file btrfs
btrfs: ELF 64-bit LSB  executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), stripped
root@porteus:/mnt/live/bin# file busybox 
busybox: ELF 32-bit LSB  executable, Intel 80386, version 1 (SYSV), statically linked, stripped
probably i must compile the btrfs-tools for the busybox ...
KnallKopf wrote: 2.) there are a lot of mount --bind ... in the linuxrc be shure that btrfs files on the right places, when it will need..
I know, but the btrfsck must run before i mount the Partition.

Code: Select all

root@porteus:/# umount /dev/mmcblk0p2
root@porteus:/# df -h
Dateisystem    Größe Benutzt Verf. Verw% Eingehängt auf
aufs            1,2G     31M  1,1G    3% /
devtmpfs        947M     27M  920M    3% /dev
/mnt/live/run   949M    305M  644M   33% /run
/dev/mmcblk1p1   13G    2,2G   11G   18% /mnt/data16gb-intern
root@porteus:/# btrfsck /dev/mmcblk0p2
/dev/mmcblk0p2 is currently mounted. Aborting.

root@porteus:/# losetup -a
/dev/loop0: [0014]:177 (/mnt/live/memory/copy2ram/000-kernel.xzm)
/dev/loop1: [0014]:173 (/mnt/live/memory/copy2ram/001-core.xzm)
/dev/loop2: [0014]:186 (/mnt/live/memory/copy2ram/001-core_alldesktops-150124.xzm)
/dev/loop3: [0014]:187 (/mnt/live/memory/copy2ram/002-xorg.xzm)
/dev/loop4: [0014]:188 (/mnt/live/memory/copy2ram/002-xorg_alldesktops-150126.xzm)
/dev/loop5: [0014]:189 (/mnt/live/memory/copy2ram/003-xfce.xzm)
/dev/loop6: [0014]:190 (/mnt/live/memory/copy2ram/004-xfce_fixes-150124.xzm)
/dev/loop7: [0014]:191 (/mnt/live/memory/copy2ram/0099-settings.xzm)
/dev/loop8: [0014]:192 (/mnt/live/memory/copy2ram/05-devel.xzm)
/dev/loop9: [0014]:193 (/mnt/live/memory/copy2ram/vim-7.4.050-x86_64-bundle.xzm)
/dev/loop10: [0014]:194 (/mnt/live/memory/copy2ram/bluez-4.99-x86_64-bundle.xzm)
/dev/loop11: [0014]:195 (/mnt/live/memory/copy2ram/btrfs-progs-20150213-x86_64-1.xzm)
/dev/loop12: [0014]:196 (/mnt/live/memory/copy2ram/crda-1.1.1-x86_64-bundle.xzm)
/dev/loop13: [0014]:197 (/mnt/live/memory/copy2ram/font-misc-misc-1.1.2-noarch-1.xzm)
/dev/loop14: [0014]:198 (/mnt/live/memory/copy2ram/font-xfree86-type1-1.0.4-noarch-1.xzm)
/dev/loop15: [0014]:199 (/mnt/live/memory/copy2ram/iw-3.5-x86_64-1.xzm)
/dev/loop16: [0014]:200 (/mnt/live/memory/copy2ram/libXrender-0.9.8-x86_64-1.xzm)
/dev/loop17: [0014]:201 (/mnt/live/memory/copy2ram/libmtp-1.1.6-x86_64-1.xzm)
/dev/loop18: [0014]:202 (/mnt/live/memory/copy2ram/locales-de_AT.utf8-x86_64-1prt.xzm)
/dev/loop19: [0014]:203 (/mnt/live/memory/copy2ram/unifont-5.1.20080907-noarch-1_Ahau.xzm)
/dev/loop20: [0014]:204 (/mnt/live/memory/copy2ram/xfce4-battery-plugin-1.0.5-x86_64-2rl.xzm)
/dev/loop21: [0014]:205 (/mnt/live/memory/copy2ram/xfce4-weather-plugin-0.8.4-x86_64-1_slack14.1.xzm)
/dev/loop22: [0025]:295 (/mnt/data16gb-intern/USM-store/google-chrome-stable_current_amd64.xzmI
hmm, this is curious :%)

cu & thx gerry
Last edited by duungustl on 03 Sep 2015, 07:11, edited 3 times in total.

KnallKopf
Samurai
Samurai
Posts: 134
Joined: 18 Sep 2012, 20:56
Distribution: Porteus 64bit KDE4
Location: Absurdistan

Re: linuxrc - btrfsck command not found

Post#4 by KnallKopf » 02 Sep 2015, 23:49

It seems that porteus will boot. Is this correct ?

Normally it should work without filecheck, (but it is usefull)
I think you can disable it provisionally

Code: Select all

# for x in `blkid | grep 'TYPE="btrfs"' | cut -d: -f1`; do $bcheck --repair $x; echo "Filecheck on $x"; wait; done
But i wondering too because i think for mounting btrfs you need.
/lib/modules/3.17.4-porteus/kernel/fs/btrfs/btrfs.ko
first
root@porteus:/# umount /dev/mmcblk0p2
root@porteus:/# df -h
Dateisystem Größe Benutzt Verf. Verw% Eingehängt auf
aufs 1,2G 31M 1,1G 3% /
devtmpfs 947M 27M 920M 3% /dev
/mnt/live/run 949M 305M 644M 33% /run
/dev/mmcblk1p1 13G 2,2G 11G 18% /mnt/data16gb-intern
root@porteus:/# btrfsck /dev/mmcblk0p2
/dev/mmcblk0p2 is currently mounted. Aborting.

I can not explain.
But it is the same situation on my PC.
copy modules to RAM from /dev/sda2 (ext4)
+ changes container on /dev/sda2

Code: Select all

umount /dev/sda2
umount: /dev/sda2: not mounted
I cannot see them with df -h

Code: Select all

root@porteus:~# e2fsck /dev/sda2
e2fsck 1.42.12 (29-Aug-2014)
/dev/sda2 is mounted.
e2fsck: Cannot continue, aborting.
The reason (i think) is i have a open changes-container on /dev/sda2
And it can not remount. See line 422 of linuxrc

Code: Select all

echo $i"changing root directory"
if param noauto; then
    for x in `grep /mnt/ /etc/fstab | cut -d/ -f3`; do mkdir -p /union/mnt/$x; umount -n /mnt/$x 2>/dev/null && rmdir /mnt/$x; done
else
    grep /mnt/ /etc/fstab >> /union/etc/mtab
    for x in `grep /mnt/ /etc/fstab | cut -d/ -f3`; do mkdir -p /union/mnt/$x; mount -n --move /mnt/$x /union/mnt/$x; rmdir /mnt/$x; done
fi
Be sure that /dev/mmcblk0p2 on /etc/fstab (on a booted porteus /mnt/live/etc/fstab)
read at line 44

Code: Select all

# Device Functions:
...
to 79

User avatar
duungustl
White ninja
White ninja
Posts: 9
Joined: 24 Aug 2015, 22:54
Distribution: Porteus 3.1
Location: vienna

Re: linuxrc - btrfsck command not found

Post#5 by duungustl » 03 Sep 2015, 07:07

KnallKopf wrote:It seems that porteus will boot. Is this correct ?
YES
KnallKopf wrote:But i wondering too because i think for mounting btrfs you need.
/lib/modules/3.17.4-porteus/kernel/fs/btrfs/btrfs.ko
first

Code: Select all

cat .config|grep BTRFS
CONFIG_BTRFS_FS=y
CONFIG_BTRFS_FS_POSIX_ACL=y
# CONFIG_BTRFS_FS_CHECK_INTEGRITY is not set
# CONFIG_BTRFS_FS_RUN_SANITY_TESTS is not set
# CONFIG_BTRFS_DEBUG is not set
# CONFIG_BTRFS_ASSERT is not set

KnallKopf wrote: I can not explain.
The reason (i think) is i have a open changes-container on /dev/sda2
And it can not remount. See line 422 of linuxrc

Code: Select all

echo $i"changing root directory"
if param noauto; then
    for x in `grep /mnt/ /etc/fstab | cut -d/ -f3`; do mkdir -p /union/mnt/$x; umount -n /mnt/$x 2>/dev/null && rmdir /mnt/$x; done
else
    grep /mnt/ /etc/fstab >> /union/etc/mtab
    for x in `grep /mnt/ /etc/fstab | cut -d/ -f3`; do mkdir -p /union/mnt/$x; mount -n --move /mnt/$x /union/mnt/$x; rmdir /mnt/$x; done
fi
I boot with the param --> noauto
Look at my refind.conf (/dev/mmcblk0p1)
UUID:8ae1954a-f20c-4c6c-9074-d19ca6b60418 =/dev/mmcblk0p2

Code: Select all

options "fsck tpm_tis.force=1 copy2ram acpi_osi=Linux sgnfile=porteus.sgn noauto changes=EXIT:UUID:8ae1954a-f20c-4c6c-9074-d19ca6b60418/porteus timezone=Europe/Vienna kmap=de"
KnallKopf wrote: Be sure that /dev/mmcblk0p2 on /etc/fstab (on a booted porteus /mnt/live/etc/fstab)
read at line 44 to 79

Code: Select all

# Device Functions:
...
this is the function fstab() { .... }
this will call after the filesystemcheck by line 170

it's a hard work :wall:

KnallKopf
Samurai
Samurai
Posts: 134
Joined: 18 Sep 2012, 20:56
Distribution: Porteus 64bit KDE4
Location: Absurdistan

Re: linuxrc - btrfsck command not found

Post#6 by KnallKopf » 03 Sep 2015, 20:24

Your linuxrc is working, but only the filecheck will not work.
You will have the same affect if you use ext4 instead of btrfs.

It is not possible to use changes=... and umount the same partition. But this is the result of noauto.
see line 424

Code: Select all

for x in `grep /mnt/ /etc/fstab | cut -d/ -f3`; do mkdir -p /union/mnt/$x; umount -n /mnt/$x 2>/dev/null && rmdir /mnt/$x; done
Your changes=... is in use and umount not possible.

User avatar
francois
Contributor
Contributor
Posts: 6434
Joined: 28 Dec 2010, 14:25
Distribution: xfce plank porteus nemesis
Location: Le printemps, le printemps, le printemps... ... l'hiver s'essoufle.

Re: linuxrc - btrfsck command not found

Post#7 by francois » 03 Sep 2015, 21:38

To be able to use btrfs it seems that you have to install the package under porteus:

Code: Select all

root@porteus:~# usm -u all
root@porteus:~# usm -g btrfs
Prendre son temps, profiter de celui qui passe.

User avatar
duungustl
White ninja
White ninja
Posts: 9
Joined: 24 Aug 2015, 22:54
Distribution: Porteus 3.1
Location: vienna

Re: linuxrc - btrfsck command not found

Post#8 by duungustl » 04 Sep 2015, 01:27

francois wrote:To be able to use btrfs it seems that you have to install the package under porteus:

Code: Select all

root@porteus:~# usm -u all
root@porteus:~# usm -g btrfs
Hello francois,
yes it is :-)

Code: Select all

root@porteus:~# usm -s btrfs
btrfs-progs-20130418-x86_64-1.txz was found in slackware [installed]
btrfs-progs-20150213-x86_64-1.txz was found in slackwarepatches [installed]
Packages found:   2 


User avatar
duungustl
White ninja
White ninja
Posts: 9
Joined: 24 Aug 2015, 22:54
Distribution: Porteus 3.1
Location: vienna

Re: linuxrc - btrfsck command not found

Post#9 by duungustl » 04 Sep 2015, 02:27

KnallKopf wrote:Your linuxrc is working, but only the filecheck will not work.
You will have the same affect if you use ext4 instead of btrfs.
Sorry this is not correct.
I change my Partitions:
Porteus is on /dev/mmcblk0p2 (btrfs)
changes is on /dev/mmcblk1p2 (ext4)
Now it's possible to make a fsck on /dev/mmcblk1p2 (ext4) when the linuxrc starts!
The /dev/mmcblk0p2 can i check with /etc/rc.d/rc.local (called by init3)

Code: Select all

umount  /dev/mmcblk0p2 && btrfsck --repair  /dev/mmcblk0p2
This is a workaround for me.

The btrfsck don't work because busybox have no applet for btrfsck (only for viewing with blkid)-i read a lot and also i will test do compile a new busysbox with a btrfsck applet, but this was to strange für me..
http://www.busybox.net/FAQ.html#adding
KnallKopf wrote: It is not possible to use changes=... and umount the same partition. But this is the result of noauto.
see line 424
Your changes=... is in use and umount not possible.

Code: Select all

for x in `grep /mnt/ /etc/fstab | cut -d/ -f3`;  # here you see the [devices]  - test it: grep /mnt/ /etc/fstab | cut -d/ -f3
do mkdir -p /union/mnt/$x;  # create only a directory in /union/mnt/[device]
umount -n /mnt/$x 2>/dev/null &&  # UMOUNT /mnt/[device]
 rmdir /mnt/$x; done   # delete /mnt/[device]

No [device] is mounted.

Thanks a lot for your help "KnallKopf"
gerry the ungustl :beer:

Post Reply