Archive

Archive for the ‘debian’ Category

Replacing ifconfig with ip

August 12, 2017 Leave a comment

https://www.linux.com/learn/replacing-ifconfig-ip

Advertisements
Categories: debian Tags: ,

Vagrant was unable to communicate with the guest machine

October 23, 2016 3 comments

Problem:
I was setting up vagrant on an old laptop running debian 8. I also had virtualbox installed. I ran into the following error when trying to set up an ubuntu vm.

$ vagrant init ubuntu/trusty32
$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Importing base box 'ubuntu/trusty32'...
==> default: Matching MAC address for NAT networking...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Setting the name of the VM: flaskbox_default_1477256195436_10223
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
Timed out while waiting for the machine to boot. This means that
Vagrant was unable to communicate with the guest machine within
the configured ("config.vm.boot_timeout" value) time period.

If you look above, you should be able to see the error(s) that
Vagrant had when attempting to connect to the machine. These errors
are usually good hints as to what may be wrong.

If you're using a custom box, make sure that networking is properly
working and you're able to connect to the machine. It is a common
problem that networking isn't setup properly in these boxes.
Verify that authentication configurations are also setup properly,
as well.

If the box appears to be booting properly, you may want to increase
the timeout ("config.vm.boot_timeout") value.

The main reason for this was because the networking on ubuntu was not working.

Solution:
The fix was to restart the network interface on the ubuntu box.

To do this I had to log into the box via the gui interface using virtualbox or uncommenting “vb.gui=true” in the Vagrantfile.

After connecting I ran the following commands

$ sudo ifdown eth0
$ sudo ifup eth0

I then made sure that I could ping google.com and the host box. Now I needed to enable this when the machine booted. That meant adding the same command to /etc/rc.local

$ less /etc/rc.local
ifdown eth0
ifup eth0

exit 0

I now did a test run on ubuntu/precise32. This worked well and vagrant was now working as expected. Trying the same on ubuntu/trusty32 resulted in a timeout once again. This meant that I had to add the following to the Vagrantfile

  # For ubuntu/trusty32 the box takes a while to boot up.
  # Default timeout is 300 seconds.
  config.vm.boot_timeout = 600

Now both boxes are able to come up even after reboot.

$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'ubuntu/trusty32' is up to date...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 22 (guest) => 2222 (host) (adapter 1)
==> default: Booting VM...
==> default: Waiting for machine to boot. This may take a few minutes...
    default: SSH address: 127.0.0.1:2222
    default: SSH username: vagrant
    default: SSH auth method: private key
==> default: Machine booted and ready!
==> default: Checking for guest additions in VM...
    default: The guest additions on this VM do not match the installed version of
    default: VirtualBox! In most cases this is fine, but in rare cases it can
    default: prevent things such as shared folders from working properly. If you see
    default: shared folder errors, please make sure the guest additions within the
    default: virtual machine match the version of VirtualBox you have installed on
    default: your host and reload your VM.
    default: 
    default: Guest Additions Version: 4.3.36
    default: VirtualBox Version: 5.1
==> default: Mounting shared folders...
    default: /vagrant => /home/rodnee/boxes/testbox
$ vagrant ssh
Welcome to Ubuntu 14.04.5 LTS (GNU/Linux 3.13.0-100-generic i686)

 * Documentation:  https://help.ubuntu.com/

  System information as of Sun Oct 23 21:21:41 UTC 2016

  System load:  0.25              Processes:           81
  Usage of /:   3.3% of 39.34GB   Users logged in:     0
  Memory usage: 15%               IP address for eth0: 10.0.2.15
  Swap usage:   0%

  Graph this data and manage this system at:
    https://landscape.canonical.com/

  Get cloud support with Ubuntu Advantage Cloud Guest:
    http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.


Last login: Sun Oct 23 21:12:08 2016 from 10.0.2.2
vagrant@vagrant-ubuntu-trusty-32:~$ exit
logout
Connection to 127.0.0.1 closed.
$ vagrant halt
==> default: Attempting graceful shutdown of VM...

Note:
You would have to log into a new box the very first time to bring up the network interface. The new changes will persist after a reboot.

Sources:
This took me so long to fix and I went down so many different rabbit holes that I can’t quite say that there was a definitive source that helped me out.

Lessons learnt
1. Installing the latest version of virtualbox did not work on debian 8 (stretch). I needed to stick with what came with the distribution.
2. I did not need to install virtualbox-guest-additions as it already comes with virtualbox.
3. There is no need to change the Network settings on virtualbox. The default settings for NAT work just fine and were not part of the problem.

