How do I disable and then re-enable network card?

Questions about Wi-Fi and other network devices, file sharing, firewalls, connection sharing etc
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

How do I disable and then re-enable network card?

Post by MlxySF »

Hi there everyone, I'm new to Linux and wonder if there is Plug N Play commands like on Windows available on Linux. Currently, I can't dig any information on the internet unless for lshw, udev and much more. The commands I need is the below :

pnputils /disable-device {device id}
and /enable-device

These are the command on Windows, wonder if anyone have a solution to have a similiar or run these on linux. Thanks in advance!
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
User avatar
xenopeek
Level 25
Level 25
Posts: 29597
Joined: Wed Jul 06, 2011 3:58 am

Re: PnP commands in Linux

Post by xenopeek »

I guess you mean pnputil, not pnputils. This tool: https://docs.microsoft.com/en-us/window ... and-syntax

I don't think there is a single command that is equivalent for all device types. Perhaps instead start with specifically what device you want to disable and why?
Image
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: PnP commands in Linux

Post by MlxySF »

xenopeek wrote: Mon May 23, 2022 9:34 am I guess you mean pnputil, not pnputils. This tool: https://docs.microsoft.com/en-us/window ... and-syntax

I don't think there is a single command that is equivalent for all device types. Perhaps instead start with specifically what device you want to disable and why?
I wanna disable my network card and re-enable it. It's because my PC is kinda weird with the internal network cards. In Windows, I have to disable and enable it using the commands I stated in the ori post in order for the network card to be able to connect to internet and be used without any issues. Without disable and enabling it, network card will have issues in Windows, and also Linux of course.
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: PnP commands in Linux

Post by MlxySF »

xenopeek wrote: Mon May 23, 2022 9:34 am I guess you mean pnputil, not pnputils. This tool: https://docs.microsoft.com/en-us/window ... and-syntax

I don't think there is a single command that is equivalent for all device types. Perhaps instead start with specifically what device you want to disable and why?
And yea its the pnputil.exe in windows which have the command that I stated above.
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: How do I disable and then re-enable network card?

Post by MlxySF »

Also, a thing to mention is that the network card will boot as "The device is not working" and therefore there is no logical names to do sudo ifconfig name up.
cliffcoggin
Level 8
Level 8
Posts: 2297
Joined: Sat Sep 17, 2016 6:40 pm
Location: England

Re: How do I disable and then re-enable network card?

Post by cliffcoggin »

Rather trying try to find an equivalent to your Windows bodge, it would be better to fully describe your problem in order to get a proper fix.
Cliff Coggin
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How do I disable and then re-enable network card?

Post by rene »

If the NIC shows in lspci as e.g.

Code: Select all

[ ... ]
00:19.0 Ethernet controller: Intel Corporation 82567LM-3 Gigabit Network Connection (rev 02)
[ ... ]
you can try

Code: Select all

sudo sh -c 'echo -n 1 >/sys/bus/pci/devices/0000:00:19.0/reset'
or maybe

Code: Select all

sudo sh -c 'echo -n 1 >/sys/bus/pci/devices/0000:00:19.0/rescan'
If need be,

Code: Select all

sudo sh -c 'echo -n 1 >/sys/bus/pci/devices/0000:00:19.0/remove && sleep 1 && echo -n 1 >/sys/bus/pci/rescan'
Supposedly at least of one those does what Windows' PNPUTIL does.
User avatar
Termy
Level 12
Level 12
Posts: 4248
Joined: Mon Sep 04, 2017 8:49 pm
Location: UK
Contact:

Re: How do I disable and then re-enable network card?

Post by Termy »

Could OP just use ip(8) to enable and disable the network interfaces? IE: ip link set IFACE [up|down]
I'm also Terminalforlife on GitHub.
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How do I disable and then re-enable network card?

Post by rene »

No; see just above me; there's seemingly nothing to ip up/down. I assume it's a matter of a firmware reload trigger and that might point to possible better solutions such as resetting the card from the initramfs so that the later module load finds it in consistent state -- but if it's not working on Windows either, whatever I guess, at least for now.
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: How do I disable and then re-enable network card?

Post by MlxySF »

Have no luck on trying all the above, my network card is bcm4359 which is using the firmware-b43-installer. Whenever I boot, network card will either be disabled and wifi internet connections cannot be turned on, or the card works and it can find internet connections, but it will be stucked at connecting when prompt to be connected and coming out lots of internet password request, and then the network card will went down and can't enable wifi anymore.

