• About TC
  • Affiliate Disclaimer
  • Privacy Policy
  • TOS
  • Contact
Sunday, June 15, 2025
Techcratic
  • TC
  • AI
    Artificial Intelligence

    Amazon Nova Lite enables Bito to offer a free tier option for its AI-powered code reviews

    Artificial Intelligence

    Bridging the Gap: New Datasets Push Recommender Research Toward Real-World Scale

    Artificial Intelligence

    7 Python Errors That Are Actually Features

    Artificial Intelligence

    10 Awesome OCR Models for 2025

    Artificial Intelligence

    5 Error Handling Patterns in Python (Beyond Try-Except)

    Artificial Intelligence

    Top 5 Alternative Data Career Paths and How to Learn Them for Free

    Artificial Intelligence

    Implementing Machine Learning Pipelines with Apache Spark

    Artificial Intelligence

    Learn Power BI for Free This Week

    Artificial Intelligence

    Build GraphRAG applications using Amazon Bedrock Knowledge Bases

  • Crypto
    Bitcoin Eyes $30T Treasury Store of Value Market, Says Bitwise CEO

    Bitcoin Eyes $30T Treasury Store of Value Market, Says Bitwise CEO

    ZKJ Token Plummets More Than 60% in Flash Crash Amid Rug-Pull Allegations

    ZKJ Token Plummets More Than 60% in Flash Crash Amid Rug-Pull Allegations

    Bitcoin Holding $105K During War Is Bullish for Crypto

    Bitcoin Holding $105K During War Is Bullish for Crypto

    Saylor Signals Another Bitcoin Buy—Orange Dots Strike Again

    Saylor Signals Another Bitcoin Buy—Orange Dots Strike Again

    XRP Technical Analysis: Downtrend Dominates—Is the $2.05 Floor About to Collapse?

    XRP Technical Analysis: Downtrend Dominates—Is the $2.05 Floor About to Collapse?

    Best Presales to Buy Today – Which Coins Are Poised for a Breakout?

    Last 72 Hours to Join $49M Raise

    Corporate Bitcoin Holdings a ‘Blessing’ Now, Challenge Later, Says Roxom CEO

    Corporate Bitcoin Holdings a ‘Blessing’ Now, Challenge Later, Says Roxom CEO

    Cryptocurrency Remittances Spike 40% in Latin America

    Cryptocurrency Remittances Spike 40% in Latin America

    Sonic Integrates Bubblemaps V2 to Enhance Onchain Intelligence

    Sonic Integrates Bubblemaps V2 to Enhance Onchain Intelligence

  • Cybersecurity
    Cybersecurity

    AI Agents Run on Secret Accounts — Learn How to Secure Them in This Webinar

    Cybersecurity

    How to Address the Expanding Security Risk

    Cybersecurity

    ConnectWise to Rotate ScreenConnect Code Signing Certificates Due to Security Risks

    Cybersecurity

    5 Lessons from River Island

    Cybersecurity

    INTERPOL Dismantles 20,000+ Malicious IPs Linked to 69 Malware Variants in Operation Secure

    Cybersecurity

    SinoTrack GPS Devices Vulnerable to Remote Vehicle Control via Default Passwords

    Cybersecurity

    Researchers Uncover 20+ Configuration Risks, Including Five CVEs, in Salesforce Industry Cloud

    Cybersecurity

    Adobe Releases Patch Fixing 254 Vulnerabilities, Closing High-Severity Security Gaps

    Cybersecurity

    Researcher Found Flaw to Discover Phone Numbers Linked to Any Google Account

  • Deals
    Kingston NV3 1TB M.2 2280 NVMe SSD | PCIe 4.0 Gen 4×4 | Up to 6000 MB/s | SNV3S/1000G

    Kingston NV3 1TB M.2 2280 NVMe SSD | PCIe 4.0 Gen 4×4 | Up to 6000 MB/s | SNV3S/1000G

    Intel Core Ultra 7 Desktop Processor 265K – 20 cores (8 P-cores + 12 E-cores) up to 5.5…

    Intel Core Ultra 7 Desktop Processor 265K – 20 cores (8 P-cores + 12 E-cores) up to 5.5…

    Hitachi FIJ0038 Fuel Injector

    Hitachi FIJ0038 Fuel Injector

    EVGA Supernova 1300 P+, 80+ Platinum 1300W, Fully Modular, 10 Year Warranty, Includes…

    EVGA Supernova 1300 P+, 80+ Platinum 1300W, Fully Modular, 10 Year Warranty, Includes…

    Logitech G502 X Plus Wireless Gaming Mouse – LIGHTSPEED Optical, LIGHTFORCE Switches,…

    Logitech G502 X Plus Wireless Gaming Mouse – LIGHTSPEED Optical, LIGHTFORCE Switches,…

    Cable Matters 8-Pack Snagless Cat 5e Ethernet Cable – 5ft, Gigabit Cat5e Cable, Cat5e…

    Cable Matters 8-Pack Snagless Cat 5e Ethernet Cable – 5ft, Gigabit Cat5e Cable, Cat5e…

    Logitech iPad Pro 12.9 inch Keyboard Case | SLIM COMBO with Detachable, Backlit,…

    Logitech iPad Pro 12.9 inch Keyboard Case | SLIM COMBO with Detachable, Backlit,…

    TECKNET Ergonomic Mouse, Wireless Bluetooth Vertical Mouse, 4800 DPI Optical Tracking, 6…

    TECKNET Ergonomic Mouse, Wireless Bluetooth Vertical Mouse, 4800 DPI Optical Tracking, 6…

    DUMOS Ergonomic Gaming Desk Chair – PU Leather Recliner with Footrest, Lumbar Support,…

    DUMOS Ergonomic Gaming Desk Chair – PU Leather Recliner with Footrest, Lumbar Support,…

  • Gaming
    The Legend of Zelda: Breath of the Wild – Shada Naw Shrine Walkthrough [HD 1080P]

    The Legend of Zelda: Breath of the Wild – Shada Naw Shrine Walkthrough [HD 1080P]

    Zelda Breath of the Wild – All Rito Weapons (Complete Set Location)

    Zelda Breath of the Wild – All Rito Weapons (Complete Set Location)

    Walkthrough FR l Zelda Ocarina Of Time l Premier Flacon

    Walkthrough FR l Zelda Ocarina Of Time l Premier Flacon

    Five Nights At Freddy’s still going strong: The latest game briefly grappled with Dune over Steam’s top seller spot

    Five Nights At Freddy’s still going strong: The latest game briefly grappled with Dune over Steam’s top seller spot

    The Super Mario Bros Movie Reaction!

    The Super Mario Bros Movie Reaction!

    The Legend of Zelda: Ocarina of Time Master Quest Walkthrough (Pt. 78)

    The Legend of Zelda: Ocarina of Time Master Quest Walkthrough (Pt. 78)

    The Legend of Zelda: Breath of the Wild – Champions Ballad Shrines Walkthrough

    The Legend of Zelda: Breath of the Wild – Champions Ballad Shrines Walkthrough

    Legend of Zelda Montage

    Legend of Zelda Montage

    Legend of Zelda Breath of the Wild Gameplay/Walkthrough – Part 3

    Legend of Zelda Breath of the Wild Gameplay/Walkthrough – Part 3

  • Tesla
    Upgrade fit Tesla Model Y (2019-2023) Center Console Wireless Charger Mat – Silicone…

    Upgrade fit Tesla Model Y (2019-2023) Center Console Wireless Charger Mat – Silicone…

    Torx Plus Socket, 5-External Torx Socket 1/4″ Dr 10EPR Compatible With Tesla Model 3…

    Torx Plus Socket, 5-External Torx Socket 1/4″ Dr 10EPR Compatible With Tesla Model 3…

    Car Seat Organizers,Multi-functional Back Seat Protectors, Storage Pouches, and Tray…

    Car Seat Organizers,Multi-functional Back Seat Protectors, Storage Pouches, and Tray…

    AOHI USB C Car Charger, PD 45W&QC 30W 2 Port Type-C Fast Charging Car Charger Lighter…

    AOHI USB C Car Charger, PD 45W&QC 30W 2 Port Type-C Fast Charging Car Charger Lighter…

    Roof Sunshades for Tesla Model 3 2025, Upgraded 3.0 Sunroof Shade Sunshade Roof Sun…

    Roof Sunshades for Tesla Model 3 2025, Upgraded 3.0 Sunroof Shade Sunshade Roof Sun…

    SOOPII for Tesla Phone Mount,Strongest Magnetic Monitor Mount for Tesla 3/Y…

    SOOPII for Tesla Phone Mount,Strongest Magnetic Monitor Mount for Tesla 3/Y…

    A2C Gym Fitness Phone Mount for MagSafe – 17 N52 Strong Magnets Stable and Secure Phone…

    A2C Gym Fitness Phone Mount for MagSafe – 17 N52 Strong Magnets Stable and Secure Phone…

    3PCS All Weather Tesla Model 3 Highland Floor Mats 2024 2025 | Sleek Design,…

    3PCS All Weather Tesla Model 3 Highland Floor Mats 2024 2025 | Sleek Design,…

    Tesla Door Handle Cover Model Y Model 3 2020-2025 Door Handle Protector Model Y Model 3…

    Tesla Door Handle Cover Model Y Model 3 2020-2025 Door Handle Protector Model Y Model 3…

  • UFO
    Football Fan Patch Trucker Hat – Netted Snapback Baseball Cap with Team Design for Men & Women

    Football Fan Patch Trucker Hat – Netted Snapback Baseball Cap with Team Design for Men & Women

    [F4A] Alien researcher reports her findings [Scientist Speaker] [Research]

    [F4A] Alien researcher reports her findings [Scientist Speaker] [Research]

    Secrets of the Moon (S11, E11) | Ancient Aliens | Full Episode

    Secrets of the Moon (S11, E11) | Ancient Aliens | Full Episode

    UFOs Over Arizona: A True History of Extraterrestrial Encounters in the Grand Canyon State

    UFOs Over Arizona: A True History of Extraterrestrial Encounters in the Grand Canyon State

    French Contactee confirms Intergalactic Confederation is seeding human worlds

    French Contactee confirms Intergalactic Confederation is seeding human worlds

    New Balance Men’s 574 Greens V2 Golf Shoe

    New Balance Men’s 574 Greens V2 Golf Shoe

    Armin van Buuren rocking Ultra Miami with the new Exploration Of Space (Third Contact Remix)

    Armin van Buuren rocking Ultra Miami with the new Exploration Of Space (Third Contact Remix)

    I found footage of me explaining all 7 Paranormal Activity movies while haunted

    I found footage of me explaining all 7 Paranormal Activity movies while haunted

    Retro Aviator Sunglasses for Women Men – 70s Trendy Square Vintage Shade Sun Glasses UV Protection

    Retro Aviator Sunglasses for Women Men – 70s Trendy Square Vintage Shade Sun Glasses UV Protection

