# [SOLVED] How to configure webcam.

## terrenana

Hello,

My Nexigo USB webcam seems to not be working. I use this site: https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=&cad=rja&uact=8&ved=2ahUKEwj4kde94dXuAhWPmuAKHZ0lCGEQFjAAegQIChAC&url=https%3A%2F%2Fwww.onlinemictest.com%2Fwebcam-test%2F&usg=AOvVaw3C_n4orF8wKfwRmWNhO719 to test my webcam. It shows a black screen. Not sure if this is because I have the wrong input, or if I need to enable a kernel setting, or for someother reason. Can someone help?

Thanks!

----------

## NeddySeagoon

terrenana,

Please post your lsusb output, so we can see the webcam you have.

Please put your kernel .config file onto a pastebin site so we can see if you have kernel support for your particular webcam.

----------

## terrenana

lsusb:

```
Bus 003 Device 002: ID 1bcf:2284 Sunplus Innovation Technology Inc. Full HD webcam

Bus 003 Device 004: ID 0c76:161e JMTek, LLC. USB PnP Audio Device

Bus 001 Device 003: ID 046d:c08b Logitech, Inc. G502 SE HERO Gaming Mouse

Bus 002 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 004 Device 001: ID 1d6b:0003 Linux Foundation 3.0 root hub

Bus 003 Device 003: ID 045e:0719 Microsoft Corp. Xbox 360 Wireless Adapter

Bus 001 Device 002: ID 046d:c335 Logitech, Inc. G910 Orion Spectrum Mechanical Keyboard

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

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

```

The device is Bus 003 Device 002. It has a built in microphone aswell. When I use pavucontrol the mic shows and works fine.

kernel .config: https://dpaste.org/5wOJ

----------

## fedeliallalinea

For similar webcam in my system

```
Bus 001 Device 003: ID 1bcf:2b95 Sunplus Innovation Technology Inc.
```

I enabled

```
Device Drivers  --->

    <M> Multimedia support  --->

        [*]   Cameras/video grabbers support

        [*]   Media USB Adapters  --->

            <M>   USB Video Class (UVC)                                         

            [*]   UVC input events device support                             

            <M>   GSPCA based webcams  --->

                <M>   SUNPLUS USB Camera Driver
```

----------

## terrenana

When i go into make menuconfig to edit my kernel, i go to Multimedia support, and its symbol is ---. I can't select it to get further in the menu, or turn it on or off.

----------

## javeree

in menuconfig, press 'Z' to see the hidden items. You can then navigate to them and check what preconditions it has and why it is not showing.

----------

## NeddySeagoon

terrenana,

The 

```
<M> Multimedia support  --->
```

 help says ...

```
   CONFIG_MEDIA_SUPPORT:                                                │  

  │                                                                      │  

  │ If you want to use media devices, including Webcams, Video grabber   │  

  │ devices and/or TV devices, V4L2 codecs, etc, enable this option      │  

  │ and other options below.                                             │  

  │                                                                      │  

  │ Additional info and docs are available on the web at                 │  

  │ <https://linuxtv.org>                                                │  

  │                                                                      │  

  │ Symbol: MEDIA_SUPPORT [=m]                                           │  

  │ Type  : tristate                                                     │  

  │ Defined at drivers/media/Kconfig:12                                  │  

  │   Prompt: Multimedia support                                         │  

  │   Depends on: HAS_IOMEM [=y]                                         │  

  │   Location:                                                          │  

  │     -> Device Drivers                                                │  
```

Notice the Depends on: That is a boolean expression that must evaluate to true to be able to use the option.

In short, HAS_IOMEM is required. That's not a user selectable option. and its on in your kernel 

```
CONFIG_HAS_IOMEM=y
```

Have you ever used a text editor on your kernel .config?

----------

## terrenana

 *NeddySeagoon wrote:*   

> 
> 
> Have you ever used a text editor on your kernel .config?

 

In fact, I have. When I did, it threw a warning and the options I had added were removed. Did this break something? I am a little confused on how I can fix this. If its on in my kernel then shouldn't I be able to select the multimedia support?

----------

## NeddySeagoon

terrenana,

That's what made me suspect a text editor may have been used. Things are not self consistent.

When you use any of the kernel configuration tools, without asking you, when you select one option, it may turn on several others too.