# Packages that I needed to install
$ sudo apt-get install virtualbox virtualbox-guest-dkms dkms
$ sudo apt-get install vagrant

apt-get notes

September 26, 2016 Leave a comment

A nice summary of some apt-get commands.

# Installs the selected package from repositories listed in
# /etc/apt/sources.list
$ apt-get install <package>

# Installs the selected package from repositories listed in
# /etc/apt/sources.list
$ apt-get install <package>

# Removes the selected package from your system
$ apt-get remove <package> 

# Updates the list of packages available on the repositories listed in
# /etc/apt/sources.list
$ apt-get update

# Installs the latest available versions of all your installed software
$ apt-get upgrade

# Installs the latest available software related to your configuration
$ apt-get dist-upgrade 

# Restarts/Starts the configuration script inside the package, 
# which will bring up the menu-based dialogs in the same way as after installation
$ dpkg-reconfigure

# Prints detailed information about the software package
$ apt-cache show <package> 

# Prints information on the installed software package
$ dpkg -l <package>

# Lists all files installed by the software package
$ dpkg -L <package>

# Installs a local (.deb) file to your system
$ dpkg -i <file>

# Prints information about the software package owning <file>
$ dpkg -S <file>

# Searches apt database for packages containing <string> in their 
# name and description
$ apt-cache search <string>

Source:
OpenVPN: Building and Integrating Virtual Private Networks

Categories: bash, debian, notes Tags: ,

E: The method driver /usr/lib/apt/methods/https could not be found.

June 18, 2015 Leave a comment

Problem:
I was getting the following error when trying to install Wireshark

E: The method driver /usr/lib/apt/methods/https could not be found.

# apt-get install wireshark
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following extra packages will be installed:
libc-ares2 libsmi2ldbl libwireshark-data libwireshark5 libwiretap4
libwsutil4 wireshark-common
Suggested packages:
snmp-mibs-downloader wireshark-doc
The following NEW packages will be installed:
libc-ares2 libsmi2ldbl libwireshark-data libwireshark5 libwiretap4
libwsutil4 wireshark wireshark-common
0 upgraded, 8 newly installed, 0 to remove and 1 not upgraded.
Need to get 13.4 MB/13.6 MB of archives.
After this operation, 78.5 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
WARNING: The following packages cannot be authenticated!
libsmi2ldbl libc-ares2 libwsutil4 libwiretap4 libwireshark-data
libwireshark5 wireshark-common wireshark
Install these packages without verification? [y/N] y
Err http://ftp.it.debian.org/debian/ testing/main libwsutil4 amd64 1.12.4+gb4861da-1
404 Not Found
Err http://ftp.it.debian.org/debian/ testing/main libwiretap4 amd64 1.12.4+gb4861da-1
404 Not Found
Err http://ftp.it.debian.org/debian/ testing/main libwireshark-data all 1.12.4+gb4861da-1
404 Not Found
Err http://ftp.it.debian.org/debian/ testing/main libwireshark5 amd64 1.12.4+gb4861da-1
404 Not Found
Err http://ftp.it.debian.org/debian/ testing/main wireshark-common amd64 1.12.4+gb4861da-1
404 Not Found
Err http://ftp.it.debian.org/debian/ testing/main wireshark amd64 1.12.4+gb4861da-1
404 Not Found
E: Failed to fetch http://ftp.it.debian.org/debian/pool/main/w/wireshark/libwsutil4_1.12.4+gb4861da-1_amd64.deb 404 Not Found

E: Failed to fetch http://ftp.it.debian.org/debian/pool/main/w/wireshark/libwiretap4_1.12.4+gb4861da-1_amd64.deb 404 Not Found

E: Failed to fetch http://ftp.it.debian.org/debian/pool/main/w/wireshark/libwireshark-data_1.12.4+gb4861da-1_all.deb 404 Not Found

E: Failed to fetch http://ftp.it.debian.org/debian/pool/main/w/wireshark/libwireshark5_1.12.4+gb4861da-1_amd64.deb 404 Not Found

E: Failed to fetch http://ftp.it.debian.org/debian/pool/main/w/wireshark/wireshark-common_1.12.4+gb4861da-1_amd64.deb 404 Not Found

E: Failed to fetch http://ftp.it.debian.org/debian/pool/main/w/wireshark/wireshark_1.12.4+gb4861da-1_amd64.deb 404 Not Found

E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

Then when I tried to run a apt-get update

