Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo With Musl [I have no idea what I'm doing]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Unsupported Software
View previous topic :: View next topic  
Author Message
unheatedgarage
n00b
n00b


Joined: 19 Sep 2016
Posts: 60

PostPosted: Mon Dec 11, 2017 4:28 am    Post subject: Gentoo With Musl [I have no idea what I'm doing] Reply with quote

Greetings to all. I hope this message finds you in good places—with good people.

I had hoped to start this as a “how-to” for Gentoo musl, but I’m stuck. With your good graces, maybe we can work this into some sort of self-help. If it pleases everyone, I’ll update this later with my methodology with all the ins-and-outs, but for now, here’s the TL;DR:

I’m chrooted into my environment, I can build an XFCE desktop and all its goodies, but for the life of me, I cannot boot.

Try as I might, I can't get an initramfs. Genkernel gives me this:


Code:
* Gentoo Linux Genkernel; Version 68
* Running with options: --install initramfs

* Using genkernel.conf from /etc/genkernel.conf
* Sourcing arch-specific config.sh from /usr/share/genkernel/arch/x86_64/config.sh ..
* Sourcing arch-specific modules_load from /usr/share/genkernel/arch/x86_64/modules_load ..

* Linux Kernel 4.12.12-gentoo for x86_64...
* .. with config file /etc/kernels/kernel-config-x86_64-4.12.12-gentoo
* mount: /boot mounted successfully!
* busybox: >> Applying patches...
*           - 1.18.1-openvt.diff
*           - busybox-1.20.1-strict-atime.patch
*           - busybox-1.20.2-glibc-sys-resource.patch
*           - busybox-1.7.4-signal-hack.patch
* busybox: >> Configuring...
* busybox: >> Compiling...
* ERROR: Failed to compile the "all" target...
*
* -- Grepping log... --
*
*  SHIPPED scripts/kconfig/zconf.tab.c
*  SHIPPED scripts/kconfig/lex.zconf.c
*  SHIPPED scripts/kconfig/zconf.hash.c
*  HOSTCC  scripts/kconfig/zconf.tab.o
*In file included from scripts/kconfig/zconf.tab.c:152:0:
*scripts/kconfig/zconf.hash.c:155:43: warning: ‘kconf_id_strings_contents’ is static but used in inline function ‘kconf_id_lookup’ which is not static
* #define kconf_id_strings ((const char *) &kconf_id_strings_contents)
*                                           ^
*scripts/kconfig/zconf.hash.c:222:44: note: in expansion of macro ‘kconf_id_strings’
*               register const char *s = o + kconf_id_strings;
*                                            ^~~~~~~~~~~~~~~~
*scripts/kconfig/zconf.hash.c:215:26: warning: ‘kconf_id_hash’ is static but used in inline function ‘kconf_id_lookup’ which is not static
*       register int key = kconf_id_hash (str, len);
*                          ^~~~~~~~~~~~~
*scripts/kconfig/zconf.hash.c:171:26: warning: ‘wordlist’ is static but declared in inline function ‘kconf_id_lookup’ which is not static
*   static struct kconf_id wordlist[] =
*                          ^~~~~~~~
*  HOSTLD  scripts/kconfig/conf
*scripts/kconfig/conf -o Config.in
*#
*.config:45:warning: trying to assign nonexistent symbol PID_FILE_PATH
*.config:100:warning: trying to assign nonexistent symbol SHA3_SMALL
*.config:268:warning: trying to assign nonexistent symbol SHA3SUM
*.config:621:warning: trying to assign nonexistent symbol FEATURE_VOLUMEID_EXFAT
*.config:625:warning: trying to assign nonexistent symbol FEATURE_VOLUMEID_NILFS
*.config:633:warning: trying to assign nonexistent symbol FEATURE_VOLUMEID_SQUASHFS
*.config:1027:warning: trying to assign nonexistent symbol FEATURE_KMSG_SYSLOG
*--
*Additional LDLIBS (EXTRA_LDLIBS) []
*
* Debugging Options
*
*Build BusyBox with extra Debugging symbols (DEBUG) [N/y/?] n
*Abort compilation on any warning (WERROR) [N/y/?] n



And etc, etc.

I’ve tried compiling the kernel manually and that gives no errors. Going through the the whole grub-mkconfig thingie works fine. System recognizes and tries to boot into it, but always with the kernel panic:

Code:
unable to mount root fs block [0.0]


Or something along those lines.

This is all new to me. Honestly, there’s always been someone else who’s asked the same question I’ve had, and so I’ve been able to humm along quietly in the background. But here with musl experimental, I’m really struggling.

Here’s my make.conf

Code:
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
CFLAGS="-march=native -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult http://www.gentoo.org/doc/en/change-chost.xml before changing.
CHOST="x86_64-gentoo-linux-musl"
# These are the USE flags that were used in addition to what is provided by the
# profile used for building.
MAKEOPTS="-j3"
VIDEO_CARDS="intel i965"
USE="libressl mmx sse sse2"
PORTDIR="/usr/portage"
DISTDIR="${PORTDIR}/distfiles"
PKGDIR="${PORTDIR}/packages"
CPU_FLAGS_X86="aes avx mmx mmxext popcnt sse sse2 sse3 sse4_1 sse4_2 ssse3"
FEATURES="buildpkg"
CURL_SSL="libressl"
ACCEPT_KEYWORDS="~amd64"


I’ve researched the snot out of this—been working on this on-and-off for about a week—have learned a lot, but obviously I’m too dense to see what the problem is. I can’t help but feel it’s right in front of me.

Yes, I installed the experimental musl stage3. Absolutely I got layman going and got the musl overlay happening.

In all my other installs, I’ve never bothered with multiple partitions—just one big fat ext4 and then genkernel (or a quickie kernel tweak) took care of it. This whole bootstrap issue is (obviously) new.

[IHAVENOIDEAWHATI’MDOING]

Found a bug report here: https://github.com/orsonteodoro/muslx32/issues/4 but I’m not sure if it’s even relevant anymore.

I’ve subscribed to the gentoo-musl mailing list and scoured their history, but for the most part it’s devs talking to devs. They’ve already got a working system and (seriously) know what they're talking about.

So I’m flustered. My feathers are rustled.

I’ll calm my tits eventually, but for now I’m crawling before you with alms bowl in hand—humbly begging for a few shekels of help.

Is there any way I can boot into this puppy!?

[edit] I'm in this for the long haul; would really enjoy and appreciate anyone walking me through this. I'm not a fly-by-night kitten!
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


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

PostPosted: Mon Dec 11, 2017 11:32 am    Post subject: Reply with quote

unheatedgarage,

Configure your kernel so you don't need an initrd.

You need to set a few things =y in the kernel but thats it.

These few things are
the options to read your partition tables
support for SCSI disks
support for your HDD controller, at least, the one that has your root filesystem attached.
support for your root filesystem.

Everything else can be modules.

Build and install your kernel and modules in the normal way.
You might even be able to use genkernel -menuconfig to help.
_________________
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
Mr. T.
Guru
Guru


Joined: 26 Dec 2016
Posts: 477

PostPosted: Tue Dec 12, 2017 7:20 am    Post subject: Reply with quote

In my opinion, your choice implies the following acquired:

  1. have the fundamentals of programming
  2. know the development environment
  3. have a good knowledge of the C language (advanced level)

It seems to me that the third element is essential to perceive significant elements. Feel free to ask questions!
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Fri Dec 15, 2017 5:38 pm    Post subject: Reply with quote

What Neddy said.

Oh, I wouldn't use: -fomit-frame-pointer either. It's not as useful on amd64 as x86.

IIRC RBP is used for object/module lookup as well (might be something else), and the ABI requires double-word (64-bit not intel asm) stack alignment, so pushing RBP on entry is not an issue; it actually makes everything simpler.
Back to top
View user's profile Send private message
unheatedgarage
n00b
n00b


Joined: 19 Sep 2016
Posts: 60

PostPosted: Thu Jan 04, 2018 3:42 am    Post subject: Reply with quote

A long time coming--the holidays and end-of-semester hyperbole were enough to keep me tied up, but I'm back and have successfully booted.

Turns out it's because I, derpitty-derp, was following the systemd instructions for grub. It's been a long time since I've done a default install, so there I was trying to do systemd where it absolutely does not belong.

So, hurray! I'm installed with musl! Yay! Uh, now what do I do?

This all began by finding this very interesting blog while I was searching for ways to compile Chromium with clang. One thing lead to another, and now I'm here. Fun!

Guess I'll be using it until something breaks. Maybe I'll get the smarts one day to file a bug report if I find one, but until then I'll just slink back into the shadows.

Thank you for all your help, everyone.
Back to top
View user's profile Send private message
unheatedgarage
n00b
n00b


Joined: 19 Sep 2016
Posts: 60

PostPosted: Thu Jan 04, 2018 4:00 am    Post subject: Reply with quote

And I'll add that the idea of me starting this as a "how to"? And to somehow "give" my methodology?

HA. Haha, haha, haha...

The hubris. The arrogance. The horror.

:oops:
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Fri Jan 05, 2018 3:57 pm    Post subject: Reply with quote

Same error here

Code:
genkernel --lvm --luks initramfs


My kernel was build on the normal way

Code:
make menuconfig && make && make modules_install && make install


A need a initramfs for dm-crypt (luks encrypted disk)

any idea how to fix this ?
Back to top
View user's profile Send private message
_j
n00b
n00b


Joined: 05 Jan 2018
Posts: 9

PostPosted: Fri Jan 05, 2018 4:34 pm    Post subject: Reply with quote

gengreen wrote:
any idea how to fix this ?


Hi there,

You could try better-initramfs (https://bitbucket.org/piotrkarbowski/better-initramfs); has been working fine for me on musl. I've had to switch since it's got no ZFS support though!
Back to top
View user's profile Send private message
steveL
Watchman
Watchman


Joined: 13 Sep 2006
Posts: 5153
Location: The Peanut Gallery

PostPosted: Sat Jan 06, 2018 9:26 am    Post subject: Reply with quote

unheatedgarage wrote:
So, hurray! I'm installed with musl!
Woot! Well done. :-)
Quote:
Yay! Uh, now what do I do?

Guess I'll be using it until something breaks. Maybe I'll get the smarts one day to file a bug report if I find one, but until then I'll just slink back into the shadows.
First part sounds about right; after all, you wanted the computer to do something, right? ;)

I wouldn't do the latter; it sounds like you haven't gotten into IRC yet (if you have, excuse me.)

I highly recommend you /join #gentoo-musl on IRC: chat.freenode.net or .org as well as #gentoo-chat for social offtopic nonsense.

There aren't enough musl users (yet) and it means you can get "live" support, as well as quicker fixes. Just being able to chat with other people who are into, and running, the same stuff as you is a big easement, ime.

Musl is a great basis to learn portable POSIX coding, btw. It's well-written (I chatted with the author online quite a bit, a while back, and he knows his craft) and it helps wean you off any glibc-dependencies you may have fostered, if you learnt to code on Linux.
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sat Jan 06, 2018 7:26 pm    Post subject: Reply with quote

_j wrote:
gengreen wrote:
any idea how to fix this ?


Hi there,

You could try better-initramfs (https://bitbucket.org/piotrkarbowski/better-initramfs); has been working fine for me on musl. I've had to switch since it's got no ZFS support though!


Hello,

Thanks for your suggestion

I tried better-initramfs, I can build it, generate the initd and grub boot

However I end with the error "/dev/sda3 /newroot..."

Code:
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-/dev/mapper/crypt' {
   load_video
   insmod gzio
   insmod part_msdos
   set root='hd1,msdos1'
   if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  812d41a8-5d34-4f95-a1b5-b139fdc712b9
   else
    search --no-floppy --fs-uuid --set=root 812d41a8-5d34-4f95-a1b5-b139fdc712b9
    fi
   echo    'Loading Linux 4.9.73-minipli+grsec ...'
   linux    /vmlinuz-4.9.73-minipli+grsec root=UUID=c1706691-300b-4ef4-94dc-90aa7196606a crypt_root=/dev/sda3 real_root=/dev/mapper/crypt lvm rootfstype=ext4 ro
   echo           'Loading initial ramdisk ...'
   initrd           /initramfs.cpio.gz
}


This is what I have in my grub

I can access to a shell with busybox, I use cryptsetup luksOpen /dev/sda3 crypt and use the resume-boot command, but it still won't boot, repeating /dev/sda3 /newroot

Any idea ?

My fstab :

Code:
/dev/sda1                  /boot      ext4      defaults,noatime    0 2
/dev/sda2               none      swap      sw         0 0
UUID="c1706691-300b-4ef4-94dc-90aa7196606a"      /      ext4      defaults       0 0


dmcrypt was add in boot with rc-update

My kernel have the exact same .config of my actual Gentoo hardened which have luks encrypted disk too
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sat Jan 06, 2018 8:48 pm    Post subject: Reply with quote

Despite the lack of documentation regarding musl and the stage3 musl containing some unpatched header, I finally made it, gcc 7.2.0, kernel build, grub, system ready to be use. I was I though

- No compatibility with genkernel for generate the initramfs needed for dmcrypt / luks full encrypt, let's find another way

- Tried better-initramfs which look promising, ended with the problem related here https://bitbucket.org/piotrkarbowski/better-initramfs#rst-header-id15, I will wait the response of -J I may have miss something.

- Dracut, supposed to work with musl (package get from the overlay musl), try to emerge it you end with the error "no libc found"

I put away for now the idea of musl on Gentoo, I could make it work without dmcrypt / luks, but this is absolutely not an acceptable option.
-
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Jan 06, 2018 9:31 pm    Post subject: Reply with quote

gengreen wrote:
I put away for now the idea of musl on Gentoo, I could make it work without dmcrypt / luks, but this is absolutely not an acceptable option.

gengreen ... I have a default/linux/musl/x86 install with dmcrypt/luks, lvm, and better-initramfs, it's in storage as I had issues with musl and intel_drv.so (xorg) "lazy binding" and so put it aside. Anyhow, that is a separate issue, so enough said ... WRT, better-initramfs, there should be no issues with musl as better-initramfs is built using Aboriginal Linux (with uClibc) and so none of that matters (it's a completely separate build system), in fact you can built it elsewhere, or you could use the pre-built "release".