This issue also happens in Windows but a different situations. In windows, it will boot fine or sometimes marked as problematic, and after internet connected after a few mins of usage it will disconnect from the internet and the network card cannot connect to WiFi anymore. But this problems are all fixed by everytime I boot like I said I created a bat file with the first post commands to disable and enable the network card and it works well without any issue till the next reboot.

Wonder if anybody had any similiar problems and have any other possible solutions? Thanks!
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How do I disable and then re-enable network card?

Post by rene »

So as to give people google fodder you will want to post output of inxi -Fxz.
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: How do I disable and then re-enable network card?

Post by MlxySF »

These are the results from inxi -Fxz

https://ibb.co/t3gN4hr
https://ibb.co/dWS6rvj
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How do I disable and then re-enable network card?

Post by rene »

Note that you can just mouse-select the text in a terminal window, rclick-copy and rclick-paste into a reply box such as here on the forum; preferably in between [code ]...[/code] tags (also available from the </> button above the reply box when you are replying) so as to retain formatting.

Any case; am not finding similar issue for your Lenovo G460 with BCM43228. Your v2.15 BIOS version appears latest -- but it's a system from circa 2010 and with specifically troublesome closed/proprietary Broadcom WiFi. I believe you can try to run

Code: Select all

sudo apt-get install bcmwl-kernel-source
which will install a driver, and then reboot to see. If not I'll need to excuse myself from the thread; am not a mobile tech person, and this system is getting to be too old to have many relevant google results around even if they exist.
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: How do I disable and then re-enable network card?

Post by MlxySF »

I tried installing drivers too, but doesn't fix the problems. It might not be driver issues but others which I'm not sure. As in Windows, just a simple disabling and enabling the device back again fix the problem. On Linux, I can't find anything to enable and disabling the driver unfortunately, bad for me as I really wanna try out Linux mint :(
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How do I disable and then re-enable network card?

Post by rene »

Have you tried the exact apt-get command (and reboot) I suggested?

Otherwise; my above advised echoing into sysfs should disable/enable, certainly the last remove/rescan. No other suggestions I'm afraid...
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: How do I disable and then re-enable network card?

Post by MlxySF »

rene wrote: Tue May 24, 2022 11:49 am Have you tried the exact apt-get command (and reboot) I suggested?

Otherwise; my above advised echoing into sysfs should disable/enable, certainly the last remove/rescan. No other suggestions I'm afraid...
Yup I have tried the apt-get install bcmwl-kernel-source command and sudo reboot. But didn't work :(

Also sometimes the echoing commands works, it does disabled the network card, but then I can't enable it anymore for some reason. Well, I guess I have to abandon the toughts of using Linux on this old machine and stick with Windows 10 then :(
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: How do I disable and then re-enable network card?

Post by rene »

Well; it's supposedly at least somewhat Broadcom specific, so I guess it might be worth a shot to see if the board's expert on those matters feels anything worth mentioning; he'll get pinged by the below quote. I myself am as said not a mobile tech person.

Just so as to doubly note for his potential sake, in case it needs to be undone again for the sake of further tries: bcmwl-kernel-source has been installed, i.e., the driver DKMS-ed.
JeremyB wrote: Sun May 22, 2022 5:20 pm
sleeper12
Level 21
Level 21
Posts: 14561
Joined: Thu May 25, 2017 3:22 pm

Re: How do I disable and then re-enable network card?

Post by sleeper12 »

Try:

Code: Select all

sudo apt remove firmware-b43-installer && sudo apt install --reinstall bcmwl-kernel-source
Reboot

Also post what this shows:

Code: Select all

iwconfig
MlxySF
Level 1
Level 1
Posts: 9
Joined: Mon May 23, 2022 4:24 am

Re: How do I disable and then re-enable network card?

Post by MlxySF »

Hi there sorry for the late reply, tried the command too and still not working. Have uninstalled Linux Mint, but I'm always interested in testing and moving over from Windows, just need the WiFi thingy to be fixed like on Windows.

Just an off topic right here, maybe anyone knows whats the problem of my Mini PCI-E slot is or any other things that may be related to cause this network card issue? I bought another Intel Mini PCI-E network card too, and also it's the same problem on Windows and I have to disable and enable using the commands in the bat file everytime I boot up.

Thanks in advance!
Locked

Return to “Networking”