No Result
View All Result
  • TC
  • AI
    Artificial Intelligence

    Amazon Nova Lite enables Bito to offer a free tier option for its AI-powered code reviews

    Artificial Intelligence

    Bridging the Gap: New Datasets Push Recommender Research Toward Real-World Scale

    Artificial Intelligence

    7 Python Errors That Are Actually Features

    Artificial Intelligence

    10 Awesome OCR Models for 2025

    Artificial Intelligence

    5 Error Handling Patterns in Python (Beyond Try-Except)

    Artificial Intelligence

    Top 5 Alternative Data Career Paths and How to Learn Them for Free

    Artificial Intelligence

    Implementing Machine Learning Pipelines with Apache Spark

    Artificial Intelligence

    Learn Power BI for Free This Week

    Artificial Intelligence

    Build GraphRAG applications using Amazon Bedrock Knowledge Bases

  • Crypto
    Bitcoin Eyes $30T Treasury Store of Value Market, Says Bitwise CEO

    Bitcoin Eyes $30T Treasury Store of Value Market, Says Bitwise CEO

    ZKJ Token Plummets More Than 60% in Flash Crash Amid Rug-Pull Allegations

    ZKJ Token Plummets More Than 60% in Flash Crash Amid Rug-Pull Allegations

    Bitcoin Holding $105K During War Is Bullish for Crypto

    Bitcoin Holding $105K During War Is Bullish for Crypto

    Saylor Signals Another Bitcoin Buy—Orange Dots Strike Again

    Saylor Signals Another Bitcoin Buy—Orange Dots Strike Again

    XRP Technical Analysis: Downtrend Dominates—Is the $2.05 Floor About to Collapse?

    XRP Technical Analysis: Downtrend Dominates—Is the $2.05 Floor About to Collapse?

    Best Presales to Buy Today – Which Coins Are Poised for a Breakout?

    Last 72 Hours to Join $49M Raise

    Corporate Bitcoin Holdings a ‘Blessing’ Now, Challenge Later, Says Roxom CEO

    Corporate Bitcoin Holdings a ‘Blessing’ Now, Challenge Later, Says Roxom CEO

    Cryptocurrency Remittances Spike 40% in Latin America

    Cryptocurrency Remittances Spike 40% in Latin America

    Sonic Integrates Bubblemaps V2 to Enhance Onchain Intelligence

    Sonic Integrates Bubblemaps V2 to Enhance Onchain Intelligence

  • Cybersecurity
    Cybersecurity

    AI Agents Run on Secret Accounts — Learn How to Secure Them in This Webinar

    Cybersecurity

    How to Address the Expanding Security Risk

    Cybersecurity

    ConnectWise to Rotate ScreenConnect Code Signing Certificates Due to Security Risks

    Cybersecurity

    5 Lessons from River Island

    Cybersecurity

    INTERPOL Dismantles 20,000+ Malicious IPs Linked to 69 Malware Variants in Operation Secure

    Cybersecurity

    SinoTrack GPS Devices Vulnerable to Remote Vehicle Control via Default Passwords

    Cybersecurity

    Researchers Uncover 20+ Configuration Risks, Including Five CVEs, in Salesforce Industry Cloud

    Cybersecurity

    Adobe Releases Patch Fixing 254 Vulnerabilities, Closing High-Severity Security Gaps

    Cybersecurity

    Researcher Found Flaw to Discover Phone Numbers Linked to Any Google Account

  • Deals
    Kingston NV3 1TB M.2 2280 NVMe SSD | PCIe 4.0 Gen 4×4 | Up to 6000 MB/s | SNV3S/1000G

    Kingston NV3 1TB M.2 2280 NVMe SSD | PCIe 4.0 Gen 4×4 | Up to 6000 MB/s | SNV3S/1000G

    Intel Core Ultra 7 Desktop Processor 265K – 20 cores (8 P-cores + 12 E-cores) up to 5.5…

    Intel Core Ultra 7 Desktop Processor 265K – 20 cores (8 P-cores + 12 E-cores) up to 5.5…

    Hitachi FIJ0038 Fuel Injector

    Hitachi FIJ0038 Fuel Injector

    EVGA Supernova 1300 P+, 80+ Platinum 1300W, Fully Modular, 10 Year Warranty, Includes…

    EVGA Supernova 1300 P+, 80+ Platinum 1300W, Fully Modular, 10 Year Warranty, Includes…

    Logitech G502 X Plus Wireless Gaming Mouse – LIGHTSPEED Optical, LIGHTFORCE Switches,…

    Logitech G502 X Plus Wireless Gaming Mouse – LIGHTSPEED Optical, LIGHTFORCE Switches,…

    Cable Matters 8-Pack Snagless Cat 5e Ethernet Cable – 5ft, Gigabit Cat5e Cable, Cat5e…

    Cable Matters 8-Pack Snagless Cat 5e Ethernet Cable – 5ft, Gigabit Cat5e Cable, Cat5e…

    Logitech iPad Pro 12.9 inch Keyboard Case | SLIM COMBO with Detachable, Backlit,…

    Logitech iPad Pro 12.9 inch Keyboard Case | SLIM COMBO with Detachable, Backlit,…

    TECKNET Ergonomic Mouse, Wireless Bluetooth Vertical Mouse, 4800 DPI Optical Tracking, 6…

    TECKNET Ergonomic Mouse, Wireless Bluetooth Vertical Mouse, 4800 DPI Optical Tracking, 6…

    DUMOS Ergonomic Gaming Desk Chair – PU Leather Recliner with Footrest, Lumbar Support,…

    DUMOS Ergonomic Gaming Desk Chair – PU Leather Recliner with Footrest, Lumbar Support,…

  • Gaming
    The Legend of Zelda: Breath of the Wild – Shada Naw Shrine Walkthrough [HD 1080P]

    The Legend of Zelda: Breath of the Wild – Shada Naw Shrine Walkthrough [HD 1080P]

    Zelda Breath of the Wild – All Rito Weapons (Complete Set Location)

    Zelda Breath of the Wild – All Rito Weapons (Complete Set Location)

    Walkthrough FR l Zelda Ocarina Of Time l Premier Flacon

    Walkthrough FR l Zelda Ocarina Of Time l Premier Flacon

    Five Nights At Freddy’s still going strong: The latest game briefly grappled with Dune over Steam’s top seller spot

    Five Nights At Freddy’s still going strong: The latest game briefly grappled with Dune over Steam’s top seller spot

    The Super Mario Bros Movie Reaction!

    The Super Mario Bros Movie Reaction!

    The Legend of Zelda: Ocarina of Time Master Quest Walkthrough (Pt. 78)

    The Legend of Zelda: Ocarina of Time Master Quest Walkthrough (Pt. 78)

    The Legend of Zelda: Breath of the Wild – Champions Ballad Shrines Walkthrough

    The Legend of Zelda: Breath of the Wild – Champions Ballad Shrines Walkthrough

    Legend of Zelda Montage

    Legend of Zelda Montage

    Legend of Zelda Breath of the Wild Gameplay/Walkthrough – Part 3

    Legend of Zelda Breath of the Wild Gameplay/Walkthrough – Part 3

  • Tesla
    Upgrade fit Tesla Model Y (2019-2023) Center Console Wireless Charger Mat – Silicone…

    Upgrade fit Tesla Model Y (2019-2023) Center Console Wireless Charger Mat – Silicone…

    Torx Plus Socket, 5-External Torx Socket 1/4″ Dr 10EPR Compatible With Tesla Model 3…

    Torx Plus Socket, 5-External Torx Socket 1/4″ Dr 10EPR Compatible With Tesla Model 3…

    Car Seat Organizers,Multi-functional Back Seat Protectors, Storage Pouches, and Tray…

    Car Seat Organizers,Multi-functional Back Seat Protectors, Storage Pouches, and Tray…

    AOHI USB C Car Charger, PD 45W&QC 30W 2 Port Type-C Fast Charging Car Charger Lighter…

    AOHI USB C Car Charger, PD 45W&QC 30W 2 Port Type-C Fast Charging Car Charger Lighter…

    Roof Sunshades for Tesla Model 3 2025, Upgraded 3.0 Sunroof Shade Sunshade Roof Sun…

    Roof Sunshades for Tesla Model 3 2025, Upgraded 3.0 Sunroof Shade Sunshade Roof Sun…

    SOOPII for Tesla Phone Mount,Strongest Magnetic Monitor Mount for Tesla 3/Y…

    SOOPII for Tesla Phone Mount,Strongest Magnetic Monitor Mount for Tesla 3/Y…

    A2C Gym Fitness Phone Mount for MagSafe – 17 N52 Strong Magnets Stable and Secure Phone…

    A2C Gym Fitness Phone Mount for MagSafe – 17 N52 Strong Magnets Stable and Secure Phone…

    3PCS All Weather Tesla Model 3 Highland Floor Mats 2024 2025 | Sleek Design,…

    3PCS All Weather Tesla Model 3 Highland Floor Mats 2024 2025 | Sleek Design,…

    Tesla Door Handle Cover Model Y Model 3 2020-2025 Door Handle Protector Model Y Model 3…

    Tesla Door Handle Cover Model Y Model 3 2020-2025 Door Handle Protector Model Y Model 3…

  • UFO
    Football Fan Patch Trucker Hat – Netted Snapback Baseball Cap with Team Design for Men & Women

    Football Fan Patch Trucker Hat – Netted Snapback Baseball Cap with Team Design for Men & Women

    [F4A] Alien researcher reports her findings [Scientist Speaker] [Research]

    [F4A] Alien researcher reports her findings [Scientist Speaker] [Research]

    Secrets of the Moon (S11, E11) | Ancient Aliens | Full Episode

    Secrets of the Moon (S11, E11) | Ancient Aliens | Full Episode

    UFOs Over Arizona: A True History of Extraterrestrial Encounters in the Grand Canyon State

    UFOs Over Arizona: A True History of Extraterrestrial Encounters in the Grand Canyon State

    French Contactee confirms Intergalactic Confederation is seeding human worlds

    French Contactee confirms Intergalactic Confederation is seeding human worlds

    New Balance Men’s 574 Greens V2 Golf Shoe

    New Balance Men’s 574 Greens V2 Golf Shoe

    Armin van Buuren rocking Ultra Miami with the new Exploration Of Space (Third Contact Remix)

    Armin van Buuren rocking Ultra Miami with the new Exploration Of Space (Third Contact Remix)

    I found footage of me explaining all 7 Paranormal Activity movies while haunted

    I found footage of me explaining all 7 Paranormal Activity movies while haunted

    Retro Aviator Sunglasses for Women Men – 70s Trendy Square Vintage Shade Sun Glasses UV Protection

    Retro Aviator Sunglasses for Women Men – 70s Trendy Square Vintage Shade Sun Glasses UV Protection