So, all you need do is grab the release and provide the required parameters via grub2.cfg, eg:

Code:
rootfstype=ext4 luks enc_root=/dev/sdaX lvm root=/dev/mapper/vg-root

... and that particular issue should be solved.

If you have further questions feel free to ask ... best ... khay
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sat Jan 06, 2018 10:03 pm    Post subject: Reply with quote

khayyam thanks you, I was able to boot

The problem remain, /newroot

But, with cryptsetup luksOpen /dev/sda3 crypt and mount /dev/mapper/crypt /newroot the system will boot.

It is not really practical but as I don't reboot often, I can accept it until I find out where is the problem

My grub

Code:

menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-/dev/mapper/crypt' {
   load_video
   insmod gzio
   insmod part_msdos
   set root='hd1,msdos1'
   if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  812d41a8-5d34-4f95-a1b5-b139fdc712b9
   else
    search --no-floppy --fs-uuid --set=root 812d41a8-5d34-4f95-a1b5-b139fdc712b9
    fi
   echo    'Loading Linux 4.9.73-minipli+grsec ...'
   linux    /vmlinuz-4.9.73-minipli+grsec enc_root=/dev/sda3 lvm root=/dev/mapper/crypt
   echo           'Loading initial ramdisk ...'
   initrd           /initramfs.cpio.gz
}


