Windows 10: WSL run commands on boot as sudo

Discus and support WSL run commands on boot as sudo in Windows 10 Support to solve the problem; I have pihole installed on ubuntu linux. It works fine except i have to manually run couple of commands on windows boot. I am running windows 10 home... Discussion in 'Windows 10 Support' started by edvrfn, May 22, 2020 at 5:17 AM.

  1. edvrfn Win User

    WSL run commands on boot as sudo


    I have pihole installed on ubuntu linux. It works fine except i have to manually run couple of commands on windows boot. I am running windows 10 home 18363.836. I want those commands to run on windows boot and if it can happen even before i logon to windows would be best. And that sudo elevation is needed to run those commands . How can this be achieved.

    pihole restartdns
    service lighttpd restart

    :)
     

  2. WSL unable to perform DNS lookup

    Can you go back and check that WSL hasn’t over written resolv.conf

    If it has can you fix it again and then run:

    sudo chmod 444 /etc/resolv.conf

    Regards,

    Ross
     
  3. Error "Server execution failed" when trying to run bash command in Windows 10 (Version 10.0.17763.475)

    As the title says, when I try to run the "bash" command, I get an error saying, "Server execution failed". I got this problem after I ran the "sudo apt-get update" and "sudo apt-get upgrade -y" commands during my last successful run of the WSL and then
    exiting out of it immediately. I'm not sure if that could've caused the issue, though.

    Any help would be greatly appreciated. Thanks in advance. (Is this posted under the right category?)
     
  4. Bree Win User

    WSL run commands on boot as sudo

    Installation media boots to command prompt

    I've just booted from known working install media to see exactly what it does when booting. The sequence of events is...

    1. Windows logo on a black screen
    2. circling dots appear beneath the logo
    3. light blue 'Please wait' screen with circling dots
    4. a command prompt window (very briefly)
    5. the initial Setup page appears

    Do you see steps 1-3? If so, it appears you have stopped at step 4, suggesting that something on the disc cannot be read.

    Does the disc boot properly in another machine? If so, try cleaning the laptop's drive lens then try booting from the disc again.

    If not, make new install media with Microsoft's Media Creation Tool, either as a bootable USB, on an ISO that you can burn to another disc. At Step 8 in Option One of this tutorial you can choose between making a USB or an ISO.

    Download Windows 10 ISO File
     
Thema:

WSL run commands on boot as sudo

Loading...
  1. WSL run commands on boot as sudo - Similar Threads - WSL run commands

  2. running .exe command

    in Windows 10 Customization
    running .exe command: I am using mingw compiler. while i am running a CC++ program works fine program it compiles successfully but when i ran it i am facing a problem.I am getting that access is denied.I tried reinstalling but nothing has changed.I am facing this problem when i am connected to...
  3. run command not working

    in Windows 10 Drivers and Hardware
    run command not working: I reinstalled Windows and now when I open "Run" and type a command, it just disappears. https://answers.microsoft.com/en-us/windows/forum/all/run-command-not-working/9148aa0a-a0b5-4334-8ce6-3ca44ba85289
  4. Windows 10 Doesn't boot after running command

    in Windows 10 Customization
    Windows 10 Doesn't boot after running command: I am trying to get my Hypervisor running. after days of problems and finally have everything correctly done it still "isn't running" Its enabled in my bios and checked off in Turn Windows features on and off. I then found that you need to enable it during boot loadup. So I...
  5. WSL does not show a command line prompt.

    in Windows 10 BSOD Crashes and Debugging
    WSL does not show a command line prompt.: Hi, I have trouble starting WSL. The window opens, but I cannot type anything. It is showing a black/blue window with a blinking prompt. I rebooted my system and it still doing that. Any idea how to fix this?...
  6. run command problem

    in Windows 10 Customization
    run command problem: what I enter in run command it is not saving history why so https://answers.microsoft.com/en-us/windows/forum/all/run-command-problem/c25284b3-3a40-4898-aa2f-bd7912b033d6
  7. Cannot run Ubuntu with WSL

    in Windows 10 Installation and Upgrade
    Cannot run Ubuntu with WSL: I have Windows 10 Education build 18272.rs_prerelease.181026-1425. I have turned on Windows Subsystem for Linux, but I cannot run Ubuntu. I have tried installing the apps "Ubuntu" and later "Ubuntu 18.04 LTS" from the Windows store and running them. Upon installing either app...
  8. Run Ubuntu (WSL) app minimized

    in Windows 10 Software and Apps
    Run Ubuntu (WSL) app minimized: Ordinarily, I can right click on an app to trace back to the application file in File Explorer, open its properties tab, and set it to run minimized from there. With Ubuntu, that isn't possible. So how can I make it run minimized?...
  9. Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10

    in Windows 10 Tutorials
    Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10: How to: Add, Remove, and List Sudo Users in a WSL Linux Distro in Windows 10 How to Add, Remove, and List Sudo Users in Windows Subsystem for Linux (WSL) Distro in Windows 10 The Windows Subsystem for Linux (WSL) is a new Windows 10 feature that enables you to run...
  10. Running Commands as an Administrator

    in Windows 10 Support
    Running Commands as an Administrator: I've just downloaded my Windows 10 upgrade and can't send mail through Outlook 13. On a forum I was told to run the sfc command but when I tried, I was told that I'm not an administrator. Mine is the only account on my PC, so surely I must be. Help please! 16164