No Result
View All Result
Techcratic
No Result
View All Result
Home Hacker News

How to Setup QEMU Output to Console and Automate Using Shell Script

Hacker News by Hacker News
April 5, 2025
in Hacker News
Reading Time: 9 mins read
125 5
A A
0

2025-04-05 18:04:00
fadeevab.com

SSH. Expect. Named pipes. Input/output to the host terminal. Early boot messages.


  • Alexandr Fadeev
How to Setup QEMU Output to Console and Automate Using Shell Script

Safe Skies

Join Timothy Snyder’s fundraiser! 👇 Safe SkiesJoin Timothy Snyder’s fundraiser! The history professor is raising funds towards a situational alert system for Ukraine’s Air Defence Forces. Protect Ukrainian towns from terrorist attacks.

While struggling to automate QEMU guest (communicate and control with the shell scripts), I faced a lot of incomplete, partially working solutions around the Internet. Now, I’ve got a pretty decent collection of working recipes to tune up a QEMU guest, so I decided to organize all that stuff here, and it could be definitely useful for anyone else. Each scenario has been tested on the binaries, links on which I put below in the annex: Binaries used in the examples, so you could check it out on your own.

  1. Input/output to the host terminal
  2. Early boot messages in the host terminal
  3. Input/output through a named pipe (file)
  4. Automate QEMU guest using expect tool
  5. Automate QEMU guest using ssh
  6. Binaries used in examples

