What commands are needed to install Ubuntu Core?
Solution 1
All of those commands will require admin-rights. Easiest is to do sudo su
to get a root console.
-
Archives like your core .tar.gz (this is oneiric, precise beta is here) are combined in one file (packed) and reduced in size (compressed).
gzip -d ubuntu-core-11.10-core-i386.tar.gz
will uncompress the core to ubuntu-core-11.10-core-i386.tar (no .gz anymore; one big file).
-
To partition the device for core it's easiest to use a graphical tool like gparted. When that's not available. See here. In a nutshell - assuming you want to partition the device /dev/sda:
fdisk /dev/sda
then pressn
p
1
<Return>
<Return>
a
1
w
(for details please see link).This creates /dev/sda1 partition.
mkfs.ext4 /dev/sda1
This creates an ext4 filesystem on the new partition. You can of course use
mkfs.ext3
,mkfs.ext2
as well.Mount it:
mount /dev/sda1 /mnt
and go therecd /mnt
-
tar -xf /path/to/where/you/put/ubuntu-core-11.10-core-i386.tar
will unpack the core (many files).
-
grub-install --root-directory=/mnt /dev/sda
will install the bootloader (this is of course just one of many options).
-
cp /etc/resolv.conf /mnt/etc/resolv.conf
will allow network access after chroot-ing (in step 7) by copying the DNS resolver configuration
-
for f in /sys /proc /dev ; do mount --rbind $f /mnt/$f ; done ; chroot /mnt
will go to a chroot, see Is there an easier way to chroot than bind-mounting? for details about mount rbind
-
apt-get update && apt-get install linux-{headers,image}-generic
will install kernel ("linux")
Note: it's possible that
apt-get update
will not work because no network is present. reboot
and you're good to go.
I haven't got a machine to test this so the answer probably won't be complete. I will change my answer should you stumble across problems.
Solution 2
You may also check this to install the Ubuntu Core to a USB stick
The Ubuntu Core is providing us a nice startup for playing with Linux. It's saving lots of time for building a rootfs, which might require a lot of efforts to get working.
There could be many ways to play with a rootfs. The simplest could be using chroot to temporarily switch to Ubuntu Core. Most of the utilities you're familiar with should be working. But the network shouldn't be, because there's actually no network configuration. Neither the devfs nor sysfs was created, so many utilities depending on those kernel inode interfaces shouldn't be working.
Yet it's still possible to install packages onto the Ubuntu Core root.
Installation Example
Install the Ubuntu Core rootfs and kernel images.
sudo bash cd /media/duzy/Root tar xzvf ~/Downloads/ubuntu-core-15.10-core-amd64.tar.gz cp -vf /boot/vmlinuz-4.*-generic /media/duzy/Boot cp -vf /boot/initrd.img-4.*-generic /media/duzy/Boot useradd --root /media/duzy/Root -s '/bin/bash' -m duzy passwd --root /media/duzy/Root duzy Enter new UNIX password: ...... Retype new UNIX password: ...... cp /etc/resolv.conf /media/duzy/Root/resolv.conf for s in proc sys dev ; do mount --rbind /dev /media/duzy/Root/$s; done chroot /media/duzy/Root apt-get update
Install grub (grub-install)
sudo grub-install --boot-directory=/media/duzy/Boot /dev/sdf
sudo grub-mkconfig -o /media/duzy/Boot/grub/grub.cfg
Test USB with KVM (link)
kvm -hdb /dev/sde # NOT the partition (/dev/sde1)!
Or test with VirtualBox
VBoxManage internalcommands createrawvmdk -filename VirtualBox/usbdisk.vmdk -rawdisk /dev/sde
Oxwivi
Updated on September 18, 2022Comments
-
Oxwivi over 1 year
Ubuntu Core's wiki page page contains the instructions to install Ubuntu Core on a target media:
- Uncompress (do not unpack) rootfs
- Format target media: at least one partition should be
ext2
,ext3
, orext4
- Unpack Ubuntu Core to
ext{2,3,4}
partition - Install boot-loader
- Install Linux
- If the Linux kernel requires modules, add these to
/lib/modules/$(uname -r)
in theext{2,3,4}
file system - Boot the target device
- Install any additional required software using
apt-get
But what are the specific commands to do the above? The things I'm specifically confused about are:
- Uncompressing and unpacking, what's the difference and how do I do them?
- What package should I install if I want the generic kernel provided in regular Ubuntu installation?
- I won't be installing any drivers or anything related to kernel other than what's provided in the repos, do I need to worry about manually adding kernel modules?
PS I would like to request that all the commands used in the installation process be mentioned in the answer, for the benefit of ones who're completely unfamiliar and myself, should I ever forget.
-
Oxwivi over 12 yearsI suppose I can create users using the
chroot
environment? -
David Guo over 12 yearsYeah definitely! Remember to use
adduser
as opposed touseradd
as it's more comfortable. -
Oxwivi over 12 yearsI will not be able to immediately try these out as well, but I'm accepting it, since to my knowledge, it will work perfectly. I will comment and edit if I come across any hiccups.
-
Alex over 11 yearsExcellent guide. I found this to be an easier process than the one on the Ubuntu wiki here: wiki.ubuntu.com/Core/InstallationExample.However once I finished I could not log in as a normal user, or even su to a normal user from root. I got the error "Cannot execute /bin/bash: Permission denied", and "user not known to the underlying authentication module". The problem was that the root (/) directory did not have read or execute permissions for group or other. Running
chmod go+rx /
as root fixed this problem. Something to watch out for! -
Pro Backup over 10 years@turbo Each step you are explaining what it does. Except for step five "Go to a chroot:" doesn't explain what you are doing here. Would you please elaborate?
-
DeeJayh over 8 years@turbo I would suggest addingmore step1 prior to rebooting... One would likely need to add a user, with a password, to the adm and sudo groups. edit: likely a second step to add would be a sudoer file change, but that's optional so I dont know that it should be added or not