Any suggestion ?
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sat Jan 06, 2018 10:10 pm    Post subject: Reply with quote

gengreen wrote:
Code:
  linux /vmlinuz-4.9.73-minipli+grsec enc_root=/dev/sda3 lvm root=/dev/mapper/crypt

Any suggestion ?

gengreen ... yes, you need to pass 'luks' also ... otherwise, hehehe :)

Code:
  linux /vmlinuz-4.9.73-minipli+grsec luks enc_root=/dev/sda3 lvm root=/dev/mapper/crypt

I'd also recommend passing rootfstype=ext4 (or whatever you happen to be using).

HTH & best ... khay
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sat Jan 06, 2018 10:34 pm    Post subject: Reply with quote

All good, thank you a lot khayyam

Code:
   menuentry 'Gentoo GNU/Linux' --class gentoo --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-/dev/mapper/crypt' {
   load_video
   insmod gzio
   insmod part_msdos
   set root='hd1,msdos1'
   if [ x$feature_platform_search_hint = xy ]; then
    search --no-floppy --fs-uuid --set=root --hint-bios=hd1,msdos1 --hint-efi=hd1,msdos1 --hint-baremetal=ahci1,msdos1  812d41a8-5d34-4f95-a1b5-b139fdc712b9
   else
    search --no-floppy --fs-uuid --set=root 812d41a8-5d34-4f95-a1b5-b139fdc712b9
    fi
   echo    'Loading Linux 4.9.73-minipli+grsec ...'
   linux    /vmlinuz-4.9.73-minipli+grsec rootfstype=ext4 luks enc_root=/dev/sda3 lvm root=/dev/mapper/enc_root
   echo           'Loading initial ramdisk ...'
   initrd           /initramfs.cpio.gz
}


