hack のためのネタ帳, etc,,,

下準備
  1. 「スタート」→「設定」→「更新とセキュリティ」→「開発者向け」→「開発者モード」を ON に
  2. 「スタート」→「設定」→「システム」→「アプリと機能」→「プログラムと機能」→「Windowsの機能の有効化または無効化」→「Windows Subsystem for Linux (Beta)」を ON に
  3. reboot
この状態でも「ストア」には「Ubuntu on Winsows」は表示されない。
しかし cmd を開き bash と入力すると以下のようなメッセージが表示される。
Microsoft Windows [Version 10.0.14316]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\WINDOWS\system32>bash
-- Beta feature --
This will install Ubuntu on Windows, distributed by Canonical
and licensed under its terms available here:
https://aka.ms/uowterms

Type "y" to continue:
y と入力すると
Downloading from the Windows Store... 100%
Extracting filesystem, this will take a few minutes...
と表示されてしばらく時間を要した後
??????????????????????????...
と何やら文字化けっぽい表示が出て
root@localhost:/mnt/c/WINDOWS/system32#
とめでたく root 状態の bash が起動した。
ステータス的にはこんな感じ
root@localhost:/mnt/c/WINDOWS/system32# echo $SHELL
/bin/bash
root@localhost:/mnt/c/WINDOWS/system32# echo $BASH_VERSION
4.3.11(1)-release
root@localhost:/mnt/c/WINDOWS/system32# bash --version
GNU bash, version 4.3.11(1)-release (x86_64-pc-linux-gnu)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
root@localhost:/mnt/c/WINDOWS/system32# uname -a
Linux localhost 3.4.0+ #1 PREEMPT Thu Aug 1 17:06:05 CST 2013 x86_64 x86_64 x86_64 GNU/Linux
root@localhost:/mnt/c/WINDOWS/system32# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 14.04.4 LTS
Release:        14.04
Codename:       trusty
root@localhost:/mnt/c/WINDOWS/system32# mount
rootfs on / type rootfs (ro,relatime)
tmpfs on /dev type tmpfs (rw,seclabel,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,seclabel,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,seclabel,relatime)
root@localhost:/mnt/c/WINDOWS/system32# ps ax
  PID TTY      STAT   TIME COMMAND
    1 ?        Ss     0:00 /init
    2 ?        Ss     0:01 /bin/bash
   46 ?        R      0:00 ps ax

rootfs は以下にある模様。
  • %USERPROFILE%/AppData/Local/lxss/rootfs/
ただし bash 上では root 扱いになっているのでなので bash から上記の場所を求めることは難しい($USER, %USERNAME% 等が取れないため)。
lxss のサイズは約 528MB (554,004,911B)だった。
notepad.exe については既報の通り Ubuntu on Windows 上からは起動しない。
root@localhost:/mnt/c/WINDOWS/system32# ls -l notepad.exe
-rwxrwxrwx 2 root root 242176 Apr  3 16:20 notepad.exe
root@localhost:/mnt/c/WINDOWS/system32# stat notepad.exe
  File: ‘notepad.exe’
  Size: 242176          Blocks: 480        IO Block: 512    regular file
Device: 0h/0d   Inode: 562949953476678  Links: 2
Access: (0777/-rwxrwxrwx)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2016-04-03 16:20:33.909947400 +0000
Modify: 2016-04-03 16:20:33.909947400 +0000
Change: 2016-04-11 05:47:53.005801200 +0000
 Birth: -
root@localhost:/mnt/c/WINDOWS/system32# ./notepad.exe
bash: ./notepad.exe: cannot execute binary file: Exec format error
初期状態で導入されているパッケージは以下

rootdlocalhost:/tmp# dpkg -l

root@localhost:/tmp# dpkg -l | wc
    437    4296   54682

コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

管理人/副管理人のみ編集できます