To add to the difficulty, some of these options can be hidden' as in, not user selectable.

Its unlikely you would choose these Selects: options when you use a text editor., so you get a kernel will  an illegal .config file.

Symptoms vary. If you are lucky, the build fails, if not, you get some odd run time problems.

The solution, is not to use a text editor on the .config file ever. Well, looking is harmless.  

It really means what it says. 

```
#

# Automatically generated file; DO NOT EDIT.
```

Putting your .config into a kernel here shows

```
  │ │    [ ] HDMI CEC drivers  ----                               │ │  

  │ │    < > Multimedia support  ----                             │ │  

  │ │        Graphics support  ---> 
```

That tells that 

```
< > Multimedia support  ---- 
```

is a menu option and that you cannot go into the the menu while its set to off.

Notice the symbol change

```
< > Multimedia support  ----

<M> Multimedia support  ---> 

<*> Multimedia support  --->
```

Now you can go into the menu and select items from its sub menu(s).

If you were really lucky, the kernels automatic use of 

```
make oldconfig
```

at the start of the build process fixed any damage you did with a text editor.

If not, something may break in hard to diagnose ways.

That was all done using your posted .config file, so you should see what I saw too.

----------

## terrenana

I'm still a bit confused. After I edited the file, the lines i appended were gone. I assume this means the kernel fixed itself. I compiled the kernel on the .config which was i vim-ed into and edited. I have a working OS still. How do I fix the menuconfig issue? It seems what you are saying is I turned some options on without turning on their dependencies and broke something. I just don't get how this would break the multimedia option in menuconfig, what I edited had nothing to do with that.

----------

## NeddySeagoon

terrenana,

I don't think its broken in your .config as it worked for me.

Paste the lines from your menuconfig into a post.

----------

## terrenana

I am a total idiot. I tried to enter the menu without having it installed. I am building the new kernel right now and ill edit this post when i finished the whole process.

----------

## terrenana

Alright, my kernel finished and I rebooted, webcam still doesn't work. Using the webcam tester i mentioned still results in black screen.

----------

## NeddySeagoon

terrenana,

What does 

```
uname -a
```

 give for a date and time?

The date and time there is the date and build time of the running kernel, so if you are running the new kernel, it should show a time of a few minutes ago.

----------

## terrenana

uname -a:

```
Linux gentoo 5.10.12-gentoo #3 SMP Sat Feb 6 09:27:13 -00 2021 x86_64 AMD Ryzen 5 1600 Six-Core Processor AuthenticAMD GNU/Linux
```

If this is in my timezone (its 4:39 rn) then im pretty sure this isnt the remade kernel. Very interesting. The command i used to install the kernel was:

```
make && make modules_install install
```

 the appended install is to move the built kernel files to the correct directory (/boot) and then i 

```
cp vmlinuz efi/boot/bootx64.efi
```

 where vmlinuz is the built kernel. The copying moves it to folder for efibootmanager to boot from.

----------

## NeddySeagoon

terrenana,

I suspect you forgot to mount /boot before the kernel install.

Look in /boot now.

Next mount /boot

Look in /boot again. Has the contents changed?

```
make install
```

installs the kernel. 

```
cp vmlinuz efi/boot/bootx64.efi
```

looks wrong as that would copy vmlinuz, where in already is to $PWD/efi/boot/bootx64.efi

$PWD/ will be the root of your kernel tree, usually /usr/src/linux

The destination of the cp needs to be an absolute path, that is, starting with a /.

The #3 means that its the third build of that kernel.

What does 

```
date
```

tell?

That's your system date/time. 

```
$ date

Sat  6 Feb 23:10:23 GMT 2021

roy@NeddySeagoon_Static ~ $ uname -a

Linux NeddySeagoon_Static 5.10.2-gentoo #1 SMP PREEMPT Sat Dec 26 13:24:57 GMT 2020 x86_64 AMD Phenom(tm) II X6 1090T Processor AuthenticAMD GNU/Linux

```

both show my timezone.

----------

## terrenana

Actually, /dev/sda1 (my boot part) mounts automatically to /boot. 

Still no webcam, after everything you said.

I ran date 

```
Sat Feb  6 17:37:49 -00 2021

```

and uname -a again

```
Linux gentoo 5.10.12-gentoo #3 SMP Sat Feb 6 09:27:13 -00 2021 x86_64 AMD Ryzen 5 1600 Six-Core Processor AuthenticAMD GNU/Linux

```

