<html><body><div style="font-family: arial, helvetica, sans-serif; font-size: 12pt; color: #000000"><div>I've been dealing with mkinitramfs under LFS for a bit and realized my stow system is biting me in the a$$. The solution is to bite back.</div><div><br data-mce-bogus="1"></div><div>I can simplify the issue. In mkinitramfs from </div><div><br data-mce-bogus="1"></div><div>http://www.linuxfromscratch.org/blfs/view/svn/postlfs/initramfs.html</div><div><br data-mce-bogus="1"></div><div><pre class="root" style="font-family: monospace; border: 1px solid #1111aa; padding: 0.5em 1em; margin: 0px 2em 0.5em; font-weight: bold; color: #101310; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; line-height: 19.2px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #e5e5e5;" data-mce-style="font-family: monospace; border: 1px solid #1111aa; padding: 0.5em 1em; margin: 0px 2em 0.5em; font-weight: bold; color: #101310; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; line-height: 19.2px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #e5e5e5;"><kbd class="command" style="font-family: monospace;" data-mce-style="font-family: monospace;">if [ -d /lib/udev ]; then
cp -a /lib/udev $WDIR/lib
fi</kbd></pre></div><div><br data-mce-bogus="1"></div><div>symlinks will bomb with that -a.</div><div><br data-mce-bogus="1"></div><div>because of (shortened listing)</div><div><br data-mce-bogus="1"></div><div><span style="font-family: "courier new", courier, monaco, monospace, sans-serif;" data-mce-style="font-family: 'courier new', courier, monaco, monospace, sans-serif;">root:/run# ls -l /lib/udev//cdrom_id </span><br><span style="font-family: "courier new", courier, monaco, monospace, sans-serif;" data-mce-style="font-family: 'courier new', courier, monaco, monospace, sans-serif;">lrwxrwxrwx 1 root root 41 Sep 21 23:18 /lib/udev//cdrom_id -> <span style="background-color: #ffff00;" data-mce-style="background-color: #ffff00;">../../</span>usr/pkg/eudev-3.2/lib/udev/cdrom_id</span><br><span style="font-family: "courier new", courier, monaco, monospace, sans-serif;" data-mce-style="font-family: 'courier new', courier, monaco, monospace, sans-serif;">root:/run#</span></div><div><br data-mce-bogus="1"></div><div>What you end up with is a directory of broken links and modules are not loaded.</div><div><br data-mce-bogus="1"></div><div>Two solutions. In the post install run a program that converts files like that to real ones. Remove the links. Or put the files with the links in the initramfs image.</div><div><br data-mce-bogus="1"></div><div>Since I love a good beating I chose the later. And came up with this idea</div><div><br data-mce-bogus="1"></div><div><pre class="root" style="font-family: monospace; border: 1px solid #1111aa; padding: 0.5em 1em; margin: 0px 2em 0.5em; font-weight: bold; color: #101310; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; line-height: 19.2px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #e5e5e5;" data-mce-style="font-family: monospace; border: 1px solid #1111aa; padding: 0.5em 1em; margin: 0px 2em 0.5em; font-weight: bold; color: #101310; font-style: normal; font-variant-ligatures: normal; font-variant-caps: normal; letter-spacing: normal; line-height: 19.2px; orphans: 2; text-align: left; text-indent: 0px; text-transform: none; widows: 2; word-spacing: 0px; -webkit-text-stroke-width: 0px; background-color: #e5e5e5;"><kbd class="command" style="font-family: monospace;" data-mce-style="font-family: monospace;"><br>if [ -e /lib/udev ]; then<br> #cp -aL /lib/udev $WDIR/lib<br> find /lib/udev/ > /tmp/udev.txt<br> while IFS= read -r line; do # Whitespace-safe EXCEPT newlines<br> if test -h "${line}"; then<br> FILE=${line};<br> printf "${FILE}\n"<br> while test -h "${FILE}"; do<br> FILE=$(realpath -s $(readlink ${FILE}) 2>/dev/null) && \<br> printf "${FILE}\n"<br> done<br> elif test -d "${line}"; then<br> # If I specify a dir will it try it all?<br> :<br> else<br> # Not a dir and not a link<br> printf "${FILE}\n"<br> fi<br> done < /tmp/udev.txt | sort > /tmp/udev-sorted.txt<br> (tar -C / -T /tmp/udev-sorted.txt -cf - | tar -C ${WDIR} -xvf -)<br>fi<br></kbd><br># The result and what is needed in initramfs to preserve links is<br># /lib/udev/ata_id<br># /lib/udev/cdrom_id<br># /lib/udev/collect<br># /lib/udev/init-net-rules.sh<br># /lib/udev/mtd_probe<br># /lib/udev/rule_generator.functions<br># /lib/udev/rules.d/10-dm.rules<br># /lib/udev/rules.d/11-dm-lvm.rules<br># /lib/udev/rules.d/13-dm-disk.rules<br># /lib/udev/rules.d/50-udev-default.rules<br># /lib/udev/rules.d/60-block.rules<br># /lib/udev/rules.d/60-cdrom_id.rules<br># /lib/udev/rules.d/60-drm.rules<br># /lib/udev/rules.d/60-evdev.rules<br># /lib/udev/rules.d/60-persistent-alsa.rules<br># /lib/udev/rules.d/60-persistent-input.rules<br># /lib/udev/rules.d/60-persistent-storage-tape.rules<br># /lib/udev/rules.d/60-persistent-storage.rules<br># /lib/udev/rules.d/60-persistent-v4l.rules<br># /lib/udev/rules.d/60-serial.rules<br># /lib/udev/rules.d/64-btrfs.rules<br># /lib/udev/rules.d/70-mouse.rules<br># /lib/udev/rules.d/75-net-description.rules<br># /lib/udev/rules.d/75-probe_mtd.rules<br># /lib/udev/rules.d/78-sound-card.rules<br># /lib/udev/rules.d/80-drivers.rules<br># /lib/udev/rules.d/80-net-name-slot.rules<br># /lib/udev/rules.d/95-dm-notify.rules<br># /lib/udev/scsi_id<br># /lib/udev/v4l_id<br># /lib/udev/write_cd_rules<br># /lib/udev/write_net_rules<br># /usr/pkg/LVM2.2.02.164/lib/udev/rules.d/10-dm.rules<br># /usr/pkg/LVM2.2.02.164/lib/udev/rules.d/11-dm-lvm.rules<br># /usr/pkg/LVM2.2.02.164/lib/udev/rules.d/13-dm-disk.rules<br># /usr/pkg/LVM2.2.02.164/lib/udev/rules.d/95-dm-notify.rules<br># /usr/pkg/eudev-3.2/lib/udev/ata_id<br># /usr/pkg/eudev-3.2/lib/udev/cdrom_id<br># /usr/pkg/eudev-3.2/lib/udev/collect<br># /usr/pkg/eudev-3.2/lib/udev/init-net-rules.sh<br># /usr/pkg/eudev-3.2/lib/udev/mtd_probe<br># /usr/pkg/eudev-3.2/lib/udev/rule_generator.functions<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/50-udev-default.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-block.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-cdrom_id.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-drm.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-evdev.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-persistent-alsa.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-persistent-input.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-persistent-storage-tape.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-persistent-storage.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-persistent-v4l.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/60-serial.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/64-btrfs.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/70-mouse.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/75-net-description.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/75-probe_mtd.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/78-sound-card.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/80-drivers.rules<br># /usr/pkg/eudev-3.2/lib/udev/rules.d/80-net-name-slot.rules<br># /usr/pkg/eudev-3.2/lib/udev/scsi_id<br># /usr/pkg/eudev-3.2/lib/udev/v4l_id<br># /usr/pkg/eudev-3.2/lib/udev/write_cd_rules<br># /usr/pkg/eudev-3.2/lib/udev/write_net_rules<br><br></pre></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>No real reason for the sort. The issue is that the original cp copied /lib/udev. I can't just tar up that directory because there are links that references files in different directories. I opted to basically set /lib/udev as the target, create a list of everything there, walk that list and list out the links with their realpaths. Instead of cp I used tar as the copy. </div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div>99.9% of the time I'd break out Perl and do it there. Much easier on me, but Perl is not really ready for use in the LFS system until you install all needed modules. Since most distis use bash to do these things I stuck with it.</div><div><br data-mce-bogus="1"></div><div>Not sure if there is a better way. </div><div><br></div><div>Note: I did not create those boxes. I'm using Zimbra's web interface and a copy from the LFS online manual created them. :)</div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div><div><br data-mce-bogus="1"></div></div></body></html>