However I have to replace /dev/mapper/crypt by /dev/mapper/enc_root, the luks password prompt target /dev/mapper/enc_root even if the is /dev/mapper/crypt or /dev/mapper/cat

better-initramfs should definitively be available in the portage and the Gentoo documentation, it rox !
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Jan 07, 2018 12:34 am    Post subject: Reply with quote

gengreen wrote:
All good, thank you a lot khayyam

gengreen ... you're welcome.

gengreen wrote:
However I have to replace /dev/mapper/crypt by /dev/mapper/enc_root, the luks password prompt target /dev/mapper/enc_root even if the is /dev/mapper/crypt or /dev/mapper/cat

hmmm ... 'enc_root' is what the system will see as the 'name' of the 'LVM2_member':

lsblk -o +fstype,label:
NAME          MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT FSTYPE      LABEL
sda             8:0    0 298.1G  0 disk                         
├─sda1          8:1    0   200M  0 part             vfat        EFI
└─sda2          8:2    0 297.9G  0 part             crypto_LUKS
  └─enc_root  254:0    0 297.9G  0 crypt            LVM2_member
    ├─vg-swap 254:1    0     2G  0 lvm   [SWAP]     swap        swap
    ├─vg-root 254:2    0    10G  0 lvm   /          ext4        root
    ├─vg-var  254:3    0     6G  0 lvm   /var       ext4        var
    └─vg-home 254:4    0 279.9G  0 lvm   /home      ext4        home

