ユーザ用ツール

サイト用ツール


mae3xx_tips:setup_docker:create_bootable_sd:start

Boot 用 SD カードの準備

Docker の導入には、本体 Flash Memory では容量が不足するため、SD カードから起動する形で導入します。
以下 SD カード作成の方法には、Docker をサポートした Kernel が導入されているファームウェア (v4.0.0β1 以降) が必要です。


パーティション作成

購入した状態の SD カードは、Windows 用のパーティション構成(FAT32) となっていますので、fdisk コマンドにより下記パーティション構成に変更します。

No. Partition type 容量 Note
1 0x06 100MiB程度 active
2 0x83 残り全部1)


root@plum:~# fdisk /dev/mmcblk0

Welcome to fdisk (util-linux 2.31.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): d  <---------- (1) FAT32 パーティションの削除
Selected partition 1
Partition 1 has been deleted.

Command (m for help): n  <---------- (2) FAT16 パーティション作成 (for bootloader, /boot)
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-3911679, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-3911679, default 3911679): +100M

Created a new partition 1 of type 'Linux' and of size 100 MiB.

Command (m for help): n  <---------- (3) Linux 用パーティション作成 (for root filesystem)
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (206848-3911679, default 206848): 
Last sector, +sectors or +size{K,M,G,T,P} (206848-3911679, default 3911679): 

Created a new partition 2 of type 'Linux' and of size 1.8 GiB.