# apt-get update
Get:1 http://ftp.nl.debian.org jessie InRelease [134 kB]
Get:2 http://ftp.debian.org jessie-updates InRelease [126 kB]
E: The method driver /usr/lib/apt/methods/https could not be found.
N: Is the package apt-transport-https installed?

Finally when I tried to install apt-transport-https

# apt-get install apt-transport-https
Reading package lists… Done
Building dependency tree
Reading state information… Done
The following NEW packages will be installed:
apt-transport-https
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 137 kB of archives.
After this operation, 226 kB of additional disk space will be used.
WARNING: The following packages cannot be authenticated!
apt-transport-https
Install these packages without verification? [y/N] y
Err http://ftp.it.debian.org/debian/ testing/main apt-transport-https amd64 1.0.9.9
404 Not Found
E: Failed to fetch http://ftp.it.debian.org/debian/pool/main/a/apt/apt-transport-https_1.0.9.9_amd64.deb 404 Not Found

E: Unable to fetch some archives, maybe run apt-get update or try with –fix-missing?

Solution:
I edited /etc/apt/sources.list

I remove references to ftp.it.debian.org and added ftp.us.debian.org

I then ran
# apt-get check

That seemed to fix it. I was then able to run
# apt-get update
# apt-get install apt-transport-https
# apt-get install wireshark

In retrospect
I did google the error but the issues that other users were reporting were not related to mine. I think that the main issue was that the ftp.it.debian.org site I was using was not available. Thus the 404 errors that I was getting. The issue was staring me in the face 🙂

Categories: debian Tags:

Fluxbox changing focus

December 8, 2014 Leave a comment

Problem:
I reinstalled debian and fluxbox. I have a monitor attached to my laptop, but every time I clicked on any window on the second screen, it would get moved to the first screen. Right clicking to bring up the main menu on the second screen also did not work.

Solution:
Apparently, under main menu, configuration there is an option to change the Focus Model. That was my problem. I changed it to “Mouse Focus” then back to “Click to Focus” and my fluxbox is now working as normal.

So that was not the fix. The issue was that when fluxbox starts, my Toolbar width is only on one screen. When I right click on the second screen that does not have the toolbar, the menu only appears on the first screen. So to fix, I need to restart fluxbox so that the Toolbar appears on both. (I need to change the init settings for this). Earlier, when changing focus I restarted it but attributed the fix to the changing of focus which was incorrect.

The upside of this struggle, was that I learnt quite a bit about the keys file. For more on keys

http://linux.die.net/man/5/fluxbox-keys

Working with “Vagrant and Oracle database 11g”

December 6, 2014 Leave a comment

This is a follow up to my earlier post here.

I. Some changes made to Vagrantfile

1. Changed the host port to 1234 as it complained that 1521 was already in use. (This is the one to connect to via sqlplus64)
config.vm.network :forwarded_port, guest: 1521, host: 1234
2. Changed the amount of memory database should use from 512 to 2048
i. In the VagrantFile
# Oracle claims to need 512MB of memory available minimum
"--memory", "2048",

ii. In /modules/oracle/manifests/init.pp file, changed from 1024 to 4096
"/bin/dd if=/dev/zero of=/swapfile bs=1M count=4096",

II. Bring up Oracle 11g database on virtual instance of Ubuntu

$ cd vagrant-ubuntu-oracle-xe/
:~/vagrant-ubuntu-oracle-xe$ vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Clearing any previously set forwarded ports...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...
    default: Adapter 1: nat
==> default: Forwarding ports...
    default: 1521 => 1234 (adapter 1)
    default: 22 => 2222 (adapter 1)
==> default: Running 'pre-boot' VM customizations...
==> default: Booting VM...
... <deleted a bit of output>
==> default: Machine already provisioned. Run `vagrant provision` or use the `--provision`
==> default: to force provisioning. Provisioners marked to run always will still run.
:~/vagrant-ubuntu-oracle-xe$ vagrant provision
==> default: Running provisioner: shell...
    default: Running: inline script
==> default: stdin: is not a tty
... <deleted a bit of output>
==> default: notice: /Stage[main]/Oracle::Server/Exec[apt-update]/returns: executed successfully
==> default: notice: /Stage[main]/Oracle::Xe/File[/tmp/oracle-env.sh]/ensure: defined content as '{md5}c874e5a7a4cc6b15ff68055335c136fb'
==> default: notice: /Stage[main]/Oracle::Xe/File[/tmp/xe.rsp.orig]/ensure: defined content as '{md5}b79c95d12321f3eb55d855082d1d6831'
==> default: notice: /Stage[main]/Oracle::Server/File[/tmp/60-oracle.conf]/ensure: defined content as '{md5}61b22d59fdc07f9fa6929ab74f5b6e99'
==> default: info: /Stage[main]/Oracle::Server/File[/tmp/60-oracle.conf]: Scheduling refresh of Exec[procps]

