3 ms·
i am forced to do sudo -s, enter my password and then enter echo -n "0000:00:14.0" | tee /sys/bus/pci/drivers/xhci_hcd/unbind this is because somehow my usb i
by 2Gkashmiri 5y ago
i am forced to do sudo -s, enter my password and then enter
echo -n "0000:00:14.0" | tee /sys/bus/pci/drivers/xhci_hcd/unbind
this is because somehow my usb is broken on motherboard and it makes cpu 100% with full fan running, some over current issue. this command disables all usb.
the problem is i am forced to open terminal, up, enter password, enter, up, enter, exit, exit on every boot time.
it gets tiring and i found no good way for bash to automate typing password on sudo -s. any ideas?
- dgfitz 5y agoThe hack would be to put it in rc.local but don’t do that. The more correct way would be to make an init.d/systemd service to run on boot, which executes as root. The most correct solution would be to get a new keyboard or re-pin your usb connector.
- 2Gkashmiri 5y agothis is a laptop so i am out of luck on that one.
- 2Gkashmiri 5y agohttps://tecadmin.net/run-shell-script-as-systemd-service/ https://tecadmin.net/run-shell-script-as-systemd-service/ this?
- dgfitz 5y agoYup that should do it
- mmh0000 5y agoThere are multiple ways to fix this, here's some of the methods of the top of my head ranked best to worst: 1: Write a udev rule to unbind the 0000:00:14.0 device when detected. This is the best solution, and a google search can show you how. But does require some underlying knowledge of devices and udev. [A][B][C] 2: Create a systemd startup service that runs your above commands at startup. This is less elegant than the above, but the end result would mostly be the same. [H] 3: Configure sudo to not require a password, then create an xdg-autostart script that runs your command. [W][X] [A] https://wiki.gentoo.org/wiki/Udev https://wiki.gentoo.org/wiki/Udev [B] https://www.linuxquestions.org/questions/linux-software-2/udev-rules-for-hid-binding-unbinding-of-custom-driver-4175685728/ https://www.linuxquestions.org/questions/linux-software-2/ud... [C] https://github.com/Roboy/flexrayusbinterface/issues/13 https://github.com/Roboy/flexrayusbinterface/issues/13 [H] https://wiki.archlinux.org/title/systemd#Writing_unit_files https://wiki.archlinux.org/title/systemd#Writing_unit_files [W] https://phpraxis.wordpress.com/2016/09/27/enable-sudo-without-password-in-ubuntudebian/ https://phpraxis.wordpress.com/2016/09/27/enable-sudo-withou... [X] https://specifications.freedesktop.org/autostart-spec/autostart-spec-latest.html https://specifications.freedesktop.org/autostart-spec/autost...
- hawski 5y agoOther answers are better, but in the shell you can do above without a separate sudo login. For example: echo -n "0000:00:14.0" | sudo tee /sys/bus/pci/drivers/xhci_hcd/unbind