You are not logged in.

#1 2016-01-02 08:54:14

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Minimal Linux Live ....

under my research to make obarun from scratch i find this : http://minimal.linux-bg.org/.
This is very simple and very interesting approch about linux system. Make test is very easy and it's a good practice to understand a system from boot to console.


Obarun : free to control your system

Offline

#2 2016-01-02 12:28:08

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

I do like busybox and have always wanted to build an Arch based system using it. As runit is built in init is not really a problem. It was just the getting rid of systemd. For a console based system it is far less of a problem. Once you try to install X then issues with polkit,dbus.udev.

First thoughts are an alpine linux setup using musl to reduce the super massive size of Arch packages....

Thanks for sharing....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#3 2016-01-02 12:48:46

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

@eric fist attempt at running script failed, is there any reason to build kernel and busybox? Arch already ships with both, could they not be used instead?

--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.
--------------------------------------------------

6_pack_rootfs.sh: line 11: cpio: command not found
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
Kernel: arch/x86/boot/bzImage is ready  (#1)
rm -rf arch/x86/boot/isoimage
mkdir arch/x86/boot/isoimage
for i in lib lib64 share end ; do \
	if [ -f /usr/$i/syslinux/isolinux.bin ] ; then \
		cp /usr/$i/syslinux/isolinux.bin arch/x86/boot/isoimage ; \
		break ; \
	fi ; \
	if [ $i = end ] ; then exit 1 ; fi ; \
done
arch/x86/boot/Makefile:160: recipe for target 'isoimage' failed
make[1]: *** [isoimage] Error 1
arch/x86/Makefile:236: recipe for target 'isoimage' failed
make: *** [isoimage] Error 2
cp: cannot stat ‘arch/x86/boot/image.iso’: No such file or directory

I love it <3


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#4 2016-01-03 00:21:38

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

@mr green

yes you can replace it if you want.
replace the bzimage generate by 02 script in the correct folder
be careful with busybox, the official arch package delete so many option on it, but you can replace it if you want too.

BTW, for the error simply

$ pacman -S cpio

smile

note: stupid question but what's mean "<3"

Edit needed to work

pacman -S cpio cdrkit

cdrkit provide genisoimage

then copy /usr/lib/initcpio/bios/{isolinux.bin,ldlinux.c32} to /usr/lib/initcpio or make a symlinks.

modify the /work/kernel/linux-4.1.6/arch/x86/boot/makefile section isoimage as following

isoimage: $(obj)/bzImage
    -rm -rf $(obj)/isoimage
    mkdir $(obj)/isoimage
    for i in lib lib64 share end ; do \
        if [ -f /usr/$$i/syslinux/isolinux.bin ] ; then \
            cp /usr/$$i/syslinux/{isolinux.bin,ldlinux.c32} $(obj)/isoimage ; \
            break ; \
        fi ; \
        if [ $$i = end ] ; then exit 1 ; fi ; \
    done
    cp $(obj)/bzImage $(obj)/isoimage/linux
    echo '$(image_cmdline)' > $(obj)/isoimage/isolinux.cfg
    if [ -f '$(FDINITRD)' ] ; then \
        cp '$(FDINITRD)' $(obj)/isoimage/initrd.img ; \
    fi
    genisoimage -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \
        -no-emul-boot -boot-load-size 4 -boot-info-table \
        $(obj)/isoimage
    isohybrid $(obj)/image.iso 2>/dev/null || true
    rm -rf $(obj)/isoimage

it should work smile

EDIT: So now, mr green,i'm looking forward to see an archbang version from scrach big_smile big_smile big_smile

Last edited by eric (2016-01-03 01:50:09)


Obarun : free to control your system

Offline

#5 2016-01-03 03:07:57

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Are you running each script in sequence rather than using build_minimal_linux_live.sh?

Did have a quick look at Arch Busybox config most options are still there....

<3 = heart/love


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#6 2016-01-03 07:29:23

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

No changes too scripts but kernel now builds...

--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.
--------------------------------------------------

4702 blocks
  CHK     include/config/kernel.release
  CHK     include/generated/uapi/linux/version.h
  CHK     include/generated/utsrelease.h
  CHK     include/generated/bounds.h
  CHK     include/generated/asm-offsets.h
  CALL    scripts/checksyscalls.sh
  CHK     include/generated/compile.h
Kernel: arch/x86/boot/bzImage is ready  (#1)
rm -rf arch/x86/boot/isoimage
mkdir arch/x86/boot/isoimage
for i in lib lib64 share end ; do \
	if [ -f /usr/$i/syslinux/isolinux.bin ] ; then \
		cp /usr/$i/syslinux/isolinux.bin arch/x86/boot/isoimage ; \
		break ; \
	fi ; \
	if [ $i = end ] ; then exit 1 ; fi ; \
done
arch/x86/boot/Makefile:160: recipe for target 'isoimage' failed
make[1]: *** [isoimage] Error 1
arch/x86/Makefile:236: recipe for target 'isoimage' failed
make: *** [isoimage] Error 2
cp: cannot stat ‘arch/x86/boot/image.iso’: No such file or directory

Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#7 2016-01-03 12:09:10

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

Mr Green wrote:

Are you running each script in sequence rather than using build_minimal_linux_live.sh?

one by one but don't change anything

your trouble is here in the makefile

for i in lib lib64 share end ; do \
	if [ -f /usr/$i/syslinux/isolinux.bin ] ; then \
		cp /usr/$i/syslinux/isolinux.bin arch/x86/boot/isoimage ; \
		break ; \
	fi ; \
	if [ $i = end ] ; then exit 1 ; fi ; \
done

this loop do not content the good path (for arch strucutre) to find isolinux.bin and this loop (for the cp command) do not content any exit in case of error. after the makefile call genisoimage(not available on arch is you don't install cdrkit) with option -b isolinux.bin like this :

genisoimage -J -r -o $(obj)/image.iso -b isolinux.bin -c boot.cat \
		-no-emul-boot -boot-load-size 4 -boot-info-table \
		$(obj)/isoimage

this command fail to execute correctly because isolinux.bin doesn't exist. smile. futhermore (and i don't know why sad) if you don't implement a another $ in the line /usr/$1/syslinux/isolinux.bin the command fail too, so the loop look like this :
note : if you do not want to copy or create symlink for isolunix.bin ldlinux.c32 you can change the path like follow

for i in lib lib64 share end ; do \
		if [ -f /usr/$$i/syslinux/bios/isolinux.bin ] ; then \
			cp /usr/$$i/syslinux/bios/{isolinux.bin,ldlinux.c32} $(obj)/isoimage ; \
			break ; \
		fi ; \
		if [ $$i = end ] ; then exit 1 ; fi ; \
	done

ldlinux.c32 is necessary for usb stick.

Last edited by eric (2016-01-03 12:17:14)


Obarun : free to control your system

Offline

#8 2016-01-03 13:57:19

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Success, changes to Makefile (syslinux/bios) iso builds and runs fine. Does try to connect to network but fails (VirtualBox). Adding pacman might be a very different thing, maybe a simpler package manager?


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#9 2016-01-05 01:13:43

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

@eric mkinitcpio does all the work for you

total 3632
drwxr-xr-x 11 mrgreen users    4096 Jan  5 07:14 .
drwx------ 26 mrgreen users    4096 Jan  5 07:14 ..
lrwxrwxrwx  1 mrgreen users       7 Jan  5 07:14 bin -> usr/bin
-rw-r--r--  1 mrgreen users    2490 Jan  5 07:14 buildconfig
-rw-r--r--  1 mrgreen users      64 Jan  5 07:14 config
drwxr-xr-x  2 mrgreen users    4096 Jan  5 07:14 dev
drwxr-xr-x  3 mrgreen users    4096 Jan  5 07:14 etc
drwxr-xr-x  2 mrgreen users    4096 Jan  5 07:14 hooks
-rwxr-xr-x  1 mrgreen users    2300 Jan  5 07:14 init
-rw-r--r--  1 mrgreen users   12469 Jan  5 07:14 init_functions
-rw-r--r--  1 mrgreen users 3640398 Jan  5 07:14 initramfs-linux.img
lrwxrwxrwx  1 mrgreen users       7 Jan  5 07:14 lib -> usr/lib
lrwxrwxrwx  1 mrgreen users       7 Jan  5 07:14 lib64 -> usr/lib
drwxr-xr-x  2 mrgreen users    4096 Jan  5 07:14 new_root
drwxr-xr-x  2 mrgreen users    4096 Jan  5 07:14 proc
drwxr-xr-x  2 mrgreen users    4096 Jan  5 07:14 run
lrwxrwxrwx  1 mrgreen users       7 Jan  5 07:14 sbin -> usr/bin
drwxr-xr-x  2 mrgreen users    4096 Jan  5 07:14 sys
drwxr-xr-x  2 mrgreen users    4096 Jan  5 07:14 tmp
drwxr-xr-x  5 mrgreen users    4096 Jan  5 07:14 usr
-rw-r--r--  1 mrgreen users       2 Jan  5 07:14 VERSION
[mrgreen@arch fred]$ ls -lah initramfs-linux.img 
-rw-r--r-- 1 mrgreen users 3.5M Jan  5 07:14 initramfs-linux.img

wink


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#10 2016-01-05 03:19:39

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

@Mr Green i know i know smile, i think about build from scratch to change some things about arch structure and soft used but keeping some useful appli like mkinitcpio, pacman, makepkgs, pacman-key, pkgbuild hook system etc.
However, for example, using musl, possibility to mount /usr/lib on ram with zram and some other stuff like that.
But make this alone is very very long and i'm not talking about maintaining sad. so i can make it for me but it's impossible to share, so many package to maintain and rebuild
for the moment isn't in my todo list, i work a lot on obarun-server smile but after, may be i will take some time to make a test

Last edited by eric (2016-01-05 03:20:57)


Obarun : free to control your system

Offline

#11 2016-01-05 12:40:56

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

@eric I can understand it would take quite some work to get anything worthwhile running. Checked mkinitcpio-busybox and as you said Arch has pulled most of the busybox features. Things like minimal linux get my attention, then I think what could I do with it....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#12 2016-01-07 13:57:50

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

@eric update use of BINARIES in mkinitcpio.conf adds pacman too initramfs!!!! bound to fail but interesting all the same.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#13 2016-01-07 22:36:45

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

look for build configuration of busybox : CONFIG_STATIC=y smile. Not the case for all the structure and prog on arch, need to be changed but it's mean implement binutils, gcc and glibc or musl.
Well here an expirimental minimal linux : https://github.com/ivandavidov/minimal/ … perimental


Obarun : free to control your system

Offline

#14 2016-01-08 11:56:33

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Might use minimal linux busybox or build my own, reason for using Arch packages was to reduce compiling. Plan is too create a virtual machine and test different setups (can break boot loader to get too reduced shell). Not sure I would ever be able to add Xorg. Going to check systemd-free packages....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#15 2016-01-10 04:30:43

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

After doing some research looks like archiso baseline could be of some use. It only creates a 'base' install which could easily be modified.....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#16 2016-01-10 10:16:55

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

After making a few changes too 'baseline' configs I have got an iso...

[mkarchiso] INFO: Done! | 9.0M out/archlite-10.01.2016-x86_64.iso

Bit more bloated than minimal but could be improved.....

Kept getting images of 200+mb then noticed it was squashing filesystem (which of course I do not need).

Would have to make changes to my local mkinitcpio to get any extra binaries added, also need a better busybox setup than arch provides at the moment.

TODO:

Well need to work on 'init' to make it more friendly for a start

Come on eric give it a go you know you want too wink


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#17 2016-01-10 10:19:10

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

@Mr Green, yes baseline do the same thing but you will not be able to change the core of the system, i mean if you want to use musl you need build gcc according to this. binutils, gcc, glibc, linux-headers and libstdcc are the heart of the system. taking the base arch system do not permit to change this. Another point, if you want to change some mount structure (like slackware with modules using aufs) is not possible or you need to change the init arch system. About this you have an interesting projects from a french man called butter on AUR repo ( arch french forum https://forums.archlinux.fr/viewtopic.php?f=18&t=17721) , it's an helper for dm-snapshot.

By the way, minimal linux is interesting to understand how to a machine boot and what is necessary smile
obarun under musl hummm i like the idea lol smile


Obarun : free to control your system

Offline

#18 2016-01-10 10:25:05

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

I can find busybox-musl in aur. Are you talking about changes for filesystem initramfs? if so I have a cunning plan... wink

Will check out link thanks


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#19 2016-01-10 21:21:10

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

i'm talking about that http://aufs.sourceforge.net/aufs2/report/sq/sq.pdf. it can be used for mounting a particular directory like usr/lib or etc/ directly in memory. this reduce the respond time when you call an application. (hum difficult for me to explain in english exactly what i mean sorry). it's the same principle that archiso hook. take a look on /usr/lib/initcpio/hook/archiso. this mounting technic can be used for another directory on hard installation. smile


Obarun : free to control your system

Offline

#20 2016-01-11 15:21:29

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Removed archiso.img (squashfs) as it was 200mb in size with only kernel and syslinux. You can find my work on archlite here

https://github.com/mrgreen3/archlite


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#21 2016-01-12 14:19:29

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Getting to the point of adding more features, still not found an easy way to edit image. Have got a full version of busybox installed but do not have modules/applications that support networking. lspci -v give me no real output. Wondering if I need more hooks? wink


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#22 2016-01-12 14:47:13

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

A little searching found this

http://nairobi-embedded.org/initramfs_tutorial.html

Might give me a way to build my own rootfs with what I need....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#23 2016-01-15 14:09:35

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

I can create build and run initramfs images without a problem. Getting mdev working failed so was unable to access terminal. Udev was my next idea but for some reason I get errors on file not found. Still enjoying messing around with init system and am learning more and more all the time.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#24 2016-01-15 22:06:46

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

can you post your initramfs init scripts please? if i can help.... smile. i guess you know this https://woozle.org/neale/papers/arch-runit.html. Be sure to build busybox with mdev option. Mdev don't load modules like udev you need to do manualy. Another page https://git.busybox.net/busybox/tree/do … _18_stable ... a good starting point too. here a good explanation to populate /dev in buildroot http://lists.busybox.net/pipermail/buil … 48057.html.


Obarun : free to control your system

Offline

#25 2016-01-16 02:21:12

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Am using arch-runit scripts, have no way of checking mdev is working (seems to be linked to busybox). His scripts run a service called tty1 only it uses agetty (not part of busybox applets). So not really getting far at the moment.

Will update my GitHub today and you can then take a look.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#26 2016-01-16 09:26:29

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

This is my init script

! /bin/sh

PATH=/usr/bin; export PATH

if [ $$ -ne 1 ]; then
	case $(basename $0) in
        reboot)
            exec kill -15 1
            ;;
        halt|poweroff)
            exec kill -12 1
            ;;
    esac

	cat <<EOD 1>&2
runit doesn't have run levels!
Please see http://busybox.net/~vda/init_vs_runsv.html

You may enjoy the "reboot" and "halt" commands, though.
EOD
    exit 1
fi

# Print out distribution name
if [ -f /etc/os-release ]; then
	awk -F '["=]+' '/PRETTY_NAME|HOME_URL/ { printf("========= %s\n", $2) }' /etc/os-release
else
	echo "========= Hello!"
fi

echo ":: Mounting initial filesystems"
mountpoint -q /tmp || mount -t tmpfs tmp /tmp
mountpoint -q /proc || mount -t proc proc /proc -o nosuid,noexec,nodev
mountpoint -q /sys || mount -t sysfs sys /sys -o nosuid,noexec,nodev
mountpoint -q /run || mount -t tmpfs run /run -o mode=0755,nosuid,nodev
mountpoint -q /dev || mount -t devtmpfs dev /dev -o mode=0755,nosuid

echo ":: Setting up temporary directories"
while read mode root grp path; do
	busybox install -d -m $mode -o $user -g $grp $path
done << EOD
0775 root lock /run/lock
0775 root lock /run/lock/lockdev
0775 root lock /run/lock/lvm
0755 root root /run/user
0755 root root /dev/pts
0755 root root /dev/shm
EOD
mountpoint -q /dev/pts || mount -n -t devpts devpts /dev/pts -o mode=0620,gid=5,nosuid,noexec
mountpoint -q /dev/shm || mount -n -t tmpfs shm /dev/shm -o mode=1777,nosuid,nodev

mount -o remount,ro /

#echo ":: Setting up Unicode"
#for i in /dev/tty[0-9]*;do
#  unicode_start <$i
#done &

echo ":: Setting system clock"
busybox hwclock --utc --hctosys

echo ":: Enabling devices"
busybox mdev -s &

echo $PWD

echo ":: Loading drivers"
for i in $(seq 2); do
	find /sys -name modalias -type f -exec cat {} + | sort -u | xargs modprobe -b -a
done 2>/dev/null

echo ":: Setting hostname"
cat /etc/hostname >/proc/sys/kernel/hostname

echo ":: Bringing up network"
busybox ip link set up dev lo
busybox ip addr add dev lo 127.0.0.1/8

echo ":: Checking filesystems"
[ -f /forcefsck ] || grep -q forcefsck /proc/cmdline && FORCEFSCK=-f
if ! [ -f /fastboot ] && ! grep -q fastboot /proc/cmdline; then
	fsck -A -T -C -a -t noopts=_netdev $FORCEFSCK
	if [ $? -gt 1 ]; then
		busybox sulogin
	fi
fi

echo ":: Mounting filesystems"
mount -o remount,rw /
mount -a -t "nosysfs,nonfs,nonfs4,nosmbfs,nocifs" -O no_netdev

echo ":: Tidying up"
busybox install -m0664 -o root -g utmp /dev/null /run/utmp  &
rm -f /etc/nologin /forcefsck /forcequotacheck /fastboot &

if grep -q 'break=init' /proc/cmdline; then
    echo 'Breaking before init, type "exit" to continue booting'
    /bin/sh
fi

if [ -x /etc/rc.local ]; then
	echo ":: Sourcing /etc/rc.local"
	. /etc/rc.local
fi

echo ":: Passing control to runit"
exec runsvdir -P -s /usr/bin/runit-signal /var/service

Busybox is loaded into initramfs (static),only on boot init script complains busybox cannot be found.....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#27 2016-01-16 20:50:20

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

agetty come from util-linux and getty come from busybox. you need use getty smile. however you need more variables to declare getty in /var/service/tty1/run like for example:

tty=${PWD##*-}
BAUD_RATE=38400
TERM_NAME=linux
exec setsid getty "${tty}" "${BAUD_RATE}" "${TERM_NAME}"

and the finish file

tty=${PWD##*-}
exec utmpset -w $tty

you don't need use devtmpfs when you mount /dev because you use mdev, so mounting /dev with tmpfs is sufficient. Futhermore if you would like to use hotplug you need to add this

echo "/usr/bin/mdev" > /proc/sys/kernel/hotplug

EDIT :
i think that your primary structure is a little complicated. just create a directory /usr/bin and /usr/lib (edit : you don't need /usr/lib for the moment because busybox use static library) then make symlink bin and sbin to /usr/bin, lib and lib64 to /usr/lib. enter in the directory /usr/bin in launch this little scripts (busybox need to be installed on your host)

#!/usr/bin/zsh

dir=`pwd`
for prog in $(/usr/bin/busybox --list); do
	ln -sT busybox "$dir/$prog"
done

busybox executable need to be present in /usr/bin, just copy it smile

EDIT:
this is a good exercice man, i will follow your github for this smile. onemore , here a good links to understand http://gentoo-en.vfose.ru/wiki/Initramfs and http://wiki.sourcemage.org/HowTo%282f%29Initramfs.html

Last edited by eric (2016-01-16 21:49:09)


Obarun : free to control your system

Offline

#28 2016-01-17 02:10:35

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Was thinking of using busybox --install s that should take care of links. I agree that init script is a little complicated. Once I can get to log in then I need to sort out root issue....

Am looking at alpine init script has many more clues....

Edit hotplug is not part of kernel anymore


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#29 2016-01-17 06:05:44

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#30 2016-01-17 06:17:07

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#31 2016-01-18 11:46:50

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

So far I am having no real luck creating my own init scripts, system boots and I get login but nothing else. Keyboard does not work at all. If I use other setups either Arch initramfs everything seems to work (other than I do not get all the busybox applets). Minimal Linux again works fine...

The quest continues....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#32 2016-01-19 00:04:02

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

about keyboard :

not sure about that but take a look on kernel building configuration between minimal linux and archlinux kernel. Some options are on arch kernel and not present on minimal linux.

minimal linux

# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ADP5588 is not set
# CONFIG_KEYBOARD_ADP5589 is not set
CONFIG_KEYBOARD_ATKBD=y
# CONFIG_KEYBOARD_QT1070 is not set
# CONFIG_KEYBOARD_QT2160 is not set
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_TCA6416 is not set
# CONFIG_KEYBOARD_TCA8418 is not set
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_LM8333 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
# CONFIG_KEYBOARD_MCS is not set
# CONFIG_KEYBOARD_MPR121 is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_OPENCORES is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set

and this is arch

 Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
CONFIG_KEYBOARD_ADP5588=m
CONFIG_KEYBOARD_ADP5589=m
CONFIG_KEYBOARD_ATKBD=m
CONFIG_KEYBOARD_QT1070=m
CONFIG_KEYBOARD_QT2160=m
# CONFIG_KEYBOARD_LKKBD is not set
# CONFIG_KEYBOARD_GPIO is not set
# CONFIG_KEYBOARD_GPIO_POLLED is not set
CONFIG_KEYBOARD_TCA6416=m
CONFIG_KEYBOARD_TCA8418=m
CONFIG_KEYBOARD_MATRIX=m
# CONFIG_KEYBOARD_LM8323 is not set
CONFIG_KEYBOARD_LM8333=m
# CONFIG_KEYBOARD_MAX7359 is not set
CONFIG_KEYBOARD_MCS=m
CONFIG_KEYBOARD_MPR121=m
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_OPENCORES is not set
# CONFIG_KEYBOARD_SAMSUNG is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_KEYBOARD_CROS_EC is not set

may be is the problem, you can surely turn around this issue with loading necessary modules like :

echo ":: Loading drivers"
for i in $(seq 2); do
    find /sys -name modalias -type f -exec cat {} + | sort -u | xargs modprobe -b -a
done 2>/dev/null

Last edited by eric (2016-01-19 00:06:37)


Obarun : free to control your system

Offline

#33 2016-01-19 09:19:43

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Think some of the issue is console and tty... Will add code above and call mdev. Once I get a working tty then maybe I can look at adding more.

Another thing I might try is adding inittab (busybox does not require it...)

Even looked at docker images for clues wink


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#34 2016-01-20 09:32:22

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

some test was made with this simple init:

#!/usr/bin/ash

PATH="/usr/bin"

init=/sbin/init

## "Mounting pseudo-filesystems"
dmesg -n 1
mount -o nosuid,noexec,nodev -t proc proc /proc
mount -o nosuid,noexec,nodev -t sysfs sys /sys

# populate /dev with mdev
mdev -s

/usr/bin/sh

this is the tree of the cpio image :

drwxr-xr-x 10 obarun users 4.0K Jan 20 19:25 ./
drwxr-xr-x  5 obarun users 4.0K Jan 20 18:55 ../
drwxr-xr-x  2 obarun users 4.0K Jan 16 18:30 dev/
drwxr-xr-x  2 obarun users 4.0K Jan 16 18:30 etc/
drwxr-xr-x  2 obarun users 4.0K Jan 16 18:30 new_root/
drwxr-xr-x  2 obarun users 4.0K Jan 16 18:30 proc/
drwxr-xr-x  2 obarun users 4.0K Jan 16 18:30 run/
drwxr-xr-x  2 obarun users 4.0K Jan 16 18:31 sys/
drwxr-xr-x  2 obarun users 4.0K Jan 16 18:31 tmp/
drwxr-xr-x  5 obarun users 4.0K Jan 16 18:31 usr/
lrwxrwxrwx  1 obarun users    7 Jan 16 18:32 bin -> usr/bin/
-rwxr-xr-x  1 obarun users 1.6K Jan 20 19:25 init*
lrwxrwxrwx  1 obarun users    7 Jan 16 18:32 lib -> usr/lib/
lrwxrwxrwx  1 obarun users    7 Jan 16 18:32 lib64 -> usr/lib/
-rwxr-xr-x  1 obarun users  121 Jan 20 19:08 make_initramfs*
-rw-r--r--  1 obarun users 1.3M Jan 20 19:25 rootfs.cpio.gz
lrwxrwxrwx  1 obarun users    7 Jan 16 18:32 sbin -> usr/bin/

got a keyboard, builded with 7_generate_iso.sh from minimal linux, keeping vmlinuz from minimal linux too. /usr/bin is populate by symlink from busybox. /usr/lib is empty

note: this is so fun lol

Last edited by eric (2016-01-20 09:36:55)


Obarun : free to control your system

Offline

#35 2016-01-20 10:35:25

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Know that minimal works, minirc (github by hut) works. Both use busybox....

Minimal runs bootscript.sh via /etc/inittab

# The script "/etc/bootscript.sh" is automatically executed as part of the
# "init" proess. We suppress most kernel messages, mount all crytical file
# systems, loop through all available network devices and we configure them
# through DHCP.
cat > bootscript.sh << EOF
#!/bin/sh

dmesg -n 1
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys

EOF

chmod +x bootscript.sh

No mention of any device management at all

Yes it fun, when it works! wink

Then tty2 is opened and welcome text is displayed (via inittab)

# The file "/etc/inittab" contains the configuration which defines how the
# system will be initialized. Check the following URL for more details:
# http://git.busybox.net/busybox/tree/examples/inittab
cat > inittab << EOF
::sysinit:/etc/bootscript.sh
::restart:/sbin/init
::ctrlaltdel:/sbin/reboot
::once:cat /etc/welcome.txt
::respawn:/bin/cttyhack /bin/sh
tty2::once:cat /etc/welcome.txt
tty2::respawn:/bin/sh
tty3::once:cat /etc/welcome.txt
tty3::respawn:/bin/sh
tty4::once:cat /etc/welcome.txt
tty4::respawn:/bin/sh

EOF

Actual init script is

# The "/init" script passes the execution to "/sbin/init" which in turn looks
# for the configuration file "/etc/inittab".
cat > init << EOF
#!/bin/sh

exec /sbin/init

EOF

chmod +x init

Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#36 2016-01-21 11:45:26

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Added arch-runit script too arch initramfs, was not working until I added udev (contained in initramfs). Can get too reduced shell with working keyboard (sulogin). No tty as yet really feel that a simpler method of init is the way to go. Might use inittab again.

Would prefer to use runit but with so few services that would need to be run seems not worth it.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#37 2016-01-21 20:38:39

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

for my part i try to use squashfs database. i mean : kernel boot then pass to initramfs then switch_root to disk.ob mounted on loop device. disk.ob contain the same files and the same structure than initramfs (so busybox). But  i have some problem to incorporate module correctly into the initramfs. Have you used arch srcipts for /usr/lib/modules or you have made it by  the hand? i think i have trouble because it lacks libraries.
i will make a github repo to share my work

edit: i saw you use xargs modprobe -b -a into your init. be careful you need to write the fullpath like /usr/bin/modprobe, if you do not the soft used is modprobe from busybox and the option -a and -b it doesn't recognize by him. Well it's my case smile, not sure for you but .....

Last edited by eric (2016-01-21 21:13:03)


Obarun : free to control your system

Offline

#38 2016-01-22 01:35:55

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

making a little test using kernel (vmlinuz-linux) from arch, no keyboard, keeping exactly the same rootfs but building iso with kernel (linux) from minimal linux, keyboard is present smile. So i need to inspect configuration file for arch kernel.....

EDIT : Arch dev build a large part of the kernel using modules , e.g. CONFIG_KEYBOARD_ATKBD=m (m means modules), it's mean the corresponding modules need to be present on rootfs (i think), good way or not my knowledge isn't sufficient for know it ... smile

Last edited by eric (2016-01-22 02:03:01)


Obarun : free to control your system

Offline

#39 2016-01-22 09:59:40

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

There are some modules in initramfs..

mrgreen@arch kernel]$ ls
ahci.ko   cdrom.ko  crc-itu-t.ko  ehci-pci.ko  firewire-core.ko  firewire-sbp2.ko  hid.ko    jbd2.ko       libahci.ko  libps2.ko   mmc_block.ko  scsi_mod.ko  sdhci-pci.ko  serio.ko   usb-common.ko  usbhid.ko
atkbd.ko  crc16.ko  ehci-hcd.ko   ext4.ko      firewire-ohci.ko  hid-generic.ko    i8042.ko  led-class.ko  libata.ko   mbcache.ko  mmc_core.ko   sdhci.ko     sd_mod.ko     sr_mod.ko  usbcore.ko     usb-storage.ko

Also have included keyboard hook for good measure. My own feeling is that mdev just does not work at it should, maybe a config thing or it is not up to date.

I think I am confusing console with ttys

The github build uses mkinitcpio setup (stock), have simply changed init script and added some links too busybox.

Need to get rid of udev possibly try vdev?


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#40 2016-01-22 20:36:01

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

Mr Green wrote:

Also have included keyboard hook for good measure. My own feeling is that mdev just does not work at it should, maybe a config thing or it is not up to date.

udev load modules automaticly, not the case for mdev. mdev just populate the necessary nodes, you need to load modules "manualy" before start mdev on your init smile


Obarun : free to control your system

Offline

#41 2016-01-23 01:11:41

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Am learning all the time, this might help too

http://blog.falconindy.com/articles/opt … tcpio.html

Will stick with mdev and try to load modules required wink


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#42 2016-01-23 03:56:27

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Things are more interesting now, adding certain modules does help. My feeling now is that if I was ever to create a live initramfs image it would have to contain all kernel modules to allow it too work on a range of machines. Not sure if that would be possible or worthwhile.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#43 2016-01-23 22:19:21

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

Mr Green wrote:

Things are more interesting now, adding certain modules does help. My feeling now is that if I was ever to create a live initramfs image it would have to contain all kernel modules to allow it too work on a range of machines. Not sure if that would be possible or worthwhile.

this is the role of autodetect hook. a simple way to know the modules necessary for a kernel is (edit :make a loop here):

$ find /sys -name modalias -print0 | xargs -0 cat | sort -u

then launching modinfo to find the dependence for the modules

$ modinfo -k "$kernel_version" "$modules"

replacing the two variables by the good values.

a special way is needed for lvm volume, dm raid and fstype to find the needed module, for example for the fstype :

$ findmnt -uno fstype -T '/'

take a look on the script autodetect and the functions add_modules install_modules on /usr/lib/initcpio/functions smile

Last edited by eric (2016-01-23 22:33:16)


Obarun : free to control your system

Offline

#44 2016-01-24 02:12:37

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

We would not need to worry about fancy file system setups as we are running live from initramfs. If we need to go that route addition of required binaries, files etc is all we need.

Forgot about looking at hooks, autodetect guess there is clue in the name.

It is a real shame that no one else is interested in this, too busy worrying about chrome dropping 32 bit support..... wink


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#45 2016-01-24 02:45:31

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

i'm working on simple script to provide the necessary for build an initramfs, re-invent the wheel i do lol, but it's a very good exercice. A little patience more and i share my script on github. i would like to understand correctly how to mount a .db (maked by mksquashfs) and make it rw with union-fs.


Obarun : free to control your system

Offline

#46 2016-01-24 10:55:29

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Can udev or any of the device managers do the work for us?

https://wiki.archlinux.org/index.php/ke … e_handling


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#47 2016-01-27 00:57:49

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

here some scripts . https://github.com/Obarun/rootfs-obarun

impossible to have keybaord, i don't understand why sad


Obarun : free to control your system

Offline

#48 2016-01-27 01:08:38

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Have some time to check it out, do not worry will be able to get something working wink


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#49 2016-01-27 01:34:34

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

Mr Green wrote:

Have some time to check it out, do not worry will be able to get something working wink

it's for development purpose so works or not isn't the problem for me wink


Obarun : free to control your system

Offline

#50 2016-01-27 02:04:59

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Well my first attempt ended with kernel panic, so not working for me. Certainly have something to build on...


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#51 2016-01-27 03:00:59

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

it's weird, i'm just tested it and work.
i make it in this order

$ ./make_rootfs
$ ./make_cpio
$./make_iso
$./start_iso

all works


Obarun : free to control your system

Offline

#52 2016-01-27 03:12:26

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

I will retest, am running under Virtualbox.... trying to build under my scripts to get keyboard working


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#53 2016-01-27 03:30:06

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Ok have rebuilt got to shell login then again no keyboard...


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#54 2016-01-27 03:36:38

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

i have tested some different way with modules and tested udev(easy to implement) with it too, no keyboard, i don't understand why

onto the file /proc/bus/input/devices i don't have keybord or mouse sad

Last edited by eric (2016-01-27 03:39:09)


Obarun : free to control your system

Offline

#55 2016-01-27 04:01:00

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

One of the things I did try was adding passwd file, as some articles stated that root user was unknown.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#56 2016-01-27 04:05:42

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

look at make_cpio command :

 find . | cpio -H newc -o -R '0:0' | gzip > $path/iso/rootfs.cpio.gz

normaly the -R option do the tricks


Obarun : free to control your system

Offline

#57 2016-01-27 04:19:55

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

of course that is from minimal....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#58 2016-01-27 05:15:08

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Tried many ways to get keyboard working without any luck, could adding/trying udev be an option. Still do not think mdev is the way to go. Even adding inittab did not help.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#59 2016-01-27 06:29:12

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

which is puzzle me is :
replace udev by mdev or mdev by udev, i have the same results, /sys is not populate correctly, change modules can be help in certain case, but mouse and keyboard never appear.

Last edited by eric (2016-01-27 06:30:59)


Obarun : free to control your system

Offline

#60 2016-01-28 02:00:48

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Can you check your busybox version?

busybox 1.24.1-1 # installer from community

In /usr/lib/initcpio

mrgreen@arch initcpio]$ ./busybox 
BusyBox v1.21.1 (2013-07-28 11:02:27 EDT) multi-call binary.

Stock mkinitcpio (initramfs image) works to reduced shell login, if I switch too installed version of busybox (all applets) keyboard will not work and I get a modprobe error (-a not found...).

Not sure if you are running arch busybox or built version.

Could be how busybox is built or 4555 setting got no idea....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#61 2016-01-28 07:31:32

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

wow good catch, "j'avais pas fait gaffe".
same thing for me the version is different in /usr/lib/initcpio (1.21.1). tried to use the /usr/lib/initcpio no mdev on it o0.

@Not sure if you are running arch busybox or built version
busybox version 1.24 used, it seems the trouble, i need to investigate the pkgbuild about it smile

about modprobe, it a normal behaviour, busybox modprobe doesn't have the option -a, it's the case for lsmod, mount too (less options), that is for why base hook add kmod, mount, blkid binary.
I have tried to use busybox as replacement of all binary in standard arch system, a lot of soft doesn't work, for e.g. yaourt doesn't work because readlink no have all option necessary

so i go to investigate busybox pkgbuild and i come back smile

Last edited by eric (2016-01-28 07:37:17)


Obarun : free to control your system

Offline

#62 2016-01-28 10:17:18

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

post this link here but ...
this is very interesting http://landley.net/aboriginal/about.html


Obarun : free to control your system

Offline

#63 2016-01-28 12:40:09

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Something that arch initramfs does is add 'mount' command, it does not use busybox version. kmod is another. It may well be that busybox 1.24 clashes with arches mount command.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#64 2016-02-04 08:57:10

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

have already a trouble with modules, making rootfs with my scripts (keeping the same way as arch hook) do not the same result about modules installed and i do not understand why. need more investigation about it again sad


Obarun : free to control your system

Offline

#65 2016-02-04 15:34:33

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

I have been looking at building a small ISO the normal way, but base alone is well over 200mbs. What about adding linux package to he mix?


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#66 2016-02-05 08:26:24

eric
Member
Registered: 2015-07-10
Posts: 240
Website

Re: Minimal Linux Live ....

Mr Green wrote:

What about adding linux package to he mix

sorry but i don't understand, can you say with another way please?


Obarun : free to control your system

Offline

#67 2016-02-06 01:13:13

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

Adding linux package (kernel). Problem we have is we are using modules required.


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#68 2016-02-07 11:46:00

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

What I am going to do is build iso the way I normally do but without X and pacman wink aim to get around 100mb or less....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#69 2016-02-13 00:41:43

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: Minimal Linux Live ....

https://github.com/rancher/os

A docker based system is that is around 25mb


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

Board footer

Powered by FluxBB