However, this won't be 'root' (or whatever your LV is called), perhaps when you created your PV you provided some other name? Check with 'lsblk'.

gengreen wrote:
better-initramfs should definitively be available in the portage and the Gentoo documentation, it rox !

I agree, and you won't have to re-build it as and when you update the kernel. Also, it doesn't require you build cryptsetup, lvm2, etc, as 'static' ... it's also damn small.

Code:
# du -h -d0 /usr/src/initramfs/sourceroot/
2.9M    /usr/src/initramfs/sourceroot/

HTH & best ... khay
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sun Jan 07, 2018 11:27 am    Post subject: Reply with quote

I previously copy/paste the grub I keep in backup when I reinstall Gentoo, no lvm on my new install so I end up with this

Code:

menuentry 'Gentoo 4.9.73-minipli' {
  insmod gzio
  insmod part_msdos
  set root='hd1,msdos1'
  search --no-floppy --fs-uuid --set=root 812d41a8-5d34-4f95-a1b5-b139fdc712b9
  linux /vmlinuz-4.9.73-minipli+grsec rootfstype=ext4 luks enc_root=/dev/sda3 root=/dev/mapper/enc_root
  initrd /initramfs.cpio.gz
}


It work just fine thanks again.

Everything went perfect, I emerged almost everything I need until I failed on

