Not able to install ksh

I tried to install ksh, but not able to.

ubuntu@shin-instance:~$ ksh --version

Command 'ksh' not found, but can be installed with:

sudo apt install ksh    # version 2020.0.0-5, or
sudo apt install ksh93  # version 93u+20120801-7
sudo apt install mksh   # version 58-1

ubuntu@shin-instance:~$ sudo apt install ksh
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  binfmt-support
The following NEW packages will be installed:
  binfmt-support ksh
0 upgraded, 2 newly installed, 0 to remove and 50 not upgraded.
Need to get 856 kB of archives.
After this operation, 3046 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://archive.ubuntu.com/ubuntu focal/universe amd64 binfmt-support amd64 2.2.0-2
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu focal/universe amd64 ksh amd64 2020.0.0-5
  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/b/binfmt-support/binfmt-support_2.2.0-2_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/k/ksh/ksh_2020.0.0-5_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ubuntu@shin-instance:~$ apt-get update
Reading package lists... Done
E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)
E: Unable to lock directory /var/lib/apt/lists/
W: Problem unlinking the file /var/cache/apt/pkgcache.bin - RemoveCaches (13: Permission denied)
W: Problem unlinking the file /var/cache/apt/srcpkgcache.bin - RemoveCaches (13: Permission denied)

What am I doing wrong? How can I install ksh?

Ok, I sorted it out.

$ echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
$ sudo apt-get update
$ sudo apt-get install ksh

Hi @okada-shin, that first line shouldn’t be needed, but you do need sudo with apt update.

I am trying to install moreutils:

I run sudo apt-get update and sudo apt-get install moreutils, but I get errors. How can I install moreutils?

ubuntu@shin-instance:~$ sudo apt-get update
Err:1 http://security.ubuntu.com/ubuntu focal-security InRelease
  Temporary failure resolving 'security.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu focal InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal-updates InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal-backports InRelease
  Temporary failure resolving 'archive.ubuntu.com'
Reading package lists... Done
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/focal-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
W: Failed to fetch http://security.ubuntu.com/ubuntu/dists/focal-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
W: Some index files failed to download. They have been ignored, or old ones used instead.
ubuntu@shin-instance:~$ sudo apt-get install moreutils
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  linux-headers-5.4.0-52 linux-headers-5.4.0-52-generic linux-image-5.4.0-52-generic linux-modules-5.4.0-52-generic
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libio-pty-perl libipc-run-perl libtime-duration-perl libtimedate-perl
The following NEW packages will be installed:
  libio-pty-perl libipc-run-perl libtime-duration-perl libtimedate-perl moreutils
0 upgraded, 5 newly installed, 0 to remove and 64 not upgraded.
Need to get 230 kB of archives.
After this operation, 771 kB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Err:1 http://archive.ubuntu.com/ubuntu focal/main amd64 libio-pty-perl amd64 1:1.12-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:2 http://archive.ubuntu.com/ubuntu focal/main amd64 libipc-run-perl all 20180523.0-2
  Temporary failure resolving 'archive.ubuntu.com'
Err:3 http://archive.ubuntu.com/ubuntu focal/universe amd64 libtime-duration-perl all 1.21-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:4 http://archive.ubuntu.com/ubuntu focal/main amd64 libtimedate-perl all 2.3200-1
  Temporary failure resolving 'archive.ubuntu.com'
Err:5 http://archive.ubuntu.com/ubuntu focal/universe amd64 moreutils amd64 0.63-1
  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libi/libio-pty-perl/libio-pty-perl_1.12-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libi/libipc-run-perl/libipc-run-perl_20180523.0-2_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/libt/libtime-duration-perl/libtime-duration-perl_1.21-1_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/main/libt/libtimedate-perl/libtimedate-perl_2.3200-1_all.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Failed to fetch http://archive.ubuntu.com/ubuntu/pool/universe/m/moreutils/moreutils_0.63-1_amd64.deb  Temporary failure resolving 'archive.ubuntu.com'
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?
ubuntu@shin-instance:~$

@okada-shin you have the same problem as previously - the DNS server that’s set up for Multipass isn’t working.

Can you please file a bug, providing the necessary info at https://github.com/canonical/multipass/issues/new?template=bug_report.md&title=DNS%20resolution%20failing ?

If you’re on Windows or macOS, have a look at our documentation on the topic:


@saviq Thanks, the link helped me.

I needed to add:

nameserver 1.1.1.1

to /etc/resolv.conf.