-serial stdio

qemu-system-x86_64 -serial stdio wheezy.qcow2

qemu-serial-stdio-1

-serial stdio redirects the virtual serial port to the host’s terminal input/output. You will see a welcome string after a successful boot.

-nographic

qemu-system-x86_64 -nographic wheezy.qcow2

qemu-nographic

-nographic does the same as “-serial stdio” and also hides a QEMU’s graphical window.

Cautions:

  1. You will not see any early boot logs in the host’s console. To get them, see Early boot messages in the host terminal below.
  2. To exit the guest system without GUI, using stdio redirected to the terminal, login as a root (user: root, password: root) and shutdown the system (wait after that for a while):
    # Guest
    shutdown -h now
    

console=ttyS0

If you want to see early boot logs, you should pass console=ttyS0 parameter to a Linux kernel command line:

qemu-system-x86_64 -nographic -kernel vmlinuz -hda wheezy.img -append "root=/dev/sda console=ttyS0"

or

qemu-system-x86_64 -serial stdio -kernel vmlinuz -hda wheezy.img -append "root=/dev/sda console=ttyS0"

or

qemu-system-x86_64 -serial stdio wheezy.qcow2
 # 1. Wait for a GRUB menu to show.
 # 2. Press `e`.
 # 3. Find the line starting with "linux".
 # 4. Add "console=ttyS0".

