Installing openwrt on ubuntu

According to the x86 instructions, I should "extract" the openwrt-21.02.1-x86-64-generic-ext4-combined-efi-img.gz . However, I keep getting "An error occurred while extracting files.". I used the terminal to do the gunzip thing but it says "No such file or directory" even though it is there. Can someone please help me. I just can't seem to install openwrt properly.

OpenWrt is not an application/package to install onto linux. It is an operating system, and therefore does not run within another operating system.

That file you have downloaded is an image that is intended to be written to a disk (you can use the ubuntu tool disks or gparted to do this). You'd write this to a boot disk (or possibly a USB stick for a USB based boot).

If you want to run OpenWrt from within Ubuntu, you can do it using a virtualization package such as VirtualBox. In this case, you'd tell VB to use the image you've already downloaded as the install media for a new guest OS. Setting up networking in VB is not quite as straight forward as doing it when you're running OpenWrt directly on the hardware. There is a guide for using OpenWrt within VB here.

3 Likes

So if I do write it on a usb, then the usb is stuck to the x86 forever(as in the usb is plugged in to the pc)? Currently that's what my openwrt set up is like. I can boot the openwrt from bios but if it loses power or I restart openwrt. The pc defaults to ubuntu and therefore I lose all internet connection until I restart again and boot the openwrt in the bios.
What I want is for the openwrt OS to be "alone" in my x86 storage(no ubuntu, no windows, no nothing). But I just could not figure it out.

I'm not sure I understand the question, but if you set the computer to boot from USB, as long as that stick in inserted, the PC will boot using whatever OS is installed thee (i.e. OpenWrt).

You'll have to look at your boot settings. If you don't need ubuntu, you can simply write OpenWrt to the internal disk and that will be the only OS on the device.

In order to replace a running OS, you often need to boot off another drive. You can probably make a USB boot disk with Ubuntu, and then use that to write OpenWrt to the internal disk.

That's what I've been trying to figure out all this time but I am still clueless.

1 Like

You can use the USB with OpenWrt installed to install on the internal disk.

Boot up OpenWrt on the USB and make sure it is connected to the Internet. Look for the drive letter of the internal disk using ls /dev. If it is a SATA disk it should be /dev/sdb (the OpenWrt USB is /dev/sda). If it's an M2 type disk it will be /dev/mmcblk0. Confirm by running mount that the disk you plan to write to is not mounted.

Use wget to download a fresh copy of the OpenWrt image to your /tmp directory (which is a RAM disk). It is possible to unzip and write OpenWrt to the internal disk in one step:

All existing filesystems and data on the internal disk will be lost. This procedure re-formats the disk so that OpenWrt will be the only operating system, running on bare metal.

gzip -cd openwrtfilename | dd bs=1M of=internal disk name
sync
poweroff
After the power turns off, pull out the USB drive then push the power button to turn the PC back on, and it should boot from the internal disk.

2 Likes

Not that I’ve tried it with OpenWrt, but I’d think GRUB might be another option.

For doing what, grub is a boot loader.

Exactly. Win7/Win10/Mint17/Kali/OpenWrt - one box - what’s your flavour on reboot?