Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Building a custom initramfs /dev/disk missing?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
finalturismo
Guru
Guru


Joined: 06 Jan 2020
Posts: 410

PostPosted: Fri Jul 01, 2022 8:05 pm    Post subject: Building a custom initramfs /dev/disk missing? Reply with quote

So have an interesting situation.... and I am not sure what is causing it or what makes it unique to the system.


But i generated an initramfs on 1 computer and i extracted the files and slimmed it down. I than merged it inside the kernel and did a few other things. .......


Anyway when push comes to shove when ever i boot into the initramfs fs on any other computer besides the host it was created on the entire /dev/disk subset is missing from the device tree.



The disks show fine, the kernel modules are backed into the kernel.... but for some /dev/disk/by-id is missing /dev/disk/by-label. Anything that is under /disk/disk* is gone....


Anyone know what this is?

Trying to make a portable initramfs....
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 916
Location: Richmond Hill, Canada

PostPosted: Fri Jul 01, 2022 8:16 pm    Post subject: Reply with quote

The "/dev/disk/" is create by udev. So do your initrd have udev binary? and your /init script call udev binary?
Back to top
View user's profile Send private message
finalturismo
Guru
Guru


Joined: 06 Jan 2020
Posts: 410

PostPosted: Fri Jul 01, 2022 8:37 pm    Post subject: Reply with quote

pingtoo wrote:
The "/dev/disk/" is create by udev. So do your initrd have udev binary? and your /init script call udev binary?



ya i saw that and yes it does have udev and it works fine as long as it is being used on the host otherwise it seems udev doesnt do anything...
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 916
Location: Richmond Hill, Canada

PostPosted: Fri Jul 01, 2022 8:54 pm    Post subject: Reply with quote

Prior to invoke udev did you make udev update hwdb? i.e.
Code:
udevadm hwdb --update


How you generate initramfs? and what did you "slimmed it down"?
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54214
Location: 56N 3W

PostPosted: Fri Jul 01, 2022 9:49 pm    Post subject: Reply with quote

finalturismo,

I would start from the bottom up, not by taking things out of an existing initrd.

What is the real problem you are trying to solve any why are the /dev/disk/... symlinks the solution?
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
finalturismo
Guru
Guru


Joined: 06 Jan 2020
Posts: 410

PostPosted: Fri Jul 01, 2022 11:11 pm    Post subject: Reply with quote

NeddySeagoon wrote:
finalturismo,

I would start from the bottom up, not by taking things out of an existing initrd.

What is the real problem you are trying to solve any why are the /dev/disk/... symlinks the solution?



Iam working on making a portable initramfs for a ZFS installation for quick dirty imports and exports of pools but in a smart way. So far i have a gutted kernel running with all the common hardware built in.

I have specific kernel parameters set that block the spa cache files and set a host id of zero for all hosts. But the risk iam running into is messing up the labels that are generated via UUID and create symlinks to the /dev/disk/by-id


Because of the race conditions of the standard block devices, not using a the UUIDs can cause a mix up of the device labels and cause the pool the be broken and at the point you lose some data.


Anyway i have a git project going for a custom kernel builder that builds an initramfs with ZFS built in and it works pretty good so far. I got the kernel , initram merged and set as an EFI stub partition with the EFI bootmgr creating a stub entry in the bios.

My 1 blockade seems to be the initramfs right now. I would attempt to get rid of the initramfs and go straight kernel but i need to some how call a pool import which i think mostly needs the initramfs. Iam sure its possible i just dont have enough knowledge for that part anyway.

So when i get stuck with stuff i come here , because you guys seem to be pretty smart. XD

I was doing some reading and it seems that alot of distros might have a host id of some sort attached to the initramfs that may create some issues. i dont know much where to start..... but at this point it might just be easier for me to downoad busy box and attempt to build my own?


pingtoo wrote:
Prior to invoke udev did you make udev update hwdb? i.e.
Code:
udevadm hwdb --update


How you generate initramfs? and what did you "slimmed it down"?



I just deleted the firmware folders, i don't need any of it.


And its a standard devuan initramfs , the same as debians for the most part. I just unpacked it with lsinitrd --unpack
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54214
Location: 56N 3W

PostPosted: Sat Jul 02, 2022 11:18 am    Post subject: Reply with quote

finalturismo,

When your initrd fails, arrange for it to drop you to the busybox shell.
Check for the existence of /dev/... and friends.
They should be there by the time you type the command.

If that is true, you are trying to use them before udev has created them.
That's a well known and possibly forgotten thing by now but its why the handbook was changed to not use disk-by in fstab.

If they are still missing, udev is not creating them.
You may need the openrc sysinit scripts. I don't have udev, so I don't know their names.
udev-settle comes to mind and I think that there are a couple of others.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
pingtoo
l33t
l33t


Joined: 10 Sep 2021
Posts: 916
Location: Richmond Hill, Canada

PostPosted: Sat Jul 02, 2022 7:51 pm    Post subject: Reply with quote

finalturismo,

I am afraid I will not be able to help much here.:(

I am not able to find where devuan initramfs-tools source code to check.

I look debian initramfs-tools source code, but I am not able to figure out how debian initramfs call udev, it seems only wait for udev event to settle. debian initramfs-tools seems depend on a lot of building host environment to create a initramfs. So without look at the building host I don't know where to begin.

BTW, Devuan seems to focus on create a system without systemd, so I wonder if they use a different logic for their initramfs creation.

If you write your own /init script for initramfs, maybe call blkid within your script after /sys is mounted will do the trick to get list of UUID.
Back to top
View user's profile Send private message
dantrell
l33t
l33t


Joined: 01 Jun 2007
Posts: 915
Location: Earth

PostPosted: Sun Jan 01, 2023 6:48 pm    Post subject: Reply with quote

finalturismo wrote:
Anything that is under /[dev]/disk* is gone....

pingtoo wrote:
The "/dev/disk/" is create by udev.

The answer lies in Giles's answer on the Unix & Linux Stack Exchange.

Adapting his answer for the presence of sys-apps/systemd-utils in Gentoo, what you want to do is:
  1. Bundle udevadm (older initramfs' called this udevd and systemd-variants call it systemd-udevd so create symlinks accordingly if applicable).

  2. Bundle /lib/udev and the relevant rules (at least 1 persistent-storage rule) as well as whatever imported programs those rules mention (you don't need to bundle builtin programs, however, you probably want to bundle blkid anyway).

  3. Forget about calling udevadm as a daemon. Get a restrictive list of block devices (you can bundle lsblk for this) and use "udevadm test [options] devpath" on each block device (feel free to redirect the noise to /dev/null).

  4. Don't forget the step about moving /dev (if relevant).
Now, you can move on to the next issue. :wink:
_________________
Dantrell B.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
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