Add new hardware linux

Howto: Linux Add or Remove a Linux Kernel Modules / Drivers

=> Under MS-Windows you use term device driver for modules.

=> Under Linux you use term modules for device drivers.

Tutorial details
Difficulty level Advanced
Root privileges Yes
Requirements modprobe/lsmod/modinfo utilities
Est. reading time N/A

=> The Linux kernel has a modular design.

=> At boot time, only a minimal resident kernel is loaded into memory.

=> If you add new hardware you need to add driver i.e. modules.

  • No ads and tracking
  • In-depth guides for developers and sysadmins at Opensourceflare✨
  • Join my Patreon to support independent content creators and start reading latest guides:
    • How to set up Redis sentinel cluster on Ubuntu or Debian Linux
    • How To Set Up SSH Keys With YubiKey as two-factor authentication (U2F/FIDO2)
    • How to set up Mariadb Galera cluster on Ubuntu or Debian Linux
    • A podman tutorial for beginners – part I (run Linux containers without Docker and in daemonless mode)
    • How to protect Linux against rogue USB devices using USBGuard

Join Patreon

=> The modprobe command intelligently adds or removes a module from the Linux kernel

=> Usually, all Linux kernel modules (drivers) are stored in the module directory located that /lib/modules/$(uname -r) directory. To see current modules, type:
$ ls /lib/modules/$(uname -r)
Output:

Use the following command to list all drivers for various devices:
$ ls /lib/modules/$(uname -r)/kernel/drivers/
Sample outputs:

Fig.01: Device drivers on my Linux based system

Task: Add a Module (driver) Called foo

Type the following command as root user:
# modprobe foo
In this example, I am loading a module called i8k, enter:
# modprobe -v i8k
Sample outputs:

Find out info about loaded module

You need to use the modinfo command to see information about a Linux Kernel module. The syntax is:
# modinfo -v
# modinfo i8k
Sample outputs:

Fig.02: Displaying information about a Linux Kernel module called i8k

Task: List all loaded modules

Use the lsmod command to show the status of modules in the Linux Kernel:
# lsmod
Sample outputs:

Task: Remove a module called foo

Pass the -r option to modprobe command to remove a module, type:
# modprobe -r foo
You can also use the rmmod command, which is simple program to remove a module from the Linux Kernel:
# rmmod foo

Recommended readings
  • man pages – modinfo, lsmod, insmod, and modprobe

🐧 Get the latest tutorials on Linux, Open Source & DevOps via

Category List of Unix and Linux commands
Documentation help • mandb • man • pinfo
Disk space analyzers df • duf • ncdu • pydf
File Management cat • cp • less • mkdir • more • tree
Firewall Alpine Awall • CentOS 8 • OpenSUSE • RHEL 8 • Ubuntu 16.04 • Ubuntu 18.04 • Ubuntu 20.04
Linux Desktop Apps Skype • Spotify • VLC 3
Modern utilities bat • exa
Network Utilities NetHogs • dig • host • ip • nmap
OpenVPN CentOS 7 • CentOS 8 • Debian 10 • Debian 8/9 • Ubuntu 18.04 • Ubuntu 20.04
Package Manager apk • apt
Processes Management bg • chroot • cron • disown • fg • glances • gtop • jobs • killall • kill • pidof • pstree • pwdx • time • vtop
Searching ag • grep • whereis • which
Shell builtins compgen • echo • printf
Text processing cut • rev
User Information groups • id • lastcomm • last • lid/libuser-lid • logname • members • users • whoami • who • w
WireGuard VPN Alpine • CentOS 8 • Debian 10 • Firewall • Ubuntu 20.04

Comments on this entry are closed.

when the system is rebooted the module inside the kernel will not be present.But i want the modules to be seen permenently.what should i do.

Thanks alot for this, very helpful for teh newbz.

Thank’s first for the helpfull command , where can i get the new modules other then my OS,

how to build linux kernel module with new device driver module during build

Thanks a lot for the info…:) 🙂

Hi there…
I am trying to remove TCP IP from a linux kernel, and want to recompile the LINUX kernel. But being a novice with the administrations of the linux (UBUNTU 10.4), I know a little about it. Agter recompilation can I again design mu own TCPIP using the C language code?
Guys please help me out…waiting for the reply .
Regards…

Thanks for this very short but very clear information. That helps me to understand the concept (of add or remove module on Linux) very much.

One question remain: how do we check to know what modules are available to add on a existing system?

Thank you in advance!

One question remain: how do we check to know what modules are available to add on a existing system?