qemu-system-x86_64 -serial stdio -kernel vmlinuz -hda wheezy.img -append “root=/dev/sda console=ttyS0”:
qemu-early-boot-logs-2

  • -serial stdio or -nographic redirects input/output to the current terminal.
  • -append “root=/dev/sda console=ttyS0”: console=ttyS0 forces the guest kernel to send output to the first UART serial port ttyS0, which is redirected to the host by the -serial stdio option, and root=/dev/sda points the kernel to use a /dev/sda device to load the wheezy.img.

Other options:

  • -kernel vmlinuz loads the kernel from the local “./vmlinuz” file.
  • -hda wheezy.img is a raw image which is suitable for booting with vmlinuz binary (wheezy.qcow2 won’t be recognized in the block device).

Create a named pipe

mkfifo /tmp/guest.in /tmp/guest.out

Start QEMU

qemu-system-x86_64 -serial pipe:/tmp/guest -kernel vmlinuz -hda wheezy.img -append "root=/dev/sda console=ttyS0"

-serial pipe:/tmp/guest redirects a guest’s output to a /tmp/guest.out and allows to send input from host to guest via /tmp/guest.in.

Take an output from the guest

cat /tmp/guest.out

Send a command to the guest

When login screen appears, send a login string:

printf "root\n" > /tmp/guest.in