This is AFTER rebuilding and reinstalling the kernel following what you said. It seems it still hasn't worked.   :Question: 

----------

## NeddySeagoon

terrenana,

Follow the timestamps.

The timestamp on your .config file should be the oldest.

The timestamp on vmlinuz should be newer, as its made from the .config

The timestamp on the running kernel 

```
uname -a
```

 will be between these two.

If that's not true, your new kernel is not being loaded.

If its correct, pastebin your new .config.

----------

## terrenana

stat vmlinuz

```
Modify: 2021-02-06 15:30:30.000000000 -0000

```

stat .config

```
Change: 2021-02-06 15:20:36.941152238 -0000

```

uname -a

```
Linux gentoo 5.10.12-gentoo #3 SMP Sat Feb 6 09:27:13 -00 2021 x86_64 AMD Ryzen 5 1600 Six-Core Processor AuthenticAMD GNU/Linux

```

This uname hasn't changed. It is clearly from 9:27 this morning, while .config and vmlinuz are from around 15:25 this afternoon.

----------

## NeddySeagoon

terrenana,

You are not using your new kernel then.

Its either not installed correctly or it's installed but its not being selected.

Follow the timestamps into /boot and look at your boot loader configuration.

Some boot loaders to not make new kernel the default option.

----------

## terrenana

I was told with efibootmgr, as long as you copy vmlinuz to /boot/efi/boot/boox64.efi, no furthur configuration was needed. Is this not true?

----------

## Buffoon

Where from did you get this vmlinuz? It must be EFI stub kernel to boot it this way.

----------

## terrenana

This vmlinuz is from make. /usr/src/linux, i configure it, then run make && make modules_install which builds the kernel, then i run make install to move it to the correct directory (/boot) then i copy the vmlinuz in /boot to /boot/efi/boot/bootx64.efi

----------

## NeddySeagoon

terrenana,

```
CONFIG_EFI=y

CONFIG_EFI_STUB=y

CONFIG_EFI_MIXED=y
```

Your kernel will boot after being loaded by a boot leader or as an EFI program, loaded directly by the EFI firmware.

What does 

```
ls -l   /boot/efi/boot/
```

show?

----------

## Buffoon

NeddySeagoon, even better is 

```
file /boot/efi/boot/bootx64.efi 
```

----------

## terrenana

I think I may have found the issue. bootx64.efi was last modifed the same time as uname -a shows. So the issue must lie when I copy vmlinuz into the directory. All of those settings are on.

----------

## NeddySeagoon

Buffoon,

I wanted to see it all, in case there are several kernels there.

A cp typo would break it.

----------

## terrenana

I correctly cp-ed it into bootx64, but now gentoo wont boot....... I tried reverting to vmlinuz.old, to no avail.

----------

## terrenana

Is it possible i build off of the .config I posted earlier? I think that one should boot. I will try this.

----------

## Buffoon

NeddySeagoon, 

then this, it will tell if the images found are EFI executables, along with date and other information.

```
file /boot/efi/boot/*
```

----------

## terrenana

It's just asking me a ton of questions as i go through the make. it isnt supposed to do that.

----------

## terrenana

This is what that command gives:

```
/boot/efi/boot/bootx64.efi:     empty

/boot/efi/boot/bootx64.efi.old: Linux kernel x86 boot executable bzImage, version 5.10.12-gentoo (root@gentoo) #3 SMP Sat Feb 6 09:27:13 -00 2021, RO-rootFS, swap_dev 0xB, Normal VGA

```

Weird.......

vmlinuz also shows EMPTY

----------

## terrenana

I fixed the bootx64.efi and im gonna fix vmlinuz and see if it will boot. Fingers crossed.

----------

## terrenana

Didn't work. I will just rebuild the kernel from .config and hope this fixes it.

----------

## terrenana

I rebuilt the kernel, still doesn't boot. Something must be wrong with the .config itself then.

----------

## NeddySeagoon

terrenana,

Do each step one at a time, so you see any failures.

You might want to use 

```
make -j<cores>
```

so the kernel is compiled with more than one core.

----------

## terrenana

make:

