I can't start my linux in qemu-vm












0














I try to run a Ubuntu in my qemu,but I always encounter errors:



[  OK  ] Started Create Static Device Nodes in /dev.
[FAILED] Failed to mount /sys/kernel/config.
See 'systemctl status sys-kernel-config.mount' for details.
[DEPEND] Dependency failed for Local File Systems.
[DEPEND] Dependency failed for Mark the need to relabel after reboot.
[FAILED] Failed to start Remount Root and Kernel File Systems.
....
[FAILED] Failed to start Raise network interfaces.
See 'systemctl status networking.service' for details.
[ OK ] Reached target Network.
You are in emergPress Enter for maintenance
(or press Control-D to continue):


and this a minimal Debian-stretch Linux image,the kernel I built with my config



and this is my command to run start:



qemu-system-x86_64 
-kernel /home/hunter/Desktop/linux-4.4.33/arch/x86/boot/bzImage
-append "console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=QUZ"
-hda stretch.img
-net user,hostfwd=tcp::10021-:22 -net nic
-enable-kvm
-nographic
-m 1G
-smp 2
-pidfile vm.pid
2>&1 | tee vm.log


and this is my script to creatw a image:



#!/bin/bash
# Copyright 2016 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

# create-image.sh creates a minimal Debian Linux image suitable for syzkaller.

set -eux

# Create a minimal Debian distribution in a directory.
RELEASE=stretch
DIR=stretch
sudo rm -rf $DIR
mkdir -p $DIR
sudo debootstrap --include=openssh-server,curl,tar,gcc,libc6-dev,time,strace,sudo,less,psmisc,selinux-utils,policycoreutils,checkpolicy,selinux-policy-default $RELEASE $DIR
sudo chroot stretch /bin/bash -c "apt-get update; apt-get install -y curl tar time strace gcc net-tools iputils-ping make sysbench git vim screen usbutils"

# Set some defaults and enable promtless ssh to the machine for root.
sudo sed -i '/^root/ { s/:x:/::/ }' $DIR/etc/passwd
echo 'T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100' | sudo tee -a $DIR/etc/inittab
printf 'nauto eth0niface eth0 inet dhcpn' | sudo tee -a $DIR/etc/network/interfaces
echo '/dev/root / ext4 defaults 0 0' | sudo tee -a $DIR/etc/fstab
echo 'debugfs /sys/kernel/debug debugfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
echo 'securityfs /sys/kernel/security securityfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
echo 'configfs /sys/kernel/config/ configfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
echo 'binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0' | sudo tee -a $DIR/etc/fstab
echo "kernel.printk = 7 4 1 3" | sudo tee -a $DIR/etc/sysctl.conf
echo 'debug.exception-trace = 0' | sudo tee -a $DIR/etc/sysctl.conf
echo "net.core.bpf_jit_enable = 1" | sudo tee -a $DIR/etc/sysctl.conf
echo "net.core.bpf_jit_kallsyms = 1" | sudo tee -a $DIR/etc/sysctl.conf
echo "net.core.bpf_jit_harden = 0" | sudo tee -a $DIR/etc/sysctl.conf
echo "kernel.softlockup_all_cpu_backtrace = 1" | sudo tee -a $DIR/etc/sysctl.conf
echo "kernel.kptr_restrict = 0" | sudo tee -a $DIR/etc/sysctl.conf
echo "kernel.watchdog_thresh = 60" | sudo tee -a $DIR/etc/sysctl.conf
echo "net.ipv4.ping_group_range = 0 65535" | sudo tee -a $DIR/etc/sysctl.conf
echo -en "127.0.0.1tlocalhostn" | sudo tee $DIR/etc/hosts
echo "nameserver 8.8.8.8" | sudo tee -a $DIR/etc/resolve.conf
echo "syzkaller" | sudo tee $DIR/etc/hostname
ssh-keygen -f $RELEASE.id_rsa -t rsa -N ''
sudo mkdir -p $DIR/root/.ssh/
cat $RELEASE.id_rsa.pub | sudo tee $DIR/root/.ssh/authorized_keys

# Build a disk image
dd if=/dev/zero of=$RELEASE.img bs=1M seek=2047 count=1
sudo mkfs.ext4 -F $RELEASE.img
sudo mkdir -p /mnt/$DIR
sudo mount -o loop $RELEASE.img /mnt/$DIR
sudo cp -a $DIR/. /mnt/$DIR/.
sudo umount /mnt/$DIR


I need your help