III. Install sqlplus
Download oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm from Oracle site.
http://download.oracle.com/otn/linux/instantclient/11204/oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm

1. Install alien
# apt-get install alien
2. Convert rpm to deb
# alien -k --scripts oracle-instantclient11.2-sqlplus-11.2.0.4.0-1.x86_64.rpm
3. Install deb
# dpkg -i oracle-instantclient11.2-sqlplus_11.2.0.4.0-1_amd64.deb

IV. Connect to Oracle 11g database

$ sqlplus64 system/manager@//localhost:1234/XE

SQL*Plus: Release 11.2.0.4.0 Production on Sat Dec 6 13:44:32 2014

Copyright (c) 1982, 2013, Oracle.  All rights reserved.

Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production
SQL> 

If you have an issues with sqlplus64, try to follow instructions in this post. YMMV.

V. Adding History
# apt-get install rlwrap

As a normal user
$ rlwrap sqlplus64 system/manager@//localhost:1234/XE

Source:
http://webikon.com/cases/installing-oracle-sql-plus-client-on-ubuntu
https://wiki.kuali.org/display/KULRICE/Install+Oracle+11g+using+Vagrant
http://pastebin.com/tsJ32r4p

Using Oracle with Vagrant

December 6, 2014 Leave a comment

Problem:
This was a major issue for me. I needed Oracle 11g Database on my laptop.

Solution:
One of the possible solutions I took was to use vagrant. (I am pretty much just going to repeat the same steps as per what I got from the website listed in the Sources section below.)

1. Download and install Vagrant
2. Download and install VirtualBox
3. Download the Oracle 11g zip file for Linux x64
NB. Always download the Linux x64 zip file, even if you are on Windows or Mac OSX.
4. Clone the vagrant-ubuntu-oracle-xe repository from GitHub
git clone git://github.com/hilverd/vagrant-ubuntu-oracle-xe
5. Copy the Oracle 11g zip file to the directory vagrant-ubuntu-oracle-xe expects to find it in
cp ~/Downloads/oracle-xe-11.2.0-1.0.x86_64.rpm.zip ~/vagrant-ubuntu-oracle-xe/modules/oracle/files
6. Install vbguest
vagrant plugin install vagrant-vbguest
7. Invoke Vagrant to install and configure Oracle 11g
cd ~/vagrant-ubuntu-oracle-xe
vagrant up

After a few minutes your local machine will be running an Oracle 11g server on a virtual instance of Ubuntu 12.04

Well… not exactly.
1. I had run out of space on my / partition. I couldn’t install the new linux header files that were needed. The quickest thing for me was to format my machine. This time round I gave a bit more GBs to / partition.
2. Added some mirrors to /etc/apt/sources.list
3. root> apt-get update
4. First mistake I made was not to do apt-get dist-upgrade
5. So, oblivious of that, I followed steps 1 to 7, but vagrant up brought more errors
6. The kernel version on my machine and the latest linux-headers- being seen by virtual box were not the same. I was getting an error similar to this. (It was late and I did not have the presence of mind to save the errors. Sorry.)
$ VBoxManage --version
WARNING: The character device /dev/vboxdrv does not exist.
Please install the virtualbox-ose-dkms package and the appropriate
headers, most likely linux-headers-generic

You will not be able to start VMs until this problem is fixed.
X.X.XX_DebianXXXXX

7. Googled a bit. All references to above error were advising the OPs to do the following
apt-get install linux-headers-$(uname -r)
8. But above did not work since I could not find the linux-headers for the current system version that I had.
9. After 2 or 4 hours, I realised that I needed to get my kernel (3.14) to the same version as what was installed (3.16), so read about configuring kernels but the steps were too hard for my already fried brain. At this point I stumbled accross an page explaining what apt-get does. And thus I tried dist-upgrade with the hope that it would upgrade my kernel.
10. Ran the below command
root> apt-get dist-upgrade
11. Once that was done, I rebooted and sure enough my kernel was now 3.16
12. vagrant up now runs
13. So this install would have gone a whole lot more smoothly if I had updgraded my machine before I started this exercise. I’m much older and wiser 🙂

Source:
https://wiki.kuali.org/display/KULRICE/Install+Oracle+11g+using+Vagrant
https://help.ubuntu.com/community/AptGet/Howto