```
 DESCEND  objtool

  CALL    scripts/atomic/check-atomics.sh

  CALL    scripts/checksyscalls.sh

  CHK     include/generated/compile.h

Kernel: arch/x86/boot/bzImage is ready  (#5)

```

seems like there are no errors here

----------

## terrenana

make modules_install:

```
 INSTALL crypto/sha1_generic.ko

  INSTALL drivers/crypto/ccp/ccp-crypto.ko

  INSTALL drivers/crypto/ccp/ccp.ko

  INSTALL drivers/gpu/drm/i2c/ch7006.ko

  INSTALL drivers/gpu/drm/i2c/sil164.ko

  INSTALL drivers/ide/ide-core.ko

  INSTALL drivers/ide/ide-gd_mod.ko

  INSTALL drivers/media/common/videobuf2/videobuf2-common.ko

  INSTALL drivers/media/common/videobuf2/videobuf2-memops.ko

  INSTALL drivers/media/common/videobuf2/videobuf2-v4l2.ko

  INSTALL drivers/media/common/videobuf2/videobuf2-vmalloc.ko

  INSTALL drivers/media/usb/gspca/gspca_main.ko

  INSTALL drivers/media/usb/gspca/gspca_sunplus.ko

  INSTALL drivers/media/usb/uvc/uvcvideo.ko

  INSTALL fs/efivarfs/efivarfs.ko

  INSTALL net/ipv4/netfilter/iptable_nat.ko

  INSTALL net/ipv4/netfilter/nf_log_arp.ko

  INSTALL net/ipv4/netfilter/nf_log_ipv4.ko

  INSTALL net/ipv6/netfilter/nf_log_ipv6.ko

  INSTALL net/netfilter/nf_log_common.ko

  INSTALL net/netfilter/xt_LOG.ko

  INSTALL net/netfilter/xt_MASQUERADE.ko

  INSTALL net/netfilter/xt_addrtype.ko

  INSTALL net/netfilter/xt_mark.ko

  INSTALL net/netfilter/xt_nat.ko

  DEPMOD  5.10.12-gentoo

```

this seems like less output then when i do them at the same time.

----------

## terrenana

I have decided to take the easy way out.... 

I will just totally remake my kernal, i'm going re-emerge gentoo-sources. This should fix the problem

----------

## Buffoon

```
make mrproper
```

This will restore your sources, no re-emerge needed. Note, your custom .config will be gone, too.

----------

## terrenana

Ok. Big rip for my config, not a massive deal though.

----------

## NeddySeagoon

terrenana,

```
arch/x86/boot/bzImage is ready  (#5)
```

 is your kernel.

