tokiclover / mkinitramfs-ll

Lightweight, modular and powerfull initramfs generating tool

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Init exits causing kernel panic

samuraiii opened this issue · comments

Hello again,

After successful test of your marvelous work I decided to put it on other machine:

When I tried to boot for first time I get this error
/init:line 177: syntax error: bad substitution

first i tried to figure out it myself (trying to find my mistakes) but no luck

system is Gentoo 64 - fresh install and with your latest scripts (cloned around 9:00 GMT)

S.

That's weird because line 177 is a simple substitution with a simple match/replace, and, sh (/bin/busybox sh) handle it just fine.

So you're using LVM2/LUKS on this machine. Do you use LVM2 on the other? Your VG name or LV does not have hyphens '-' do they?

I cannot think of something that could cause it, so, if you don't mind I'd like to get your kernel cmdline. If you cannot post it on this issue, mail me at tokiclover at gmail dot com.

Another question, are you using master branch script (meaning bash script) to build your initramfs?

NOTE: init wasn't changed lastly... two features just got added and the LVM2 part is unchanged for a while. I could modify it if the line is faulty.

I know that line 177 is simple thats why I first tried to check my faults.

machine is 3 partitions
ntfs for winxp
boot (holding kernel initrd and gpg-ed key-file
luks container
___lvm2 PV
_____root
_____swap
_____home
_____var
_____tmp

setup is made to support squashfs (when its fully setup), with gpg and lvm, no splash (I using Grub 2) or TuxOnIce (considered to be added when sources move to kernel 3).

all is bzipped here http://dat.societasnocturna.com/ini.tar.bz2
(archive contains copy of initrd, grub.cfg (contains kernel command-line) and copy of tools used / needed to build init

hope this helps
S

You don't need to upload all that stuff... copying the kernel cmdline would have been enough. Anyway, I am using grub2 as well, that can cause a few confusion.

Anyway, your cmdline is faulty. You can, of course, use UUID with grub2 to set up 'root' environment variable, no problem here. But you have to follow the README when it comes to passing cmdline argument to the init.

Your LVM2 argument is "ilvm=sss-sda3" meaning in this case that you'll get a decrypted PV named `/dev/mapper/sss'. If your VG name is "sss" as well, as the PV mapping name, as your cmdline implies, you just had to append "iroot=sss-root"; That will do the job!

If you're going to use aufs+squashfs, I recommand strongly to append a ":c:ext4" to iroot argument because once your aufs filesystem is mounted, you'll have to go to the hassle to umount everything to fsck and that much more troublesome for rootfs! so replace iroot by "iroot=sss-root:c:ext" instead of that faulty iroot argument (where the "mapper/" comes from?). [I'm assuming your roots is ext4 because I'm seeing a `/sbin/fsck.ext4' in your initramfs.]

Yes it is my fault
On computer from which I write right now I'm using this kernel setup:
menuentry 'GNU/Linux, with Linux 3.0.6-gentoo' --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root cd41cddd-be19-49f5-932f-1625e01d4382
echo 'Loading Linux 3.0.6-gentoo ...'
linux /kernel-3.0.6-gentoo root=mapper/aja-root ikroot=gpg:sda2:/aja.key.gpg iroot=aja-root:c:ext4 ilvm=aja-sda3
}
with init revision 0.3.5_p20110906
and everything works as it should

so I just tried to cope-edit kernel line for another computer which has changed just name (substitute aja for sss)... thats why its not working...

is this correct?
menuentry 'GNU/Linux, with Linux 3.0.6-gentoo' --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root 92ded676-f995-4896-9634-d7775abee242
echo 'Loading Linux 3.0.6-gentoo ...'
linux /kernel-3.0.6-gentoo root=mapper/sss-root iroot=sss-root:c:ext4 ikroot=gpg:sda2:/sss.key.gpg ilvm=sss-sda3
initrd /initrd-3.0.6-gentoo.cpio.xz
}
as it is in file I send you?

I know I have 2 linux entries in my grub.cfg but only the first counts

That doesn't matter. I'm closing this issue as it's just your iroot argument that was/is at fault. Seriously, there's no where in the README that indicate to prefix LV with "mapper/" or whater--it's all about VG/LV/PV names! And why it could be when even the "/dev/" prefixes were removed. Just take some time to read the README whenever you're using something. There's nothing complicated or not understandable in it. It maybe a little compact because I don't want to write a novel. And your first iroot argument is WRONG as well. I have no idea how you can boot with that. Where are you finding those "mapper/" prefix?! And why don't you append "/dev/" prefix when you're at that? [you're going for kernel panics for sure.]

NOTE: nonetheless, I'm quite surprised that sh fails at that.

EDIT: Darn remove that root argument! you don't need any as the init script will take care of mounting your rootfs! it's useless either way it take some place or... And why are appending that "root=mapper/sss-root" thing?

EDIT2: no idea how your 1st machine is booting from but you should definitly take example on the second corrected machine without that useless root argument..

Still no luck even after changes and as you write I dont have any mapper in IROOT argument from beginig
menuentry 'GNU/Linux, with Linux 3.0.6-gentoo' --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
echo 'Loading Linux 3.0.6-gentoo ...'
linux /kernel-3.0.6-gentoo iroot=sss-root:c:ext4 ikroot=gpg:sda2:/sss.key.gpg ilvm=sss-sda3
initrd /initrd-3.0.6-gentoo.cpio.xz
}

or menuentry 'GNU/Linux, with Linux 3.0.6-gentoo' --class gnu-linux --class gnu --class os {
load_video
insmod gzio
insmod part_msdos
insmod ext2
set root='(hd0,msdos2)'
search --no-floppy --fs-uuid --set=root 92ded676-f995-4896-9634-d7775abee242
echo 'Loading Linux 3.0.6-gentoo ...'
linux /kernel-3.0.6-gentoo iroot=sss-root:c:ext4 ikroot=gpg:sda2:/sss.key.gpg ilvm=sss-sda3
initrd /initrd-3.0.6-gentoo.cpio.xz
}

ok I removed the argument on the booting machine and it still boots
Now Im going build for it init from fresh clone of your git.
To try if it will fail or not.

There's simply no reason for a failure in that line... even with that mistake of yours, but hey if sh cannot handle mistakes like that I'm for nothing in that kind of failure.
I did not put much time first with your mixture of root and iroot argument. If you don't have any weird prefix in iroot, that's good, you could boot in not time. And you don't have TO CLONE AGIAN! you simply need to run `git pull' that'll do the trick. And there's nothing much changed in master branch but a few subtle changes for power users if I might say, especially with the master branch.

Ok I finally found the source of problem:
wrong busybox executable
somehow it was the one found on system not he one which was build for init

sorry for time wasted with me
if you want I can littlebit broaden your readme - if you want

Have nice day
S

Thanks, same to you. Are you using zsh scripts (devel branch)? That issue was in mkifs-ll[.zsh] in devel branch... I don't remember it being in master branch (bash scripts). Anyway, I fixed it the day following the culpirit commit. But hey, it was actually copying (system wide) `/bin/bb' which should work just fine, I'm saying should because sometimes weird stuff comes out of it. So which binary were included in your initramfs? '/bin/bb' (the static binary) or '/bin/busybox' (dynamic linked binary)?

Yeah, I'll appreciate it! Just fork the repository. You can follow a little help on gitweb for that, there's really nothing much to do. So you could easily request a "pull" without much effort. Else, you can modify the file and mail me and I'll include the changes with/without a few editing if necessary.

now i have in my (working) init busybox binary which I build following the article from gentoo wiki.
and in that broken one was also busybox binary but the one found in system ("default" one :-) )

I don know why it wasn't working but when i builded busybox by the article and nuild init it was working

the one which i had ni my broken initrd is still in that archive mentioned above (the initrd is in it)

Actually, I added a script [mkifs-ll_bb] for building a static busybox based on the one found on the unofficial gentoo wiki (gentoo-wiki.com) and another one [mkifs-ll_gpg] for gnupg-1.4.x and another script to build everything, well with the right switch mkifs-ll_gen will effectively build everything. There's no doc/info aside for running a script with -u[--usage] or even -h[--help] to get going. No much testing was done on those scripts, they're quite easy to debug quickly anyway! Optionally, mkifs-ll_bb can build an unicode compatible keymap with the right switch as well.

Well, maybe I should something about those scripts, however one can run one with '-u' to get going...