cd to /lib/modules/$(uname -r) directory and you can see the list of available modules (run as root):

The following will list all drives

To find out more info about a module called foo:

Hope this helps!

Hi
thanks for your comments, I am trying to write a printer driver for linux, what should I do?

Please help me on this task.

Does anyone knows step by step guide for how to install ip_conntrack support into kernel Linux linux 2.6.35.14-106.fc14.i686 #1 SMP Wed Nov 23 13:57:33 UTC 2011 i686 i686 i386 GNU/Linux

I am unable to remove the following modules after issuing the commands.
$ rmmod usbhid and
$rmmod hid..

After issuing the commands the modules are not shown in “lsmod” but as soon as a device is added they again get loaded.

thanks, very clear article.

Hello there. I have an old computer Celeron, 128MB RAM and 28MB of VGA. What I want to do is keep the drivers that are needed for my system. Like if I use the Realtek Chipset for Network Card why should the Atheros driver be present on the system? Is there any way to accomplish this task?
Regards.

I have a serious problem, my Linux does not have these comands:
apt-get
uname
modprobe
mknod
man
…etc… and also has not a lot of typical commands

And there is no /dev/loop*

And mount -o loop blablabla bleble say incorrect option, does not undertand loop.

Of course, all problem seem that Kernel has no loop device support.

How can i fix it?

Please have in mind Kernel is on ROM (a chip not writteable), it is not a flasheable chip, i can not modify it on any way, … read only memory chip!!

I wish if it could be possible to add loop device support at run time as a module…

But it does not have modprobe command… neither a lot of clasic Linux commands… so i got to fail.

Need some help, i am not an expert.

Step 1: try to create /dev/loop0 (it does not exists) with mknod but mknod command not found

Try to add such coomands with apt-get, wget, etc… all says such commands not exists

I am getting mad…

Please note it is an ARM processor based, and Kernel is on a ReadOnly chip not flashable.

Thanks in advance for any help… i am getting really mad…

If I were you, rather than finding Linux Kernel modulos to have “uname”, “modprobe”, “man” recovered (maybe you have played around some kernel rebuild and screwed up some basic binaries?), I will re-install the entire Linux OS from scratch. You can download CentOS (Red Hat) or SUSE, Fedora or whatever Linux to have all these basic utilities included.

trying to add slcan module to kernel 2.6.32-504.30.3.el6.i686 but having problems with the following response … question is how to get it added

FATAL: Module slcan not found.

Thank you so much…

i want to know how many mouldes in linus and brief explanation of them.i will glad if my question is been answered.

hi all,
iam unable to remove nvme module in primary drive(ssd) by using
following comment:
rmmod nvme

Источник

Migrate installation to new hardware

This article discusses the steps required for moving an Arch Linux system to new hardware. The goal is to achieve the same ArchLinux installation, in terms of the installed software and configuration that is independent of the hardware.

There are two different approaches to migrating an installation:

  1. Bottom to top: Install a fresh Arch Linux system on the new hardware, afterwards restore the installed packages and configuration files, e.g. as described in dotfiles.
  2. Top to bottom: Clone the old harddrive to the new harddrive, or place the old harddrive into the new system; modify configuration files where necessary.

The top to bottom approach gives a more exact reproduction of the original system than the bottom to top approach.

Contents

Adapt to new hardware

Before you begin, research aspects of the new hardware and make a list of differences. Common differences are

Hard drive vs. SSD

See the article SSD.

CPU vendor

If you switch the CPU, to a CPU from another vendor (e.g. Intel to AMD), change the Microcode configuration.

GPU vendor

If you changed the GPU to a GPU from another vendor (e.g. from Amd to NVIDIA) change the graphics driver.

UEFI vs. MBR boot code booting

If you switch to a more recent mainboard with UEFI, it might be preferable or required to switch from «MBR boot code» booting to UEFI booting. In this case a new EFI system partition is needed.

Bottom to top

On the old system

We define here a minimal configuration that carries over from the old to the new system which differentiates this approach from the Installation guide. Think about the configuration files from /etc and dotfiles in /home that you want to copy to the new system, as well as user data files. If you will not have access to the old system from the new system then backup up all the files that you want to copy over.

List of installed packages

gives you a nice list of explicitly installed packages from the repositories and from the AUR. Include it in your backup if you make one.

You may also use the following script to give you a better overview of the binaries and libraries installed unbeknownst to pacman (e. g. installed via Steam, Desura or using their own install methods):

pacman cache

