Table of Contents
1 デフォルトだとapt sourceできない
Ubuntu 16.04をインストールした直後の状態だとapt sourceが失敗します。
$ apt source linuxReading package lists… DoneE: You must put some ‘source’ URIs in your sources.list
これはdeb-srcがコメントアウトされている為です。
$ cat /etc/apt/sources.list<snip># See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to# newer versions of the distribution.deb http://jp.archive.ubuntu.com/ubuntu/ xenial main restricted# deb-src http://jp.archive.ubuntu.com/ubuntu/ xenial main restricted## Major bug fix updates produced after the final release of the## distribution.deb http://jp.archive.ubuntu.com/ubuntu/ xenial-updates main restricted# deb-src http://jp.archive.ubuntu.com/ubuntu/ xenial-updates main restricted<snip>
2 deb-srcを有効にする
debに対応したdeb-srcのURLをリポジトリのリストに追加します。
$ sudo su -c “grep ‘^deb ‘ /etc/apt/sources.list | sed ‘s/^deb/deb-src/g’ > /etc/apt/sources.list.d/deb-src.list”
リポジトリのデータベースを更新します。
$ sudo apt update -y
3 実行結果
apt sourceを実行できるようになりました。
$ mkdir linux$ cd linux$ apt source linuxReading package lists…NOTICE: ‘linux’ packaging is maintained in the ‘Git’ version control system at:git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenialPlease use:git clone git://git.launchpad.net/~ubuntu-kernel/ubuntu/+source/linux/+git/xenialto retrieve the latest (possibly unreleased) updates to the package.Need to get 144 MB of source archives.Get:1 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux 4.4.0-28.47 (dsc) [9,611 B]Get:2 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux 4.4.0-28.47 (tar) [133 MB]Get:3 http://jp.archive.ubuntu.com/ubuntu xenial-updates/main linux 4.4.0-28.47 (diff) [11.3 MB]gpgv: Signature made 2016年06月24日 19時02分30秒 JST using RSA key ID FDCE24FCgpgv: Can’t check signature: public key not founddpkg-source: warning: failed to verify signature on ./linux_4.4.0-28.47.dscdpkg-source: info: extracting linux in linux-4.4.0dpkg-source: info: unpacking linux_4.4.0.orig.tar.gzdpkg-source: info: applying linux_4.4.0-28.47.diff.gzdpkg-source: info: upstream files that have been modified:<snip>$ lslinux-4.4.0 linux_4.4.0-28.47.diff.gz linux_4.4.0-28.47.dsc linux_4.4.0.orig.tar.gz