Wait until some string

Wait until SSH Daemon starts.

while read line; do
  echo "${line}"
  if [[ ${line} == *"Secure Shell server: sshd"* ]]; then
    break;
  fi
done 

Install “expect” tool

sudo apt install expect

Create an expect script

example.exp:

#!/usr/bin/expect -f

# Wait enough (forever) until a long-time boot
set timeout -1

# Start the guest VM
spawn qemu-system-x86_64 -serial stdio wheezy.qcow2

expect "login: "
send "root\n"

expect "Password: "
send "root\n"

expect "# "
send "shutdown -h now"

Original script is found there: https://stacoverflow.com/questions/314613/qemu-guest-automation, but be careful, symbol of quotes “ (which is not a “) in the original stackoverflow answer cannot be recognized by the expect utility (send "root\n").

Execute “expect” script

chmod +x example.exp
./example.exp

Set up port forwarding

qemu-system-x86_64 -netdev user,id=net0,hostfwd=tcp::10022-:22 -device e1000,netdev=net0 wheezy.qcow2

Connect via ssh

ssh root@localhost -p 10022 'uptime; ls; echo Test;'

Troubleshooting

  1. QEMU guest has to be able to recognize a network card device (NIC, Network Interface Card): -netdev user,id=net0 -device e1000,netdev=net0.
    # Without port forwarding
    qemu-system-x86_64 -netdev user,id=net0 -device e1000,netdev=net0 wheezy.qcow2
    
  2. Boot and check that the new interface has appeared on the guest system:
    # Guest
    ifconfig -a
    

    Linux kernel on the guest must support a network card emulated by QEMU. In the opposite case the guest won’t get a new Ethernet interface. After booting you should find “eth0” (running broadcast device, not loopback) on the guest. It depends solely on the guest Linux kernel and on the kernel modules.

  3. Check the 10022 port on the host:
    # Host
    netstat -tanp | grep 10022
       tcp  0  0 0.0.0.0:10022   0.0.0.0:*  LISTEN  16589/qemu-system-x
    
  4. Check the 22 port on the guest:
    # Guest
    netstat -tanp | grep 22
        tcp  0  0 0.0.0.0:22      0.0.0.0:*  LISTEN  2430/sshd
    
  5. You can forward telnet port 23 and verify the connection:
    qemu-system-x86_64 -netdev user,id=net0,hostfwd=tcp::10023-:23 -device e1000,netdev=net0 wheezy.qcow2
    
    1. Guest (server):
      # Guest
      nc -v -l -p 23
          Listening on [0.0.0.0] (family 0, port 23)
      
    2. Host (client):
      # Host
      echo asdf | nc localhost 10023
      

