View previous topic :: View next topic |
Author |
Message |
fidel Guru
Joined: 16 Jul 2004 Posts: 407 Location: CH
|
Posted: Wed Feb 15, 2006 1:29 pm Post subject: |
|
|
Sorry! I had an empty line at the beginning of my linuxrc script!...
Now the linuxrc gets found, still I get some errors, the cdrom format cannot be found, somehow I must have missed the pivot_root (cannot be found either..) and creating tmpfs fails (read only filesystem)...
Trying to fix that....
thanks a lot!
[edit]
It just won't work! I've been trying to get a running livecd for a week now, trying two different guides... But I hate to give up!.. Still I am getting errors that the cdrom format cannot be identified and that there is no possibility of creating anything tmpfs, read only...
Please help!...
I wrote a little script for creating the initrd:
Code: | ##
rm /boot/initrd
touch /boot/initrd
dd if=/dev/zero of=/boot/initrd bs=1024k count=8
losetup /dev/loop0 /boot/initrd
mke2fs /dev/loop0
mkdir /mnt/initrd
mount /dev/loop0 /mnt/initrd
cd /mnt/initrd
mkdir etc dev lib bin sbin proc new cdrom
touch linuxrc
chmod +x linuxrc
cp /linuxrc ./
touch etc/mtab
touch etc/fstab
# bin fuellen
cp /bin/sh bin
cp /bin/cat bin
cp /bin/mount bin
cp /bin/umount bin
cp /bin/mkdir bin
cp /bin/chroot bin
cp /bin/tar bin
cp /sbin/pivot_root bin
cp /sbin/init sbin
cp /lib/libblkid.so.1 lib
cp /lib/libuuid.so.1 lib
cp /lib/libc.so.6 lib
cp /lib/ld-linux.so.2 lib
cp /lib/librt.so.1 lib
cp /lib/libpthread.so.0 lib
cp /lib/libdl.so.2 lib
mknod /mnt/initrd/dev/console c 5 1
mknod /mnt/initrd/dev/null c 1 3
mknod /mnt/initrd/dev/hda b 3 0
mknod /mnt/initrd/dev/hdb b 3 64
mknod /mnt/initrd/dev/hdc b 22 0
mknod /mnt/initrd/dev/hdd b 22 64
mknod /mnt/initrd/dev/tty c 4 0
mknod /mnt/initrd/dev/loop0 b 7 0
|
The script for creating the livecd is about the same as in the guide:
Code: | #!/bin/bash
rm -rf target
mkdir target
cp -a source/boot target/
mkdir target/files
rm -rf source/var/tmp/*
rm -rf source/var/run/*
rm -rf source/var/lock/*
rm -rf source/tmp/*
rm -f source/etc/mtab
touch source/etc/mtab
cd source/etc/
tar cvpf ../../target/files/etc.tar *
cd ../var/
tar cvpf ../../target/files/var.tar *
cd ../root/
tar cvpf ../../target/files/root.tar *
cd ../../
mksquashfs source/ target/files/source.img
mkisofs -R -b boot/grub/stage2_eltorito -no-emul-boot -boot-load-size 4 -boot-info-table -iso-level 4 -hide boot.catalog -o ./livecd.iso target |
My linuxrc:
Code: | #!/bin/sh
export PATH=/bin
# Get kernel CMDLINE
mount -t proc none /proc
CMDLINE=`cat /proc/cmdline`
umount /proc
# Mount CD device
CDROM=""
for x in hda hdb hdc hdd
do
mount -t iso9660 -r /dev/${x} /cdrom > /dev/null 2>&1
if [ "$?" = "0" ]
then
CDROM="${x}"
break
fi
done
# CD not found
if [ "${CDROM}" == "" ]
then
exec /bin/sh
exit
fi
# Mount root and create read-write directories
mount -t squashfs -o loop /cdrom/files/source.img /new > /dev/null 2>&1
mount -t tmpfs -o size=32m none /new/var > /dev/null 2>&1
mount -t tmpfs -o size=32m none /new/etc > /dev/null 2>&1
mount -t tmpfs -o size=32m none /new/tmp > /dev/null 2>&1
mount -t tmpfs -o size=32m none /new/root > /dev/null 2>&1
cd /new/var && tar xpf /cdrom/files/var.tar > /dev/null 2>&1
cd /new/etc && tar xpf /cdrom/files/etc.tar > /dev/null 2>&1
cd /new/root && tar xpf /cdrom/files/root.tar > /dev/null 2>&1
# Pivot root and start real init
cd /new
pivot_root . newroot
exec chroot . /bin/sh <<- EOF >dev/console 2>&1
exec /sbin/init ${CMDLINE}
EOF
|
Just don't see what's wrong here!..
[/edit] |
|
Back to top |
|
|
Lepaca Kliffoth l33t
Joined: 28 Apr 2004 Posts: 737 Location: Florence, Italy
|
Posted: Thu Feb 16, 2006 5:51 pm Post subject: |
|
|
Please check again if you built the iso9660 filesystem (the fs used for cd and dvd) INSIDE the kernel. Not built as a module. You also need squashfs support INSIDE the kernel. The error you describe sounds like your kernel doesn't know those filesystems, which is the case when you build them as modules. You're doing fine, don't worry, this kind of things always happen the first couple of times.
edit: about the pivot_root, just put it in the intird under /bin if for some reason it isn't there already and check again that all the libraries it needs are under /lib inside the initrd.
edit2: oh and in the script you wrote that builds the initrd, take away the line that copies the "init" executable. You don't want it inside the intird. _________________ It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox! |
|
Back to top |
|
|
fidel Guru
Joined: 16 Jul 2004 Posts: 407 Location: CH
|
Posted: Thu Feb 16, 2006 9:36 pm Post subject: |
|
|
Thanks a lot! The thing is, I really have the iso9660 fs and squashfs and the appropriate ide driver etc. compiled into the kernel!... The script that creates the initrd really does copy the pivot_root from /sbin/ to /mnt/initrd/bin/. Really strange to me! I don't know if that might be an issue at all, I am merging the system on an amd64 host and it should result in a livecd for a pentium4 or some i686 system....
Code: | # linux32 chroot /mnt/dick/livecd/source /bin/bash --login
# env-update && source /etc/profile
>>> Regenerating /etc/ld.so.cache...
# emerge --info
Portage 2.0.54 (default-linux/x86/2005.1, gcc-3.4.4, glibc-2.3.5-r2, 2.6.15-gentoo-r5 i686)
=================================================================
System uname: 2.6.15-gentoo-r5 i686 AMD Athlon(tm) 64 Processor 3200+
Gentoo Base System version 1.6.14
dev-lang/python: 2.3.5-r2, 2.4.2
sys-apps/sandbox: 1.2.12
sys-devel/autoconf: 2.13, 2.59-r6
sys-devel/automake: 1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r1
sys-devel/binutils: 2.16.1
sys-devel/libtool: 1.5.22
virtual/os-headers: 2.6.11-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe -fomit-frame-pointer"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3/share/config /usr/lib/X11/xkb /usr/lib64/mozilla/defaults/pref /usr/share/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O2 -march=i686 -pipe -fomit-frame-pointer"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoconfig distlocks sandbox sfperms strict"
GENTOO_MIRRORS="http://mirror.switch.ch/ftp/mirror/gentoo/"
LANG="de_CH"
LC_ALL="de_CH.UTF-8"
LINGUAS="de"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="x86 X alsa apm arts avi berkdb bitmap-fonts bzip2 cdrom cdrw crypt cups dvd eds emboss encode expat foomaticdb fortran gdbm gif gpm gstreamer gtk gtk2 imlib ipv6 jpeg libg++ libwww livecd mad mikmod motif mp3 mpeg ncurses nls ogg oggvorbis opengl oss pam pcre pdflib perl png python quicktime readline sdl slang spell ssl tcpd truetype truetype-fonts type1-fonts udev unicode usb userlocales utf8 vorbis xml2 xmms xv zlib linguas_de userland_GNU kernel_linux elibc_glibc"
Unset: ASFLAGS, CTARGET, LDFLAGS, MAKEOPTS, PORTDIR_OVERLAY
|
When I finally try to boot from the cd, grub starts fine and the kernel gets loaded. After that though, right after the filling of the ramdisk, the following appears:
Code: |
RAMDISK: ext2 filesystem found at block 0
RAMDISK: Loading 8192KiB[1 disk] into ramdisk... done
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended
VFS: Mounted root (ext2 filesystem)
Freeing unused kernel memory: 284k freed
pivot_root: No such file or directory
/linuxrc: line 41 cannot create temp file for here document: Read-only filesystem
Kernel panic - not syncing: Attempted to kill init |
The line 41 of the linuxrc:
Code: | exec chroot . /bin/sh <<- EOF >dev/console 2>&1
|
... I am stuck! |
|
Back to top |
|
|
Lepaca Kliffoth l33t
Joined: 28 Apr 2004 Posts: 737 Location: Florence, Italy
|
Posted: Fri Feb 17, 2006 12:53 am Post subject: |
|
|
I'm quite sure there is no /newroot inside your initrd. Create a "/newroot" directory inside the initrd and try again.
edit: more indepth: look at the "pivot_root" command inside the linurc: "pivot_root . /newroot". As you see during bootup the pivot_root command doesn't find a file; since "." always exists, the directory "newroot" must be the missing file. I noticed just now that the script you use to make the initrd doesn't create it. _________________ It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox! |
|
Back to top |
|
|
vinky Apprentice
Joined: 24 Feb 2005 Posts: 214 Location: Sweden
|
Posted: Fri Feb 17, 2006 5:36 pm Post subject: |
|
|
fidel: make sure your initrd is smaller than what is supported by the kernel. I had a similar prob until I recreated the initrc and saw that it was 8.4MB and the kernel supported 8.0MB(something wrong with dd not understanding my will (bs=1024k count=8 should create a file of 8MB right?))
the newroot dir is created by tar when unpacking your squashfile and should be automatically created in /new |
|
Back to top |
|
|
Lepaca Kliffoth l33t
Joined: 28 Apr 2004 Posts: 737 Location: Florence, Italy
|
Posted: Fri Feb 17, 2006 6:09 pm Post subject: |
|
|
vinky wrote: | fidel: make sure your initrd is smaller than what is supported by the kernel. I had a similar prob until I recreated the initrc and saw that it was 8.4MB and the kernel supported 8.0MB(something wrong with dd not understanding my will (bs=1024k count=8 should create a file of 8MB right?))
the newroot dir is created by tar when unpacking your squashfile and should be automatically created in /new |
Are you sure? First of all his kernel seem to load and mount the initrd without any problems:
Code: | RAMDISK: Loading 8192KiB[1 disk] into ramdisk... done
EXT2-fs warning: mounting unchecked fs, running e2fsck is recommended |
Thanks for pointing out the fact that newroot is inside the squashfs image and not in the initrd, my fault. However tar doesn't unpack the squashfs file -- it's not unpacked at all -- and it certainly doesn't create any newroot dir. So /newroot isn't missing from the initrd, as you pointed out it's not needed there, but it's still missing from the squashfs archive and he must create it by hand.
fidel: Instead of creating the newroot dir inside the initrd, create it inside the root of the livecd. Sorry for my mistake. _________________ It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox! |
|
Back to top |
|
|
vinky Apprentice
Joined: 24 Feb 2005 Posts: 214 Location: Sweden
|
Posted: Sat Feb 18, 2006 10:28 am Post subject: |
|
|
Lepaca Kliffoth wrote: | vinky wrote: | skrev:
fidel: make sure your initrd is smaller than what is supported by the kernel. I had a similar prob until I recreated the initrc and saw that it was 8.4MB and the kernel supported 8.0MB(something wrong with dd not understanding my will (bs=1024k count=8 should create a file of 8MB right?))
the newroot dir is created by tar when unpacking your squashfile and should be automatically created in /new |
Are you sure? First of all his kernel seem to load and mount the initrd without any problems: |
Not sure but it helped me |
|
Back to top |
|
|
vinky Apprentice
Joined: 24 Feb 2005 Posts: 214 Location: Sweden
|
Posted: Sat Feb 18, 2006 1:22 pm Post subject: |
|
|
I have done as the guide says and installed grub and made a grub.conf under boot/grub but when I boot I get a grub-commandline and manualy have to write:
root (cd)
configfile (cd)/boot/grub/grub.conf to get a normal bootwindows,
any ideas? |
|
Back to top |
|
|
Lepaca Kliffoth l33t
Joined: 28 Apr 2004 Posts: 737 Location: Florence, Italy
|
Posted: Sat Feb 18, 2006 2:14 pm Post subject: |
|
|
You just have to make sure you wrote correctly menu.lst under /boot/grub/ as the guide says. Once it was grub.conf, now it seems to have changed to menu.lst. _________________ It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox! |
|
Back to top |
|
|
fidel Guru
Joined: 16 Jul 2004 Posts: 407 Location: CH
|
Posted: Sat Feb 18, 2006 4:14 pm Post subject: |
|
|
Thanks a lot!!!! Dumb me! It really was that the command pivot_root in my file used a non-existant directory! It now boots!!!
Great!!!
There is just another problem though, first of all depscan.sh is missing functions.sh in /etc/init.d.... Hmmm! In my running Gentoo System functions.sh is a link to..:
Code: | $ ll /etc/init.d | grep func
lrwxrwxrwx 1 root root 23 16. Feb 00:51 functions.sh -> ../../sbin/functions.sh |
Therefore I assume I need to change that! I will try it removing the link and copying the file from /sbin to /etc/init.d!...
Results will follow!...
Another problem, I just by now don't know yet if it occurs because of the above error, is that I really have to login, I don't automatically get logged in...
But, results will follow!
Thanks a lot!!!!! Your patience, your help and your awesome guide really rocks! Great!!! |
|
Back to top |
|
|
Lepaca Kliffoth l33t
Joined: 28 Apr 2004 Posts: 737 Location: Florence, Italy
|
Posted: Sat Feb 18, 2006 6:01 pm Post subject: |
|
|
fidel wrote: | Thanks a lot!!!! Dumb me! It really was that the command pivot_root in my file used a non-existant directory! It now boots!!!
Great!!!
There is just another problem though, first of all depscan.sh is missing functions.sh in /etc/init.d.... Hmmm! In my running Gentoo System functions.sh is a link to..:
Code: | $ ll /etc/init.d | grep func
lrwxrwxrwx 1 root root 23 16. Feb 00:51 functions.sh -> ../../sbin/functions.sh |
Therefore I assume I need to change that! I will try it removing the link and copying the file from /sbin to /etc/init.d!...
Results will follow!...
Another problem, I just by now don't know yet if it occurs because of the above error, is that I really have to login, I don't automatically get logged in...
But, results will follow!
Thanks a lot!!!!! Your patience, your help and your awesome guide really rocks! Great!!! |
The depscan thing is called when init tries to cache service dependencies. I'm not sure that it will work but try running "rc" from the chroot. Don't move functions.sh!
(oh and this is not my guide, it's veezi's!) _________________ It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox! |
|
Back to top |
|
|
fidel Guru
Joined: 16 Jul 2004 Posts: 407 Location: CH
|
Posted: Sun Feb 19, 2006 11:41 am Post subject: |
|
|
Alright, still got the same problem, running rc kills my running environment. Got something to do with running a unicode system, after running rc in the chroot environment I can't use my system anymore, had to reboot (no keyboard anymore).
I still got the same error "Could not get SVCDIR!", "Error running /sbin/depscan.sh", some errors showing that ebegin, eerror and eend couldn't be found and another complaint that I got a read only filesystem, not able to create anything in the according directory...
I still don't get logged in as root, I get a prompt to log in.
I am a lot further now, the kernel gets loaded and the cdrom gets mounted and the system starts.... grr, I'd like to get the rest as well!.. |
|
Back to top |
|
|
Lepaca Kliffoth l33t
Joined: 28 Apr 2004 Posts: 737 Location: Florence, Italy
|
Posted: Sun Feb 19, 2006 11:52 am Post subject: |
|
|
I figured it wouldn't work but I didn't think it would make your system unusable and need a reboot O_O Sorry, I thought it was harmless.
About the problem I'm a bit clueless. It's a long time since I last made a non-unionfs livecd and I don't remember ever getting that problem. Have you tried identifying which of the many services cause the problem? Maybe if I know which service it is I can help you. _________________ It isn't enough to win - everyone else must lose, and you also have to rub it in their face (maybe chop off an arm too for good measure).
Animebox! |
|
Back to top |
|
|
fidel Guru
Joined: 16 Jul 2004 Posts: 407 Location: CH
|
Posted: Sun Feb 19, 2006 12:46 pm Post subject: |
|
|
Don't really know how to figure that out.. I guess that in /sbin/depscan.sh the thing
Code: | f [[ ! -d ${svcdir} ]] ; then
if ! mkdir -p -m 0755 "${svcdir}" 2>/dev/null ; |
can't be done, I also get errors of having an unwriteable filesystem... might be wrong though, just guessing!.. |
|
Back to top |
|
|
fidel Guru
Joined: 16 Jul 2004 Posts: 407 Location: CH
|
Posted: Tue Feb 21, 2006 6:46 am Post subject: |
|
|
I got a bit further. After I installed livecd-tools I get logged in as root, the cd works so far. Still, running depscan I get the error that {SVCDIR} cannot be gotten. It seems as well that autoconfig (from livecd-tools) doesn't get started, I assume that's because of the error of not being able to get svcdir. I unfortunately don't even know, what depscan really does and what svcdir stands for... do I miss a directory? Can anybody give me a suggestion how to find out about that error?... (It's the last thing my livecd needs!...)
Thanks!
[edit]
Weird! functions.sh still doesn't get found!...
[/edit] |
|
Back to top |
|
|
fidel Guru
Joined: 16 Jul 2004 Posts: 407 Location: CH
|
Posted: Tue Feb 21, 2006 8:42 pm Post subject: |
|
|
Hate to give up, but now time has come to surrender....
Is there anyone who can provide me with a livecd with a kernel >=2.6.15 and sys-fs/raidtools installed?...
could give a ftp place.... |
|
Back to top |
|
|
slycordinator Advocate
Joined: 31 Jan 2004 Posts: 3065 Location: Korea
|
Posted: Tue Mar 14, 2006 8:29 pm Post subject: |
|
|
So in the original post, why bind-mount just /usr/portage/distfiles? Why not bind-mount the entire /usr/portage?
Bind-mounting distfiles is so you don't have to download them again. Well, bind-mounting the whole tree clearly avoids having to unpack a snapshot and what-not. |
|
Back to top |
|
|
marciv n00b
Joined: 22 Feb 2006 Posts: 8 Location: Berlin/Germany
|
Posted: Mon Apr 17, 2006 11:57 am Post subject: |
|
|
Hello,
first: sorry for my bad english...
I have a problem with my Live-cd, when i boot my CD initrd stops with this message:
Code: |
...
Freeing unused kernel memory: 216k freed
Starte Initrd...
/linuxrc: line 37: dev/console: Read-only file system
Kernel panic - not syncing: Attempted to kill init!
|
Can some one help me?
My linuxrc script is exactly the same as this in the tutorial...
[edit]
Now i have tested the livecd with a genkernel an its initrd,
but i dont get it work. There comes this:
Code: |
...
>>Activating udev
>>Making tmpfs for /newroot
...
>>Attempting to mount CD: - /dev/hdc
...
>>No bootable medium found. waiting for new devices...
...
>>Attempting to mount CD: - /dev/hdc
...
!! Could not find CD to boot, something else needed!
>>Determining root device...
!! The root block device is unspecified or not detected
Please specify a device to boot, or "shell" for a shell...
boot() ::_
|
[/edit] _________________ Hardware: Athlon XP 2600+ Barton, Shuttle AN35N Ultra nforce2, 512 MB DDR DC Ram, Geforce 6800
OS: Gentoo Linux |Kernel 2.6.15-r1|KDE 3.4.3 |
|
Back to top |
|
|
marciv n00b
Joined: 22 Feb 2006 Posts: 8 Location: Berlin/Germany
|
Posted: Tue Apr 18, 2006 3:24 pm Post subject: |
|
|
So, i have tried this, with the initramfs-genkernel:
Code: |
boot() :: /dev/hdc # hdc is definitely my cdrom drive
>>Mounting root...
mkdir: Cannot create directory '/newroot/tmp` : Read-only file system
mknod: //newroot-dev-console: No such file or directory
mknod: //newroot/dev/tty1: No such file or directory
>>Booting (initramfs)...umount: /sys: Invalid argument
*: Failed to umount the initrd /sys!
..
chroot: cannot execute /bin/sh : No such file or directory
Kernel panic - not syncing: Attemted to kill init!
|
On sonday i tried it with my own initrd, it was the first time i made the iso of the cd.
With this CD i can boot with init=/bin/sh into the initrd and start the whole cd by hand.
It doesnt start automaticly because, i have written "mount -t squashfs -o loop /cdrom/files/livecd.img" in the linuxrc script,
but my .img was "/cdrom/livecd.squashfs"
Yesterday i corrected the linuxrc and maked a new iso now there is the error in my first post. I dont know why... _________________ Hardware: Athlon XP 2600+ Barton, Shuttle AN35N Ultra nforce2, 512 MB DDR DC Ram, Geforce 6800
OS: Gentoo Linux |Kernel 2.6.15-r1|KDE 3.4.3 |
|
Back to top |
|
|
slycordinator Advocate
Joined: 31 Jan 2004 Posts: 3065 Location: Korea
|
Posted: Tue Apr 18, 2006 8:30 pm Post subject: |
|
|
Lepaca Kliffoth wrote: | You just have to make sure you wrote correctly menu.lst under /boot/grub/ as the guide says. Once it was grub.conf, now it seems to have changed to menu.lst. |
Code: | # ls -l /boot/grub/menu.lst
lrwxrwxrwx 1 root root 9 Apr 3 19:28 /boot/grub/menu.lst -> grub.conf |
menu.lst is a symlink to grub.conf |
|
Back to top |
|
|
scriptX n00b
Joined: 05 Jul 2005 Posts: 69
|
Posted: Tue Apr 18, 2006 9:31 pm Post subject: |
|
|
The ISO9660 or whatever it is filesystem doesn't like symlinks |
|
Back to top |
|
|
Thegreatone n00b
Joined: 12 Jul 2005 Posts: 36
|
Posted: Thu Apr 20, 2006 10:31 am Post subject: |
|
|
Hi guys!
I have built the livecd using your help but got some problem with database:
I need to load at boot, both postgresql and mysql..
should i change something during the creation process?
Thanks
Luca |
|
Back to top |
|
|
Thegreatone n00b
Joined: 12 Jul 2005 Posts: 36
|
|
Back to top |
|
|
vinky Apprentice
Joined: 24 Feb 2005 Posts: 214 Location: Sweden
|
Posted: Thu Apr 20, 2006 6:58 pm Post subject: |
|
|
check that you have right command in linuxrc when it comes to the mounting |
|
Back to top |
|
|
Thegreatone n00b
Joined: 12 Jul 2005 Posts: 36
|
|
Back to top |
|
|
|