Como instalar o / lib / modules / $ (uname -r) ausente no meu contêiner do docker confiável

3

Execução do docker em um Mac

docker pull ubuntu:14.04
docker run -i -t ubuntu:14.04 /bin/bash

Base padrão do Linux

root@d112db1e835e:~# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.5 LTS
Release:    14.04
Codename:   trusty

Meu objetivo é aposentar um laptop dedicado que usei para criar um bom código C antigo e usar um contêiner docker.

Para compilar meu código, meu Makefile está tentando executar

Makefile:       /usr/bin/make -C /lib/modules/$(shell uname -r)/build M=$(PWD)/linux/$* modules

infelizmente, a pasta modules está vazia

mysuer@d112db1e835e:~/robot$ ls -al /lib/modules/
ls: cannot access /lib/modules/: No such file or directory

Na minha máquina linux, eu posso encontrar os módulos

$ ls -al /lib/modules/
total 28
drwxr-xr-x  7 root root 4096 Dez 13  2016 .
drwxr-xr-x 24 root root 4096 Apr 24  2017 ..
drwxr-xr-x  5 root root 4096 Dez 13  2016 3.13.0-105-generic
drwxr-xr-x  5 root root 4096 Jun 23  2015 3.13.0-55-generic
drwxr-xr-x  5 root root 4096 Jul 10  2015 3.13.0-57-generic
drwxr-xr-x  5 root root 4096 Nov  3  2015 3.13.0-65-generic
drwxr-xr-x  5 root root 4096 Nov 24  2015 3.13.0-68-generic

mas sem módulos na minha janela de encaixe.

Na minha janela de encaixe

uname -r
4.9.60-linuxkit-aufs

daí

/usr/bin/make -C /lib/modules/4.9.60-linuxkit-aufs/build .... FAILS

/lib/modules/4.9.60-linuxkit-aufs não está lá.

Como faço para contornar isso?

Tentando instalar cabeçalhos

apt-cache search linux-headers-4
linux-headers-4.2.0-18 - Header files related to Linux kernel version 4.2.0
linux-headers-4.2.0-18-generic - Linux kernel headers for version 4.2.0 on 64 bit x86 SMP
linux-headers-4.2.0-18-lowlatency - Linux kernel headers for version 4.2.0 on 64 bit x86 SMP
linux-headers-4.2.0-19 - Header files related to Linux kernel version 4.2.0
linux-headers-4.2.0-19-generic - Linux kernel headers for version 4.2.0 on 64 bit x86 SMP
linux-headers-4.2.0-19-lowlatency - Linux kernel headers for version 4.2.0 on 64 bit x86 SMP
linux-headers-4.2.0-21 - Header files related to Linux kernel version 4.2.0
linux-headers-4.2.0-21-generic - Linux kernel headers for version 4.2.0 on 64 bit x86 SMP
linux-headers-4.2.0-21-lowlatency - Linux kernel headers for version 4.2.0 on 64 bit x86 SMP
linux-headers-4.2.0-22 - Header files related to Linux kernel version 4.2.0
...

Não encontro cabeçalhos para 4.9.60

root@d112db1e835e:~#  apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package linux-headers-4.9.60-linuxkit-aufs
E: Couldn't find any package by regex 'linux-headers-4.9.60-linuxkit-aufs'

ou

root@d112db1e835e:~# apt-cache search linux-headers-4.9
root@d112db1e835e:~# 

nenhum candidato

root@d112db1e835e:~# apt-get install linux-headers 
Reading package lists... Done
Building dependency tree        
Reading state information... Done
Package linux-headers is a virtual package provided by:
  linux-headers-4.4.0-1010-aws 4.4.0-1010.10
  linux-headers-4.4.0-1009-aws 4.4.0-1009.9
... FILTERED ...
  linux-headers-3.13.0-100-lowlatency 3.13.0-100.147
  linux-headers-3.13.0-100-generic 3.13.0-100.147
You should explicitly select one to install.

E: Package 'linux-headers' has no installation candidate
root@d112db1e835e:~# 

não retorna nenhum pacote

root@d112db1e835e:~# apt-cache search linux-source     
linux-source - Linux kernel source with Ubuntu patches
linux-source-3.13.0 - Linux kernel source for version 3.13.0 with Ubuntu patches
    
por zabumba 17.01.2018 / 23:41

1 resposta

3

O Docker para Mac é construído com o Hyperkit para virtualização (consulte FAQ ), e executa um linuxkit

Eu recomendo usar o QEMU para esse tipo de trabalho, pois você pode emular diferentes tipos de hardware, usar BIOS diferentes e até mesmo pxeboot usando ipxe .

Dito isto, para responder à sua pergunta, você precisará instalar o linux-virtual para ter um kernel genérico do linux para o seu contêiner.

EDIT: também uname -r não funciona, pois será uma versão do kernel diferente. A versão padrão do kernel para o trusty (14.04) ainda é 3.x

    
por 29.01.2018 / 01:05

Tags