Vnstat error on installing

Asked by Luis M.Jacinto on 2019-11-05

Ubuntu 16.04
vnstat

Error “E: Sub-process /usr/bin/dpkg returned an error code (1)” on the end of sudo apt-get install vnstat
Can someone help fix this?

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Manfred Hampl
Solved:
2019-11-07
Last query:
2019-11-07
Last reply:
2019-11-07

What is the output of:

lsb_release -a; uname -a; apt-cache policy vnstat vnstati

Thanks

Manfred Hampl (m-hampl) said : #2

Additional diagnostics:
What is the output of the commands

grep vnstat /etc/passwd
ls -l /etc/vnstat.conf
sestatus

(My guess: might be Bug #1769301 )

Luis M.Jacinto (ljacinto) said : #3

luis@luis-desktop:~$ lsb_release -a; uname -a; apt-cache policy vnstat vnstati
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.6 LTS
Release: 16.04
Codename: xenial
Linux luis-desktop 4.15.0-66-generic #75~16.04.1-Ubuntu SMP Tue Oct 1 14:01:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
vnstat:
  Installed: (none)
  Candidate: 1.14-1ubuntu2
  Version table:
     1.14-1ubuntu2 500
        500 http://mirror.wiru.co.za/ubuntu xenial/universe amd64 Packages
vnstati:
  Installed: (none)
  Candidate: 1.14-1ubuntu2
  Version table:
     1.14-1ubuntu2 500
        500 http://mirror.wiru.co.za/ubuntu xenial/universe amd64 Packages
luis@luis-desktop:~$

luis@luis-desktop:~$ grep vnstat /etc/passwd
vnstat:x:121:129::/var/lib/vnstat:/bin/false
luis@luis-desktop:~$ ls -l /etc/vnstat.conf
ls: cannot access '/etc/vnstat.conf': No such file or directory
luis@luis-desktop:~$ sestatus

Manfred Hampl (m-hampl) said : #4

Please provide the full output that you receive for the command

sudo apt install vnstat

Luis M.Jacinto (ljacinto) said : #5

luis@luis-desktop:~$ sudo apt install vnstat
[sudo] password for luis:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  vnstati
The following NEW packages will be installed:
  vnstat
0 upgraded, 1 newly installed, 0 to remove and 36 not upgraded.
2 not fully installed or removed.
Need to get 0 B/74.1 kB of archives.
After this operation, 237 kB of additional disk space will be used.
Selecting previously unselected package vnstat.
(Reading database ... 261633 files and directories currently installed.)
Preparing to unpack .../vnstat_1.14-1ubuntu2_amd64.deb ...
Unpacking vnstat (1.14-1ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.22) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
ureadahead will be reprofiled on next reboot
Setting up postfix (3.1.0-3ubuntu0.3) ...
setting myhostname=luis-desktop in /etc/postfix

Postfix is now set up with the changes above. If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
newaliases: fatal: myorigin parameter setting must not contain multiple values: luis-deskto <email address hidden>
dpkg: error processing package postfix (--configure):
 subprocess installed post-installation script returned error exit status 75
dpkg: dependency problems prevent configuration of bsd-mailx:
 bsd-mailx depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package bsd-mailx (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                          Setting up vnstat (1.14-1ubuntu2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for systemd (229-4ubuntu21.22) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Errors were encountered while processing:
 postfix
 bsd-mailx
E: Sub-process /usr/bin/dpkg returned an error code (1)
luis@luis-desktop:~$

Manfred Hampl (m-hampl) said : #6

vnstat is now correctly installed, but you have a problem with two other packages (postfix and bsd-mailx).

I do not know why you need them at all. Do you really want to run your own e-mail server? This would require that you have registered your own domain.
The error mesages indicates, that you have incorrectly specified the myorigin configuration parameter in /etc/postfix/main.cf

Looks fine to me, vnstat is in...

newaliases: fatal: myorigin parameter setting must not contain multiple values: luis-deskto <email address hidden>

Is on issue

*one issue

Luis M.Jacinto (ljacinto) said : #9

Tried to edit /etc/postfix/main.cf but not allowed to save.
Where next

sudo vi /etc/postfix/main.cf

Will give write access (change vi to the text editor or your choice if you don't use vi)

Luis M.Jacinto (ljacinto) said : #11

I remove vnstat with sudo apt-get purge vnstat.
Edit /etc/postfix/main.cf removing <email address hidden> and then run '/etc/init.d/postfix reload'.
But still with error E: Sub-process /usr/bin/dpkg returned an error code (1).

Manfred Hampl (m-hampl) said : #12

Your output in comment #5 shows that it is not vnstat, but another package (or packages) that causes the error from the package management system.

As already written before:
Please provide the FULL output, and not only the very last line (which is just a summary telling "_something_ went wrong").

Repeating (and reformulating) my question from above:
Are you sure that you want to run your own e-mail server?
Are you aware of the prerequistes that must be there, that this can work?

Luis M.Jacinto (ljacinto) said : #13

luis@luis-desktop:~$ sudo apt install vnstat
[sudo] password for luis:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
  vnstati
The following NEW packages will be installed:
  vnstat
0 upgraded, 1 newly installed, 0 to remove and 37 not upgraded.
2 not fully installed or removed.
Need to get 0 B/74.1 kB of archives.
After this operation, 237 kB of additional disk space will be used.
Selecting previously unselected package vnstat.
(Reading database ... 261633 files and directories currently installed.)
Preparing to unpack .../vnstat_1.14-1ubuntu2_amd64.deb ...
Unpacking vnstat (1.14-1ubuntu2) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for systemd (229-4ubuntu21.22) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
ureadahead will be reprofiled on next reboot
Setting up postfix (3.1.0-3ubuntu0.3) ...
setting myhostname=luis-desktop in /etc/postfix

Postfix is now set up with the changes above. If you need to make changes, edit
/etc/postfix/main.cf (and others) as needed. To view Postfix configuration
values, see postconf(1).

After modifying main.cf, be sure to run '/etc/init.d/postfix reload'.

Running newaliases
newaliases: fatal: myorigin parameter setting must not contain multiple values: luis-deskto <email address hidden>
dpkg: error processing package postfix (--configure):
 subprocess installed post-installation script returned error exit status 75
dpkg: dependency problems prevent configuration of bsd-mailx:
 bsd-mailx depends on default-mta | mail-transport-agent; however:
  Package default-mta is not installed.
  Package postfix which provides default-mta is not configured yet.
  Package mail-transport-agent is not installed.
  Package postfix which provides mail-transport-agent is not configured yet.

dpkg: error processing package bsd-mailx (--configure):
 dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
                                                                                                          Setting up vnstat (1.14-1ubuntu2) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
Processing triggers for systemd (229-4ubuntu21.22) ...
Processing triggers for ureadahead (0.100.0-19.1) ...
Errors were encountered while processing:
 postfix
 bsd-mailx
E: Sub-process /usr/bin/dpkg returned an error code (1)
luis@luis-desktop:~$

Don't want running an e-mail server.
Don't know the prerequisites that must be there, that this can work
After removing vnstat with command sudo apt-get purge --auto-remove vnstat there still one folder
“/var/lib” with two files “enp2s0 and lo”.
Don't know when myorigin got wrong
On installing vnstat now the screen is very different that what used to be.

https://www.howtoforge.com/community/threads/perfect-debian-sarge-installation.1222/

Seems to have a fix.

Well, I found out, that the file in the parameter "myorigin = /etc/mailname" contains several domains. On purpose?

I deleted all of them and added only one. seems to work?!

But i dont know if i can connect to the postfixserver via telnet.

Manfred Hampl (m-hampl) said : #16

The packages with problem aren't vnstat, but postfix and bsd-mailx.

If you want to get your package management problem solved, then you do not need to uninstall vnstat, but you must either get the prerequisites and settings for postfix and bsd-mailx correct, or you must remove those two packages.

My suggesstion is to remove the mail server packages for the time being, in an attempt to bring your package management system back into a sane state.

Try the command
sudo apt remove postfix bsd-mailx
and report the results.

Luis M.Jacinto (ljacinto) said : #17

luis@luis-desktop:~$ sudo apt remove postfix bsd-mailx
[sudo] password for luis:
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  liblockfile-bin liblockfile1
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
  bsd-mailx postfix
0 upgraded, 0 newly installed, 2 to remove and 37 not upgraded.
2 not fully installed or removed.
After this operation, 3,864 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 261631 files and directories currently installed.)
Removing bsd-mailx (8.1.2-0.20160123cvs-2) ...
Removing postfix (3.1.0-3ubuntu0.3) ...
Processing triggers for man-db (2.7.5-1) ...
Processing triggers for libc-bin (2.23-0ubuntu11) ...
luis@luis-desktop:~$

Best Manfred Hampl (m-hampl) said : #18

Ok, the package management is back in a consistent status, no half-installed packages any more.

Now it makes sense to consider what you want to do.
Installing vnstat (and eventually vnstati) should now work without error messages.
If you think that you shoudl install postfix, then you should start investigating what the prerequisites are.

You should also check for updates; there are at least 37 packages that could be upgraded to a newer version.

Luis M.Jacinto (ljacinto) said : #19

Thanks Manfred Hampl, that solved my question.