# HELP - initrd embedded in kernel - SOLVED

## Moriah

I have been running gentoo since 2004, linux since 1993, unix since 1989.  I have used grub to boot my gentoo systems for over 10 years (at least!).  Now good old grub is superceeded by grub2.  Since I am rebuilding my road warrior laptop, I decided to install 4.14.83-gentoo for my kernel, and use the shiny new grub2 to boot it.

I copied the .config from my old kernel (3.12.21-gentoo-r1, yes, I know that's pretty old.) and did a make oldconfig, taking the defaults for everything.  Then I did a make && make modules_install followed by make install.  I dutifully followed the handbook's directions for grub2, but it wouldn't boot.

I have used an initrd for years on this box because the boot drive is a usb-stick on my keychain (along with the house key, car key, etc.), and the drive in the laptop is a 2 TB SSD that is whole-disk encrypted with LUKS.  The initrd lets me put in my pass phrase, then activates LVM on the result, then mounts the root filesystem.

I have used the nice feature of embedding the initrd into the kernel image for years, so my grub.conf did not need to specify anything regarding the initrd.

Suspecting something was wrong with the initrd, I ran make menuconfig and verified the initrd stuff was configured properly in the "General setup" menu.  It looked like this:

```
  | |               [*] Initial RAM filesystem and RAM disk (initramfs/initrd) support                   | |  

  | |               (/usr/src/initramfs) Initramfs source file(s)                                        | |  

  | |               (0)   User ID to map to 0 (user root)                                                | |  

  | |               (0)   Group ID to map to 0 (group root)                                              | |  

  | |               [*]   Support initial ramdisk/ramfs compressed using gzip                            | |  

  | |               [*]   Support initial ramdisk/ramfs compressed using bzip2                           | |  

  | |               [*]   Support initial ramdisk/ramfs compressed using LZMA                            | |  

  | |               [*]   Support initial ramdisk/ramfs compressed using XZ                              | |  

  | |               [*]   Support initial ramdisk/ramfs compressed using LZO                             | |  

  | |               [*]   Support initial ramdisk/ramfs compressed using LZ4                             | |  

  | |               [ ]   Built-in initramfs compression mode                                            | |  

```

I seem to remember that I used to have to specify an initial ramdisk size or something like that when the initrdfs was internal to the kernel.  Where did this selection go?  Do I need to do something different for an internal initrdfs now?

----------

## Tony0945

The shiny new grub2 is old. Unless your hardware is really old and doesn't support UEFI, use reFind instead.

----------

## The Doctor

The problem is most likely trying to go from 3.12.21 to 4.14.83. Make oldconfig cannot handle that. I recommend poking around the forum to find the appropriate kernel seed from pappy and start over.

----------

## Hu

 *Moriah wrote:*   

> I dutifully followed the handbook's directions for grub2, but it wouldn't boot.

 Please show us how it fails.  There are far more ways to do it wrong than to do it right.  We need to start with the symptoms before we can identify the cause.

----------

## Moriah

It drop into a rescue shell without booting any kernel.

----------

## NeddySeagoon

Moriah,

The rescue shell comes from the initrd which is embedded in the kernel, so the kernel must load, decompress and get as far as mounting the initrd as root.

In the rescue shell, what do you have in /dev ?

Some /dev/sd? entries would be good.

/dev/mapper would be even better.

You must have /dev/console and /dev/null as character devices too, or nothing will work.

----------

## Moriah

Got a little further today.  Now it says "uncompression error".  (or "decompression error" -- can't remember which)

I assume this was trying to uncompress the initrd.  I fell back to good old original grub, not grub2.  Once I get it to boot with grub, then I will try grub2.

My concern, as stated earlier, is that I see no way in menuconfig to specify an initrd embedded in the kernel image, and that'sd the way I have been operating for years -- with the initrd in the kernel image.  What happened to that option?  How do I specify the path to the initrd?  Is it the directory that has the iniotrd filesystem tree in it, or is it the tarred and gzipped image file in the /boot directory, where the kernel image lives?

Or is there a way to get the initrd in the kernel image after all, and I am just missing it?

----------

## Hu

The Kconfig symbol you want is CONFIG_INITRAMFS_SOURCE.  It may be hidden if a prerequisite is not satisfied.  Use the standard menuconfig tools to explore that: / to find it and see its dependencies or Z to show everything, including things you cannot select due to dependencies.  That option takes either a path to a directory to bundle into the initrd or a path to a file which describes what to bundle.  The latter is more convenient, since you don't need to retain separate copies of everything, and you can use it to generate an initrd with special files that your build user cannot create.

----------

## Moriah

So I now have it booting and running the initramfs, but it fail when it does the "cryptsetup luksOpen /dev/sda blahblah" saying "device not found".  How could it not find /dev/sda?  Here is the init file:

```

#!/bin/busybox sh

rescue_shell() {

    echo "Something went wrong. Dropping you to a shell."

    busybox --install -s

    exec /bin/sh

}

echo Mount the /proc and /sys filesystems.

sleep 10

mount -t proc none /proc

mount -t sysfs none /sys

echo prior to luksOpen

fdisk -l

sleep 30

echo doing luksOpen

sleep 10

cryptsetup luksOpen /dev/sda cryptoroot

echo after luksOpen

sleep 30

echo doing vgscan

sleep 10

lvm vgscan

echo doing vgchange

sleep 10

lvm vgchange -a y

echo mounting root

sleep 10

mount /dev/gentoo/rootfs /mnt/root

echo unmounting /proc and /sys

sleep 10

umount /proc

umount /sys

echo doing the pivot root

sleep 10

exec switch_root /mnt/root /sbin/init

# if we get here, it means trouble!  :-(

echo "starting emergency rescue shell..."

rescue_shell()

```

The echo and sleep lines are my way of debugging it, to see what is happening.  The fdisk -l was an attempt to see what drives it recognized, but I guess fdisk is not in busybox.    :Sad: 

----------

## NeddySeagoon

Moriah,

When it fails and drops you to the shell, run 

```
ls /dev/sd*
```

If sda isn't listed, then devtmpfs probably isn't being mounted.

That's either a kernel option, or you can add it to  

```
mount -t proc none /proc

mount -t sysfs none /sys 
```

For testing in the initrd shell, 

```
mount -t devtmpfs none /dev
```

should work.

Now you can execute the init script by hand, either all of it and ignore the errors about proc and sys being mounted, or you can type it a line at a time.

----------

## Moriah

When the luksOpen fails, the initscript continues anyway, and since the drive is not "right" at that point, it just runs away bonkers and does something to the usb port that messes up my little 2-port kvm.  I have to disconnect the kvm from both usb ports and also from the hdmi video to totally p0ower it down, the reconnect to get it in its right mind again.  That's the reason for the sleep 30 after the luksOpen: it gives me time to manually shut the laptop off with the power button, so the kvm confusion doesn't occur.  I guess I could just work on the laptop screen, but I like my big monitor.

Anyway, thanks for the devtmpfs clue.  I'll be looking into the kernel config to see about that later today.

----------

## NeddySeagoon

Moriah,

Heh ... you never get to the shell, I didn't notice.  Lets fix your init script.

Add in the echo "$@".

```
rescue_shell() {

    echo "$@"

    echo "Something went wrong. Dropping you to a shell."

    busybox --install -s

    exec /bin/sh

} 
```

cryptsetup luksOpen /dev/sda cryptoroot becomes 

```
cryptsetup luksOpen /dev/sda cryptoroot || rescue_shell "cryptsetup  failed"
```

and so on.

If cryptsetup fails, the || is executed. That calls rescue_shell and passes the string "cryptsetup  failed" to it.

Do your calls to sleep and mount work?

My initrd init script contains full path names because I didn't set $PATH.

----------

## Moriah

I guess I should mention that my entire initrsmfs is the same one I have used since 2014 to boot my laptop.  The echos and sleeps were added to help me debig booting the linux-4.14.83-gentoo kernel, but iut has worked for almost 5 years before now.

Yes, I thought of using the || trick, but I also thought of just putting debug lines before the luksOpen to see what was happening.

I'm thinking its the devtempfs problem...

----------

## NeddySeagoon

Moriah,

You want it to drop to a shell as soon as it fails.  When it works its fine.

Check your devtmpfs settings in the kernel and add in the || clauses to the init script.

Any changes are a kernel rebuild for you anyway.

----------

## Moriah

OK, made your suggested changes.  First off, the devtmpfs automount was not set, so I turned it on.

Added the || clause to invoke the rescue shell if cryptsetup failed, which it did.

```

doing luksOpen

Command failed: Can not access device

cryptsetup failed

Something went wrong.  Dropping you to a shell.

/bin/sh: can't access tty; job control turned off

/ #

```

So I did an ls /dev, and it gave me:

console  mapper  null sda urandom

should I see devtmpfs there?  I also did a cat /etc/mtab, but only saw /prov and /sys there.

A df returns nothing but the header line.

I next tried a "dd if=/dev/sda of=/dev/null" but it complained:

"dd: can't open '/dev/sda': No such device of address

So something is apparently screwed up with /dev/sda

ls -l /dev/sda returns:

brw-rw----   1 0     6      8,    0 Feb 11 16:38 /dev/sda

Are the perms wrong?  The major or minor numbers wrong?  What gives?

These are the same perms and major/minor numbers /dev/sda has when I boot 3.12.21-gentoo-r1 on the same laptop.

----------

## Moriah

Got it to boot and get past cryptsetup.  Had a misconfigured SATA driver.    :Embarassed: 

Now it fail mounting root:

```

mounting root

mount: mounting /dev/gentoo/rootfs on /mnt/root failed: Invalid argument

mount root failed

Something went wrong.  Dropping you to a shell.

/bin/sh: can't access tty; job control turned off

/ # 

```

I did ls -ld /mnt and got drwxr-wr-w   3 0 0 60 Feb 11 18:27 /mnt

the ls -la /mnt and it showed root with drwxr-xr-x perms, so that looks good.

then I did lvm lvdisplay and a reasonable looking output.

/dev/gentoo/rootfs is a symlink to /dev/mapper/gentoo-rootfs which is reasonable.

What could be invalid about those 2 arguments?

----------

## Moriah

By chance, I was using a usb keyboard today and noticed that it didn't work.  The laptop builtin keyboard worked fine.  Hmm...  Maybe there is a problem with usb!  Maybe that's why the mount fails.  So I compared the usb setting in my 3.12.21 kernel where the usb keyboard works with the setting in my new 4.whateve kernel, and guess what?  There was a missing usb driver.  I added it to the mix, rebuild, and booted.  Now my usb keyboard works, but the mount still fails.

I should mention that the boot drive is a usb stick on this system.

Perhaps there are fislesystem related setting that apply to usb that I still don't have right.  Any ideas?   :Idea: 

----------

## NeddySeagoon

Moriah,

Once the kernel is loaded, /boot no longer matters.

Once you get into the rescue shell does 

```
mount /dev/mapper/gentoo-rootfs /mnt/root
```

work.

Do both exist and look OK?

You have already said that /mnt/root does.  The mount should be -o ro at this stage too as checkrootfs needs to run.

Your 

```
/bin/sh: can't access tty; job control turned off 
```

is probably because you need

```
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
```

With devpts not mounted, you can't have any background jobs.

Check /dev/null permissions.  

```
crw-rw-rw- 1 root root 1, 3 May 12  2013 /dev/null
```

is correct.

Lots of strange things go wrong if thats not right.

Do you have /dev/console too?

```
ls /dev/console -l

crw------- 1 root root 5, 1 Feb 12 09:59 /dev/console
```

----------

## Moriah

My root filesystem is xfs.  I had carelessly built xfs as a module.    :Embarassed: 

I rebuilt it compiled into the kernel, and now it boots and I can log in!    :Mr. Green: 

----------

## Moriah

Thanks for you help, Neddy!  I think I can take it from here.  I still have a lot of stuff to add to it, but at least it boots.

----------

## Moriah

So I have a bootable system.  I have added support for a simple X server using the intel integrated video on the laptop.  The box also has nvidia video, but I'll worry about that later.  I need to get the basics working first.

I can ssh out of the laptop.  I have sshd running on it, but I cannot log in to the laptop from another machine; it fails on the password.  I can log in when I am physically at the laptop.  I even re-established the passwd just to be sure, but still no remote ssh login to the laptop.

Any idea what could be wrong there?

Also, I have an X-server running, and I have twm, xemacs, firefox, xterm, xsetroot, xload, and xclock running on it just fine.  But there is one nagging problem: once I start the xserver (using xinit), I cannot switch back to a text console using alt-ctl-f1 thru f6.  This makes it a pain to test many things, or to close down in an orderly fashion and reboot to test a new kernel, etc.  Normally I would just start X instead of using xinit, but once I start X, I loose the console and cannot get it back.  Since I cannot login remote over ssh, I must power cycle the laptop to regain control.

I have not tried starting several x-servers and switching between them, although I usually operate with 5 x-server running at once on f7 thru f11.  This is to support full screen vnc clients, for remote systems, or for virtual machines on the laptop.

Any idea what is causing the inability to switch to a text console after I start an X-server?

----------

## NeddySeagoon

Moriah,

ssh into the laptop from the laptop.  Its not very useful but it a good test.

Try ssh@localhost and ssh@wired/wireless_IP

password logins are not permitted for root any longer.

Once that works, god back to the remote system and try ssh -v ...

Post the output.

You don't use startx?

That should run twm, with three xterms and an analogue clock without any configuration.

alt-ctl-FnX works here.

There is a xorg.conf option to prevent alt-ctl-FnX working. My xorg.conf started life in 1999, I've just migrated it from system to system :)

----------

## Moriah

ssh to itself doesn't work eother, but since I'm still setting this box up, the only user I have is root.  I didn't know that password logins were no longer permitted for root, so that's the reason it doesn't.  I'll wait until I have another user and try again. All I was doing was testing the sshd setup.

Any thought on why X doesn't let me switch back to the boot console?  I seem to remember there was something you had to dop to let that happen, either in setting up the terminals, or in setting up Xorg or something else in X.

----------

## NeddySeagoon

Moriah,

My xorg.conf contains

```
# Uncomment this to disable the <Ctrl><Alt><Fn> VT switch sequence

# (where n is 1 through 12).  This allows clients to receive these key

# events.

#    Option "DontVTSwitch"
```

Do you have the Option "DontVTSwitch" active?

----------

## Moriah

I did not even have an /etc.xorg.conf, so I copied the one I used to have from my backup server.  That stopped xinit from working at all.  It said "unable to find any available screen".

I'm working on bluetoth in the meanwhile, so I can get my good mouse working.  I hate touch pads.

----------

## Moriah

If one googles and fiddles enough, you can make this stuff work!  I now have my intel integrated display running perfectly, and also my nvidia discrete video and external monitor working great as well.

So I have a booting system with proper X video.  It feels good again.  I still have a number of othere things to do:

1. bluetooth for my mouse.

2. wifi

3. my usb connected cellular modem

4. audio/sound

5. laptop screen backlight dimmer

6. thinkpad backlit keyboard off/dim/brite

7. the nitelite that shines down on the keyboard on/off

8.. adobe flash or some suitable substitute -- might already be there after I installed firefox -- nope, just checked

9. adobe acroread or suitable substitute.  Prefer genuine adobe acroread, since I have stuff that works much better with it than gv, etc.

10. need to get thunderbird configured properly.  I installed it, but can't get it to connect to my server.  why do they always change the config interface for these things?

11. open-office -- I plan to install this tonight while I sleep, since it takes so long to install.

Plus a few nits regarding startup initialization of ny netork and getting eth0 back again instead of enp0s25; YUK!

After everythin is working, I will restore user files from the backup server.

 :Mr. Green: 

----------

## Moriah

bluetoothct barfs:

```

onesimus ~ # bluetoothctl 

Segmentation fault

onesimus ~ # 

```

Here's the version:

```

*  net-wireless/bluez

      Latest version available: 5.50-r1

      Latest version installed: 5.50-r1

      Size of files: 1715 KiB

      Homepage:      http://www.bluez.org

      Description:   Bluetooth Tools and System Daemons for Linux

      License:       GPL-2+ LGPL-2.1+

```

Used to work fine with my old kernel 3.12.21-gentoo-r1.

```

onesimus ~ # lsmod

Module                  Size  Used by

btusb                  49152  0

btrtl                  16384  1 btusb

btbcm                  16384  1 btusb

btintel                16384  1 btusb

bluetooth             376832  5 btrtl,btintel,btbcm,btusb

ecdh_generic           24576  1 bluetooth

psmouse               110592  0

nvidiafb               45056  0

wmi_bmof               16384  0

iwlwifi               172032  0

vgastate               20480  1 nvidiafb

e1000e                208896  0

onesimus ~ # 

```

Any idea what the problem could be?

----------

## NeddySeagoon

Moriah,

```
onesimus ~ # bluetoothctl

Segmentation fault

onesimus ~ # 
```

will tell something useful in dmesg.

----------

## Moriah

Indeed it does:

```

onesimus /usr/src/linux # dmesg | grep -i blue

[   14.010790] Bluetooth: Core ver 2.22

[   14.010797] Bluetooth: HCI device and connection manager initialized

[   14.010799] Bluetooth: HCI socket layer initialized

[   14.010800] Bluetooth: L2CAP socket layer initialized

[   14.010801] Bluetooth: SCO socket layer initialized

[   14.121011] Bluetooth: hci0: BCM: chip id 63

[   14.122019] Bluetooth: hci0: BCM: features 0x07

[   14.137908] Bluetooth: hci0: BCM20702A

[   14.138915] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000

[   14.138931] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e6.hcd failed with error -2

[   14.138932] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e6.hcd not found

onesimus /usr/src/linux # 

```

I call your attention to the lines:

```

[   14.138931] bluetooth hci0: Direct firmware load for brcm/BCM20702A1-0a5c-21e6.hcd failed with error -2

[   14.138932] Bluetooth: hci0: BCM: Patch brcm/BCM20702A1-0a5c-21e6.hcd not found

```

This looks suspicious, but even after I emerged the only firmware thing associated with bluetooth, and verified ther was nothing else in the kernel with make menuconfig, and rebooting just to be sure, I still get the same firmware message.    :Confused: 

I found the firmware image at:

```

https://github.com/winterheart/broadcom-bt-firmware/blob/master/brcm/BCM20702A1-0a5c-21e8.hcd

```

but I don't know where to put it so the bluez stuff can find it.

Likewise, the "patch" is at:

```

https://github.com/winterheart/broadcom-bt-firmware/blob/master/brcm/BCM20702A1-0a5c-21e6.hcd

```

but I don't know where to put that either.

----------

## NeddySeagoon

Moriah,

The file goes into /lib/firmware/<path_from_dmesg>

Thats /lib/firmware/brcm/BCM20702A1-0a5c-21e6.hcd for you.  /lib/firmware/brcm may already exist, as linux-firmware puts files there. 

The file you found is BCM20702A1-0a5c-21e8.hcd, which is not what your driver is looking for, so it won't be found.  

Get https://github.com/winterheart/broadcom-bt-firmware/blob/master/brcm/BCM20702A1-0a5c-21e6.hcd and put it into  /lib/firmware/brcm

----------

## Moriah

Still barfs:

```

onesimus ~ # bluetoothctl 

Segmentation fault

onesimus ~ # 

```

Here's the dmesg output:

```

onesimus ~ # dmesg | grep -i blue

[   17.607300] Bluetooth: Core ver 2.22

[   17.607309] Bluetooth: HCI device and connection manager initialized

[   17.607312] Bluetooth: HCI socket layer initialized

[   17.607313] Bluetooth: L2CAP socket layer initialized

[   17.607315] Bluetooth: SCO socket layer initialized

[   17.722796] Bluetooth: hci0: BCM: chip id 63

[   17.723799] Bluetooth: hci0: BCM: features 0x07

[   17.739701] Bluetooth: hci0: BCM20702A

[   17.740603] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000

[   19.808047] Bluetooth: hci0 command 0x0a0a tx timeout

[   28.128054] Bluetooth: hci0: BCM: Patch command 0a0a failed (-110)

[   30.240048] Bluetooth: hci0 command 0x1001 tx timeout

[   35.391973] bluetoothctl[2985]: segfault at 8 ip 00007fb723ff2073 sp 00007ffe79f11830 error 4 in libdbus-1.so.3.14.14[7fb723fdc000+43000]

[   38.368055] Bluetooth: hci0: BCM: Reading local version info failed (-110)

[  603.964545] bluetoothctl[3222]: segfault at 8 ip 00007f080f0a7073 sp 00007ffc8baf00c0 error 4 in libdbus-1.so.3.14.14[7f080f091000+43000]

onesimus ~ # bluetoothctl 

```

Seems the "patch" thing is not working...

----------

## NeddySeagoon

Moriah,

Please pastebin all of dmesg.  If you have a combined WiFi/Bluetooth they need extra care.

If your Bluetooth is really intended for a UEFI system and you use BIOS, you need a .txt file to provide the the missing data that UEFI would have provided.

The segfault looks ugly but I'm not convinced its relevant yet.

----------

## Moriah

Yes, I needd both wifi and bluetooth, and sometimes I need both active and running at the same time, if that matters.

The laptop is a Lenovo ThinkPad w530.

I have fetched from paste bin, but never posted to it.  I can post to my own web server, if that would help.  Let me know.

I used to have all this working fine under my old 3.12.21-gentoo-r1 kernel, and I have all those files on my backup server, if that would help.  I also have the entire /usr/src/linux-.12.21-gentoo-r1 directory tree already on the laptop now, so I can compare .configs, etc.

----------

## NeddySeagoon

Moriah,

wgetpaste is your friend. 

```
$ dmesg | wgetpaste

Your paste can be seen here: https://paste.pound-python.org/show/1NXuJXOv1474CKLAYtrg/
```

That's for real too.

lspci or lsusb, whatever shows your WiFi and Bluetooth would be good too.

WiFi and Bluetooth both operate in the 2.4GHz Unlicensed Mobile Band and often share the same RF circuits and antenna(s).

That keeps cost and power down.

The kernel has an option that some Broadcom combined devices need to make both work together at the same time.

----------

## Moriah

```

onesimus ~ # lspci 

00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)

00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04)

00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)

00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4)

00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)

00:1c.2 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 3 (rev c4)

00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation QM77 Express Chipset LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)

00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04)

01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1000M] (rev a1)

01:00.1 Audio device: NVIDIA Corporation GK107 HDMI Audio Controller (rev a1)

02:00.0 System peripheral: Ricoh Co Ltd PCIe SDXC/MMC Host Controller (rev 05)

02:00.3 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 PCIe IEEE 1394 Controller (rev 04)

03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)

onesimus ~ # 

```

```

onesimus ~ # lsusb

Bus 002 Device 005: ID 2188:0ae1  

Bus 001 Device 003: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102/2.0 / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick

Bus 001 Device 005: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad]

Bus 001 Device 006: ID 04f2:b2ea Chicony Electronics Co., Ltd Integrated Camera [ThinkPad]

Bus 001 Device 004: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 004: ID 062a:0201 MosArt Semiconductor Corp. Defender Office Keyboard (K7310) S Zodiak KM-9010

Bus 002 Device 003: ID 0451:8044 Texas Instruments, Inc. 

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

onesimus ~ # 

```

```

onesimus ~ # dmesg | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/aQrRBg39iVr3S7eiQ0xP/

onesimus ~ # 

```

----------

## NeddySeagoon

Moriah,

First the good news, your WiFi and Bluetooth are separate devices.

Wifi is 

```
03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)
```

Bluetooth is 

```
Bus 001 Device 005: ID 0a5c:21e6 Broadcom Corp. BCM20702 Bluetooth 4.0 [ThinkPad] 
```

Your wifi is missing firmware too.

```
[   17.596589] Intel(R) Wireless WiFi driver for Linux

[   17.596590] Copyright(c) 2003- 2015 Intel Corporation

[   17.596793] iwlwifi 0000:03:00.0: can't disable ASPM; OS doesn't have ASPM control

[   17.597965] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-6000g2a-6.ucode failed with error -2

[   17.597972] iwlwifi 0000:03:00.0: Direct firmware load for iwlwifi-6000g2a-5.ucode failed with error -2

[   17.597974] iwlwifi 0000:03:00.0: no suitable firmware found!

[   17.597975] iwlwifi 0000:03:00.0: minimum version required: iwlwifi-6000g2a-5

[   17.597976] iwlwifi 0000:03:00.0: maximum version supported: iwlwifi-6000g2a-6

[   17.597976] iwlwifi 0000:03:00.0: check git://git.kernel.org/pub/scm/linux/kernel/git/firmware/linux-firmware.git
```

Install linux-firmware to get the missing microcode.

This much of the Bluetooth looks OK too

```
[   17.607300] Bluetooth: Core ver 2.22

[   17.607308] NET: Registered protocol family 31

[   17.607309] Bluetooth: HCI device and connection manager initialized

[   17.607312] Bluetooth: HCI socket layer initialized

[   17.607313] Bluetooth: L2CAP socket layer initialized

[   17.607315] Bluetooth: SCO socket layer initialized

[   17.610056] usbcore: registered new interface driver btusb

[   17.722796] Bluetooth: hci0: BCM: chip id 63

[   17.723799] Bluetooth: hci0: BCM: features 0x07

[   17.739701] Bluetooth: hci0: BCM20702A

[   17.740603] Bluetooth: hci0: BCM20702A1 (001.002.014) build 0000
```

then it goes wrong.

```
[   19.808047] Bluetooth: hci0 command 0x0a0a tx timeout

[   28.128054] Bluetooth: hci0: BCM: Patch command 0a0a failed (-110)

[   30.240048] Bluetooth: hci0 command 0x1001 tx timeout
```

According to github you shold have one more line.

```
Bluetooth: hci1: BCM: chip id 63

Bluetooth: hci1: BCM20702A

Bluetooth: hci1: BCM20702A1 (001.002.014) build 0000

Bluetooth: hci1: BCM20702A1 (001.002.014) build 1467

Bluetooth: hci1: Broadcom Bluetooth Device
```

You are missing the 

```
Bluetooth: hci1: BCM20702A1 (001.002.014) build 1467 
```

line.

That page may help.

I can't tell from dmesg if you are booting in BIOS (legacy) on UEFI mode.

----------

## Moriah

I am booting legacy, uaingf old fashioned grub.  I'd like to switch to grub2 after I get everything else working though...

----------

## NeddySeagoon

Moriah,

This Arch Linux thread describes extracting the firmware from the Windows driver.

Maybe that matters ?

----------

## Moriah

After emerging linux-firmware wifi works:

```

onesimus ~ # ifconfig 

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1400

        inet 192.168.5.108  netmask 255.255.255.0  broadcast 192.168.5.255

        ether e0:9d:31:2d:84:a0  txqueuelen 1000  (Ethernet)

        RX packets 8  bytes 1356 (1.3 KiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 15  bytes 2064 (2.0 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

onesimus ~ # 

```

Bluetooth is still broken.  Last time I booted, I saw the bluetooth lines in dmesg; this time there is no mention of them.    :Shocked: 

----------

## Moriah

Not being one to impede progress (meaning I wasn't sleepy enough to go to bed yet), I started working on sound.  

It didn't work.

The following extract from dmesg is informative, but I don't know what to do about it:

```

[    2.138950] ALSA device list:

[    2.138953]   No soundcards found.

[    2.143707] hdaudio hdaudioC0D0: Unable to bind the codec

[    2.248124] hdaudio hdaudioC1D0: Unable to bind the codec

```

Did I miss a kernel option?  Or do I need a list somewhere of the devices I want to the sound system to talk to?

Here's the only audio device I could find:

```

onesimus ~ # lspci

  :

00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04)

```

Eventually I want bluetooth audio also, but this is not as important as getting my bluetooth mouse to work.

----------

## NeddySeagoon

Moriah,

Put your current kernel .config file onto a pastebin and your current dmesg.

Your old dmesg says

```
[    2.088156] ALSA device list:

[    2.088159]   No soundcards found.

...

[   16.966614] XFS (dm-1): Mounting V4 Filesystem

```

Alsa tries to start before root is mounted. That may be a bad thing. Your pastebins will tell.

----------

## Moriah

```

onesimus ~ # dmesg | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/b2JgJ262s4rXHEiK80tx/

onesimus ~ # cat /usr/src/linux/.config | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/ig5RGG861rzvy7kwiCAG/

onesimus ~ # 

```

So I assume there is a way to change the order of events here...

Would it help if I posted the .config for the 3.12.21 kernel?  That worked for wifi, bluetooth, and audio.

It may sound like a nit, battery life and eye burnout are helped by having the screen dimmable, and the nitelite and keyboard backlight also used to work.  I would like to get them working again too.

I also have to get my cellular modem working, but I'll wait until everything else works to tackle that.  I used to work under 3.12.21, and I have all the old files.

----------

## NeddySeagoon

Moriah,

Sound is in two parts. The PCI bus end, which you have and the codec end which includes the Digital to Analogue converters for output and the Analogue to Digital converters for input.

All your codecs are off.

```
# HD-Audio

#

CONFIG_SND_HDA=y

CONFIG_SND_HDA_INTEL=y

# CONFIG_SND_HDA_HWDEP is not set

# CONFIG_SND_HDA_RECONFIG is not set

# CONFIG_SND_HDA_INPUT_BEEP is not set

# CONFIG_SND_HDA_PATCH_LOADER is not set

# CONFIG_SND_HDA_CODEC_REALTEK is not set

# CONFIG_SND_HDA_CODEC_ANALOG is not set

# CONFIG_SND_HDA_CODEC_SIGMATEL is not set

# CONFIG_SND_HDA_CODEC_VIA is not set

# CONFIG_SND_HDA_CODEC_HDMI is not set

# CONFIG_SND_HDA_CODEC_CIRRUS is not set

# CONFIG_SND_HDA_CODEC_CONEXANT is not set

# CONFIG_SND_HDA_CODEC_CA0110 is not set

# CONFIG_SND_HDA_CODEC_CA0132 is not set

# CONFIG_SND_HDA_CODEC_CMEDIA is not set

# CONFIG_SND_HDA_CODEC_SI3054 is not set

# CONFIG_SND_HDA_GENERIC is not set

CONFIG_SND_HDA_POWER_SAVE_DEFAULT=0

CONFIG_SND_HDA_CORE=y

CONFIG_SND_HDA_I915=y

CONFIG_SND_HDA_PREALLOC_SIZE=64
```

Enable all the codecs and  SND_HDA_GENERIC. You can remove unneeded codecs later, once you know which one you need.

----------

## Moriah

I tried setting the codecs, both as modules, and built into the kernal; neither gave any sound.  

I did try emerging alsamixer, but apparently it is no longer out there, so I copied it from my backup server.  I told me:

Card: HDA Intel PCH

Chip: Realtek ALC269VC

and that mute was on, which I suspected, so I turned mute off, but still no output.    :Sad: 

```

// current config

onesimus ~ # cat /usr/src/linux/.config | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/x5flAiF3VO0oGPU98DPO/

onesimus ~ # 

// old config when aidio worked

onesimus ~ # cat /usr/src/linux-3.12.21-gentoo-r1/.config | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/wbcxIlpInz48w3ORsriV/

onesimus ~ # 

onesimus ~ # dmesg | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/ecYwUmttDUqgTe2WiTG0/

onesimus ~ # 

```

----------

## NeddySeagoon

Moriah,

With 

```
CONFIG_SND_HDA=y

CONFIG_SND_HDA_INTEL=y 
```

the codecs need to be built in too.

You probably have several soudcards. What does /proc/asound/devices tell?

Its quite popular for the default soundcard to be set to the wrong card. 

Add alsasound to the default runlevel. It preserves you sound card settings across reboots. Without that, your sound will be muted at boot. 

The alsa page is good reading too.

Alsamixer is still around. If you have copied it from elsewhere, your alsa install is probably incomplete.

----------

## Moriah

Short note to answer you question:

```

onesimus /usr/src/linux # cat /proc/asound/devices

  0: [ 0]   : control

  1:        : sequencer

 16: [ 0- 0]: digital audio playback

 32: [ 1]   : control

 33:        : timer

 48: [ 1- 0]: digital audio playback

 56: [ 1- 0]: digital audio capture

 64: [ 2]   : control

 83: [ 2- 3]: digital audio playback

 87: [ 2- 7]: digital audio playback

onesimus /usr/src/linux # 

```

I'll do more this afternoon, but I have a tight schedule this morning, and a bunch of paperwork to get done for work.

----------

## NeddySeagoon

Moriah,

You have three sound cards, numbered 0, 1 and 2.

For analogue audio output you need to be using sound card 1 but sound card 0 is the default, so your sound output is going to the wrong card and out of one of the digital outputs.

You can reorder your sound cards with a kernel command line parameter, or you can create an /etc/asound.conf file.  

```
defaults.pcm.card 1

defaults.pcm.device 0

defaults.ctl.card 1
```

should do nicely.

The defaults.pcm.device 0 is not strictly required, as its the default anyway.

alsamixer should show a lot more controls now, with sllders and switches

----------

## Moriah

Sound is working!    :Very Happy: 

I had to emerge media-sound/alsa-tools and media-sound/alsa-utils, which includes alsamixer, btw.

Now I still need to get bluetooth and my cellular modem working, and I think I'm ready to hit the road with this laptop.

The following is my remaining to-do list:

```

      cellular

      iptables

      bluetooth

      screen dimmer

      nite lite

      kb backlight

      battery monitoring

      fan speed

      cpu temp

      fonts

      flash      adobe site say "not found"?

      vncserver      tightvnc is ancient version

```

Of these, bluetooth for my mouse it the most important, then battery monitoring, then the cellular modem.  I'm pretty sure I can handle the cellular modem, and probably the battery.

Oh yes, I need some additional fonts so I can switch font size in emacs/xemacs, and its been so long, I don't remember which fonts those are.

iptables should be straight forward, and important before I connect via public wifi on the road.

flash is nice, but not urgent.  I mostly use it for weather radar, but it still gets used in some web pages.  I probably need a firefox plugin.

What happened to tightvnc?  I have used that for years, and now we have tigervnc, which is ok for a viewer, but what does one use for a vncserver that supports tight mode? I need a tight vnc server.

kvm will become important only after everything works.  I still have a lot of applications to install after this list is done.

----------

## Moriah

OK, I got my battery monitor working.   :Smile: 

I'm having problems with iptables.  I'll post more on it tomorrow.  <yawn> Zzzz......

----------

## NeddySeagoon

Moriah,

Pastetbin your dmesg and kernel .config file. That should shed some light on bluetooth.

What is the vendor and deviceID of your cellular modem?

You may get CPU temp for free in /sys but lm-sensors should work too.

It will need kernel support.

----------

## Moriah

```

onesimus ~ # dmesg | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/WPuWpcOfmE7BxsXBohdZ/

onesimus ~ # cat /usr/src/linux/.config | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/l9Z4YEDQiMuwNRYWUAuA/

onesimus ~ # 

```

My cellular modem is a sprint netgear aircard 341u.  It worked fine under my old 3.12.21 kernel, but will not compile under the new kernel:

```
onesimus /usr/src/GobiNet # make

rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order

make -C /lib/modules/4.14.83-gentoo/build M=/usr/src/GobiNet modules

make[1]: Entering directory '/usr/src/linux-4.14.83-gentoo'

  CC [M]  /usr/src/GobiNet/GobiUSBNet.o

/usr/src/GobiNet/GobiUSBNet.c: In function 'GobiUSBNetStartXmit':

/usr/src/GobiNet/GobiUSBNet.c:1201:10: error: 'struct net_device' has no member named 'trans_start'; did you mean 'mem_start'?

    pNet->trans_start = jiffies;

          ^~~~~~~~~~~

          mem_start

make[2]: *** [scripts/Makefile.build:329: /usr/src/GobiNet/GobiUSBNet.o] Error 1

make[1]: *** [Makefile:1527: _module_/usr/src/GobiNet] Error 2

make[1]: Leaving directory '/usr/src/linux-4.14.83-gentoo'

make: *** [Makefile:8: all] Error 2

onesimus /usr/src/GobiNet # 

```

```

onesimus /usr/src/GobiNet # cd ../GobiSerial/

onesimus /usr/src/GobiSerial # make

rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions Module.* modules.order

make -C /lib/modules/4.14.83-gentoo/build SUBDIRS=/usr/src/GobiSerial modules

make[1]: Entering directory '/usr/src/linux-4.14.83-gentoo'

  CC [M]  /usr/src/GobiSerial/GobiSerial.o

/usr/src/GobiSerial/GobiSerial.c:223:2: warning: #warning "Using legacy method of locking disc_mutex" [-Wcp]

 #warning "Using legacy method of locking disc_mutex"

  ^~~~~~~

  Building modules, stage 2.

  MODPOST 1 modules

  CC      /usr/src/GobiSerial/GobiSerial.mod.o

  LD [M]  /usr/src/GobiSerial/GobiSerial.ko

make[1]: Leaving directory '/usr/src/linux-4.14.83-gentoo'

onesimus /usr/src/GobiSerial # 

```

Where would I find cpu temp in /sys/ ?   I found the processors, but can't find anything that looks like a temperature.

----------

## NeddySeagoon

Moriah,

Please post the info I requested. That you have a sprint netgear aircard 341u, is not useful.

We need to know the actual chipset inside the device.

GobiNet looks like an obsolete out of kernel, kernel module. Its not kept up with the kernel anyway.

Lets see what we can do once we know your chipset.

Depending on your kernel settings, CPU temp may be in  /sys/class/thermal/thermal_zoneX/temp  X will be an integer starting at 0  

Bluetooth does not appear in dmesg. 

Your kernel has

```
CONFIG_BT=m

CONFIG_BT_BREDR=y

# CONFIG_BT_RFCOMM is not set

# CONFIG_BT_BNEP is not set

CONFIG_BT_HIDP=m

CONFIG_BT_HS=y

CONFIG_BT_LE=y

# CONFIG_BT_LEDS is not set

# CONFIG_BT_SELFTEST is not set

#

# Bluetooth device drivers

#

CONFIG_BT_INTEL=m

CONFIG_BT_BCM=m

CONFIG_BT_RTL=m

CONFIG_BT_HCIBTUSB=m

CONFIG_BT_HCIBTUSB_BCM=y

CONFIG_BT_HCIBTUSB_RTL=y

# CONFIG_BT_HCIUART is not set

CONFIG_BT_HCIBCM203X=m

# CONFIG_BT_HCIBFUSB is not set

# CONFIG_BT_HCIVHCI is not set

# CONFIG_BT_MRVL is not set

# CONFIG_BT_ATH3K is not set
```

so is the bluetooth module loaded?

Have you built the right driver for your device.  We need its Vendor and Device IDs.

Some devices also need   # CONFIG_RFKILL is not set, turned on and the userspace net-wireless/rfkill application installed to enable the transmitter.

Given the Vendor and Device IDs of your modem and bluetooth devices, we may be able to fix your kernel for both in one go.

----------

## Moriah

If I plug in the cellular modem, lsusb tells me:

```

Bus 002 Device 007: ID 1199:9055 Sierra Wireless, Inc. Gobi 9x15 Multimode 3G/4G LTE Modem (NAT mode)

```

How do I determine the chipset?  I think its is Broadcom, but that's only a vague recollection; I do not remember where I saw that.

Here is the lsusb and lspci output:

```

onesimus /usr/src/linux # lsusb               

Bus 002 Device 005: ID 2188:0ae1  

Bus 001 Device 003: ID 0930:6545 Toshiba Corp. Kingston DataTraveler 102/2.0 / HEMA Flash Drive 2 GB / PNY Attache 4GB Stick

Bus 001 Device 005: ID 04f2:b2ea Chicony Electronics Co., Ltd Integrated Camera [ThinkPad]

Bus 001 Device 004: ID 147e:2020 Upek TouchChip Fingerprint Coprocessor (WBF advanced mode)

Bus 001 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

Bus 002 Device 004: ID 062a:0201 MosArt Semiconductor Corp. Defender Office Keyboard (K7310) S Zodiak KM-9010

Bus 002 Device 003: ID 0451:8044 Texas Instruments, Inc. 

Bus 002 Device 002: ID 8087:0024 Intel Corp. Integrated Rate Matching Hub

Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

onesimus /usr/src/linux # lspci

00:00.0 Host bridge: Intel Corporation 3rd Gen Core processor DRAM Controller (rev 09)

00:01.0 PCI bridge: Intel Corporation Xeon E3-1200 v2/3rd Gen Core processor PCI Express Root Port (rev 09)

00:14.0 USB controller: Intel Corporation 7 Series/C210 Series Chipset Family USB xHCI Host Controller (rev 04)

00:16.0 Communication controller: Intel Corporation 7 Series/C216 Chipset Family MEI Controller #1 (rev 04)

00:19.0 Ethernet controller: Intel Corporation 82579LM Gigabit Network Connection (Lewisville) (rev 04)

00:1a.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #2 (rev 04)

00:1b.0 Audio device: Intel Corporation 7 Series/C216 Chipset Family High Definition Audio Controller (rev 04)

00:1c.0 PCI bridge: Intel Corporation 7 Series/C216 Chipset Family PCI Express Root Port 1 (rev c4)

00:1c.1 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 2 (rev c4)

00:1c.2 PCI bridge: Intel Corporation 7 Series/C210 Series Chipset Family PCI Express Root Port 3 (rev c4)

00:1d.0 USB controller: Intel Corporation 7 Series/C216 Chipset Family USB Enhanced Host Controller #1 (rev 04)

00:1f.0 ISA bridge: Intel Corporation QM77 Express Chipset LPC Controller (rev 04)

00:1f.2 SATA controller: Intel Corporation 7 Series Chipset Family 6-port SATA Controller [AHCI mode] (rev 04)

00:1f.3 SMBus: Intel Corporation 7 Series/C216 Chipset Family SMBus Controller (rev 04)

01:00.0 VGA compatible controller: NVIDIA Corporation GK107GLM [Quadro K1000M] (rev a1)

01:00.1 Audio device: NVIDIA Corporation GK107 HDMI Audio Controller (rev a1)

02:00.0 System peripheral: Ricoh Co Ltd PCIe SDXC/MMC Host Controller (rev 05)

02:00.3 FireWire (IEEE 1394): Ricoh Co Ltd R5C832 PCIe IEEE 1394 Controller (rev 04)

03:00.0 Network controller: Intel Corporation Centrino Advanced-N 6205 [Taylor Peak] (rev 34)

onesimus /usr/src/linux # 

```

----------

## NeddySeagoon

Moriah,

You take the vendor and device ID ond plug it into google. 

```
USB 1199:9055 Linux
```

One of the first hits (from Scotland) is https://cateee.net/lkddb/web-lkddb/USB_NET_QMI_WWAN.html

https://cateee.net/lkddb/ is well knows for this.

That says 

```
CONFIG_USB_NET_QMI_WWAN: QMI WWAN driver for Qualcomm MSM based 3G and LTE modems

General informations

The Linux kernel configuration item CONFIG_USB_NET_QMI_WWAN:

    prompt: QMI WWAN driver for Qualcomm MSM based 3G and LTE modems

    type: tristate

    depends on: CONFIG_USB_USBNET

    defined in drivers/net/usb/Kconfig

    found in Linux kernels: 3.4–3.19, 4.0–4.20, 5.0-rc+HEAD

    modules built: qmi_wwan
```

Further down the page you will find your 1199:9055 device listed.

So you want CONFIG_USB_NET_QMI_WWAN for your modem, which  depends on: CONFIG_USB_USBNET, so that mush be on before you can see CONFIG_USB_NET_QMI_WWAN.

Note the found in Linux kernels: 3.4–3.19, 4.0–4.20, 5.0-rc+HEADso its been an in kernel driver for a long time.

Your bluetooth is not listed. Is it disabled in the BIOS, disabled via a function key combination or even not fitted at all?

-- edit --

Your bluetooth was there and its Broadcom.

Your latest kernel contains  CONFIG_BT_BCM=m so, is bluetooth enabled and is the kernel module loaded?

----------

## Moriah

Well, bluetooth was there, but it wasn't enabled.  I had to do:

```

onesimus /usr/src/linux # /etc/init.d/bluetooth status

 * status: stopped

onesimus /usr/src/linux # /etc/init.d/bluetooth start 

 * Starting dbus ...                                                                                                                       [ ok ]

 * Starting bluetooth ...                                                                                                                  [ ok ]

onesimus /usr/src/linux # bluetoothctl 

Agent registered

[bluetooth]# 

```

I need to fiddle with the blueooth a bit, but I think I will have a working bt mouse before toolong.    :Smile: 

I'll go back to the cellular modem after I get bluetooth working completely.

So meanwhile, back to bluetooth.  With bluetooth started, bluetoothctl doesn't segfault, but I still have a problem:

```

onesimus ~ # bluetoothctl       

Agent registered

[bluetooth]# power on

No default controller available

[bluetooth]# 

```

No amount of help bothers to tell me how to establish a default controller, which I assume is the linux device that talks to all the bluetooth devices, such as my bluetooth mouse.

Why do you suppose it is saying "No default controller available", and what can I do about it?

BTW here is the result of /BT_BCM in menuconfig:

```

  | Symbol: BT_BCM [=m]                                                                                                                      |  

  | Type  : tristate                                                                                                                         |  

  |   Defined at drivers/bluetooth/Kconfig:10                                                                                                |  

  |   Depends on: NET [=y] && BT [=m]                                                                                                        |  

  |   Selects: FW_LOADER [=y]                                                                                                                |  

  |   Selected by: BT_HCIBTUSB_BCM [=y] && NET [=y] && BT [=m] && BT_HCIBTUSB [=m] || BT_HCIUART_NOKIA [=n] && NET [=y] && BT [=m] && BT_HCI |  

```

Should any of the modules above be compiled in, or vice versa?

Bluetooth modules seem to be loaded:

```

onesimus /usr/src/linux # lsmod

Module                  Size  Used by

GobiSerial             16384  0

usbserial              40960  1 GobiSerial

btusb                  49152  0

btrtl                  16384  1 btusb

btbcm                  16384  1 btusb

btintel                16384  1 btusb

iwldvm                143360  0

bluetooth             376832  11 btrtl,btintel,btbcm,btusb

ecdh_generic           24576  1 bluetooth

nvidiafb               45056  0

psmouse               110592  0

e1000e                208896  0

vgastate               20480  1 nvidiafb

iwlwifi               172032  1 iwldvm

wmi_bmof               16384  0

battery                20480  0

ac                     16384  0

onesimus /usr/src/linux # 

```

----------

## Moriah

Since I was blocked on bluetooth, I played around with the cellular modem.  I was able to build the kernel with the help you gave above so that the cell modem shows up.  I tried to connect over it, but it is not giving me the gateway address or the name servers.  To save space, here are the relevent files via pastebin:

```

onesimus ~ # dmesg | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/ZuAOj7wMkh5v5JrbiJAQ/

onesimus ~ # cat /home/rj/sprint_modem.txt | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/G1xum48hrJ4LZzpMAS7Q/

onesimus ~ # cat /usr/src/linux/.config | wgetpaste 

Your paste can be seen here: https://paste.pound-python.org/show/iHHuxYYQhM50j9PfhLhO/

onesimus ~ # 

```

----------

## NeddySeagoon

Moriah,

Your cellar modem is

```
wwan0: flags=4098<BROADCAST,MULTICAST>  mtu 1500

        inet 169.254.101.112  netmask 255.255.0.0  broadcast 169.254.255.255
```

That's new to me.  Its got a link local address.

I'm not familiar with these things at all.  My dongle shows up as a serial port. I authenticate with the remote end (wvdial or chat) over the serial link then start PPP.

I guess you need to authenticate before you can use the interface but I don't know how.

It might not like to start with other interfaces active ... you might have too many default routes.  You may have at most, one default route.

----------

## Moriah

I've had this modem for several years.  It's rather "fancy", performing NAT internally, has a web server build inot it, which I can't remember the password for.  I have used it under w7, w10, and linux 3.12.21 (using the GobiSerial and GobiNet modules that won't compile under 4.14.83-gentoo.  The gobi stuff makes it look like eth1.  Here's how I used to start it up:

```

#!/bin/bash

# sprint_modem.sh -- connect to the internet with sprint 341u modem

# load kernel driver modules for /dev/ttyUSB[012]

modprobe GobiSerial

# load kernel driver modules for sprint broadband ethernet port

modprobe GobiNet

# connect to ethernet port via dhcp

dhcpcd eth1

```

The nice website you pointed out earlier shows 2 driver for this chip: one in NAT mode, and the other in direct mode.  I prefer the NAT mode, since I don't run a server on my laptop when I'm on the road.  When I'm home, I only run sshd on it or maybe a vncserver over ssh.

----------

## NeddySeagoon

Moriah,

Other than the name change to wwan0, that should still work.

GobiSerial is listed in lsmod

GobiNet is not in lsmod. Does that matter?

usbserial is used by GobiSerial too, so it appears as a USB serial port.

The kernel says 

```
$ grep -i GobiNet -R /usr/src/linux

/usr/src/linux/drivers/net/usb/qmi_wwan.c: * GobiNet driver. The requirement has been verified on an MDM9230
```

So you need whatever kernel options build that file.   I won't be able to chase that down until the weekend.

Reading the Kconfig in that dir may help.

----------

## Moriah

GobiSerial probably should not be in lsmod.  Maybe I added it manually trying to get the modem to work.  Let me reboot and see if it is there aftr a reboot.  If so, I need to get rid of it (I *think*).    :Confused: 

----------

## Moriah

So I do have qmi_wwan in lsmod:

```

rj@onesimus ~ $ lsmod | grep \[code\]

qmi_wwan               28672  0

cdc_wdm                20480  1 qmi_wwan

usbnet                 40960  1 qmi_wwan

rj@onesimus ~ $ 

```

Here's the whole list:

```

rj@onesimus ~ $ lsmod

Module                  Size  Used by

ipt_MASQUERADE         16384  0

nf_nat_masquerade_ipv4    16384  1 ipt_MASQUERADE

ipt_REJECT             16384  0

nf_reject_ipv4         16384  1 ipt_REJECT

xt_tcpudp              16384  0

iptable_nat            16384  0

nf_conntrack_ipv4      16384  1

nf_defrag_ipv4         16384  1 nf_conntrack_ipv4

nf_nat_ipv4            16384  1 iptable_nat

nf_nat                 32768  2 nf_nat_masquerade_ipv4,nf_nat_ipv4

nf_conntrack          114688  5 nf_nat_masquerade_ipv4,nf_conntrack_ipv4,nf_nat,ipt_MASQUERADE,nf_nat_ipv4

iptable_filter         16384  0

ip_tables              24576  2 iptable_filter,iptable_nat

x_tables               40960  5 iptable_filter,xt_tcpudp,ipt_MASQUERADE,ipt_REJECT,ip_tables

btusb                  49152  0

btrtl                  16384  1 btusb

btbcm                  16384  1 btusb

iwldvm                143360  0

btintel                16384  1 btusb

qmi_wwan               28672  0

bluetooth             376832  11 btrtl,btintel,btbcm,btusb

cdc_wdm                20480  1 qmi_wwan

psmouse               110592  0

usbnet                 40960  1 qmi_wwan

wmi_bmof               16384  0

nvidiafb               45056  0

ecdh_generic           24576  1 bluetooth

mii                    16384  1 usbnet

iwlwifi               172032  1 iwldvm

e1000e                208896  0

vgastate               20480  1 nvidiafb

battery                20480  0

ac                     16384  0

rj@onesimus ~ $ 
```

I can set its ip address using dhcpcd, but dhcpcd doesn't receive a route of gateway.  I know this worked with the old GobiNet drive under the 3.12.21 kernel, so its not the hardware.  I'm thinking I need another module, or an application program or something.  Here is the menuconfig output from /QMI_WWAN:

```

  | Symbol: USB_NET_QMI_WWAN [=m]                                                                               |  

  | Type  : tristate                                                                                            |  

  | Prompt: QMI WWAN driver for Qualcomm MSM based 3G and LTE modems                                            |  

  |   Location:                                                                                                 |  

  |     -> Device Drivers                                                                                       |  

  |       -> Network device support (NETDEVICES [=y])                                                           |  

  | (1)     -> USB Network Adapters (USB_NET_DRIVERS [=m])                                                      |  

  |   Defined at drivers/net/usb/Kconfig:519                                                                    |  

  |   Depends on: NETDEVICES [=y] && USB_NET_DRIVERS [=m] && USB_USBNET [=m]                                    |  

  |   Selects: USB_WDM [=m]                                                                                     |  

```

From https://cateee.net/lkddb/web-lkddb/USB_NET_QMI_WWAN.html we see:

 *Quote:*   

> 
> 
> General informations
> 
> The Linux kernel configuration item CONFIG_USB_NET_QMI_WWAN:
> ...

 

So I am going to go looking for "A modem manager with support for QMI is recommended".

[Moderator edit: fixed [code] tag.  Placing a code inside another code can do odd things. -Hu]

----------

## Moriah

I found ModemManager, but it uses NetworkManager as a front end.  These are pretty fancy tools to manage netwrking.

I installed ModemManager and it was able t see my cellular modem, but apparently one needs NetworkManager as well to actually connect the modem to the internet, so I'm installing that as I type.

----------

## Moriah

I have fiddled with mmcli and nmcli till I'm blue in the face, and I still can't get the stupid 341U to connect to Sprint, my cellular provider.

Out of desperation, I pulled the Gentoo boot drive out of my laptop and put in an old windows-7 boot drive.  I don't think I've booted that drive for 3 years, so it took 2 hours to update it, but then I was able to connect using the 341u and the sprint provided software that runs under w7.  So at least I know the hardware still works.

I will post again tomorrow, after I reboot from the Gentoo boot drive.  I'm going to bed now.    :Mr. Green: 

----------

## NeddySeagoon

Moriah,

When it works, does it use PPP?

Do you have kernel support for PPP ?

----------

## Moriah

No, it does not use ppp.  This device presents an ethernet-like device named wwan0 that gets configured just like a normal eth0 device, with ip addr, netmask, etc.  There is a second device that is used to control the connection status, etc.  It gets talked to using the qualcom qmi protocol, which is supported by ModemManager and another qmi command line tool (qmcli?  I don't remember the name).

----------

## Moriah

I have just split this thread so the bluetooth stuff is now at:

https://forums.gentoo.org/viewtopic-t-1093520-highlight-.html

----------

## Moriah

Thank God!  I finally got my Netgear 341u usb cellular 4g modem to work!   :Very Happy: 

After days of googling and fiddling with it, I have found the combination that works for me.  My carrier is Sprint in the US.  My system is a Lenovo ThinkPad W530 laptop.  I am running kernel 4.14.83-gentoo.  First, here are my particulars:

```

Module                  Size  Used by

qmi_wwan               28672  0

cdc_wdm                20480  2 qmi_wwan

usbnet                 40960  1 qmi_wwan

mii                    16384  1 usbnet

```

The above only shows modules needed for the 341u; other modules have not been shown.

```

lsusb

Bus 002 Device 014: ID 1199:9055 Sierra Wireless, Inc. Gobi 9x15 Multimode 3G/4G LTE Modem (NAT mode)

```

likewise, only stuff pertinent to the modem is shown above.

I put together a little step by step directions file to help me remember how to connect;

```

Directions to connect Netgear 341u cellular modem to Sprint 4g network

Mon Feb 25 20:04:53 EST 2019

rj@elilabs.com

TO CONNECT

==========

- start ModemManager &

- plug in 341u modem

- mmcli -L

  this will show if 341u is seen, and its index (usually 0)

  index is needed for -m option below to identify which modem you want

- mmcli -m 0 -e

  this enables the modem

- mmcli -m 0 --3gpp-scan

  should show 310xxx - (lte, current) and maybe others available

- mmcli -m 0 --simple-connect="apn=internet"

  this will connect the modem

- mmcli -b 0

  this will show:

  -------------------------

  IPv4 configuration |   method: 'static'

                     |  address: '192.168.4.4'

                     |   prefix: '24'

                     |  gateway: '192.168.4.5'

                     |      DNS: '192.168.4.1'

                     |      MTU: '1500'

  -------------------------

- ifconfig eth0 down

  this will disable the wired ethernet

- ifconfig wlan0 down

  this will disable the wifi

- ifconfig wwan0 192.168.4.4 netmask 255.255.255.0

  this will make the modem addressable

- route add default gw 192.168.4.5

  this sets the gateway

- echo 'nameserver 192.168.4.1' > /etc/resolv.conf

  this established the nameserver

- ping 8.8.8.8

  this shows the connection to the internet is working

- ping news.yahoo.com

  the tests the nameserver

TO DISCONNECT

=============

ifconfig wwan0 down

mmcli -m 0 -d

onesimus ~ # ps ax | grep -i manag

 8127 pts/24   S+     0:00 grep --colour=auto -i manag

12236 pts/24   Sl     0:00 ModemManager

onesimus ~ # kill 12236

unplug the modem

Then do whatever if you need to establish a different internet connection,

else halt the machine.

```

This was a real pain to work out, mainly because all the manpages for the tools used assume you know all the telephone acronyms, as they use them but don't explain them.  There is no good example of how to get it all to work together to establish a working internet connection.  Part of it I guess is because these tools have to work with a lot of differrent modems, but it would be nice to have a few examples.

I hope this is helpful to someone else.    :Mr. Green: 

----------

## Hu

 *Moriah wrote:*   

> This was a real pain to work out, mainly because all the manpages for the tools used assume you know all the telephone acronyms, as they use them but don't explain them.  There is no good example of how to get it all to work together to establish a working internet connection.  Part of it I guess is because these tools have to work with a lot of differrent modems, but it would be nice to have a few examples.

 If you can spare the time, please consider filing documentation enhancement requests with these projects to have them add explanations (or links to suitable explanations) to those pages, so that future readers have a better experience. *Moriah wrote:*   

> I hope this is helpful to someone else.   

 Not to me just now, but I appreciate you taking the time to document the solution.  Too often, by the time the next person comes along and needs the information, the original solution has been forgotten and the involved parties have moved on.

----------

## Moriah

So neddy helped me with a lot of things on this upgrade/rebuild of my system, but the Netgear 341u usb cellular modem was a real stumper for a while.  I had it working with the old GobiNet driver under 3.12.21-gentoo-r1, but that driver is depricated and unmaintained now and doesn't work with the 4 series kernels.  I'm really glad I was able to get it to work, as it can be a lifesaver when I'm on the road.  Many motels/hotels here in the US have wifii, but it is an unprotected cesspool, and some of the places charge as much as $5.00 US per day to use it.  With the cell modem, I usually get a faster connection.  The only problem is if the cell signal is weak.  It usually is not though.

So how do I go about filing documentation enhancement requests?

The documentation for qmilib and qmicli reads like English was not the guy's native tongue, and he started way down in the details, which made it hard to follow.  I give him credit though; at least he wrote some documentation.

----------

## NeddySeagoon

Moriah,

Make an account on the wiki ... start writing.

Keep the page in your user area, so only you can edit it while its under development.

Others can read it and add to the talk page.

When you are ready to share write access, move the page.

See the preup and predown functions for openrcs network stuff. You should be able to do it all there.

Using a static setup with a shared resource like a cellar network isn't very safe unless you have been allocated a static setup.

----------

## Moriah

That's the information the modem passes to me.  The modem has a built-in natting firewall, so the static address is 192.168.4.4, which is a non-routable address for the internet itself.  it's safe.

Thanks for the info on writing wiki pages for documentation.    :Smile: 

----------

## Hu

I meant try to improve the manpages, since those were what Moriah said were lacking in his earlier attempts.  Composing on the Wiki and getting consensus could be a good starting point before proposing manpage improvements back to the upstream projects.  As for how to change those, that depends on the project.  Usually, it's handled like any other bug report.  Tell what you found in the manpage.  Explain why it was not sufficient.  Describe what you would like to see changed.  If you can propose specific improved wording, that is often helpful.

----------

## Moriah

The man page is fine for a man page, but what is needed is a companion HowTo.

----------