Establish passwordless login via ssh

  1. Generate host SSH keys:
    # Host
    ssh-keygen -b 2048 -t rsa -q -N "" -f ./qemukey
    
  2. Set up a public key to the guest as a trusted (authorized) key.
    1. Via ssh-copy-id
    2. Manually
  3. Fix the /etc/ssh/sshd_config on the guest:
    PasswordAuthentication no
    PermitRootLogin without-password
    
  4. Restart SSH daemon on the guest:
    # Guest
    /etc/init.d/ssh restart
    
  5. Connect via ssh:
    # Host
    ssh root@localhost -p 10022 -i ./qemukey
    

    Viola! You don’t need the password and you can automate the remote QEMU guest.


  1. wheezy.qcow2 (i386): bootable Debian “Wheezy” image a QEMU copy-on-write format. Login/password: “root”/”root”, and “user”/”user”.
    wget https://people.debian.org/~aurel32/qemu/i386/debian_wheezy_i386_standard.qcow2 -O wheezy.qcow2
    
  2. wheezy.img (i386): non-bootable Debian “Wheezy” image (without kernel) to use with own kernel (-kernel vmlinuz).
    wget https://storage.googleapis.com/syzkaller/wheezy.img
    
  3. vmlinuz (i386): compressed bootable Linux kernel. Options:
    1. Build from the scratch: Build Android Kernel and Run on QEMU with Minimal Environment: Step by Step.
    2. Download from Ubuntu repository (WARNING! Port forwarding will NOT work):
      wget http://security.ubuntu.com/ubuntu/pool/main/l/linux-signed-azure/linux-image-4.15.0-1036-azure_4.15.0-1036.38~14.04.2_amd64.deb
      ar x linux-image-4.15.0-1036-azure_4.15.0-1036.38~14.04.2_amd64.deb
      tar xf data.tar.xz ./boot/vmlinuz-4.15.0-1036-azure
      cp ./boot/vmlinuz-4.15.0-1036-azure ./vmlinuz
      
    3. You can try your host’s linux kernel passing one to the QEMU guest (WARNING! You could have problems either with port forwarding, or with a block device):
      sudo cp /boot/vmlinuz-$(uname -r) ./
      

    WARNING! Ubuntu’s vmlinuz doesn’t contain drivers for QEMU emulated network card devices (NIC). Debian’s vmlinuz doesn’t have prebuilt drivers to load a raw image from /dev/sda device.

Source Link


Keep your files stored safely and securely with the SanDisk 2TB Extreme Portable SSD. With over 69,505 ratings and an impressive 4.6 out of 5 stars, this product has been purchased over 8K+ times in the past month. At only $129.99, this Amazon’s Choice product is a must-have for secure file storage.

Help keep private content private with the included password protection featuring 256-bit AES hardware encryption. Order now for just $129.99 on Amazon!


Start your free Amazon Prime trial
today and unlock unlimited streaming and more!

Help Power Techcratic’s Future – Scan To Support

If Techcratic’s content and insights have helped you, consider giving back by supporting the platform with crypto. Every contribution makes a difference, whether it’s for high-quality content, server maintenance, or future updates. Techcratic is constantly evolving, and your support helps drive that progress.

As a solo operator who wears all the hats, creating content, managing the tech, and running the site, your support allows me to stay focused on delivering valuable resources. Your support keeps everything running smoothly and enables me to continue creating the content you love. I’m deeply grateful for your support, it truly means the world to me! Thank you!

BITCOIN

Bitcoin Logo

Bitcoin QR Code

bc1qlszw7elx2qahjwvaryh0tkgg8y68enw30gpvge

Scan the QR code with your crypto wallet app

DOGECOIN

Dogecoin Logo

Dogecoin QR Code

D64GwvvYQxFXYyan3oQCrmWfidf6T3JpBA

Scan the QR code with your crypto wallet app

ETHEREUM

Ethereum Logo

Ethereum QR Code

0xe9BC980DF3d985730dA827996B43E4A62CCBAA7a

Scan the QR code with your crypto wallet app

Please read the Privacy and Security Disclaimer on how Techcratic handles your support.

Disclaimer: As an Amazon Associate, Techcratic may earn from qualifying purchases.

Tags: Hacker News
Previous Post

Satechi Qi2 Trio 3-in-1 Wireless Charger review: features & price

Next Post

Unidentified flying objects: UFO #shorts

Hacker News

Hacker News

Stay updated with Hacker News, where technology meets entrepreneurial spirit. Get the latest on tech trends, startup news, and discussions from the tech community. Read the latest updates here at Techcratic.

Related Posts

KAIST NEWS CENTER
Hacker News

KAIST NEWS CENTER

June 15, 2025
1.3k
How fast can the RPython GC allocate?
Hacker News

How fast can the RPython GC allocate?

June 15, 2025
1.3k
Biofuels Policy, a Mainstay of American Agriculture, Has Been a Failure for the Climate, a New Report Claims
Hacker News