Command (m for help): t  <---------- (4) No.1 のパーティションタイプ変更 (Linux -> FAT16 へ)
Partition number (1,2, default 2): 1
Hex code (type L to list all codes): L

 0  Empty           24  NEC DOS         81  Minix / old Lin bf  Solaris        
 1  FAT12           27  Hidden NTFS Win 82  Linux swap / So c1  DRDOS/sec (FAT-
 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS/sec (FAT-
 3  XENIX usr       3c  PartitionMagic  84  OS/2 hidden or  c6  DRDOS/sec (FAT-
 4  FAT16 <32M      40  Venix 80286     85  Linux extended  c7  Syrinx         
 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    
 6  FAT16           42  SFS             87  NTFS volume set db  CP/M / CTOS / .
 7  HPFS/NTFS/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   
 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         
 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     
 a  OS/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R/O        
 b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD/OS          e4  SpeedStor      
 c  W95 FAT32 (LBA) 52  CP/M            a0  IBM Thinkpad hi ea  Rufus alignment
 e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         eb  BeOS fs        
 f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ee  GPT            
10  OPUS            55  EZ-Drive        a7  NeXTSTEP        ef  EFI (FAT-12/16/
11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f0  Linux/PA-RISC b
12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f1  SpeedStor      
14  Hidden FAT16 <3 61  SpeedStor       ab  Darwin boot     f4  SpeedStor      
16  Hidden FAT16    63  GNU HURD or Sys af  HFS / HFS+      f2  DOS secondary  
17  Hidden HPFS/NTF 64  Novell Netware  b7  BSDI fs         fb  VMware VMFS    
18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fc  VMware VMKCORE 
1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fd  Linux raid auto
1c  Hidden W95 FAT3 75  PC/IX           bc  Acronis FAT32 L fe  LANstep        
1e  Hidden W95 FAT1 80  Old Minix       be  Solaris boot    ff  BBT            
Hex code (type L to list all codes): 6

Changed type of partition 'Linux' to 'FAT16'.

Command (m for help): a  <---------- (5) No.1 パーティションに active フラグをセットする
Partition number (1,2, default 2): 1

The bootable flag on partition 1 is enabled now.

Command (m for help): p  <---------- (6) パーティション構成の確認
Disk /dev/mmcblk0: 1.9 GiB, 2002780160 bytes, 3911680 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00073ed7

Device         Boot  Start     End Sectors  Size Id Type
/dev/mmcblk0p1 *      2048  206847  204800  100M  6 FAT16
/dev/mmcblk0p2      206848 3911679 3704832  1.8G 83 Linux

Command (m for help): w  <---------- (7) パーティション構成を SD カードに書き込み、終了
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

root@plum:~# 


ファイルシステム作成

No.1 パーティションのフォーマット(FAT)

root@plum:~# mkfs.vfat /dev/mmcblk0p1 
mkfs.fat 4.1 (2017-01-24)
root@plum:~# 


No.2 パーティションのフォーマット(ext4)

root@plum:~# mkfs.ext4 /dev/mmcblk0p2 
mke2fs 1.44.1 (24-Mar-2018)
Discarding device blocks: done                            
Creating filesystem with 463104 4k blocks and 115920 inodes
Filesystem UUID: 68c04c1f-5803-4164-b911-422e645a2885
Superblock backups stored on blocks: 
	32768, 98304, 163840, 229376, 294912

Allocating group tables: done                            
Writing inode tables: done                            
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done 

root@plum:~# 

SDカードに root filesystem を作成する (Obsolete) に書いたとおり、mkfs.ext4-i 4096 のオプションを追加しておいたほうが良いと思います。


Bootloader ファイルのコピー

No.1 パーティションを mount し、Bootloader のファイルをコピーします。
Bootloader の 2 段目は、実機の Flash Memory からコピーします。

File STAT SHA1SUM Info
mlo.zip2018/12/18 11:52 31.6 KBdd42d4ade113c16a71815d312275695f218270bcMLO(bootloader 1段目)


root@plum:~# mount /dev/mmcblk0p1 /mnt/sd/  <----- (1) No.1 パーティション (FAT) を mount
root@plum:~# cp /tmp/MLO /mnt/sd            <----- (2) MLO (Bootloader 1段目) をコピー
root@plum:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 0ff00000 00020000 "UBI"
mtd1: 00100000 00020000 "OOPS"
mtd2: 0040f800 0001f800 "kernel.0"
mtd3: 0040f800 0001f800 "kernel.1"
mtd4: 00217800 0001f800 "initramfs.0"
mtd5: 00217800 0001f800 "initramfs.1"
mtd6: 00217800 0001f800 "kmod.0"
mtd7: 00217800 0001f800 "kmod.1"
mtd8: 0501a800 0001f800 "rootfs.0"
mtd9: 0501a800 0001f800 "rootfs.1"
mtd10: 0191a000 0001f800 "opt"
mtd11: 02bce000 0001f800 "overlay"
mtd12: 00020000 00010000 "MLO"
mtd13: 00080000 00010000 "barebox.bin"
mtd14: 00020000 00010000 "barebox.env"
mtd15: 00020000 00010000 "dtb.0"
mtd16: 00020000 00010000 "dtb.1"
mtd17: 00020000 00010000 "hist_firmup"
mtd18: 000e0000 00010000 "hist_boot"
root@plum:~# cp /dev/mtdblock13 /mnt/sd/barebox.bin  <----- (3) FlashMemory から Bootloader 2段目 をコピー
root@plum:~# ls -l /mnt/sd/
total 562
-rwxr-xr-x 1 root root 524288 Dec 18 11:54 barebox.bin
-rwxr-xr-x 1 root root  49304 Dec 18 11:54 MLO
root@plum:~# 


Kernel, DeviceTree のコピー

Kernel, DeviceTree を本体 FlashMemory からコピーします。
起動している側のエリアのファイルをコピーします。

root@plum:~# cat /proc/cmdline 
ubi.mtd=UBI mtdoops.mtddev=OOPS mtdoops.record_size=8192 zswap.enabled=1  root=AREA=0 omap_wdt.start_at_boot=1 
 omap_wdt.timer_margin=180 console=ttyO0,115200  overlay=tmpfs overlay_driver=aufs  rootdelay=1 reset_cause=POR
 usbcore.autosuspend=-1 xio_id=3 mtdparts=omap2-nand.0:255M(UBI),-(OOPS) 


root=AREA=0 となっていますので、AREA0 の領域からコピーします。

root@plum:~# cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 0ff00000 00020000 "UBI"
mtd1: 00100000 00020000 "OOPS"
mtd2: 0040f800 0001f800 "kernel.0"  <----- Kernel
mtd3: 0040f800 0001f800 "kernel.1"
mtd4: 00217800 0001f800 "initramfs.0"
mtd5: 00217800 0001f800 "initramfs.1"
mtd6: 00217800 0001f800 "kmod.0"
mtd7: 00217800 0001f800 "kmod.1"
mtd8: 0501a800 0001f800 "rootfs.0"
mtd9: 0501a800 0001f800 "rootfs.1"
mtd10: 0191a000 0001f800 "opt"
mtd11: 02bce000 0001f800 "overlay"
mtd12: 00020000 00010000 "MLO"
mtd13: 00080000 00010000 "barebox.bin"
mtd14: 00020000 00010000 "barebox.env"
mtd15: 00020000 00010000 "dtb.0"  <----- DeviceTree
mtd16: 00020000 00010000 "dtb.1"
mtd17: 00020000 00010000 "hist_firmup"
mtd18: 000e0000 00010000 "hist_boot"
root@plum:/mnt/sd# cp /dev/mtdblock2 uImage
root@plum:/mnt/sd# cp /dev/mtdblock15 plum-ma.dtb


ここまでの作業で、No.1 パーティションには下記のファイルが配置されました。

root@plum:/mnt/sd# ls -l
total 4848
-rwxr-xr-x 1 root root  524288 Dec 18 11:54 barebox.bin
-rwxr-xr-x 1 root root   49304 Dec 18 11:54 MLO
-rwxr-xr-x 1 root root  131072 Dec 18 12:38 plum-ma.dtb
-rwxr-xr-x 1 root root 4257792 Dec 18 12:38 uImage
root@plum:/mnt/sd# 


No.1 パーティションは umount しておきます。

root@plum:/mnt/sd# cd
root@plum:~# umount /mnt/sd 
root@plum:~# 


root filesystem の作成

Ubuntu 18.04LTS の root filesystem を、No.2 パーティションに作成します。
まず、mount します。

root@plum:~# mount /dev/mmcblk0p2 /mnt/sd
root@plum:~# 


Debootstrap コマンドで、Ubuntu 18.04LTS のベース部分を作成しますので、debootstrap パッケージを導入します。
インターネットに接続できるように設定しておく必要があります。

root@plum:~# apt update
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease [242 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [83.2 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf Packages [968 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/main Translation-en [516 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports bionic/restricted armhf Packages [8,360 B]
Get:7 http://ports.ubuntu.com/ubuntu-ports bionic/restricted Translation-en [3,584 B]
Get:8 http://ports.ubuntu.com/ubuntu-ports bionic/universe armhf Packages [8,269 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports bionic/universe Translation-en [4,941 kB]                   
Get:10 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse armhf Packages [129 kB]                  
Get:11 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse Translation-en [108 kB]                  
Get:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf Packages [368 kB]                
Get:13 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main Translation-en [172 kB]                
Get:14 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted armhf Packages [6,460 B]         
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted Translation-en [3,076 B]         
Get:16 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe armhf Packages [559 kB]            
Get:17 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe Translation-en [171 kB]            
Get:18 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse armhf Packages [3,128 B]         
Get:19 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse Translation-en [3,356 B]         
Get:20 http://ports.ubuntu.com/ubuntu-ports bionic-security/main armhf Packages [150 kB]               
Get:21 http://ports.ubuntu.com/ubuntu-ports bionic-security/main Translation-en [85.0 kB]              
Get:22 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe armhf Packages [107 kB]           
Get:23 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe Translation-en [61.4 kB]          
Get:24 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse armhf Packages [644 B]          
Get:25 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse Translation-en [996 B]          
Fetched 17.0 MB in 28s (613 kB/s)                                                                      
Reading package lists... Done
Building dependency tree       
Reading state information... Done
3 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@plum:~# 
root@plum:~# apt install debootstrap
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf gpgsm
  libassuan0 libksba8 libnpth0 pinentry-curses
Suggested packages:
  ubuntu-archive-keyring dbus-user-session pinentry-gnome3 tor parcimonie xloadimage scdaemon
  pinentry-doc
The following NEW packages will be installed:
  debootstrap dirmngr gnupg gnupg-l10n gnupg-utils gpg gpg-agent gpg-wks-client gpg-wks-server gpgconf
  gpgsm libassuan0 libksba8 libnpth0 pinentry-curses
0 upgraded, 15 newly installed, 0 to remove and 4 not upgraded.
Need to get 1,893 kB of archives.
After this operation, 4,613 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf libassuan0 armhf 2.5.1-2 [28.3 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf gpgconf armhf 2.2.4-1ubuntu1.1 [105 kB]
... 略 ...
Setting up gpg-wks-server (2.2.4-1ubuntu1.1) ...
Setting up gpg-wks-client (2.2.4-1ubuntu1.1) ...
Setting up gnupg (2.2.4-1ubuntu1.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
root@plum:~# 


debootstrap コマンドを実行します。

root@plum:~# debootstrap bionic /mnt/sd http://ports.ubuntu.com
I: Retrieving InRelease 
I: Checking Release signature
I: Valid Release signature (key id 790BC7277767219C42C86F933B4FE6ACC0B21F32)
I: Retrieving Packages 
I: Validating Packages 
... 略 ...
I: Configuring console-setup-linux...
I: Configuring console-setup...
I: Configuring ubuntu-minimal...
I: Configuring libc-bin...
I: Configuring systemd...
I: Configuring ca-certificates...
I: Configuring initramfs-tools...
I: Base system installed successfully.
root@plum:~# 

Ubuntu の root filesystem が作成されました。


Kernel module のコピー

実機から、Kernel module をコピーします。

root@plum:~# cd /mnt/sd/lib/
root@plum:/mnt/sd/lib# mkdir modules
root@plum:/mnt/sd/lib# cd modules/
root@plum:/mnt/sd/lib/modules# cp -af /lib/modules/4.19.9+ .
root@plum:/mnt/sd/lib/modules# ls -l
total 4
drwxr-xr-x 3 root root 4096 Dec 18 09:21 4.19.9+


apt line のコピー

debootstrap しただけですと、apt line に main しか設定されていない状態なのでコピーしておきます。

root@plum:~# cat /mnt/sd/etc/apt/sources.list
deb http://ports.ubuntu.com bionic main
root@plum:~# 
root@plum:~# cp /etc/apt/sources.list /mnt/sd/etc/apt/
root@plum:~# 


ネットワークの設定

ネットワークの設定がカラの状態なので、実機からコピーしておきます。

root@plum:~# cp /etc/network/interfaces /mnt/sd/etc/network/interfaces
root@plum:~# 


初期設定

root filesystem に chroot し、Ubuntu の各種設定を行います。

root@plum:~# chroot /mnt/sd
root@plum:/# 


パッケージ更新

セキュリティアップデートなどが適用されていない状態なので、パッケージの更新をしておきます。

root@plum:~# apt update
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic InRelease [242 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic-updates InRelease [88.7 kB]
Get:3 http://ports.ubuntu.com/ubuntu-ports bionic-security InRelease [83.2 kB]
Get:4 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf Packages [968 kB]
Get:5 http://ports.ubuntu.com/ubuntu-ports bionic/main Translation-en [516 kB]
Get:6 http://ports.ubuntu.com/ubuntu-ports bionic/restricted armhf Packages [8360 B]
Get:7 http://ports.ubuntu.com/ubuntu-ports bionic/restricted Translation-en [3584 B]
Get:8 http://ports.ubuntu.com/ubuntu-ports bionic/universe armhf Packages [8269 kB]
Get:9 http://ports.ubuntu.com/ubuntu-ports bionic/universe Translation-en [4941 kB]                    
Get:10 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse armhf Packages [129 kB]                  
Get:11 http://ports.ubuntu.com/ubuntu-ports bionic/multiverse Translation-en [108 kB]                  
Get:12 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf Packages [368 kB]                
Get:13 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main Translation-en [172 kB]                
Get:14 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted armhf Packages [6460 B]          
Get:15 http://ports.ubuntu.com/ubuntu-ports bionic-updates/restricted Translation-en [3076 B]          
Get:16 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe armhf Packages [559 kB]            
Get:17 http://ports.ubuntu.com/ubuntu-ports bionic-updates/universe Translation-en [171 kB]            
Get:18 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse armhf Packages [3128 B]          
Get:19 http://ports.ubuntu.com/ubuntu-ports bionic-updates/multiverse Translation-en [3356 B]          
Get:20 http://ports.ubuntu.com/ubuntu-ports bionic-security/main armhf Packages [150 kB]               
Get:21 http://ports.ubuntu.com/ubuntu-ports bionic-security/main Translation-en [85.0 kB]              
Get:22 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe armhf Packages [107 kB]           
Get:23 http://ports.ubuntu.com/ubuntu-ports bionic-security/universe Translation-en [61.4 kB]          
Get:24 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse armhf Packages [644 B]          
Get:25 http://ports.ubuntu.com/ubuntu-ports bionic-security/multiverse Translation-en [996 B]          
Fetched 17.0 MB in 32s (534 kB/s)                                                                      
Reading package lists... Done
Building dependency tree... Done
69 packages can be upgraded. Run 'apt list --upgradable' to see them.
root@plum:~# apt upgrade
Reading package lists... Done
Building dependency tree... Done
Calculating upgrade... Done
The following NEW packages will be installed:
  python3-netifaces
The following packages will be upgraded:
  apt apt-utils base-files bsdutils console-setup console-setup-linux distro-info-data dpkg fdisk file
  gcc-8-base gpgv initramfs-tools initramfs-tools-bin initramfs-tools-core keyboard-configuration kmod
  libapparmor1 libapt-inst2.0 libapt-pkg5.0 libblkid1 libcryptsetup12 libdns-export1100 libfdisk1
  libgcc1 libgcrypt20 libglib2.0-0 libglib2.0-data libisc-export169 libkmod2 libmagic-mgc libmagic1
  libmount1 libncurses5 libncursesw5 libnss-systemd libpam-systemd libprocps6 libpython3-stdlib
  libpython3.6-minimal libpython3.6-stdlib libsmartcols1 libssl1.1 libstdc++6 libsystemd0 libtinfo5
  libudev1 libuuid1 libxml2 mount ncurses-base ncurses-bin netcat-openbsd netplan.io
  networkd-dispatcher nplan openssl perl-base procps python3 python3-minimal python3.6
  python3.6-minimal systemd systemd-sysv tzdata ubuntu-keyring udev util-linux
69 upgraded, 1 newly installed, 0 to remove and 0 not upgraded.
Need to get 22.0 MB of archives.
After this operation, 295 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
... 略 ...
Setting up file (1:5.32-2ubuntu0.1) ...
Setting up python3-netifaces (0.10.4-0.1build4) ...
Setting up networkd-dispatcher (1.7-0ubuntu3.3) ...
Installing new version of config file /etc/default/networkd-dispatcher ...
Setting up netplan.io (0.40.1~18.04.3) ...
Setting up nplan (0.40.1~18.04.3) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for initramfs-tools (0.130ubuntu3.5) ...
root@plum:~# 


Timezone 設定

Timezone を Asia/Tokyo に設定します。

root@plum:~# dpkg-reconfigure tzdata
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory

Current default time zone: 'Asia/Tokyo'
Local time is now:      Tue Dec 18 13:41:44 JST 2018.
Universal Time is now:  Tue Dec 18 04:41:44 UTC 2018.

root@plum:~# 


locale 設定

必要な locale を作成しておきます。

root@plum:~# dpkg-reconfigure locales
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
	LANGUAGE = (unset),
	LC_ALL = (unset),
	LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
locale: Cannot set LC_CTYPE to default locale: No such file or directory
locale: Cannot set LC_MESSAGES to default locale: No such file or directory
locale: Cannot set LC_ALL to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_CTYPE to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_MESSAGES to default locale: No such file or directory
/usr/bin/locale: Cannot set LC_ALL to default locale: No such file or directory
Generating locales (this might take a while)...
  en_US.UTF-8... done
  ja_JP.UTF-8... done
Generation complete.
root@plum:~# 

en_US, ja_JP の UTF8 だけ作成しました。


ユーザーの作成

ユーザー2)を作成しておきます。sudo も実行できるよう、sudo group へ追加しておきます。

root@plum:~# adduser user1
Adding user `user1' ...
Adding new group `user1' (1000) ...
Adding new user `user1' (1000) with group `user1' ...
Creating home directory `/home/user1' ...
Copying files from `/etc/skel' ...
Enter new UNIX password: 
Retype new UNIX password: 
passwd: password updated successfully
Changing the user information for user1
Enter the new value, or press ENTER for the default
	Full Name []: MA-E3xx User
	Room Number []: 
	Work Phone []: 
	Home Phone []: 
	Other []: 
Is the information correct? [Y/n] y
root@plum:~# usermod -a -G sudo user1
root@plum:~# 


追加パッケージの導入(任意)

従来とおなじ方式で Network の設定をしたい場合、パッケージを追加で導入しておきます。

root@plum:~# apt install ifupdown net-tools
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Suggested packages:
  ppp rdnssd
The following NEW packages will be installed:
  ifupdown net-tools
0 upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 220 kB of archives.
After this operation, 790 kB of additional disk space will be used.
Get:1 http://ports.ubuntu.com/ubuntu-ports bionic-updates/main armhf ifupdown armhf 0.8.17ubuntu1.1 [51.5 kB]
Get:2 http://ports.ubuntu.com/ubuntu-ports bionic/main armhf net-tools armhf 1.60+git20161116.90da8a0-1ubuntu1 [169 kB]
Fetched 220 kB in 2s (143 kB/s)
E: Can not write log (Is /dev/pts mounted?) - posix_openpt (19: No such device)
Selecting previously unselected package ifupdown.
(Reading database ... 11107 files and directories currently installed.)
Preparing to unpack .../ifupdown_0.8.17ubuntu1.1_armhf.deb ...
Unpacking ifupdown (0.8.17ubuntu1.1) ...
Selecting previously unselected package net-tools.
Preparing to unpack .../net-tools_1.60+git20161116.90da8a0-1ubuntu1_armhf.deb ...
Unpacking net-tools (1.60+git20161116.90da8a0-1ubuntu1) ...
Setting up ifupdown (0.8.17ubuntu1.1) ...
Created symlink /etc/systemd/system/multi-user.target.wants/networking.service → /lib/systemd/system/networking.service.
Created symlink /etc/systemd/system/network-online.target.wants/networking.service → /lib/systemd/system/networking.service.
Processing triggers for systemd (237-3ubuntu10.9) ...
Setting up net-tools (1.60+git20161116.90da8a0-1ubuntu1) ...
root@plum:~# 


ssh でログインして作業する場合、ssh を導入しておきます。

root@plum:~# apt install ssh
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  krb5-locales libedit2 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libpsl5
  libssl1.0.0 libwrap0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1
  multiarch-support ncurses-term openssh-client openssh-server openssh-sftp-server publicsuffix
  python3-certifi python3-chardet python3-idna python3-pkg-resources python3-requests python3-six
  python3-urllib3 ssh-import-id wget xauth
Suggested packages:
  krb5-doc krb5-user keychain libpam-ssh monkeysphere ssh-askpass molly-guard rssh ufw
  python3-setuptools python3-cryptography python3-openssl python3-socks
The following NEW packages will be installed:
  krb5-locales libedit2 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libpsl5
  libssl1.0.0 libwrap0 libx11-6 libx11-data libxau6 libxcb1 libxdmcp6 libxext6 libxmuu1
  multiarch-support ncurses-term openssh-client openssh-server openssh-sftp-server publicsuffix
  python3-certifi python3-chardet python3-idna python3-pkg-resources python3-requests python3-six
  python3-urllib3 ssh ssh-import-id wget xauth
0 upgraded, 34 newly installed, 0 to remove and 0 not upgraded.
Need to get 4,145 kB of archives.
After this operation, 19.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
... 略 ...
Creating config file /etc/ssh/sshd_config with new version
Creating SSH2 RSA key; this may take some time ...
2048 SHA256:k/J+bgGuWMsUN9GNQFTJI9segZYZpEcm5J25JzuW8XM root@plum (RSA)
Creating SSH2 ECDSA key; this may take some time ...
256 SHA256:247qQgDiEwrKEIVXJWHicy3LrPeVBfLhASsfbYefp/U root@plum (ECDSA)
Creating SSH2 ED25519 key; this may take some time ...
256 SHA256:DsMLBgUCShnQ3DEb9ICFGGFgydPnbG8yN+rFrLVtn1E root@plum (ED25519)
Created symlink /etc/systemd/system/sshd.service → /lib/systemd/system/ssh.service.
Created symlink /etc/systemd/system/multi-user.target.wants/ssh.service → /lib/systemd/system/ssh.service.
invoke-rc.d: could not determine current runlevel
Setting up ssh (1:7.6p1-4ubuntu0.1) ...
Processing triggers for libc-bin (2.27-3ubuntu1) ...
Processing triggers for systemd (237-3ubuntu10.9) ...
root@plum:~# 


これで完了です。chroot 環境から exit し、shutdown しておきます。

1)
swap を利用したい場合、その分を残して使うこともありだと思います
2)
例では user1 にしていますが、任意です。
mae3xx_tips/setup_docker/create_bootable_sd/start.txt · 最終更新: 2019/01/13 09:23 by admin