# A completely fake reboot [closed]

This challenge is simple. Write code that produces what looks exactly like a full reboot of the computer. It must not show anything on the screen that indicates it is not a real reboot and should finish at the normal log in screen you would get after rebooting.

Rules.

1. You can choose any OS you like to imitate. For example you can reboot into Linux from Windows or any other combination you choose.
2. The code should display the full shut down/reboot sequence full screen with no signs that it isn't real.
3. This is a popularity contest so the cooler the better.
4. The code must in reality be completely harmless, perform no rebooting and b easy to quit at any point.
5. If you need to use external images to make the reboot look more realistic then your code should grab those automatically from the web.
6. Your code should be self contained, only relying on standard freely available libraries or tools, and easily executable by following the instructions you provide.
7. Good luck!

As it is a popularity contest, I will award the win to the answer with the highest number of votes on June 1, 2014.

Following a request to narrow the question, here is an additional rule.

• The system should imitate any version of Windows or the Mint, Ubuntu, Debian, Fedora, Archlinux or Mageia distributions of Linux or OS X. For extra coolness, you should shut down in one and open in the other.

Interested people may want to look at Pitch dark (Earth Hour remembrance) where a number of ways are suggested for using the full screen even when starting in an xterm.

## closed as too broad by rink.attendant.6, cat, Zach Gates, NoOneIsHere, Michael KleinMay 14 '16 at 5:11

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

• As it stands, this question is too broad. By not restricting the system which should be faked it runs into (at least - this list may not be exhaustive) problems: a) with old ROM-based systems which reboot instantly, and can be faked by displaying one image; b) with determining whether or not a fake meets the acceptance criteria when e.g. the computer I'm running it on is multi-head and the faked OS didn't support multi-head (or any heads at all). – Peter Taylor May 9 '14 at 12:02
• @PeterTaylor I was hoping that answers of type a) would just get low votes and as it is a popularity contest that would be OK. If you could help me refine it to handle point b) I would be very grateful. – user9206 May 9 '14 at 12:51
• The obvious solution to problem b) is to narrow the question by saying that your solution only needs to work under the system it imitates, and by restricting the systems which can be imitated. But even then many attempts are doomed to failure by the variety of BIOSes available for IBM-compatible machines. – Peter Taylor May 9 '14 at 15:56
• @PeterTaylor Thanks. I have greatly narrowed the scope. How is it now? – user9206 May 9 '14 at 18:00
• Gah, I almost had a perfect solution for pure ArchLinux (no boot splash, just kernel messages and BIOS). I must say, I never understood the point of wasting CPU cycles at boot just to display some pretty graphics. – semi-extrinsic May 9 '14 at 20:46

# zsh + coreutils + unclutter + amixer + xterm (Arch Linux)

I took the answer by @TheDoctor and ran with it. This version has many improvements, and is 99% convincing to an experienced user (me) on my Arch Linux system. I use Zsh since it has good array and floating-point number support.
Dependencies: feh, unclutter, amixer, zsh, xterm

Improvements:

1) Use the number printed in the first column by dmesg, which is the time since boot, (e.g. [ 0.000000] ) to determine the time to sleep. Without this it looks very unrealistic on my machine. These times are parsed before the loop (in an early call to sleep) since parsing inside the loop is too slow.

2) Don't print lines where time since boot is larger than 16 seconds. This specific number is machine-dependent, but the point is to avoid printing later dmesg-stuff that comes from inserting/removing usb sticks, etc. and is unrelated to booting.

3) Do all this in a fullscreen terminal window with black background and white text. Kudos to Mechanical Snail for this trick used in: Make a PNG image with "Hello World!" with programming APIs, in the shortest code possible

4) Mute the audio on shutdown, restore volume when script finishes.

5) Hide the mouse cursor, restore when script finishes.

6) Show BIOS and Syslinux splash screens.

Run with: xterm -fu -fg white -bg black -e '/usr/bin/zsh fake-reboot.sh'

Code:

#!/usr/bin/zsh
# Remove (undisplay) the mouse pointer
unclutter -idle 0 -jitter 255 &
# Since there is no easily-accessible (i.e. without being root) shutdown log, we
# fake these messages.
echo "The system is going down for maintenance NOW."
sleep 2.0
echo "[21656.404742] systemd[1]: Shutting down."
echo "[21656.404742] systemd[1]: Stopping Session 1 of user id -u -n."
echo "[21656.404742] systemd[1]: Stopped Session 1 of user id -u -n."
echo "[21656.404742] systemd[1]: Stopping Sound Card."
# For added effect, store volume and then mute sound
volume=amixer -- sget Master | awk -F'[][]' 'END{print $2}' amixer -- sset Master 0% &> /dev/null echo "[21656.404742] systemd[1]: Stopped target Sound Card." sleep 0.5 echo "[21656.919792] systemd[1]: Stopping system-systemd\x2dfsck.slice." echo "[21656.919792] systemd[1]: Removed slice system-systemd\x2dfsck.slice." echo "[21656.919792] systemd[1]: Stopping system-netctl\x2difplugd.slice." echo "[21656.919793] systemd[1]: Removed slice system-netctl\x2difplugd.slice." echo "[21656.919793] systemd[1]: Stopping User Manager for UID id -u..." sleep 0.7 echo "[21657.624741] systemd[1]: Stopping Graphical Interface." echo "[21657.624742] systemd[1]: Stopped target Graphical Interface." echo "[21657.624745] systemd[1]: Stopping Multi-User System." sleep 0.9 echo "[21658.606561] systemd[1]: Stopped target Multi-User System." echo "[21658.606562] systemd[1]: Stopping Paths." echo "[21658.606562] systemd[1]: Stopped D-Bus System Message Bus." echo "[21658.606562] systemd[1]: Stopped target Paths." echo "[21658.606568] systemd[1]: Stopping Timers." echo "[21658.606568] systemd[1]: Stopped target Timers." echo "[21658.606568] systemd[1]: Stopping Sockets." echo "[21658.606568] systemd[1]: Stopped target Sockets." echo "[21658.606568] systemd[1]: Starting Shutdown." echo "[21658.606571] systemd[1]: Reached target Shutdown." echo "[21658.606571] systemd[1]: Starting Exit the Session..." echo "[21658.606571] systemd[1]: Received SIGRTMIN+26 from PID 10988 (kill)." echo "[21658.606571] systemd[1]: Deactivated swap." sleep 0.4 echo "[21659.001741] systemd[1]: Starting Unmount All Filesystems." echo "[21659.001742] systemd[1]: Unmounted /home." echo "[21659.001742] systemd[1]: Reached target Unmount All Filesystems." echo "[21659.001742] systemd[1]: Stopping Remount Root and Kernel File Systems..." echo "[21659.001742] systemd[1]: Stopped Remount Root and Kernel File Systems." echo "[21659.001743] systemd[1]: Reached target Shutdown." echo "[21659.001743] systemd[1]: Starting Final Step." echo "[21659.001743] systemd[1]: Reached target Final Step." echo "[21659.001754] systemd[1]: Shutting down." sleep 0.3 echo "[21659.304341] systemd-journal[250]: Journal stopped" sleep 0.2 echo "System halted." sleep 2 clear sleep 1 # Get the BIOS splash screen and display it wget http://pvv.ntnu.no/~asmunder/bios.jpg &> /dev/null feh -Z -x -F -N --force-aliasing bios.jpg & pid=$! # Store PID of Feh, so we can kill it later
# While showing the BIOS splash, use the time to parse dmesg output into arrays
tim=dmesg | awk '{print $2}' | sed 's/]//' | grep "[0-9][0-9][0-9][0-9][0-9]" tim=($=tim)
dmsg=("${(@f)$(dmesg)}")
sleep 2.5
kill $pid sleep 0.5 # Get the Syslinux splash and display it wget http://pvv.ntnu.no/~asmunder/syslinux.png &> /dev/null feh -Z -x -F -N --force-aliasing syslinux.png & pid=$!
sleep 1.3
kill $pid # Loop through the arrays we created. Calculate the time we have to wait before # displaying this line. If the wait time is less than 0.1 sec, we skip waiting. T1=0.0 T2=0.0 n=0 for d in$dmsg; do
T1=$T2 T2=${tim[$n]} ((dT =$T2-$T1)) if (($dT > 0.1));then
sleep $dT fi echo$d
if (( $T2 > 16.0 )); then break fi ((n=$n+1))
done
sleep 1
clear
# It's normally agetty that parses /etc/issue and handles escape codes in a
# special way. Thus we skip the first line of /etc/issue and do that manually.
echo "Arch Linux "uname -r" (tty1)"
tail -n +2 /etc/issue
echo hostname" login:"
sleep 10
# Reset the mouse pointer so it is visible again
unclutter -idle 5 -jitter 0 &
# Reset the audio volume
amixer -- sset Master $volume &> /dev/null • This is really good and by far the most impressive one I have been able to test so far. – user9206 May 12 '14 at 19:59 • very nice, much boot screen – Claudiu May 22 '14 at 20:50 • Haha, you linked my own question! But that is very good code there. I'm going to try it. – figgycity50 May 26 '14 at 8:38 • cat /etc/issue | tail -n +2 : useless use of cat. tail -n +2 /etc/issue is simpler, especially when there's no pipeline. – Peter Cordes Mar 25 '18 at 16:35 • Good point. Fixed it, and fixed the broken links. – semi-extrinsic Apr 12 '18 at 7:04 ## Commodore 64 1?CHR$(147)
2?"    **** COMMODORE 64 BASIC V2 ****"
3?
4?" 64K RAM SYSTEM  38911 BASIC BYTES FREE"

The BASIC intepreter will display the READY. prompt automatically.