Code:
net-libs/libpcap


I haven't found the single solution to build this against musl, so no tcpdump, no suricata... But no way to abandon now :)

I'm trying something else, not sure if this is recommanded or even possible, but I used crossdev to in the hope to build the only thing I need (libpcap / suricata or snort and tcpdump) using glibc

Code:
crossdev --k 4.9.74 --l "=2.26-r3" -s3 -t x86_64-pc-linux-gnu



Code:
/usr/x86_64-pc-linux-gnu/etc/portage/make.conf


Code:
CHOST=x86_64-pc-linux-gnu
CBUILD=x86_64-gentoo-linux-musl
ARCH=amd64
HOSTCC=x86_64-gentoo-linux-musl-gcc
ROOT=/usr/${CHOST}/
ACCEPT_KEYWORDS="amd64 ~amd64"

USE="${ARCH} -pam -nls -ipv6 -ncurses -gdbm
-geoip -javascript -geolocation -networkmanager -bluetooth -policykit -systemd -gnome -kde -jit -hal
-ldap -udisks -upower -ruby -pam -modemmanager -gstreamer -radeon -cups -flash -consolekit
-pulseaudio -dbus -gtk3 -introspection -ipv6 -mono -accessibility -mms -webkit -ffmpeg"

CFLAGS="-march=skylake -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j5"

FEATURES="-collision-protect sandbox buildpkg noman noinfo nodoc"
# Be sure we dont overwrite pkgs from another repo..
PKGDIR=${ROOT}packages/
PORTAGE_TMPDIR=${ROOT}tmp/

ELIBC="glibc"

PKG_CONFIG_PATH="${ROOT}usr/lib/pkgconfig/"
#PORTDIR_OVERLAY="/usr/portage/local/"


I used export to setup my env :

Code:
export ARCH=amd64
export CHOST=x86_64-pc-linux-gnu
export ROOT=/usr/x86_64-pc-linux-gnu/


And finaly x86_64-pc-linux-gnu-emerge to get what I need. libpcap merged with success, tcpdump, suricata or snort failed :(

Any suggestion are the most welcome
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Jan 07, 2018 11:50 am    Post subject: Reply with quote

gengreen wrote:
I haven't found the single solution to build this against musl, so no tcpdump, no suricata... But no way to abandon now :)

gengreen ... I'm fairly sure I didn't have issues with libpcap, or tcpdump, these should build as they are packaged for Alpine Linux (libpacp, tcpdump, suricata) ... and Alpine is musl based. In the past when I've had issues I would check for any patches applied to Alpine and adjust the ebuild in a local overlay (if necessary, and mostly it isn't because gentoo-musl seems to have a close eye on Alpine). You might find this is a gcc-7.2.0 issue, try with 6.4.0. Otherwise, you'd need to post the build.log, 'emerge --info', etc.

gengreen wrote:
I'm trying something else, not sure if this is recommanded or even possible, but I used crossdev to in the hope to build the only thing I need (libpcap / suricata or snort and tcpdump) using glibc

I'm fairly sure it's not a musl problem, and so that would seem like a poor workaround. Unrelated, but I gave up with using crossdev ... it's horrible. If you must then take a look at buildroot.

