View previous topic :: View next topic |
Author |
Message |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Sat Mar 27, 2021 7:07 am Post subject: Custom initramfs |
|
|
I've been following this guide https://wiki.gentoo.org/wiki/Old_Fashioned_Gentoo_Install#Making_the_initrd And created my own overlay at github. I was able to remove everything to do with IUSE for lvm but I am running into a problem with xorg-server. I know I already removed everything to do with udev in IUSE, but it keeps pulling in x11-base/xorg-server-1.20.10-r3::gentoo and keeps complaining about the flag udev. I tried masking it, I tried manipulating it with package.use, I tried installing it then installing my modified ontop of it no luck, and I looked at the ebuild structure to only double check if I completely removed everything to do with udev. No luck. Here's the structure of the ebuild I have currently:
Code: |
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
XORG_DOC=doc
inherit xorg-3 multilib flag-o-matic toolchain-funcs
EGIT_REPO_URI="https://gitlab.freedesktop.org/xorg/xserver.git"
DESCRIPTION="X.Org X servers"
#SLOT="0/${PV}"
if [[ ${PV} != 9999* ]]; then
KEYWORDS="~alpha amd64 arm arm64 ~hppa ~ia64 ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~amd64-linux ~x86-linux"
fi
IUSE_SERVERS="dmx kdrive wayland xephyr xnest xorg xvfb"
IUSE="${IUSE_SERVERS} debug +elogind ipv6 libressl minimal selinux suid systemd test unwind xcsecurity"
RESTRICT="!test? ( test )"
CDEPEND="
media-libs/libglvnd[X]
!libressl? ( dev-libs/openssl:0= )
libressl? ( dev-libs/libressl:0= )
>=x11-apps/iceauth-1.0.2
>=x11-apps/rgb-1.0.3
>=x11-apps/xauth-1.0.3
x11-apps/xkbcomp
>=x11-libs/libdrm-2.4.89
>=x11-libs/libpciaccess-0.12.901
>=x11-libs/libXau-1.0.4
>=x11-libs/libXdmcp-1.0.2
>=x11-libs/libXfont2-2.0.1
>=x11-libs/libxkbfile-1.0.4
>=x11-libs/libxshmfence-1.1
>=x11-libs/pixman-0.27.2
>=x11-libs/xtrans-1.3.5
>=x11-misc/xbitmaps-1.0.1
>=x11-misc/xkeyboard-config-2.4.1-r3
dmx? (
x11-libs/libXt
>=x11-libs/libdmx-1.0.99.1
>=x11-libs/libX11-1.1.5
>=x11-libs/libXaw-1.0.4
>=x11-libs/libXext-1.0.99.4
>=x11-libs/libXfixes-5.0
>=x11-libs/libXi-1.2.99.1
>=x11-libs/libXmu-1.0.3
x11-libs/libXrender
>=x11-libs/libXres-1.0.3
>=x11-libs/libXtst-1.0.99.2
)
kdrive? (
>=x11-libs/libXext-1.0.5
x11-libs/libXv
)
xephyr? (
x11-libs/libxcb[xkb]
x11-libs/xcb-util
x11-libs/xcb-util-image
x11-libs/xcb-util-keysyms
x11-libs/xcb-util-renderutil
x11-libs/xcb-util-wm
)
!minimal? (
>=x11-libs/libX11-1.1.5
>=x11-libs/libXext-1.0.5
>=media-libs/mesa-18[X(+),egl,gbm]
>=media-libs/libepoxy-1.5.4[X,egl(+)]
)
unwind? ( sys-libs/libunwind )
wayland? (
>=dev-libs/wayland-1.3.0
>=media-libs/libepoxy-1.5.4[egl(+)]
>=dev-libs/wayland-protocols-1.18
)
>=x11-apps/xinit-1.3.3-r1
systemd? (
sys-apps/dbus
sys-apps/systemd
)
elogind? (
sys-apps/dbus
sys-auth/elogind[pam]
sys-auth/pambase[elogind]
)
!!x11-drivers/nvidia-drivers[-libglvnd(+)]
"
DEPEND="${CDEPEND}
sys-devel/flex
>=x11-base/xorg-proto-2018.4
dmx? (
doc? (
|| (
www-client/links
www-client/lynx
www-client/w3m
)
)
)"
RDEPEND="${CDEPEND}
selinux? ( sec-policy/selinux-xserver )
"
PDEPEND="
xorg? ( >=x11-base/xorg-drivers-$(ver_cut 1-2) )"
REQUIRED_USE="!minimal? (
|| ( ${IUSE_SERVERS} )
)
?? ( elogind systemd )
minimal? ( !wayland )
xephyr? ( kdrive )"
UPSTREAMED_PATCHES=(
)
PATCHES=(
"${UPSTREAMED_PATCHES[@]}"
"${FILESDIR}"/${PN}-1.12-unloadsubmodule.patch
# needed for new eselect-opengl, bug #541232
"${FILESDIR}"/${PN}-1.18-support-multiple-Files-sections.patch
)
pkg_setup() {
if use wayland && use minimal; then
ewarn "glamor is necessary for acceleration under Xwayland."
ewarn "Performance may be unacceptable without it."
ewarn "Build with USE=-minimal to enable glamor."
fi
# localstatedir is used for the log location; we need to override the default
# from ebuild.sh
# sysconfdir is used for the xorg.conf location; same applies
# NOTE: fop is used for doc generating; and I have no idea if Gentoo
# package it somewhere
XORG_CONFIGURE_OPTIONS=(
$(use_enable ipv6)
$(use_enable debug)
$(use_enable dmx)
$(use_enable kdrive)
$(use_enable test unit-tests)
$(use_enable unwind libunwind)
$(use_enable wayland xwayland)
$(use_enable !minimal record)
$(use_enable !minimal xfree86-utils)
$(use_enable !minimal dri)
$(use_enable !minimal dri2)
$(use_enable !minimal dri3)
$(use_enable !minimal glamor)
$(use_enable !minimal glx)
$(use_enable xcsecurity)
$(use_enable xephyr)
$(use_enable xnest)
$(use_enable xorg)
$(use_enable xvfb)
$(use_with doc doxygen)
$(use_with doc xmlto)
$(use_with systemd systemd-daemon)
--enable-libdrm
--sysconfdir="${EPREFIX}"/etc/X11
--localstatedir="${EPREFIX}"/var
--with-fontrootdir="${EPREFIX}"/usr/share/fonts
--with-xkb-output="${EPREFIX}"/var/lib/xkb
--disable-config-hal
--disable-linux-acpi
--without-dtrace
--without-fop
--with-os-vendor=Gentoo
--with-sha1=libcrypto
CPP="$(tc-getPROG CPP cpp)"
)
if use systemd || use elogind; then
XORG_CONFIGURE_OPTIONS+=(
"--enable-systemd-logind"
"--disable-install-setuid"
"$(use_enable suid suid-wrapper)"
)
else
XORG_CONFIGURE_OPTIONS+=(
"--disable-systemd-logind"
"--disable-suid-wrapper"
"$(use_enable suid install-setuid)"
)
fi
}
src_install() {
xorg-3_src_install
server_based_install
if ! use minimal && use xorg; then
# Install xorg.conf.example into docs
dodoc "${S}"/hw/xfree86/xorg.conf.example
fi
newinitd "${FILESDIR}"/xdm-setup.initd-1 xdm-setup
newinitd "${FILESDIR}"/xdm.initd-11 xdm
newconfd "${FILESDIR}"/xdm.confd-4 xdm
# install the @x11-module-rebuild set for Portage
insinto /usr/share/portage/config/sets
newins "${FILESDIR}"/xorg-sets.conf xorg.conf
find "${ED}"/var -type d -empty -delete || die
}
pkg_postrm() {
# Get rid of module dir to ensure opengl-update works properly
if [[ -z ${REPLACED_BY_VERSION} && -e ${EROOT}/usr/$(get_libdir)/xorg/modules ]]; then
rm -rf "${EROOT}"/usr/$(get_libdir)/xorg/modules
fi
}
server_based_install() {
if ! use xorg; then
rm "${ED}"/usr/share/man/man1/Xserver.1x \
"${ED}"/usr/$(get_libdir)/xserver/SecurityPolicy \
"${ED}"/usr/$(get_libdir)/pkgconfig/xorg-server.pc \
"${ED}"/usr/share/man/man1/Xserver.1x
fi
}
|
I also want to talk about the need to create a patch that will build mesa package without the support of udev as well as hwids and I have no clue to do that, I mean, I recently found out how to apply the patch.
This initramfs is for raspberrypi4 by the way and this is the error I get whenever I try to install it:
Code: |
!!! Multiple package instances within a single package slot have been pulled
!!! into the dependency graph, resulting in a slot conflict:
x11-base/xorg-server:0
(x11-base/xorg-server-1.20.10-r3:0/1.20.10::initramfs_custom, ebuild scheduled for merge) USE="ipv6 systemd xorg -debug -dmx -doc (-elogind) -kdrive (-libressl) -minimal (-selinux) -suid -test -unwind -wayland -xcsecurity -xephyr -xnest -xvfb" pulled in by
(no parents that aren't satisfied by other packages in this slot)
(x11-base/xorg-server-1.20.10-r3:0/1.20.10::gentoo, ebuild scheduled for merge) USE="ipv6 systemd udev xorg -debug -dmx -doc (-elogind) -kdrive (-libressl) -minimal (-selinux) -suid -test -unwind -wayland -xcsecurity -xephyr -xnest -xvfb" pulled in by
>=x11-base/xorg-server-1.20[udev] required by (x11-base/xorg-drivers-1.20-r2:0/0::gentoo, ebuild scheduled for merge) USE="" INPUT_DEVICES="libinput -elographics -evdev -joystick (-synaptics) (-vmmouse) -void (-wacom)" VIDEO_CARDS="fbdev vc4 (-amdgpu) (-ast) -dummy -freedreno (-geode) (-glint) (-i915) (-i965) (-intel) (-mga) -nouveau (-nv) (-nvidia) (-omap) (-qxl) (-r128) (-radeon) (-radeonsi) (-siliconmotion) -tegra (-vesa) (-via) (-virtualbox) (-vmware)"
^^^^ |
Again, I don't know what's going on as I am following what the guide is telling me to do. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Sat Mar 27, 2021 9:58 am Post subject: |
|
|
kucklehead,
I build my Xorg like this. Code: | [ebuild R ] x11-base/xorg-server-1.20.10-r3:0/1.20.10::gentoo USE="ipv6 suid xorg xvfb -debug -dmx -doc (-elogind) -kdrive (-libressl) -minimal (-selinux) (-systemd) (-udev) -unwind -wayland -xcsecurity -xephyr -xnest" 0 KiB |
My /etc/portage/profile/use.mask: |
# No automatic hand holding
consolekit
policykit
pulseaudio
# Can't use systemd with a static dev as it forces udev
systemd
# Can't use udev with a static dev.
udev
elogind
# More unsavory optional black magic
udisks
upower
upnp |
It gets worse too Notice with x11-base/xorg-drivers that
Code: | [ebuild R ] x11-base/xorg-drivers-1.20-r2::gentoo INPUT_DEVICES="-elographics -evdev -joystick -libinput -synaptics -vmmouse -void -wacom" VIDEO_CARDS="amdgpu fbdev nouveau nv radeonsi vesa -ast -dummy (-freedreno) (-geode) -glint -i915 -i965 -intel -mga -nvidia (-omap) -qxl -r128 -radeon -siliconmotion (-tegra) (-vc4) -via -virtualbox -vmware" 0 KiB | the x11-drivers/xf86-input-keyboard and x11-drivers/xf86-input-mouse drivers will not be pulled in.
You need to put them in your overlay and emerge then manually.
x11-drivers/xf86-input-keyboard-1.9.0 is the last release that will support linux as upstream have removed that support.
Last but not least, I have a note
Code: | /etc/portage/package.mask/xorg:
# Must use gentoo-static version or we don't get our keymap
# maybe its been moved?
# x11-misc/xkeyboard-config-2.31 works |
I updated one day and found I couldn't use the keyboard in Xorg and that was the workaround.
Why are you putting Xorg into the initrd? Its not needed there. On a Pi, an initrd is not required unless you are doing root on raid or in LVM. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Sat Mar 27, 2021 7:40 pm Post subject: |
|
|
I am doing an initramfs because I am using lvm. And again I am following that guide which says that I need to create an overlay that has xorg-server and lvm with the udev completely removed from the ebuild. If I don't need xorg-server with the udev removed from it completely then say no more, as I am done dealing with it. I didn't know that systemd forces udev and I need that for the whole system to work. I already modified the lvm ebuild so it doesn't have udev in it and it works just fine. Can I keep the static-dev and systemd with it? Or do I have to modify the systemd ebuild so it doesn't force udev? Again, all I am trying to do is build a custom initramfs for this pi. Do I have to even follow this guide https://wiki.gentoo.org/wiki/Old_Fashioned_Gentoo_Install#Making_the_initrd? Or just follow the userspace one and the custom? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Sat Mar 27, 2021 9:43 pm Post subject: |
|
|
kucklehead,
All the initrd needs are the user space tools to start LVM and mount root.
Start reading at Making the initrd.
That's for my system with a static /dev, It can be simplified if you use devtmpfs.
LVM no longer builds statically linked. You will need the dynamically built LVM and all its dependencies.
lddtree will list them.
/root/initrd/initramfs_list tells what will go into the the initrd. File versions may have changed.
Locations may have been moved with the /17.1/ profile update too.
/root/initrd/init is the init script that uses the files in the initrd to start LVM, and mount root.
Unless you have raid, the raid things are not needed. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Sat Mar 27, 2021 9:58 pm Post subject: |
|
|
I already uninstalled the static-dev and will use the devtmpfs instead as again I need the systemd. I understand that I am going to create two initramfs one that holds the list and the other which boots the system; the one that boots my system will be added to my boot.txt. Right now I am building the initramfs. I will have to uninstall the lvm cause I made it static. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Sat Mar 27, 2021 10:25 pm Post subject: |
|
|
kucklehead,
If you can beuld LVM statically linked go ahead. I haven't been able to for a some time now. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Sat Mar 27, 2021 10:56 pm Post subject: |
|
|
Yeah it works static Here's the ebuild
Code: |
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
inherit autotools linux-info multilib systemd toolchain-funcs flag-o-matic
DESCRIPTION="User-land utilities for LVM2 (device-mapper) software"
HOMEPAGE="https://sourceware.org/lvm2/"
SRC_URI="ftp://sourceware.org/pub/lvm2/${PN/lvm/LVM}.${PV}.tgz
ftp://sourceware.org/pub/lvm2/old/${PN/lvm/LVM}.${PV}.tgz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~mips ppc ppc64 ~riscv s390 sparc x86 ~amd64-linux ~x86-linux"
IUSE="readline +static +static-libs systemd lvm2create_initrd sanlock selinux +thin device-mapper-only"
REQUIRED_USE="device-mapper-only? ( !lvm2create_initrd !sanlock !thin )
systemd? ( )"
DEPEND_COMMON="
dev-libs/libaio[static-libs?]
static? ( dev-libs/libaio[static-libs] )
!static? ( dev-libs/libaio[static-libs?] )
readline? ( sys-libs/readline:0= )
sanlock? ( sys-cluster/sanlock )
systemd? ( >=sys-apps/systemd-205:0= )"
# /run is now required for locking during early boot. /var cannot be assumed to
# be available -- thus, pull in recent enough baselayout for /run.
# This version of LVM is incompatible with cryptsetup <1.1.2.
RDEPEND="${DEPEND_COMMON}
>=sys-apps/baselayout-2.2
!<sys-apps/openrc-0.11
!<sys-fs/cryptsetup-1.1.2
!!sys-fs/lvm-user
>=sys-apps/util-linux-2.16
lvm2create_initrd? ( sys-apps/makedev )
thin? ( >=sys-block/thin-provisioning-tools-0.3.0 )"
# note: thin- 0.3.0 is required to avoid --disable-thin_check_needs_check
DEPEND="${DEPEND_COMMON}
static? (
selinux? ( sys-libs/libselinux[static-libs] )
>=sys-apps/util-linux-2.16[static-libs]
)"
BDEPEND="
sys-devel/autoconf-archive
virtual/pkgconfig
|
It works with the udev removed. Should I include the xorg-server as well? And how do I even dynamically link it? I'm going throw in everything such as the pi firmware, the cards and what not
Last edited by kucklehead on Sun Mar 28, 2021 12:58 am; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Sat Mar 27, 2021 11:07 pm Post subject: |
|
|
kucklehead,
Thank you. I'll look at it.
If you keep the initrd to the userspace tools only, it will work with any kernel.
The kernel can be made to include the firmware if you like.
If the firmware is in the intrd, when the firmware changes, the initrd needs to be updated. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Sun Mar 28, 2021 1:01 am Post subject: |
|
|
Thought I did emerge it with the static flag enabled but I didn't, I read through the parts where it failed and I got it to output this:
Code: |
[LN] liblvm2cmd.so.2.02
ln -s -f liblvm2cmd.so liblvm2cmd.so.2.02
collect2: error: ld returned 1 exit status
|
I got to this part after adding -ldl into make.conf. I have no idea and I'm done with it. How do I dynamically install lvm or anything actually. Also I got it to work by doing this: echo sys-fs/lvm2 static -udev -systemd >> /etc/portage/package.use/lvm2
Then doing this: emerge --ask --quiet =sys-fs/lvm2-2.02.187-r2
I had to re-edit my ebuild and add -systemd and it works, I ran the ldd /sbin/lvm and grabbed the files which are now in my init_list
Example:
Code: |
file /lib64/ld-linux-aarch64.so.2 /lib64/ld-linux-arm64.so.2 755 0 0
file /lib64/libext2fs.so.2 /lib64/libext2fs.so.2 755 0 0
file /lib64/libcom_err.so.2 /lib64/libcom_err.so.2 755 0 0
file /lib64/libpthread.so.0 /lib64/libpthread.so.0 755 0 0
file /lib64/libblkid.so.1 /lib64/libblkid.so.1 755 0 0
file /lib64/libuuid.so.1 /lib64/libuuid.so.1 755 0 0
file /lib64/libe2p.so.2 /lib64/libe2p.so.2 755 0 0
file /lib64/libc.so.6 /lib64/libc.so.6 755 0 0
file /lib64/libmount.so.1 /lib64/libmount.so.1 755 0 0
file /lib64/libdevmapper-event.so.1.02 /lib64/libdevmapper-event.so.1.02 755 0 0
file /lib64/libdl.so.2 /lib64/libdl.so.2 755 0 0
file /lib64/libblkid.so.1 /lib64/libblkid.so.1 755 0 0
file /lib64/libdevmapper.so.1.02 /lib64/libdevmapper.so.1.02 755 0 0
file /lib64/libaio.so.1 /lib64/libaio.so.1 755 0 0
file /lib64/libreadline.so.8 /lib64/libreadline.so.8 755 0 0
file /lib64/libc.so.6 /lib64/libc.so.6 755 0 0
file /lib/ld-linux-aarch64.so.1 /lib64/ld-linux-aarch64.so.1 755 0 0
file /lib64/libpthread.so.0 /lib64/libpthread.so.0 755 0 0
file /lib64/libm.so.6 /lib64/libm.so.6 755 0 0
file /lib64/libtinfow.so.6 /lib64/libtinfow.so.6 755 0 0
|
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Sun Mar 28, 2021 2:54 am Post subject: |
|
|
So far the initramfs is coming along much better than last time. And I also understand why you asked me why am i including the xorg-server in my initramfs? The guide I am following is building a initrd which is not used anymore and initramfs is used. But the guide for that is flagged dirty and I don't know what exactly is 100% accurate. But I have a couple questions from the old fashion guide.
I was double checking the init_list from there and it has this:
Code: |
slink /dev/stderr /proc/self/fd/2 777 0 0
slink /dev/stdin /proc/self/fd/0 777 0 0
slink /dev/std/out /proc/self/fd/1 777 0 0
|
What is that exactly? And do I need that in my init_list?
I also was curious what these numbers mean:
Code: |
nod /dev/dm-0 0660 0 0 b 253 0
nod /dev/dm-1 0660 0 0 b 253 1
nod /dev/dm-2 0660 0 0 b 254 2
# ...
|
I am talking about the 0660 0 0 b 253 0. [/code] |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Sun Mar 28, 2021 9:40 am Post subject: |
|
|
kucklehead,
You need Code: | slink /dev/stderr /proc/self/fd/2 777 0 0
slink /dev/stdin /proc/self/fd/0 777 0 0
slink /dev/std/out /proc/self/fd/1 777 0 0 | as you will not have udev in the intrd to create those symbolic links.
Programs expect to use those three /dev entries.
The 777 0 0 means Owned by root, group root, and lrwxrwxrwx permissions. Check the symlinks on your live system now.
You do not need anyentries as you will use devtmpfs
The numbers in Code: | nod /dev/dm-0 0660 0 0 b 253 0 | mean create a node called /dev/dm-0 with permissions rw-rw---- owned by root, group root, its to be a block device with major device number 253 and minor device number 0.
will show you the device mapper entries on your live system. will show the HDD. (Not NVME).
The concept of users does not exist in the initrd, so effectively there is only root.
Internally the kernel works with the major and minor device numbers. There are two sets block devices and character devices.
There is a list in /usr/src/linux/Documentation/admin-guide/devices.txt.
That guide needs to be updated. I wrote it in 2013 for a whole static /dev system. The only bit that you need is the initrd part, which hasn't changed much.
The rest has got a lot harder.
In the initrd there is only the kernel, the included progarms and libraries and the init script to do what you need, or give you a shell when it fails.
Code: | $ lddtree /bin/busybox
/bin/busybox (interpreter => None) |
That tells that busybox is statically linked and needs nothing else in the initrd,
Code: | $ lddtree /bin/bash
/bin/bash (interpreter => /lib64/ld-linux-x86-64.so.2)
libreadline.so.8 => /lib64/libreadline.so.8
libtinfow.so.6 => /lib64/libtinfow.so.6
libc.so.6 => /lib64/libc.so.6 |
That shows that bash needs four other files. It all has to go into the initrd to be able to run there.
When you miss a bit out, something will fail and you will get a shell to look around. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Wed Mar 31, 2021 8:53 pm Post subject: |
|
|
Thank you for explaining that. I did what you told me to do and read through the article making initrd the old fashion way and used the custom initramfs. It was really confusing and hard to combine them both together. This is what I did to create my initramfs:
Code: |
usr/gen_init_cpio /usr/src/initramfs/initramfs.list > /usr/src/initramfs/rpi-5.12-v8-custom_initramfs.cpio
gzip --best /usr/src/initramfs/rpi-5.12-v8-custom_initramfs.cpio
cp -Pr /usr/src/initramfs/rpi-5.12-v8-custom_initramfs.cpio.gz /boot
|
I realized that I added my these libraries using the lddtree and ldd, because they are not static and I am assuming that is how you dynamic link that?
Code: |
consoletype fsck halt mkfs.ext2 poweroff sulogin
depmod fsck.ext2 insmod mkfs.ext3 reboot swapoff
dhcpcd fsck.ext3 ldconfig mkfs.ext4 rmmod swapon
fdisk fsck.ext4 mkfs modprobe shutdown switch_root
|
I don't know if I needed that stuff, but I added it into there just in case. This is my file for the initramfs.list:
Code: |
# This is my initramfs layout. Everything here that has file needs to be archived in the /usr/src/initramfs
dir /proc 755 0 0
dir /usr 755 0 0
dir /bin 755 0 0
dir /sys 755 0 0
dir /var 755 0 0
dir /lib 755 0 0
dir /lib64 755 0 0
dir /sbin 755 0 0
dir /mnt 755 0 0
dir /mnt/root 755 0 0
dir /etc 755 0 0
dir /root 700 0 0
dir /dev 755 0 0
dir /dev/mapper 755 0 0
# Note: cp --archive is used when you're coping over a ebuild which has the static and or static-libs enabled.
# Archiving dynamic library is not needed and using lddtree --copy-to-tree /usr/src/initramfs /sbin/<binary name>
# we don't have a static /dev and mounting devtmpfs is needed.
# I will mount the devtmpfs in the init so this will work
# e.g. /dev/console below
nod /dev/console 0600 0 0 c 5 1
nod /dev/null 0666 0 0 c 1 5
# dev/sda and partitions
nod /dev/mmcblk0 0660 0 0 b 8 0
nod /dev/mmcblk0p1 0660 0 0 b 8 1
nod /dev/mmcblk0p2 0660 0 0 b 8 2
# busybox
file /bin/busybox /bin/busybox 755 0 0
# all the lvm nodes I need and dm stands for device-mapper
nod /dev/dm-0 0660 0 0 b 253 0
nod /dev/dm-1 0660 0 0 b 253 1
nod /dev/dm-2 0660 0 0 b 254 2
nod /dev/dm-3 0660 0 0 b 254 3
# ...
slink /dev/stderr /proc/self/fd/2 777 0 0
slink /dev/stdin /proc/self/fd/0 777 0 0
slink /dev/std/out /proc/self/fd/1 777 0 0
# libraries required by /sbin/fsck.ext4 and /sbin/fsck
# This section where it has /lib64 is the libraries. You can keep adding more libraries into here.
# Do not alter file /init /usr/src/initramfs/init 0755 0 0
# Libaries I added are consoletype,dhcpcd,fdisk,insmod,modprobe,switch_root,reboot,shutdown,halt,depmod,swapon,cfdisk
slink /lib /lib64 777 0 0
file /lib64/ld-linux-aarch64.so.1 /lib64/ld-linux-aarch64.so.1 755 0 0
file /lib64/libblkid.so.1 /lib64/libblkid.so.1 755 0 0
file /lib64/libmount.so.1 /lib64/libmount.so.1 755 0 0
file /lib64/libc.so.6 /lib64/libc.so.6 755 0 0
file /lib64/libext2fs.so.2 /lib64/libext2fs.so.2 755 0 0
file /lib64/libcom_err.so.2 /lib64/libcom_err.so.2 755 0 0
file /lib64/libdl.so.2 /lib64/libdl.so.2 755 0 0
file /lib64/libpthread.so.0 /lib64/libpthread.so.0 755 0 0
file /lib64/libfdisk.so.1 /lib64/libfdisk.so.1 755 0 0
file /lib64/libsmartcols.so.1 /lib64/libsmartcols.so.1 755 0 0
file /lib64/libtinfow.so.6 /lib64/libtinfow.so.6 755 0 0
file /lib64/libreadline.so.8 /lib64/libreadline.so.8 755 0 0
file /lib64/liblzma.so.5 /lib64/libzma.so.5 755 0 0
file /lib64/libz.so.1 /lib64/libz.so.1 755 0 0
file /lib64/libacl.so.1 /lib64/libacl.so.1 755 0 0
file /lib64/libcap.so.2 /lib64/libcap.so.2 755 0 0
file /lib64/libcrypt.so.1 /lib64/libcrypt.so.1 755 0 0
file /lib64/libgcrypt.so.1 /lib64/libgcrypt.so.1 755 0 0
file /lib64/libkmod.so.2 /lib64/libkmod.so.2 755 0 0
file /lib64/libpam.so.0 /lib64/libpam.so.0 755 0 0
file /lib64/librt.so.1 /lib64/librt.so.1 755 0 0
file /lib64/libseccomp.so.2 /lib64/libseccomp.so.2 755 0 0
file /lib64/libzstd.so.1 /lib64/libzstd.so.1 755 0 0
file /lib64/libm.so.6 /lib64/libm.so.6 755 0 0
file /lib64/libgpg-error.so.0 /lib64/libgpg-error.so.0 755 0 0
file /lib64/libzstd.so.1 /lib64/libzstd.so.1 755 0 0
file /lib64/libsystemd-shared-247.so /lib64/libsystemd-shared-247.so 755 0 0
file /lib64/libncursesw.so.6 /lib64/libncursesw.so.6 755 0 0
file /lib64/libe2p.so.2 /lib64/libe2p.so.2 755 0 0
file /lib64/libext2fs.so.2 /lib64/libext2fs.so.2 755 0 0
|
And this is my init file:
Code: |
#!/bin/busybox sh
# Install symlinks to all busybox applets first.
/bin/busybox mkdir -p /usr/sbin /usr/bin /sbin /bin
/bin/busybox --install -s
rescue_shell() {
echo "$@"
echo "Something went wrong. Dropping you to a shell."
/bin/busybox --install -s
exec /bin/sh
}
# allow the use of UUIDs or filesystem lables
uuidlabel_root() {
for cmd in $(cat /proc/cmdline) ; do
case $cmd in
root=*)
type=$(echo $cmd | cut -d= -f2)
echo "Mounting rootfs"
if [ $type == "LABEL" ] || [ $type == "UUID" ] ; then
uuid=$(echo $cmd | cut -d= -f3)
mount -o ro $(findfs "$type"="$uuid") /mnt/root
else
mount -o ro $(echo $cmd | cut -d= -f2) /mnt/root
fi
;;
esac
done
}
check_filesystem() {
# most of code coming from /etc/init.d/fsck
local fsck_opts= check_extra= RC_UNAME=$(uname -s)
# FIXME : get_bootparam forcefsck
if [ -e /forcefsck ]; then
fsck_opts="$fsck_opts -f"
check_extra="(check forced)"
fi
echo "Checking local filesystem $check_extra : $1"
if [ "$RC_UNAME" = Linux ]; then
fsck_opts="$fsck_opts -C0 -T"
fi
trap : INT QUIT
# using our own fsck, not the builtin one from busybox
/sbin/fsck -p $fsck_opts $1
ret_val=$?
case $ret_val in
0) return 0;;
1) echo "Filesystem repaired"; return 0;;
2|3) if [ "$RC_UNAME" = Linux ]; then
echo "Filesystem repaired, but reboot needed"
reboot -f
else
rescue_shell "Filesystem still have errors; manual fsck required"
fi;;
4) if [ "$RC_UNAME" = Linux ]; then
rescue_shell "Fileystem errors left uncorrected, aborting"
else
echo "Filesystem repaired, but reboot needed"
reboot
fi;;
8) echo "Operational error"; return 0;;
16) echo "Use or Syntax Error"; return 16;;
32) echo "fsck interrupted";;
127) echo "Shared Library Error"; sleep 20; return 0;;
*) echo $ret_val; echo "Some random fsck error - continuing anyway"; sleep 20; return 0;;
esac
# rescue_shell can't find tty so its broken
rescue_shell
}
# start for real here
# Setup dynamic IP address
ifconfig eth0 up
udhcpc -t 5 -q -s /bin/simple.script
# temporarily mount proc and sys
mount -t devtmpfs none /dev # This creates nodes, in which are described in the init_list
mount -t proc none /proc
mount -t sysfs none /sys
# lvm runs as whatever its called as
ln -s /sbin/lvm.static /sbin/vgchange
lvm vgscan --mknodes # creates /dev/mapper/control
lvm lvchange -a ly gentoo/root
lvm vgscan --mknodes # creates /dev/mapper/VG-root and /dev/VG/root
# Change VG into the Volume Group which mine is gentoo. Physical Volume PV is created first then the VG
# everything on the SDD
/sbin/vgchange -ay ssd | rescue_shell
# start the vg volume group - /home and everything for portage - need not die here
/sbin/vgchange -ay vg || rescue_shell
# get here with raid sets assembled and logical volumes available
# mounting rootfs on /mnt/root
uuidlabel_root || rescue_shell "Error with uuidlabel_root"
# space separated list of mountpoints that ...
mountpoints="/tmp /var/log"
# ... we want to find in /etc/fstab ...
ln -s /mnt/root/etc/fstab /etc/fstab
# ... to check filesystems and mount our devices.
for m in $mountpoints ; do
#echo $m
check_filesystem $m
echo "Mounting $m"
# mount the device and ...
mount $m || rescue_shell "Error while mounting $m"
# ... move the tree to its final location
mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
done
echo "All done. Switching to real root."
# clean up. The init process will remount proc sys and dev later
umount /proc
umount /sys
# switch to the real root and execute init
exec switch_root /mnt/root /sbin/init
|
After I did all that work, I am still confused about the part populating the modules: "Populating /etc/conf.d/modules
Only you know what you need here. When you reboot, its a good idea to have keyboard support and udev isn't going to load it for you any more. ", (https://wiki.gentoo.org/wiki/Old_Fashioned_Gentoo_Install#Making_the_initrd) Don't know the author so Im using the link
Do I copy them in there or create a file holding them?
And you said before that I would need this: https://www.amazon.com/Serial-Adapter-Signal-Prolific-Windows/dp/B07R8BQYW1
What is that for anyways? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Wed Mar 31, 2021 10:45 pm Post subject: |
|
|
kucklehead,
Code: | # dev/sda and partitions
nod /dev/mmcblk0 0660 0 0 b 8 0
nod /dev/mmcblk0p1 0660 0 0 b 8 1
nod /dev/mmcblk0p2 0660 0 0 b 8 2 |
8 0, 8 1 and 8 2 mean /dev/sda, /dev/sda1 and /dev/sda2
You need the numbers for your block device.
Code: | roy@Pi4_~arm64 ~ $ ls -l /dev/mmc*
brw-rw---- 1 root disk 179, 0 Jan 1 1970 /dev/mmcblk0
brw-rw---- 1 root disk 179, 1 Apr 25 2016 /dev/mmcblk0p1 | so the 8 needs to be 179.
Code: | # Install symlinks to all busybox applets first.
/bin/busybox mkdir -p /usr/sbin /usr/bin /sbin /bin
/bin/busybox --install -s |
I do that inside the rescue shell in case it overwrites real commands in the initrd.
Its still there too.
# temporarily mount proc and sys
mount -t devtmpfs none /dev # This creates nodes, in which are described in the init_list
mount -t proc none /proc
mount -t sysfs none /sys
must be first after the
Code: | # start for real here | You need /proc and /dev before its possible to do very much.
For every add a string like Code: | uuidlabel_root || rescue_shell "Error with uuidlabel_root" | to tell what failed.
You hope you won't ever see them but bugs are a fact of life.
Code: | umount /proc
umount /sys |
Need to add umunt /dev here.
Why do you do
Code: | # Setup dynamic IP address
ifconfig eth0 up
udhcpc -t 5 -q -s /bin/simple.script | the network is not used in the initrd. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 12:45 am Post subject: |
|
|
I had it in there because again I was following this guide: https://wiki.gentoo.org/wiki/Custom_Initramfs#Dynamic_devices
Which says you can do this:
Code: |
Static IP
If your network situation allows you to use a static network IP, you can set it up using the ifconfig and route commands, both of which are included in Busybox. This is by far the easiest solution, so if it's at all possible, go for it.
FILE /usr/src/initramfs/initStatic network IP setup in /init
ifconfig eth0 10.0.2.15
route add default gw 10.0.2.2
|
I removed it, and added the stuff you said earlier into the rescue_shell local variables, added the umount /dev, and have the stuff where you said it had to be after the start here:
Code: |
#!/bin/busybox sh
# Install symlinks to all busybox applets first.
rescue_shell() {
echo "$@"
echo "Something went wrong. Dropping you to a shell."
/bin/busybox --install -s
exec /bin/sh
}
/bin/busybox mkdir -p /usr/sbin /usr/bin /sbin /bin
/bin/busybox --install -s
# allow the use of UUIDs or filesystem lables
uuidlabel_root() {
for cmd in $(cat /proc/cmdline) ; do
case $cmd in
root=*)
type=$(echo $cmd | cut -d= -f2)
echo "Mounting rootfs"
if [ $type == "LABEL" ] || [ $type == "UUID" ] ; then
uuid=$(echo $cmd | cut -d= -f3)
mount -o ro $(findfs "$type"="$uuid") /mnt/root
else
mount -o ro $(echo $cmd | cut -d= -f2) /mnt/root
fi
;;
esac
done
}
check_filesystem() {
# most of code coming from /etc/init.d/fsck
local fsck_opts= check_extra= RC_UNAME=$(uname -s)
# FIXME : get_bootparam forcefsck
if [ -e /forcefsck ]; then
fsck_opts="$fsck_opts -f"
check_extra="(check forced)"
fi
echo "Checking local filesystem $check_extra : $1"
if [ "$RC_UNAME" = Linux ]; then
fsck_opts="$fsck_opts -C0 -T"
fi
trap : INT QUIT
# using our own fsck, not the builtin one from busybox
/sbin/fsck -p $fsck_opts $1
ret_val=$?
case $ret_val in
0) return 0;;
1) echo "Filesystem repaired"; return 0;;
2|3) if [ "$RC_UNAME" = Linux ]; then
echo "Filesystem repaired, but reboot needed"
reboot -f
else
rescue_shell "Filesystem still have errors; manual fsck required"
fi;;
4) if [ "$RC_UNAME" = Linux ]; then
rescue_shell "Fileystem errors left uncorrected, aborting"
else
echo "Filesystem repaired, but reboot needed"
reboot
fi;;
8) echo "Operational error"; return 0;;
16) echo "Use or Syntax Error"; return 16;;
32) echo "fsck interrupted";;
127) echo "Shared Library Error"; sleep 20; return 0;;
*) echo $ret_val; echo "Some random fsck error - continuing anyway"; sleep 20; return 0;;
esac
# rescue_shell can't find tty so its broken
rescue_shell
}
# start for real here
mount -t devtmpfs none /dev # This creates nodes, in which are described in the init_list
mount -t proc none /proc
mount -t sysfs none /sys
# lvm runs as whatever its called as
ln -s /sbin/lvm.static /sbin/vgchange
lvm vgscan --mknodes # creates /dev/mapper/control
lvm lvchange -a ly gentoo/root
lvm vgscan --mknodes # creates /dev/mapper/VG-root and /dev/VG/root
# Change VG into the Volume Group which mine is gentoo. Physical Volume PV is created first then the VG
# everything on the SDD
/sbin/vgchange -ay ssd | rescue_shell
# start the vg volume group - /home and everything for portage - need not die here
/sbin/vgchange -ay vg || rescue_shell
# get here with raid sets assembled and logical volumes available
# mounting rootfs on /mnt/root
uuidlabel_root || rescue_shell "Error with uuidlabel_root"
# space separated list of mountpoints that ...
mountpoints="/tmp /var/log"
# ... we want to find in /etc/fstab ...
ln -s /mnt/root/etc/fstab /etc/fstab
# ... to check filesystems and mount our devices.
for m in $mountpoints ; do
#echo $m
check_filesystem $m
echo "Mounting $m"
# mount the device and ...
mount $m || rescue_shell "Error while mounting $m"
# ... move the tree to its final location
mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
done
echo "All done. Switching to real root."
# clean up. The init process will remount proc sys and dev later
umount /proc
umount /sys
umount /dev
# switch to the real root and execute init
exec switch_root /mnt/root /sbin/init
|
[/code]
I fixed the part where you told me that the 8 needs to be a 179:
Code: |
# This is my initramfs layout. Everything here that has file needs to be archived in the /usr/src/initramfs
dir /proc 755 0 0
dir /usr 755 0 0
dir /bin 755 0 0
dir /sys 755 0 0
dir /var 755 0 0
dir /lib 755 0 0
dir /lib64 755 0 0
dir /sbin 755 0 0
dir /mnt 755 0 0
dir /mnt/root 755 0 0
dir /etc 755 0 0
dir /root 700 0 0
dir /dev 755 0 0
dir /dev/mapper 755 0 0
# Note: cp --archive is used when you're coping over a ebuild which has the static and or static-libs enabled.
# Archiving dynamic library is not needed and using lddtree --copy-to-tree /usr/src/initramfs /sbin/<binary name>
# we don't have a static /dev and mounting devtmpfs is needed.
# I will mount the devtmpfs in the init so this will work
# e.g. /dev/console below
nod /dev/console 0600 0 0 c 5 1
nod /dev/null 0666 0 0 c 1 5
# dev/sda and partitions
nod /dev/mmcblk0 0660 0 0 b 179 0
nod /dev/mmcblk0p1 0660 0 0 b 179 1
nod /dev/mmcblk0p2 0660 0 0 b 179 2
# busybox
file /bin/busybox /bin/busybox 755 0 0
# all the lvm nodes I need and dm stands for device-mapper
nod /dev/dm-0 0660 0 0 b 253 0
nod /dev/dm-1 0660 0 0 b 253 1
nod /dev/dm-2 0660 0 0 b 254 2
nod /dev/dm-3 0660 0 0 b 254 3
# ...
slink /dev/stderr /proc/self/fd/2 777 0 0
slink /dev/stdin /proc/self/fd/0 777 0 0
slink /dev/std/out /proc/self/fd/1 777 0 0
# libraries required by /sbin/fsck.ext4 and /sbin/fsck
# This section where it has /lib64 is the libraries. You can keep adding more libraries into here.
# Do not alter file /init /usr/src/initramfs/init 0755 0 0
# Libaries I added are consoletype,dhcpcd,fdisk,insmod,modprobe,switch_root,reboot,shutdown,halt,depmod,swapon,cfdisk
slink /lib /lib64 777 0 0
file /lib64/ld-linux-aarch64.so.1 /lib64/ld-linux-aarch64.so.1 755 0 0
file /lib64/libblkid.so.1 /lib64/libblkid.so.1 755 0 0
file /lib64/libmount.so.1 /lib64/libmount.so.1 755 0 0
file /lib64/libc.so.6 /lib64/libc.so.6 755 0 0
file /lib64/libext2fs.so.2 /lib64/libext2fs.so.2 755 0 0
file /lib64/libcom_err.so.2 /lib64/libcom_err.so.2 755 0 0
file /lib64/libdl.so.2 /lib64/libdl.so.2 755 0 0
file /lib64/libpthread.so.0 /lib64/libpthread.so.0 755 0 0
file /lib64/libfdisk.so.1 /lib64/libfdisk.so.1 755 0 0
file /lib64/libsmartcols.so.1 /lib64/libsmartcols.so.1 755 0 0
file /lib64/libtinfow.so.6 /lib64/libtinfow.so.6 755 0 0
file /lib64/libreadline.so.8 /lib64/libreadline.so.8 755 0 0
file /lib64/liblzma.so.5 /lib64/liblzma.so.5 755 0 0
file /lib64/libz.so.1 /lib64/libz.so.1 755 0 0
file /lib64/libacl.so.1 /lib64/libacl.so.1 755 0 0
file /lib64/libcap.so.2 /lib64/libcap.so.2 755 0 0
file /lib64/libcrypt.so.1 /lib64/libcrypt.so.1 755 0 0
file /usr/lib64/libgcrypt.so.20 /usr/lib64/libgcrypt.so.20 755 0 0
file /lib64/libkmod.so.2 /lib64/libkmod.so.2 755 0 0
file /lib64/libpam.so.0 /lib64/libpam.so.0 755 0 0
file /lib64/librt.so.1 /lib64/librt.so.1 755 0 0
file /usr/lib64/libseccomp.so.2 /usr/lib64/libseccomp.so.2 755 0 0
file /usr/lib64/libzstd.so.1 /usr/lib64/libzstd.so.1 755 0 0
file /lib64/libm.so.6 /lib64/libm.so.6 755 0 0
file /usr/lib64/libgpg-error.so.0 /usr/lib64/libgpg-error.so.0 755 0 0
file /lib64/libncursesw.so.6 /lib64/libncursesw.so.6 755 0 0
file /lib64/libe2p.so.2 /lib64/libe2p.so.2 755 0 0
file /lib64/libext2fs.so.2 /lib64/libext2fs.so.2 755 0 0
# Anything you archive it must be added to the init_list. You do not need to add it into the layout as you're not using it.
# For example, device-mapper known as dm is being used. I don't know anything about lvm, I archived it so it has to be defined
# lvm is located in the /sbin and the libaries I already have called in. If you get an error when booting the initramfs involving lvm libraries, remove it.
file /sbin/lvm /sbin/lvm 755 0 0
file /sbin/fsck /sbin/fsck 755 0 0
file /sbin/fsck.ext4 /sbin/fsck.ext4 755 0 0
file /sbin/lvm.static /sbin/lvm.static 755 0 0
file /sbin/dmsetup.static /sbin/dmsetup.static 755 0 0
file /sbin/ldconfig /sbin/ldconfig 755 0 0
# our init script
dir /dev 0755 0 0
file /init /usr/src/initramfs/init 0755 0 0
|
And I already have the string you metnioned in my init, and again you said I needed this for my console https://www.amazon.com/Serial-Adapter-Signal-Prolific-Windows/dp/B07R8BQYW1 Why do I need that anyways? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 5:22 am Post subject: |
|
|
I bootedshell
nd troubledshooted it the best I could and this is what I get from my initramfs:
Code: |
WARNING:Failed to connect to lvmetad Falling back to device scanning
|
I also get this error:
Code: |
/bin/bash: can't access tty; job control turned off
|
And for some reason the initramfs is looking for Volume Logic name ssd and vg for some reason, but it does find my vg. But it can't boot into the system and hangs. And what do you mean it has to be after the #start for real here
Do you mean above the rescue shell? And I'll add the mount proc later on tomorrow.
I think I figured out why it keeps popping up the ssd volume group and vg volume group.
It's this
Code: |
# everything on the SDD
/sbin/vgchange -ay ssd | rescue_shell
# start the vg volume group - /home and everything for portage - need not die here
/sbin/vgchange -ay vg || rescue_shell
|
Should get rid of the everything on ssd and change the vg to my volume group name and it should work I think [/code] |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Thu Apr 01, 2021 7:08 pm Post subject: |
|
|
kucklehead,
The warning can be ignored. lvmetad is not needed.
Code: | /bin/bash: can't access tty; job control turned off |
means that you can only run one job.
Why /bin/bash?
Bash in sot needed in the intrd, the busybox shell can do everything that is needed.
The layout of the int script is
That's the first line anh tells the kernel how to run the script.
Next are the function definitions.
Code: | rescue_shell() {
uuidlabel_root() {
check_filesystem() { |
Execution starts from the top of the file but functions are not executed as they are defined, only when they are called.
Code: | # start for real here | is the first place that any statements can be executed and it needs to be mounting filesystems as most things will want stdin, stdout and stderr.
Comment out
Code: | # everything on the SDD
/sbin/vgchange -ay ssd | rescue_shell
# start the vg volume group - /home and everything for portage - need not die here
/sbin/vgchange -ay vg || rescue_shell | if its not needed. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 7:47 pm Post subject: |
|
|
Hey, so I trouble shooted the initramfs until I got to this:
Code: |
mount: mounting /dev/mmcblk0p2 on /mnt/root failed device or resource is busy
|
Here is my initramfs.list:
Code: |
# This is my initramfs layout. Everything here that has file needs to be archived in the /usr/src/initramfs
dir /proc 755 0 0
dir /usr 755 0 0
dir /bin 755 0 0
dir /sys 755 0 0
dir /var 755 0 0
dir /lib 755 0 0
dir /lib64 755 0 0
dir /sbin 755 0 0
dir /mnt 755 0 0
dir /mnt/root 755 0 0
dir /etc 755 0 0
dir /root 700 0 0
dir /dev 755 0 0
dir /dev/mapper 755 0 0
# Note: cp --archive is used when you're coping over a ebuild which has the static and or static-libs enabled.
# Archiving dynamic library is not needed and using lddtree --copy-to-tree /usr/src/initramfs /sbin/<binary name>
# we don't have a static /dev and mounting devtmpfs is needed.
# I will mount the devtmpfs in the init so this will work
# e.g. /dev/console below
nod /dev/console 0600 0 0 c 5 1
nod /dev/null 0666 0 0 c 1 5
# dev/sda and partitions
nod /dev/mmcblk0 0660 0 0 b 179 0
nod /dev/mmcblk0p1 0660 0 0 b 179 1
nod /dev/mmcblk0p2 0660 0 0 b 179 2
# busybox
file /bin/busybox /bin/busybox 755 0 0
# all the lvm nodes I need and dm stands for device-mapper
nod /dev/dm-0 0660 0 0 b 253 0
nod /dev/dm-1 0660 0 0 b 253 1
nod /dev/dm-2 0660 0 0 b 254 2
nod /dev/dm-3 0660 0 0 b 254 3
# ...
slink /dev/stderr /proc/self/fd/2 777 0 0
slink /dev/stdin /proc/self/fd/0 777 0 0
slink /dev/std/out /proc/self/fd/1 777 0 0
# libraries required by /sbin/fsck.ext4 and /sbin/fsck
# This section where it has /lib64 is the libraries. You can keep adding more libraries into here.
# Do not alter file /init /usr/src/initramfs/init 0755 0 0
# Libaries I added are consoletype,dhcpcd,fdisk,insmod,modprobe,switch_root,reboot,shutdown,halt,depmod,swapon,cfdisk
slink /lib /lib64 777 0 0
file /lib64/ld-linux-aarch64.so.1 /lib64/ld-linux-aarch64.so.1 755 0 0
file /lib64/libblkid.so.1 /lib64/libblkid.so.1 755 0 0
file /lib64/libmount.so.1 /lib64/libmount.so.1 755 0 0
file /lib64/libc.so.6 /lib64/libc.so.6 755 0 0
file /lib64/libext2fs.so.2 /lib64/libext2fs.so.2 755 0 0
file /lib64/libcom_err.so.2 /lib64/libcom_err.so.2 755 0 0
file /lib64/libdl.so.2 /lib64/libdl.so.2 755 0 0
file /lib64/libpthread.so.0 /lib64/libpthread.so.0 755 0 0
file /lib64/libfdisk.so.1 /lib64/libfdisk.so.1 755 0 0
file /lib64/libsmartcols.so.1 /lib64/libsmartcols.so.1 755 0 0
file /lib64/libtinfow.so.6 /lib64/libtinfow.so.6 755 0 0
file /lib64/libreadline.so.8 /lib64/libreadline.so.8 755 0 0
file /lib64/liblzma.so.5 /lib64/liblzma.so.5 755 0 0
file /lib64/libz.so.1 /lib64/libz.so.1 755 0 0
file /lib64/libacl.so.1 /lib64/libacl.so.1 755 0 0
file /lib64/libcap.so.2 /lib64/libcap.so.2 755 0 0
file /lib64/libcrypt.so.1 /lib64/libcrypt.so.1 755 0 0
file /usr/lib64/libgcrypt.so.20 /usr/lib64/libgcrypt.so.20 755 0 0
file /lib64/libkmod.so.2 /lib64/libkmod.so.2 755 0 0
file /lib64/libpam.so.0 /lib64/libpam.so.0 755 0 0
file /lib64/librt.so.1 /lib64/librt.so.1 755 0 0
file /usr/lib64/libseccomp.so.2 /usr/lib64/libseccomp.so.2 755 0 0
file /usr/lib64/libzstd.so.1 /usr/lib64/libzstd.so.1 755 0 0
file /lib64/libm.so.6 /lib64/libm.so.6 755 0 0
file /usr/lib64/libgpg-error.so.0 /usr/lib64/libgpg-error.so.0 755 0 0
file /lib64/libncursesw.so.6 /lib64/libncursesw.so.6 755 0 0
file /lib64/libe2p.so.2 /lib64/libe2p.so.2 755 0 0
file /lib64/libext2fs.so.2 /lib64/libext2fs.so.2 755 0 0
file /lib64/libdevmapper.so.1.02 /lib64/libdevmapper.so.1.02 755 0 0
file /lib64/libdevmapper-event.so.1.02 /lib64/libdevmapper-event.so.1.02 755 0 0
file /lib64/libaio.so.1 /lib64/libaio.so.1 755 0 0
# Anything you archive it must be added to the init_list. You do not need to add it into the layout as you're not using it.
# For example, device-mapper known as dm is being used. I don't know anything about lvm, I archived it so it has to be defined
# lvm is located in the /sbin and the libaries I already have called in. If you get an error when booting the initramfs involving lvm libraries, remove it.
file /sbin/lvm /sbin/lvm 755 0 0
file /sbin/fsck /sbin/fsck 755 0 0
file /sbin/fsck.ext4 /sbin/fsck.ext4 755 0 0
file /sbin/lvm.static /sbin/lvm.static 755 0 0
file /sbin/dmsetup.static /sbin/dmsetup.static 755 0 0
file /sbin/ldconfig /sbin/ldconfig 755 0 0
# our init script
dir /dev 0755 0 0
file /init /usr/src/initramfs/init 0755 0 0
|
And here is my init:
Code: |
#!/bin/busybox sh
# Install symlinks to all busybox applets first.
rescue_shell() {
echo "$@"
echo "Something went wrong. Dropping you to a shell."
/bin/busybox --install -s
exec /bin/sh
}
/bin/busybox mkdir -p /usr/sbin /usr/bin /sbin /bin
/bin/busybox --install -s
# allow the use of UUIDs or filesystem lables
uuidlabel_root() {
for cmd in $(cat /proc/cmdline) ; do
case $cmd in
root=*)
type=$(echo $cmd | cut -d= -f2)
echo "Mounting rootfs"
if [ $type == "LABEL" ] || [ $type == "UUID" ] ; then
uuid=$(echo $cmd | cut -d= -f3)
mount -o ro $(findfs "$type"="$uuid") /mnt/root
else
mount -o ro $(echo $cmd | cut -d= -f2) /mnt/root
fi
;;
esac
done
}
check_filesystem() {
# most of code coming from /etc/init.d/fsck
local fsck_opts= check_extra= RC_UNAME=$(uname -s)
# FIXME : get_bootparam forcefsck
if [ -e /forcefsck ]; then
fsck_opts="$fsck_opts -f"
check_extra="(check forced)"
fi
echo "Checking local filesystem $check_extra : $1"
if [ "$RC_UNAME" = Linux ]; then
fsck_opts="$fsck_opts -C0 -T"
fi
trap : INT QUIT
# using our own fsck, not the builtin one from busybox
/sbin/fsck -p $fsck_opts $1
ret_val=$?
case $ret_val in
0) return 0;;
1) echo "Filesystem repaired"; return 0;;
2|3) if [ "$RC_UNAME" = Linux ]; then
echo "Filesystem repaired, but reboot needed"
reboot -f
else
rescue_shell "Filesystem still have errors; manual fsck required"
fi;;
4) if [ "$RC_UNAME" = Linux ]; then
rescue_shell "Fileystem errors left uncorrected, aborting"
else
echo "Filesystem repaired, but reboot needed"
reboot
fi;;
8) echo "Operational error"; return 0;;
16) echo "Use or Syntax Error"; return 16;;
32) echo "fsck interrupted";;
127) echo "Shared Library Error"; sleep 20; return 0;;
*) echo $ret_val; echo "Some random fsck error - continuing anyway"; sleep 20; return 0;;
esac
# rescue_shell can't find tty so its broken
rescue_shell
}
# start for real here
mount -t devtmpfs none /dev # This creates nodes, in which are described in the init_list
mount -t proc none /proc
mount -t sysfs none /sys
# lvm runs as whatever its called as
ln -s /sbin/lvm.static /sbin/vgchange
lvm vgscan --mknodes # creates /dev/mapper/control
lvm lvchange -a ly gentoo/root
lvm vgscan --mknodes # creates /dev/mapper/VG-root and /dev/VG/root
# Change VG into the Volume Group which mine is gentoo. Physical Volume PV is created first then the VG
# start the vg volume group - /home and everything for portage - need not die here
/sbin/vgchange -ay gentoo || rescue_shell
# get here with raid sets assembled and logical volumes available
# mounting rootfs on /mnt/root
uuidlabel_root || rescue_shell "Error with uuidlabel_root"
# space separated list of mountpoints that ...
mountpoints="/usr /var"
# ... we want to find in /etc/fstab ...
ln -s /mnt/root/etc/fstab /etc/fstab
# ... to check filesystems and mount our devices.
for m in $mountpoints ; do
#echo $m
check_filesystem $m
echo "Mounting $m"
# mount the device and ...
mount $m || rescue_shell "Error while mounting $m"
# ... move the tree to its final location
mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
done
echo "All done. Switching to real root."
# clean up. The init process will remount proc sys and dev later
umount /proc
umount /sys
umount /dev
# switch to the real root and execute init
exec switch_root /mnt/root /sbin/init
|
I don't understand why it is saying this? Again, I am not to fimilar with bash and where do you see /bin/bash at? I understand now those functions are just like functions from python. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Thu Apr 01, 2021 8:16 pm Post subject: |
|
|
kucklehead
Change Code: | /sbin/vgchange -ay gentoo || rescue_shell | to read
Code: | /sbin/vgchange -ay gentoo || rescue_shell "Activating Volume Group gentoo failed" |
When you get into the rescue shell, use it to look around.
Does show your block devices.
Does show your logical volumes?
If not. what error does the command Code: | /sbin/vgchange -ay gentoo | return?
What about just
Are your logical volumes in now.
What did you do differently.
Run the init script in the shell. You will get warnings for all the things that already worked but it might boot.
Do you get a new error? _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 8:28 pm Post subject: |
|
|
I can't get into my console as it skips over it and hangs. I have to ctrl +C to get it to say this:
Code: |
Kernel panic - not syncing: Attempted to kill init!
|
if that is the shell after that, then I'll run those commands |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 9:16 pm Post subject: |
|
|
I ran those commands you told me to do, and the init kill is not showing up:
Everything shows up in a light purple by the way
ls /dev/mapper:
Code: |
Control gentoo-root gentoo-swap gentoo-tmp gentoo-var_log
|
ls /dev:
Code: |
autofs fb0 hwrng loop5 ptmx ram3 tty0 tty18 tty27 tty36
|
There are alot more folders or files in there that I didn't write down
And lastly /sbin/vgchange:
Code: |
Warning: Failed to connect lvmetad
Falling back to device scanning
4 logical volumes in volume group "gentoo" now active
|
And no, I do not get a different error and it didn't boot at all. The error I still get is:
Code: |
mount: mounting /dev/mmcblk0p2 on /mnt/root failed device or resource busy
|
I don't have my boot in the lvm as it is outside of it. Could that be the issue? What about if I unmount the device and remount it using find fs? |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Thu Apr 01, 2021 10:08 pm Post subject: |
|
|
kucklehead,
/boot is not mouthed for booting. Whatever reads /boot at boot time has to make its own arrangements.
Code: | Warning: Failed to connect lvmetad
Falling back to device scanning
4 logical volumes in volume group "gentoo" now active |
Thats good.
Code: | mount: mounting /dev/mmcblk0p2 on /mnt/root failed device or resource busy |
Why do yo want to mount /dev/mmcblk0p2 at all?
Your root is /dev/mapper/gentoo-root
That gets mounted by Code: | uuidlabel_root || rescue_shell "Error with uuidlabel_root" |
You pass the roof filesystem UUID on the kernel command line with root=UUID=<filesystem UUID of gentoo-root>
It look like you have /usr and /var on gentoo-root, so most of Code: | # ... to check filesystems and mount our devices.
for m in $mountpoints ; do
#echo $m
check_filesystem $m
echo "Mounting $m"
# mount the device and ...
mount $m || rescue_shell "Error while mounting $m"
# ... move the tree to its final location
mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
done | can go.
The
Code: | # ... move the tree to its final location
mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m" |
Must be after the .
Code: | for m in $mountpoints ; do
...
done | is a loop but
Code: | # ... move the tree to its final location
mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m" | must be executed exactly once.
Remove the filesystem checking and mounting loop but keep the Code: | mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m" |
What do you have on the kernel command line? _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 10:23 pm Post subject: |
|
|
I do not know why it keeps wanting to mount /dev/mmcblk0p2. I've been trying to figure out how to stop it from mounting it or trying too.
I removed the for loop as what you said:
Code: |
done
# ... move the tree to its final location
mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
|
I don't know if that is what you meant? It feels to me that m isn't defined? or maybe $m defines it?
my kernel command parameters I will show in a moment, and I think I have root=/dev/mmcblk0p2
here is my kernel parameters:
Code: |
console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 root=UUID=<root-gentoo> rootfstype=ext4 rootwait dolvm
|
Last edited by kucklehead on Thu Apr 01, 2021 11:14 pm; edited 1 time in total |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
NeddySeagoon Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
![](images/avatars/3946266373f47d606a2db3.jpg)
Joined: 05 Jul 2003 Posts: 54529 Location: 56N 3W
|
Posted: Thu Apr 01, 2021 10:49 pm Post subject: |
|
|
kucklehead,
Code: | #echo $m
#/bin/sleep 20
check_filesystem $m
echo "Mounting $m"
# mount the device and ...
/bin/mount $m || rescue_shell "Error while mounting $m"
# ... move the tree to its final location
/bin/mount --move $m "/mnt/root"$m || rescue_shell "Error while moving $m"
done |
I misread my comments. Sorry about that.
Remove that entire block.
The root moving is done by Code: | exec /sbin/switch_root /mnt/root /sbin/init |
root=/dev/mmcblk0p2 will tell the kernel to mount /dev/mmcblk0p2 as root, not /dev/mapper/gentoo-root.
You will also have rootwait.
/dev/mmcblk0p2 never appears, so the kernel waits forever.
I'm not sure if root=/dev/mapper/gentoo-root will work or not. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 11:20 pm Post subject: |
|
|
I removed the whole block and added the UUID in there. root=/dev/gentoo/root was set there and it wasn't /dev/mmcblk0p2. I am recompiling my kernel as we speak. But I really don't know why it keeps wanting to mount /dev/mmcblk0p2 on /mnt/root, and I have my initramfs built into my kernel, so whever I update my kernel the initramfs will be updated as well |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
kucklehead Tux's lil' helper
![Tux's lil' helper Tux's lil' helper](/images/ranks/rank_rect_1.gif)
Joined: 13 Oct 2020 Posts: 108
|
Posted: Thu Apr 01, 2021 11:50 pm Post subject: |
|
|
I did everything you said to do and this is the error:
Code: |
Free initramfs and switched to another rootfs:
chroot to NEW_ROOT, delete all in /, move to NEW_ROOT /, execute NEW_INIT PID must be 1. NEW_ROOT must be on mountpoint
usage: switch_root [-c CONSOLE_DEV] NEW_ROOT NEW_ROOT NEW_INIT [ARGS]
|
Then after that I get this:
Code: |
end of kernel panic -- not syncing Attempted to kill the init! exitcode=0x00000100]
|
I dug around regarding that issue and it isn't a issue. I found out that my init bottom code needs to be changed from this:
Code: |
exec switch_root /mnt/root /sbin/init
|
To this:
Code: |
exec switch_root /newroot /sbin/init
|
I was successfully able to change it to newroot and I fixed the tty error
Here is my init for now:
Code: |
#!/bin/busybox sh
# Create the session loader
exec setsid sh -c exec sh </dev/tty1 >/dev/tty1 2>&1
#exec </dev/tty1 >/dev/tty1 2>&1
rescue_shell() {
echo "$@"
echo "Something went wrong. Dropping you to a shell."
/bin/busybox --install -s
exec /bin/sh
}
/bin/busybox mkdir -p /usr/sbin /usr/bin /sbin /bin
/bin/busybox --install -s
# allow the use of UUIDs or filesystem lables
uuidlabel_root() {
for cmd in $(cat /proc/cmdline) ; do
case $cmd in
root=*)
type=$(echo $cmd | cut -d= -f2)
echo "Mounting rootfs"
if [ $type == "LABEL" ] || [ $type == "UUID" ] ; then
uuid=$(echo $cmd | cut -d= -f3)
mount -o ro $(findfs "$type"="$uuid") /mnt/root
else
mount -o ro $(echo $cmd | cut -d= -f2) /mnt/root
fi
;;
esac
done
}
check_filesystem() {
# most of code coming from /etc/init.d/fsck
local fsck_opts= check_extra= RC_UNAME=$(uname -s)
# FIXME : get_bootparam forcefsck
if [ -e /forcefsck ]; then
fsck_opts="$fsck_opts -f"
check_extra="(check forced)"
fi
echo "Checking local filesystem $check_extra : $1"
if [ "$RC_UNAME" = Linux ]; then
fsck_opts="$fsck_opts -C0 -T"
fi
trap : INT QUIT
# using our own fsck, not the builtin one from busybox
/sbin/fsck -p $fsck_opts $1
ret_val=$?
case $ret_val in
0) return 0;;
1) echo "Filesystem repaired"; return 0;;
2|3) if [ "$RC_UNAME" = Linux ]; then
echo "Filesystem repaired, but reboot needed"
reboot -f
else
rescue_shell "Filesystem still have errors; manual fsck required"
fi;;
4) if [ "$RC_UNAME" = Linux ]; then
rescue_shell "Fileystem errors left uncorrected, aborting"
else
echo "Filesystem repaired, but reboot needed"
reboot
fi;;
8) echo "Operational error"; return 0;;
16) echo "Use or Syntax Error"; return 16;;
32) echo "fsck interrupted";;
127) echo "Shared Library Error"; sleep 20; return 0;;
*) echo $ret_val; echo "Some random fsck error - continuing anyway"; sleep 20; return 0;;
esac
# rescue_shell can't find tty so its broken
rescue_shell
}
# start for real here
mount -t devtmpfs none /dev
mount -t proc none /proc
mount -t sysfs none /sys
# lvm runs as whatever its called as
ln -s /sbin/lvm.static /sbin/vgchange
lvm vgscan --mknodes # creates /dev/mapper/control
lvm lvchange -a ly gentoo/root
lvm vgscan --mknodes # creates /dev/mapper/VG-root and /dev/VG/root
# Change VG into the Volume Group which mine is gentoo. Physical Volume PV is created first then the VG
# start the vg volume group - /home and everything for portage - need not die here
/sbin/vgchange -ay gentoo || rescue_shell
# get here with raid sets assembled and logical volumes available
# mounting rootfs on /mnt/root
uuidlabel_root || rescue_shell "Error with uuidlabel_root"
# ... we want to find in /etc/fstab ...
ln -s /mnt/root/etc/fstab /etc/fstab
echo "All done. Switching to real root."
break_requested() {
local want_break
for o in $(cat /proc/cmdline) ; do
case "$o" in
rd.break|rdbreak) want_break="yes" ;;
init=/bin/sh|init=/bin/bb|init=/bin/bash|init=/bin/dash) want_break="yes" ;;
esac
done
echo "${want_break}"
}
if [[ -n "$(break_requested)" ]] ; then
rescue_shell
fi
# clean up. The init process will remount proc sys and dev later
mount --move /proc /newroot/proc
mount --move /sys /newroot/sys
mount --move /dev /newroot/dev
# switch to the real root and execute init
exec switch_root -c /dev/console /newroot /sbin/init
|
I don't see mount error with mmcblk0p2, I followed this guide right here that said if you're having trouble with switch_root do this:
Code: |
# Clean up
umount /proc
umount /sys
umount /dev
# Boot the real thing
exec switch_root /newroot /sbin/init
|
To this:
Code: |
# Clean up
mount --move /proc /newroot/proc
mount --move /sys /newroot/sys
mount --move /dev /newroot/dev
# Boot the real thing
exec switch_root /newroot /sbin/init
|
This code right here fixed my tty error:
Code: |
exec setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1'
|
Now it is telling me that /dev/tty1 doesn't exist and it doesn't show anything that sticks out but only this:
Code: |
Kernel panic - not syncing: Attempted to kill init!
|
And I know it isn't the kernel rather the init script itself is messed up somewhere. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|