• I'd suggest changing line 1 to: 1 POKE 53280,6:POKE 53281,14:?CHR$(159):?CHR$(147) ...to make sure the colors are correct. – Mark May 22 '14 at 20:26
• +1 for bringing a tear to my eye, even though it doesn't meet the rules. – ClickRick May 22 '14 at 20:41

# TI-Basic

AxesOff
GridOff
LabelOff
CoordOff
ClrDraw
DispGraph
ClrHome
• On my Ti-83 Plus it shows "Done", dunno if this breaks the rules... – Joshua May 28 '14 at 12:38
• To avoid the "Done" you should add an extra line with a single quote. – Timtech Apr 29 '16 at 23:18
• This does not simulate a reboot. If you just press 2ND+ON and then ON again, you only put the device into standby and waking it up shows (in most cases) the screen that you had when you put it into a standby. A real reboot is harder to do. There are ways to do it without removing the battery, but that's the easiest one. So what you see after changing the batteries is what the program should simulate. That's harder, but also possible in TI-Basic. – Fabian Röling Feb 13 '18 at 14:00

# Bash + Coreutils (Linux)

echo "The system is going down for maintenance NOW."
clear
sleep 5
dmesg|while read i; do echo "\$i"; sleep 0.1; done
cat /etc/issue
• This is good if run from a virtual terminal. Is there some way to make it full screen if it is started in an xterm? I suppose at that point you are basically implementing a screensaver. – user9206 May 9 '14 at 13:53
• @Lembik xterm -fullscreen? – user16402 May 10 '14 at 8:31
• @professorfish As in codegolf.stackexchange.com/questions/26697/… – user9206 May 10 '14 at 10:16
• Tried it on Mac; doesn't work. – Jwosty May 11 '14 at 3:23
• @Jwosty On OS X (Mavericks, 10.9) you need to have super user privileges, so replace dmesg with sudo dmesg. Futhermore /etc/issue does not exist on OS X. – CousinCocaine May 11 '14 at 8:15

# Windows 8

Shoddy attempt, I can't figure out how to auto full screen. I tried.

<!DOCTYPE html>
<html>
<body>

<iframe width="1600" height="900" src="http://www.youtube.com/embed/VgQ87b7muWs?start=510&end=524&autoplay=1" frameborder="0" allowfullscreen></iframe>

</body>
</html>

# Python / Pygame OSX

import pygame, time, os, urllib # Import Modules
pygame.init() # Initalise Pygame
pygame.mouse.set_visible(0) # Hide the Cursor
stdscr = pygame.display.set_mode((1280,800),pygame.FULLSCREEN) # Set up the display
stdscr.fill((255,255,255)) # Fill the screen white
urllib.urlretrieve("http://harrybeadle.github.io/FakeRestart/apple.bmp", "apple.bmp") # Get Apple Logo
urllib.urlretrieve("http://harrybeadle.github.io/FakeRestart/startup.wav", "startup.wav") # Get Startup Sound
time.sleep(1) # Wait for 1 second, screen still black
stdscr.blit(applelogo,(580, 340)) # Blit the logo
pygame.mixer.music.play(1) # Play the sound
pygame.display.flip() # Flip the buffers
time.sleep(5) # Wait 5 seconds
pygame.quit() # Quit the pygame window
os.remove('apple.bmp') # Delete logo
os.remove('startup.wav') # Delete bung

Now Updated!

Features:

• Blank Screen
• White Screen w/ Apple Logo and Bung Sound
• Locks the user's Mac preserving any work using a terminal command and os.system()
• Nice. Minor nitpick - the rules say: "If you need to use external images to make the reboot look more realistic then your code should grab those automatically from the web." – semi-extrinsic May 12 '14 at 11:42
• @semi-extrinsic Looked into it, it's more bother than it's worth, I had to edit the image anyway and Pygame is not friendly with any filetype that isn't a Windows Bitmap, so I think I leave it as it is for now. – Harry Beadle May 12 '14 at 14:17
• @semi-extrinsic Scrap my previous comment, functionality added. – Harry Beadle May 12 '14 at 14:31
• This only shows the apple logo full screen for a few seconds. It definitely needs the "Bung" :) – user9206 May 13 '14 at 8:36
• @Lembik I've added that now, along with moving the assets to GitHub for reliability :) – Harry Beadle May 19 '14 at 17:17

This one does linux with parameters "quiet" and "init=/bin/sh"

#!/bin/sh
echo shutting down
sleep 1
clear
echo Press F12 to enter setup. #everyone forgets the BIOS
sleep 1
clear
• usually systems either show a image or console output. and not everyone's bios is on f12 :P – masterX244 May 12 '14 at 17:22
• @masterX244 - the image is a configurable build option in linux. with quiet there is no kernel ouput and with init=/bin/sh there is no startup output because the init is to simply start a shell. You should try it sometime and see exactly what is needed to start X. with devtmfs+automount enabled I can get to X in < 0.2sec with a 1-liner. – technosaurus May 12 '14 at 17:36
• ahh, not a common config thats why i commented – masterX244 May 12 '14 at 17:51