As the doctor gone rogue

February 11, 2017

Bitvise X11 forwarding problem

Filed under: bash, SysAdmin, ubuntu — Tags: , , — hypotheses @ 12:00 am

You may have a problem trying to forward X11 from your Linux server through a terminal in Windows. I use Bitvise as the ssh client as it also provides the interface for sftp to download/upload the files. Not that using command line scp or sftp is not efficient, but in Windows you may have to install those tools separately.

Since I was trying to avoid installing Cygwin initially, Cygwin terminal wasn’t what I initially consider. Therefore, I went ahead and install Bitvise ssh client (instead of putty), which actually turns out to be quite good. The only problem (at least now) is when trying to forward GUI from the server with X11 forwarding, it failed miserably.

  • I’ve tried setting up bitvise in the X11 forward.
  • Installed X11-server from Cygwin (finally T_T).
  • But X11 forwarding still did not work. I got the error message below.

Failed to open channel for X11 forwarding from [::1]:47396 to 127.0.0.1:6000. Error connecting to X11 server: FlowSocketConnector: Failed to connect to target address. Windows error 10061: No connection could be made because the target machine actively refused it.

I kind of have an idea that this is something to do with Windows Firewall, which does not allow a specific port to listen to an incoming connection. But I haven’t quite figured out what to do. It is actually described on the bitvise page, but I guess I haven’t quite read the whole thing.

In short, after install cygwin X11 server, make sure to run the command below to fix the firewall permission. 

C:\cygwin64\bin\XWin -listen tcp -multiwindow

Ref: https://www.bitvise.com/ssh-x11-forwarding

February 9, 2017

Get a new IP address for a running VirtualBox Ubuntu Machine

Filed under: SysAdmin, ubuntu, Virtual Machine — Tags: , , , — hypotheses @ 9:09 am

Situation

You have started up a virtual machine in VirtualBox. In this case, I ran Ubuntu 16.10. You then realized that the IP address of your VM is not accessible from your local network. Although you can connect from the Host to your Guest VM (Ubuntu).

Therefore, you would like to change the type of network from “NAT” to “Bridge”. You did this through the GUI menu (Machine > Setting > Network > Adapter 1 –> Change to “Bridged Adapter”

OK, now what. You IP addresses is still the same.

You can check your current IP and network device with

ubuntu:~$ ifconfig

(more…)

October 18, 2016

Add/Remove user from a group

Filed under: bash, SysAdmin, ubuntu — hypotheses @ 3:15 am

  • Add a user bhoom to an existing group superman: sudo usermod -A -g superman bhoom
  • remove bhoom from a group superhero: sudo gpasswd -d superhero bhoom
  • Create a new group legends:sudo groupadd legends

October 15, 2016

Find files and listing details on Linux

Filed under: bash, miscellaneous, ubuntu — Tags: , , , , , — hypotheses @ 12:01 pm

One common task that we always have to do relatively often is to find the location of some specific files. Although you may have some clues that those files are located in your current working directory, “.” symbolic link used in the command below, you may have no clue to which sub-folder your files are.

(more…)

April 24, 2016

Write a Ubuntu Linux USB boot disk

Filed under: miscellaneous, OsX, SysAdmin, ubuntu — hypotheses @ 8:47 pm

Getting the Linux Image

You’ll get an iso file from your preferred repository. Following the link to the Ubuntu mirror at KMUTT in Thailand.
Ubuntu 14.04.4 LTS (Trusty Tahr)
Ubuntu 16.04 LTS Xenial Xerus

Convert iso to img

hdiutil convert -format UDRW -o ubuntu-16.04-server-amd64.img ubuntu-16.04-server-amd64.iso

See man hdiutil for detail about the command

Create a bootable USB drive

  • plug the USB drive into your computer and find out which mount point it is mounted to.
diskutil list

This will show the list of all drives mounted to your system right now. The description of which drive is a UBS drive should be quite clear.
– Unmount the disk before we proceed to write a bootable image on it.

# unmount it
diskutil unmount /dev/disk2
  • copy the disk image to your usb drive.
sudo dd if=ubuntu-16.04-server-amd64.img.dmg of=/dev/rdisk2 bs=1m

With /dev/rdisk2 instead of /dev/disk2, you are writing the raw data to the USB drive which will be several folds faster than writing through the buffered /dev/disk2 [ref]

Eject the USB drive

  • After writing the image, a diaglog box will alert you that the disk is not readable. Simple eject the disk.
  • Alternatively, at the command diskutil eject /dev/disk2

April 14, 2016

How to reset a root password?

Filed under: miscellaneous, ubuntu, Virtual Machine — Tags: , , — hypotheses @ 5:52 am

What do you do when you forget the “root” account password?
Install new OS is not always a good idea. As long as you still have physical access to the computer, it is somewhat possible to try the followings. Depending on whether you are working with Mac or Linux. See the detail and additional reference through the links below.
OsX:
  1. Restart the Mac while holding down the Option key, and double-click the icon for the Recovery partition. …
  2. Choose Utilities > Terminal.
  3. In Terminal, type resetpassword .
Ubuntu:
  1. Reboot your computer.
  2. Hold Shift during boot to start GRUB menu.
  3. Highlight your image and press E to edit.
  4. Find the line starting with “linux” and append rw init=/bin/bash at the end of that line.
  5. Press Ctrl + X to boot.
  6. Type in passwd username.
  7. Set your password.

November 3, 2015

Add exising users to an existing group in Ubuntu

Filed under: ubuntu — Tags: , — hypotheses @ 1:22 am

sudo usermod -a -G groupName userName

October 30, 2015

apt-get error with … for package ‘linux-headers-3.2.0-60’ is missing final newline

Filed under: bash, ubuntu — Tags: , , — hypotheses @ 2:17 am

linux-headers-3.2.0-60-virtual.list

caused you the problem, do the same! Just delete them (I actually just moved them to “linux-headers-3.2.0-60.list.bak” file).

As the doctor gone rogue

I recently clone a virtual machine image and setting up locally. When trying to install a new package through <code>apt-get</code> in Ubuntu. I ran into a strange problem of “missing final newline” in linux-headers.

Trying to google for solution, I found a page in 2004 mentioning this problem. It suggested that a file in /var/lib/dpkg/info/smbf.list is the cause of the error. So, I tried to locate this file but without any success.

I notice that there is “linux-headers-3.2.0-60.list” and a few other files with similar names in this folder. So, well, why not trying to delete them.

It seems like deleting these files fix the problem and allow apt-get to install the package without any problems. So far the system seems normal. We haven’t allowed any additional access through the server, only deleting a few files that don’t look essential for the OS to run.

Further remove other apt-get unused…

View original post 9 more words

Blog at WordPress.com.