Biofuels Policy, a Mainstay of American Agriculture, Has Been a Failure for the Climate, a New Report Claims

June 15, 2025
1.3k
SakanaAI/text-to-lora: Hypernetworks that adapt LLMs for specific benchmark tasks using only textual task description as the input
Hacker News

SakanaAI/text-to-lora: Hypernetworks that adapt LLMs for specific benchmark tasks using only textual task description as the input

June 15, 2025
1.3k
tanelp/tiny-diffusion: A minimal PyTorch implementation of probabilistic diffusion models for 2D datasets.
Hacker News

tanelp/tiny-diffusion: A minimal PyTorch implementation of probabilistic diffusion models for 2D datasets.

June 15, 2025
1.3k
How we investigated Amsterdam’s attempt to build a ‘fair’ fraud detection model
Hacker News

How we investigated Amsterdam’s attempt to build a ‘fair’ fraud detection model

June 14, 2025
1.3k
Waymo rides cost more than Uber or Lyft — and people are paying anyway
Hacker News

Waymo rides cost more than Uber or Lyft — and people are paying anyway

June 14, 2025
1.3k
GitHub – zachlatta/sshtron: $ ssh sshtron.zachlatta.com
Hacker News

GitHub – zachlatta/sshtron: $ ssh sshtron.zachlatta.com

June 14, 2025
1.3k
Load More
Next Post
Unidentified flying objects: UFO #shorts

Unidentified flying objects: UFO #shorts

Legend of Zelda: Ocarina of Time Walkthrough – Inside the Deku Tree – Part 2

Legend of Zelda: Ocarina of Time Walkthrough - Inside the Deku Tree - Part 2

2 HOUR JOB SEARCH

Data Science Intern

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Your Tech Resources

  • 30 Second Tech ™
  • AI
  • App Zone ™
  • Apple
  • Ars Technica
  • CNET
  • ComputerWorld
  • Crypto News
  • Cybersecurity
  • Endgadget
  • Fossbytes
  • Gaming
  • GeekWire
  • Gizmodo
  • Google News
  • Hacker News
  • Harvard Tech
  • I Like Cats ™
  • I Like Dogs ™
  • LifeHacker
  • MacRumors
  • Macworld
  • Mashable
  • Microsoft
  • MIT Tech
  • PC World
  • Photofocus
  • Physics
  • Random Tech
  • Retro Rewind ™
  • Robot Report
  • SiliconANGLE
  • SlashGear
  • Smartphone
  • StackSocial
  • Tech Art
  • Tech Careers
  • Tech Deals
  • Techcratic ™
  • TechCrunch
  • Techdirt
  • TechRepublic
  • Techs Got To Eat ™
  • TechSpot
  • Tesla
  • The Verge
  • TNW
  • Trusted Reviews
  • UFO
  • VentureBeat
  • Visual Capitalist
  • Wired
  • ZDNet

Tech News

  • 30 Second Tech ™
  • AI
  • Apple Insider
  • Ars Technica
  • CNET
  • ComputerWorld
  • Crypto News
  • Cybersecurity
  • Endgadget
  • ExtremeTech
  • Fossbytes
  • Gaming
  • GeekWire
  • Gizmodo

Tech News

  • Harvard Tech
  • MacRumors
  • Macworld
  • Mashable
  • Microsoft
  • MIT Tech
  • Physics
  • PC World
  • Random Tech
  • Retro Rewind ™
  • SiliconANGLE
  • SlashGear
  • Smartphone
  • StackSocial
  • Tech Careers

Tech News​

  • Tech Art
  • TechCrunch
  • Techdirt
  • TechRepublic
  • Techs Got To Eat ™
  • TechSpot
  • Tesla
  • The Verge
  • TNW
  • Trusted Reviews
  • UFO
  • VentureBeat
  • Visual Capitalist
  • Wired
  • ZDNet

Site Links

  • About Techcratic
  • Affiliate Disclaimer
  • Affiliate Link Policy
  • Contact Techcratic
  • Dealors Discount Store
  • Privacy and Security Disclaimer
  • Privacy Policy
  • RSS Feed
  • Site Map
  • Support Techcratic
  • Techcratic
  • Tech Deals
  • TOS
  • 𝕏
Click For A Secret Deal

Techcratic – Your All In One Tech Hub © 2020 – 2025
All Rights Reserved
∞

No Result
View All Result
  • 30 Second Tech ™
  • AI
  • App Zone ™
  • Apple
  • Ars Technica
  • CNET
  • Crypto News
  • Cybersecurity
  • Endgadget
  • Gaming
  • I Like Cats ™
  • I Like Dogs ™
  • MacRumors
  • Macworld
  • Tech Deals
  • Techcratic ™
  • Techs Got To Eat ™
  • Tesla
  • UFO
  • Wired