Consider backing up /var/cache/pacman/pkg/ if you do not change architectures (for example from x86 to x86_64).

On the new system

Installation guide first half

For basics about installing a new system, refer to the Installation guide. Follow the first half of the installation guide up to but excluding the pacstrap command.

Copy pacman cache

Copy the pacman cache found at /var/cache/pacman/pkg/ from the old to the new system, or from the backup to the new system.

Installation guide second half

Continue with the installation guide from, and including the pacstrap command, up to the end, but do not reboot. Do not skip the pacstrap command as it does additional work besides the installation of packages.

Install previously installed software

Edit pkglist.txt (and pkglist_aur.txt) and remove drivers that are not needed on the new system. Then install any other previously installed software with

Top to bottom

There are two options for the Top to Bottom approach, you can either keep the drive where the system is already installed, and modify its contents, or you can copy the system to a new drive. If you keep the drive, and modify it, then place it back into the old system, the modifications will likely prevent the old system from booting.

Clean up the old system

It is also worth to clean up your system before cloning it, as described in System maintenance#Clean the filesystem. Make sure that the old system is still working as expected after the cleanup before moving on.

Copy the system to a new drive

There are two fundamental methods for copying the system to a new drive, disk cloning and file copying.

Disk cloning

It is required to use a live linux system rather than the old Arch Linux system; for example you could use the Arch Linux USB flash installation media. The partition layout and filesystems of the old system will be reproduced.

File copying

  • Create new partitions and filesystems on the new drive. You can use the opportunity to chose a different partition layout and/or filesystems than before.
  • For each filesystem, copy the files from the old to the new drive, using rsync or other tools that preserve permissions, attributes, etc., see rsync#Full system backup, rsync#File system cloning for further details.

Transport options

There are many different methods for how to transport the data between the two drives:

  • Connect origin and destination HDDs to the same computer, either the old or the new one. Data link: old HDD -> computer -> new HDD.
  • Make use of temporary storage devices like external HDDs, or cloud backups. Data link: old HDD -> old computer -> storage -> new computer -> new HDD. For an overview see the article System backup.
  • Transfer data over network, for example with rsync. Data link: old HDD -> old computer -> network -> new computer -> new HDD.

For the first two options, consider that you might need adapters to connect the HDDs (PATA->SATA, USB-HDD-Cases, etc.), and choose a connection that is sufficiently fast.

The last two options require you to use a live linux system on the new computer, as it is not possible to boot from the new hard drive at this point.

Update fstab

If you are using an Arch Linux Installation Image, mount the new root partition to /mnt , and any other partitions required like you would in a normal install (see Installation guide#Mount the file systems).

Insert an arbitrary comment such as #end of old fstab at the end of your /mnt/etc/fstab . Generate a new fstab file as indicated on Installation guide#Fstab, appending it to the current fstab file. In general, always review the fstab file created by genfstab. In this case, check the older fstab entries before the comment, if they are outdated or duplicates then delete them, and if the old entries remain useful then keep them. For example, mount entries for network drives can be kept. In general it is recommended to use Persistent block device naming.

Reinstall the boot loader

You might need to reinstall and/or reconfigure the boot loader for the following reasons:

  • Different disks, partition layout, or filesystem
  • Adding UEFI boot entries into the new mainboard NVRAM
  • Migration from «MBR boot code» booting to UEFI booting
  • Migration from USB to SATA/NVMe
  • Updating the kernel commandline
    • In case of a different GPU, update the framebuffer mode
    • Update the Microcode initramfs image

If you are using a Arch Linux live environment, then before reinstalling the boot loader, change root into the new system:

Refer to the article on your boot loader for instructions on how to (re)install it.

Regenerate kernel image

It is recommended to regenerate the initramfs image with mkinitcpio, although initially the fallback initramfs image may work.

Reconfigure audio

  • alsamixer volume
    • save settings

Reconfigure network

If the old installation and the migrated installation shall coexist in the same network, set a new hostname with hostnamectl.

Also consider configuration changes that are required after a change in hostname:

  • /etc/hosts
  • other apps using hostname: synergy, nut (network ups tools)
  • grep -Ri ‘hostname’ /etc (as the root user)should give some hints on the files to be updated

The network interface names may change when using dhcpcd with named network interfaces.

  • Running dmesg | grep ‘renamed from eth’ as root might help to find the new interface name
  • remove old: disable dhcpcd@enpXs0.service
  • activate new: enable dhcpcd@enpXs0.service

Источник

Читайте также:  Sliding door and windows
Оцените статью