0

Any way to breakdown this line of code? It always return permission error. I'm deploying fusionPBX on Google Cloud.

sudo wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/ubuntu/pre-install.sh | sh;
sudo cd /usr/src/fusionpbx-install.sh/ubuntu && ./install.sh

I got this error

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)
E: Could not open lock file /var/lib/dpkg/lock-frontend - open (13: Permission denied)
E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?
fatal: could not create work tree dir 'fusionpbx-install.sh': Permission denied
sh: 13: cd: can't cd to /usr/src/fusionpbx-install.sh/ubuntu
Serhii Rohoza
  • 4,287
  • 2
  • 16
  • 29
ken4ward
  • 2,246
  • 5
  • 49
  • 89

1 Answers1

1

Have a look at your command:

$ sudo cd /usr/src/fusionpbx-install.sh/ubuntu && ./install.sh

only the left sided (first) command will run with root privileges:

sudo cd /usr/src/fusionpbx-install.sh/ubuntu

but the right sided (second) command after && will run with user privileges (&& means that the right sided (second) command will only run only if the left sided (first) command is successful):

./install.sh

you can see it in the error messages:

E: Could not open lock file /var/lib/apt/lists/lock - open (13: Permission denied)

or even more clear:

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), are you root?

To make this issue more visible you can run this command:

$ sudo whoami && whoami
root
username

To solve this issue you should change your command:

$ sudo whoami && sudo whoami     
root
root

if you have a few commands that you need to execute you can do it in this way:

$ sudo -s
# whoami && whoami 
root
root
# whoami && whoami 
root
root
exit
$

In addition, I've checked FusionPBX documentation and tried steps for Debian on my test VM:

Debian

Debian 9 is the preferred operating system by the FreeSWITCH developers. It supports the latest video dependencies and should be used if you want to do video mixing. Download Debian 9 Stretch at https://cdimage.debian.org/cdimage/release/current/

wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/debian/pre-install.sh | sh;
cd /usr/src/fusionpbx-install.sh/debian && ./install.sh

but I changed them in compare to yours:

wget -O - https://raw.githubusercontent.com/fusionpbx/fusionpbx-install.sh/master/ubuntu/pre-install.sh | sudo sh;
cd /usr/src/fusionpbx-install.sh/debian && sudo ./install.sh

and found no issues.

Serhii Rohoza
  • 4,287
  • 2
  • 16
  • 29