Its also build (#5). You were booting #3.

Do you get an error in the 

```
make install
```

step or the cp step?

I don't share your confidence that re-emerge gentoo-sources will fix it.

So far, its all been correct.

I suspect that /boot is full, so you get a truncated or zero size file.

----------

## Buffoon

No massive deal? A good custom .config is hours of work and many hairs lost.

----------

## NeddySeagoon

Buffoon,

Yeah, I don't have any hair left :)

----------

## terrenana

I reconfiged the kernel and re-emerged gentoo sources. Didn't work. How do I fix /boot being full? I know im booting from the right kernel, I checked /boot/efi/boot/bootx64.efi and ran stat on it. The timestamp was correct. I think something other than the kernel is wrong. Maybe some setting I enabled in the kernel is causing the system to not boot. I enabled all the default settings as per the handbook and the Camera setting and another setting for my USB microphone which worked before.

----------

## terrenana

Honestly at this point I am considering just reinstalling. It would only take me a few hours cause I only have like 6 programs which are all on my github. I just want to make sure that is only option before I go for it.

----------

## terrenana

WAIT!

I just did file * and saw this strange little thing.

```
FSCK0000.REC:                      Linux kernel x86 boot executable bzImage, version 5.10.12-gentoo (root@gentoo) #4 SMP Sat Feb 6 15:30:15 -00 2021, RO-rootFS, swap_dev 0xB, Normal VGA

FSCK0001.REC:                      Linux kernel x86 boot executable bzImage, version 5.10.12-gentoo (root@gentoo) #3 SMP Sat Feb 6 09:27:13 -00 2021, RO-rootFS, swap_dev 0xB, Normal VGA

FSCK0002.REC:                      ASCII text

FSCK0003.REC:                      data

FSCK0004.REC:                      ASCII text

FSCK0005.REC:                      data

System.map-5.10.12-gentoo:         empty

System.map-5.10.12-gentoo.old:     empty

config-5.10.12-gentoo:             empty

config-5.10.12-gentoo.old:         empty

efi:                               directory

important_kernal_instructions.txt: ASCII text

vmlinuz-5.10.12-gentoo:            Linux kernel x86 boot executable bzImage, version 5.10.12-gentoo (root@gentoo) #3 SMP Sat Feb 6 09:27:13 -00 2021, RO-rootFS, swap_dev 0xB, Normal VGA

vmlinuz-5.10.12-gentoo.old:        empty

```

Notice FSCK0001, it seems that is kernel build #3, which is the last working kernel build. It's possible i could revert to that and try to figure out what is wrong from gentoo, which would be great cause all of my tools are on gentoo. I will try this and report back.

----------

## terrenana

It didn't work...... I think I'm just going to reinstall

----------

## NeddySeagoon

terrenana,

Bad plan. You will make the same mistake again. Maybe a different one.

All those FSCK* fliles are a result of /boot not being cleanly unmounted. Remove them. They are usually file fragments.

Your kernel binary #5 is good in the build location. Do the 

```
make install
```

 and cp again.

----------

## Buffoon

Reinstall ... what? I concur with NeddySeagoon, reinstalling the whole Gentoo won't change a thing regarding your non-funct kernel.

----------

## terrenana

What I meant was I thought the problem was something other than the kernel config, I'm away from my computer right now and I'll try following NeddySeagoons instructions when I get back. Hopefully that fixes it. Btw i have 512M of space allocated for my boot partition.

----------

## NeddySeagoon

terrenana,

FAT32 is horrible. Free space can get allocated in the free space bitmap and not in the File Allocation Table, or vice vera.

The net result is that a FAT32 filesystem can be both full and empty at the same time.

The fix is to copy everything off the filesystem, remake the filesystem, then copy everything back.

Those FSCK* file fragments are a sign that all is not well.

Its essential that FAT32 is cleanly unmounted, or bad things happen.

----------

## terrenana

Alright. I did what you said, fixed everything. The webcam works, and I understand what you mean about cleanly unmounting the fat32 system. 

would:

```
sudo shutdown -h now
```

cleanly unmount the filesystem?

and is there a way I can automatically unmount it if it don't need it after boot or do I need it? When I shutdown i press this "fast restart" button on my pc which instantly restarts the computer, I think that may be the culprit. I will mark this thread as solved.

----------

## NeddySeagoon

terrenana,

/boot is not mounted for booting. Its only ever written by the kernel when you need to update the content and its never read by the kernel.

The boot loader, or UEFI firmware if you don't use a boot loader, has to make its own arrangements to read the kernel into RAM.

Until the system is booted the kernel filesystem tree does not exist. The early part of the boot process does that, after the kernel is loaded.

There is no need to have boot mounted unless you want to update its contents. 

The default for gentoo, on boot is noauto in /etc/fstab.

```
sudo shutdown -h now
```

cleanly unmounts all your filesystems, or at least, makes them read only, so they are not marked dirty.

If you use a window manager or desktop environment, it will have a shutdown menu option.

That will do various tidying up before it runs shutdown -h now,

The power button is a last resort, when you can't get control any other way. 

Instant shutdowns are always a risk.

If you change your /etc/fstab entry for boot, don't forget the 

```
mount /boot
```

 before you run 

```
make install
```

to update your kernel.

----------

## terrenana

Does this work in /etc/fstab for keeping it unmounted?

```
UUID=DB88-E886      none      vfat        defaults,noatime    0 2

UUID=197e2dd7-8ee5-442c-b111-7c2f6b43b548   none    swap    sw  0 0

UUID=b2eca445-2531-43e5-8698-28bd113ef2ef   /   ext4    defaults,noatime 0 1
```

----------

## NeddySeagoon

terrenana,

```
UUID=DB88-E886      /boot      vfat        defaults,noauto    0 2 
```

It's the noauto option that you need.

The mount point should be /boot, or wherever the vfat filesystem is attached in the filesystem tree.

Only swap is none.

----------

## terrenana

Thanks for your help, NeddySeagoon and Buffon  :Smile: 

----------

## terrenana

Bit of an issue.... I have no sound now. I will make a separate thread about this.

----------