share|improve this question





























    0














    I try to run a Ubuntu in my qemu,but I always encounter errors:



    [  OK  ] Started Create Static Device Nodes in /dev.
    [FAILED] Failed to mount /sys/kernel/config.
    See 'systemctl status sys-kernel-config.mount' for details.
    [DEPEND] Dependency failed for Local File Systems.
    [DEPEND] Dependency failed for Mark the need to relabel after reboot.
    [FAILED] Failed to start Remount Root and Kernel File Systems.
    ....
    [FAILED] Failed to start Raise network interfaces.
    See 'systemctl status networking.service' for details.
    [ OK ] Reached target Network.
    You are in emergPress Enter for maintenance
    (or press Control-D to continue):


    and this a minimal Debian-stretch Linux image,the kernel I built with my config



    and this is my command to run start:



    qemu-system-x86_64 
    -kernel /home/hunter/Desktop/linux-4.4.33/arch/x86/boot/bzImage
    -append "console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=QUZ"
    -hda stretch.img
    -net user,hostfwd=tcp::10021-:22 -net nic
    -enable-kvm
    -nographic
    -m 1G
    -smp 2
    -pidfile vm.pid
    2>&1 | tee vm.log


    and this is my script to creatw a image:



    #!/bin/bash
    # Copyright 2016 syzkaller project authors. All rights reserved.
    # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

    # create-image.sh creates a minimal Debian Linux image suitable for syzkaller.

    set -eux

    # Create a minimal Debian distribution in a directory.
    RELEASE=stretch
    DIR=stretch
    sudo rm -rf $DIR
    mkdir -p $DIR
    sudo debootstrap --include=openssh-server,curl,tar,gcc,libc6-dev,time,strace,sudo,less,psmisc,selinux-utils,policycoreutils,checkpolicy,selinux-policy-default $RELEASE $DIR
    sudo chroot stretch /bin/bash -c "apt-get update; apt-get install -y curl tar time strace gcc net-tools iputils-ping make sysbench git vim screen usbutils"

    # Set some defaults and enable promtless ssh to the machine for root.
    sudo sed -i '/^root/ { s/:x:/::/ }' $DIR/etc/passwd
    echo 'T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100' | sudo tee -a $DIR/etc/inittab
    printf 'nauto eth0niface eth0 inet dhcpn' | sudo tee -a $DIR/etc/network/interfaces
    echo '/dev/root / ext4 defaults 0 0' | sudo tee -a $DIR/etc/fstab
    echo 'debugfs /sys/kernel/debug debugfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
    echo 'securityfs /sys/kernel/security securityfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
    echo 'configfs /sys/kernel/config/ configfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
    echo 'binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0' | sudo tee -a $DIR/etc/fstab
    echo "kernel.printk = 7 4 1 3" | sudo tee -a $DIR/etc/sysctl.conf
    echo 'debug.exception-trace = 0' | sudo tee -a $DIR/etc/sysctl.conf
    echo "net.core.bpf_jit_enable = 1" | sudo tee -a $DIR/etc/sysctl.conf
    echo "net.core.bpf_jit_kallsyms = 1" | sudo tee -a $DIR/etc/sysctl.conf
    echo "net.core.bpf_jit_harden = 0" | sudo tee -a $DIR/etc/sysctl.conf
    echo "kernel.softlockup_all_cpu_backtrace = 1" | sudo tee -a $DIR/etc/sysctl.conf
    echo "kernel.kptr_restrict = 0" | sudo tee -a $DIR/etc/sysctl.conf
    echo "kernel.watchdog_thresh = 60" | sudo tee -a $DIR/etc/sysctl.conf
    echo "net.ipv4.ping_group_range = 0 65535" | sudo tee -a $DIR/etc/sysctl.conf
    echo -en "127.0.0.1tlocalhostn" | sudo tee $DIR/etc/hosts
    echo "nameserver 8.8.8.8" | sudo tee -a $DIR/etc/resolve.conf
    echo "syzkaller" | sudo tee $DIR/etc/hostname
    ssh-keygen -f $RELEASE.id_rsa -t rsa -N ''
    sudo mkdir -p $DIR/root/.ssh/
    cat $RELEASE.id_rsa.pub | sudo tee $DIR/root/.ssh/authorized_keys

    # Build a disk image
    dd if=/dev/zero of=$RELEASE.img bs=1M seek=2047 count=1
    sudo mkfs.ext4 -F $RELEASE.img
    sudo mkdir -p /mnt/$DIR
    sudo mount -o loop $RELEASE.img /mnt/$DIR
    sudo cp -a $DIR/. /mnt/$DIR/.
    sudo umount /mnt/$DIR


    I need your help










    share|improve this question



























      0












      0








      0







      I try to run a Ubuntu in my qemu,but I always encounter errors:



      [  OK  ] Started Create Static Device Nodes in /dev.
      [FAILED] Failed to mount /sys/kernel/config.
      See 'systemctl status sys-kernel-config.mount' for details.
      [DEPEND] Dependency failed for Local File Systems.
      [DEPEND] Dependency failed for Mark the need to relabel after reboot.
      [FAILED] Failed to start Remount Root and Kernel File Systems.
      ....
      [FAILED] Failed to start Raise network interfaces.
      See 'systemctl status networking.service' for details.
      [ OK ] Reached target Network.
      You are in emergPress Enter for maintenance
      (or press Control-D to continue):


      and this a minimal Debian-stretch Linux image,the kernel I built with my config



      and this is my command to run start:



      qemu-system-x86_64 
      -kernel /home/hunter/Desktop/linux-4.4.33/arch/x86/boot/bzImage
      -append "console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=QUZ"
      -hda stretch.img
      -net user,hostfwd=tcp::10021-:22 -net nic
      -enable-kvm
      -nographic
      -m 1G
      -smp 2
      -pidfile vm.pid
      2>&1 | tee vm.log


      and this is my script to creatw a image:



      #!/bin/bash
      # Copyright 2016 syzkaller project authors. All rights reserved.
      # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

      # create-image.sh creates a minimal Debian Linux image suitable for syzkaller.

      set -eux

      # Create a minimal Debian distribution in a directory.
      RELEASE=stretch
      DIR=stretch
      sudo rm -rf $DIR
      mkdir -p $DIR
      sudo debootstrap --include=openssh-server,curl,tar,gcc,libc6-dev,time,strace,sudo,less,psmisc,selinux-utils,policycoreutils,checkpolicy,selinux-policy-default $RELEASE $DIR
      sudo chroot stretch /bin/bash -c "apt-get update; apt-get install -y curl tar time strace gcc net-tools iputils-ping make sysbench git vim screen usbutils"

      # Set some defaults and enable promtless ssh to the machine for root.
      sudo sed -i '/^root/ { s/:x:/::/ }' $DIR/etc/passwd
      echo 'T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100' | sudo tee -a $DIR/etc/inittab
      printf 'nauto eth0niface eth0 inet dhcpn' | sudo tee -a $DIR/etc/network/interfaces
      echo '/dev/root / ext4 defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'debugfs /sys/kernel/debug debugfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'securityfs /sys/kernel/security securityfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'configfs /sys/kernel/config/ configfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo "kernel.printk = 7 4 1 3" | sudo tee -a $DIR/etc/sysctl.conf
      echo 'debug.exception-trace = 0' | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.core.bpf_jit_enable = 1" | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.core.bpf_jit_kallsyms = 1" | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.core.bpf_jit_harden = 0" | sudo tee -a $DIR/etc/sysctl.conf
      echo "kernel.softlockup_all_cpu_backtrace = 1" | sudo tee -a $DIR/etc/sysctl.conf
      echo "kernel.kptr_restrict = 0" | sudo tee -a $DIR/etc/sysctl.conf
      echo "kernel.watchdog_thresh = 60" | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.ipv4.ping_group_range = 0 65535" | sudo tee -a $DIR/etc/sysctl.conf
      echo -en "127.0.0.1tlocalhostn" | sudo tee $DIR/etc/hosts
      echo "nameserver 8.8.8.8" | sudo tee -a $DIR/etc/resolve.conf
      echo "syzkaller" | sudo tee $DIR/etc/hostname
      ssh-keygen -f $RELEASE.id_rsa -t rsa -N ''
      sudo mkdir -p $DIR/root/.ssh/
      cat $RELEASE.id_rsa.pub | sudo tee $DIR/root/.ssh/authorized_keys

      # Build a disk image
      dd if=/dev/zero of=$RELEASE.img bs=1M seek=2047 count=1
      sudo mkfs.ext4 -F $RELEASE.img
      sudo mkdir -p /mnt/$DIR
      sudo mount -o loop $RELEASE.img /mnt/$DIR
      sudo cp -a $DIR/. /mnt/$DIR/.
      sudo umount /mnt/$DIR


      I need your help










      share|improve this question















      I try to run a Ubuntu in my qemu,but I always encounter errors:



      [  OK  ] Started Create Static Device Nodes in /dev.
      [FAILED] Failed to mount /sys/kernel/config.
      See 'systemctl status sys-kernel-config.mount' for details.
      [DEPEND] Dependency failed for Local File Systems.
      [DEPEND] Dependency failed for Mark the need to relabel after reboot.
      [FAILED] Failed to start Remount Root and Kernel File Systems.
      ....
      [FAILED] Failed to start Raise network interfaces.
      See 'systemctl status networking.service' for details.
      [ OK ] Reached target Network.
      You are in emergPress Enter for maintenance
      (or press Control-D to continue):


      and this a minimal Debian-stretch Linux image,the kernel I built with my config



      and this is my command to run start:



      qemu-system-x86_64 
      -kernel /home/hunter/Desktop/linux-4.4.33/arch/x86/boot/bzImage
      -append "console=ttyS0 root=/dev/sda debug earlyprintk=serial slub_debug=QUZ"
      -hda stretch.img
      -net user,hostfwd=tcp::10021-:22 -net nic
      -enable-kvm
      -nographic
      -m 1G
      -smp 2
      -pidfile vm.pid
      2>&1 | tee vm.log


      and this is my script to creatw a image:



      #!/bin/bash
      # Copyright 2016 syzkaller project authors. All rights reserved.
      # Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

      # create-image.sh creates a minimal Debian Linux image suitable for syzkaller.

      set -eux

      # Create a minimal Debian distribution in a directory.
      RELEASE=stretch
      DIR=stretch
      sudo rm -rf $DIR
      mkdir -p $DIR
      sudo debootstrap --include=openssh-server,curl,tar,gcc,libc6-dev,time,strace,sudo,less,psmisc,selinux-utils,policycoreutils,checkpolicy,selinux-policy-default $RELEASE $DIR
      sudo chroot stretch /bin/bash -c "apt-get update; apt-get install -y curl tar time strace gcc net-tools iputils-ping make sysbench git vim screen usbutils"

      # Set some defaults and enable promtless ssh to the machine for root.
      sudo sed -i '/^root/ { s/:x:/::/ }' $DIR/etc/passwd
      echo 'T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100' | sudo tee -a $DIR/etc/inittab
      printf 'nauto eth0niface eth0 inet dhcpn' | sudo tee -a $DIR/etc/network/interfaces
      echo '/dev/root / ext4 defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'debugfs /sys/kernel/debug debugfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'securityfs /sys/kernel/security securityfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'configfs /sys/kernel/config/ configfs defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo 'binfmt_misc /proc/sys/fs/binfmt_misc binfmt_misc defaults 0 0' | sudo tee -a $DIR/etc/fstab
      echo "kernel.printk = 7 4 1 3" | sudo tee -a $DIR/etc/sysctl.conf
      echo 'debug.exception-trace = 0' | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.core.bpf_jit_enable = 1" | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.core.bpf_jit_kallsyms = 1" | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.core.bpf_jit_harden = 0" | sudo tee -a $DIR/etc/sysctl.conf
      echo "kernel.softlockup_all_cpu_backtrace = 1" | sudo tee -a $DIR/etc/sysctl.conf
      echo "kernel.kptr_restrict = 0" | sudo tee -a $DIR/etc/sysctl.conf
      echo "kernel.watchdog_thresh = 60" | sudo tee -a $DIR/etc/sysctl.conf
      echo "net.ipv4.ping_group_range = 0 65535" | sudo tee -a $DIR/etc/sysctl.conf
      echo -en "127.0.0.1tlocalhostn" | sudo tee $DIR/etc/hosts
      echo "nameserver 8.8.8.8" | sudo tee -a $DIR/etc/resolve.conf
      echo "syzkaller" | sudo tee $DIR/etc/hostname
      ssh-keygen -f $RELEASE.id_rsa -t rsa -N ''
      sudo mkdir -p $DIR/root/.ssh/
      cat $RELEASE.id_rsa.pub | sudo tee $DIR/root/.ssh/authorized_keys

      # Build a disk image
      dd if=/dev/zero of=$RELEASE.img bs=1M seek=2047 count=1
      sudo mkfs.ext4 -F $RELEASE.img
      sudo mkdir -p /mnt/$DIR
      sudo mount -o loop $RELEASE.img /mnt/$DIR
      sudo cp -a $DIR/. /mnt/$DIR/.
      sudo umount /mnt/$DIR


      I need your help







      qemu






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 26 '18 at 18:05









      Kulfy

      3,89841240




      3,89841240










      asked Dec 26 '18 at 17:59









      user62291user62291

      11




      11






















          0






          active

          oldest

          votes











          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "89"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104712%2fi-cant-start-my-linux-in-qemu-vm%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes
















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Ask Ubuntu!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f1104712%2fi-cant-start-my-linux-in-qemu-vm%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

          Mangá

          Eduardo VII do Reino Unido