best ... khay
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sun Jan 07, 2018 12:18 pm    Post subject: Reply with quote

https://paste.pound-python.org/show/sBF0LRGfEhcK3RxI7Ef5/

I found on github a problem similar of my :

https://github.com/the-tcpdump-group/libpcap/issues/174

Quote:
he error does not reproduce on musl 0.9.14 although the definition of struct ifreq is indeed in <net/if.h>. I built libpcap with musl as follows: http://seclists.org/tcpdump/2013/q4/106


So I took a look on the diff of seclists, but it is already applied on libpcap-1.8.1 ...

I have alpine running on qemu, I will take a look see if I can find the source (apk fetch prebuild package)

There is also http://github.com/sabotage-linux/sabotage/tree/master/pkg that work on musl and libpcap is available

You right about crossdev for this, it's dirty,

Code:
crossdev -C x86_64-pc-linux-gnu


Done ;-)
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun Jan 07, 2018 12:37 pm    Post subject: Reply with quote

gengreen ...

and the output of 'emerge --info =net-libs/libpcap-1.8.1'

best ... khay
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sun Jan 07, 2018 12:57 pm    Post subject: Reply with quote

Ok I found the problem

https://forums.gentoo.org/viewtopic-t-1074884.html

What worked for net-tools now make the mess with libpcap

https://gentoo.osuosl.org/experimental/amd64/musl/stage3-amd64-musl-hardened-20171204.tar.bz2

I used this stage for install my Gentoo, which have

/usr/include/linux/if.h

(source : https://paste.pound-python.org/show/ObVpCemKU6dK8oHkkcVi/)

But now my "patch" mess libpcap, I will try to find a recent linux/if.h on the git musl and try to replace with my actual one
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Sun Jan 07, 2018 1:15 pm    Post subject: Reply with quote

All good, I just replaced the if.h by the original one, libpcap is merged and I tried net-tools to make sure and no problem.
Back to top
View user's profile Send private message
DarkPoe
n00b
n00b


Joined: 22 Feb 2018
Posts: 2

PostPosted: Thu Feb 22, 2018 3:47 pm    Post subject: Reply with quote

I've tried the same as OP, but with some success after editing some headers... Now I get to the part where the it appens cpio data and it stops at "Appending linker cpio data" with error: Could not copy ld.so.{cache,conf}

musl doesn't provide ldconfig (it is there, but it doesn't work) and I think it is going for ld.so.cache...

So is there any way to get this genkernel to build? I have tried dracut and better-initramfs, with no luck :<
Back to top
View user's profile Send private message
Zucca
Moderator
Moderator


Joined: 14 Jun 2007
Posts: 3309
Location: Rasi, Finland

PostPosted: Thu Feb 22, 2018 4:08 pm    Post subject: Reply with quote

helecho wrote:
In my opinion, your choice implies the following acquired:

  1. have the fundamentals of programming
  2. know the development environment
  3. have a good knowledge of the C language (advanced level)

It seems to me that the third element is essential to perceive significant elements. Feel free to ask questions!
Did I miss something here? I haven't written a single line of C code, but still have ran Gentoo for years.
_________________
..: Zucca :..
Gentoo IRC channels reside on Libera.Chat.
--
Quote:
I am NaN! I am a man!
Back to top
View user's profile Send private message
gengreen
Apprentice
Apprentice


Joined: 23 Dec 2017
Posts: 150

PostPosted: Wed Mar 07, 2018 11:40 pm    Post subject: Reply with quote

I'm actually reinstalling my system with the profile musl hardened after taking the decision to go back using the mainline kernel.
h
Nothing changed, musl is stable and I haven't encounter the single problem or the need to edit a single header line... regarding the generation tool for the initramfs, better initramfs work out of the box, what the problem you got with ?

Quote:
musl doesn't provide ldconfig


Yes it is one of the point that make musl far more secure...
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Unsupported Software 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