Ubuntu

Grub a disk read error occurred on windows after installing ubuntu

You can do the grub fix by downloading boot-repair




This program will help to solve this issue



Getting Boot-Repair


1st option : get a CD including Boot-Repair


The easiest way to use Boot-Repair is to burn one of the following disks and boot on it.
Remark : you can also install the ISO on a live-USB (eg via UnetBootin or LiliUSB or Universal USB Installer).

2nd option : install Boot-Repair in Ubuntu


- choose "Try Ubuntu"
- connect to the Internet
- open a new Terminal, then type:
sudo add-apt-repository ppa:yannubuntu/boot-repair && sudo apt-get update

- Press ENTER.
- Then type:
sudo apt-get install -y boot-repair && (boot-repair &)

- Press ENTER

Using Boot-Repair



  • launch Boot-Repair from either :
    • the Dash (the Ubuntu logo at the top-left of the screen)
    • or System->Administration->Boot-Repair menu (Ubuntu 10.04 only)
    • or by typing 'boot-repair' in a terminal
  • Then click the "Recommended repair" button. When repair is finished, note the URL (paste.ubuntu.com/XXXXX) that appeared on a paper, then reboot and check if you recovered access to your OSs. 
  • If the repair did not succeed, indicate the URL to people who help you by email or forum.



Courtesy

 :https://help.ubuntu.com/community/Boot-Repair


_________________________________________________________________________________
_________________________________________________________________________________

IP Setting in ubuntu terminal or

Setting Permanent Static IP in Ubuntu


Open the file /etc/network/interfaces ;
sudo vi /etc/network/interfaces
If you are using DHCP for your primary network card which is usually eth0, you will see the following lines;
auto eth0
iface eth0 inet dhcp
As you can see, it’s using DHCP right now. We are going to change dhcp to static, and then there are a number of options that should add and here is the example and you can change these settings according to your network settings.
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
network 192.168.1.0
broadcast 192.168.1.255
gateway 192.168.1.1
dns-nameservers 8.8.8.8 4.4.4.4
Restart the neworking service using the following command;
sudo /etc/init.d/networking restart
or
ifdown eth0
ifup eth0
and it is done…

Wired Connection Not Showing in  Ubuntu Nework Manager


However, if you wish to use Network Manager to handle the connection, you will have to reset the /etc/network/interfaces file back to defaults. That is, it should only contain -
Code:

auto lo

iface lo inet loopback
To install/reinstall Network Manager (before resetting the interfaces file of course) -
Code:

sudo apt-get update

sudo apt-get install --reinstall network-manager-gnome

You may have to reboot or manually do -
Alt+F2 > nm-applet


---------------------------------------------------------------------------------------------------------------------------------


Error when trying to use apt-get:
E: Could not get lock /var/lib/dpkg/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/) is another process

You can delete the lock file with the following command:
sudo rm /var/lib/apt/lists/lock
You may also need to delete the lock file in the cache directory
sudo rm /var/cache/apt/archives/lock
sudo rm /var/lib/dpkg/lock 
-----------------------------------------------------------------------------------------------------------------------------------


What is the PATH environment variable and how do I add to it?


PATH is an enviroment variable. It basically tells your machine where to search for programs, so when you run your picc program you can just do this:
picc
instead of
/usr/hitech/picc/9.82/bin/picc
To add a directory to your $PATH, follow any one of the below.
  1. simply edit ~/.profile
    gedit ~/.profile
    
    find the following line:
    PATH="$HOME/bin:$PATH"
    
    and change it to:
    PATH="$HOME/bin:$PATH:/usr/hitech/picc/9.82/bin"
    
  2. Run the below command in terminal
    export PATH=$PATH:/usr/hitech/picc/9.82/bin



scp can only copy files to a machine running sshd, hence you need to run the client software on the remote machine from the one you are running scp on.
If copying on the command line, use:
# copy from local machine to remote machine
scp localfile user@host:/path/to/whereyouwant/thefile
or
# copy from remote machine to local machine
scp user@host:/path/to/remotefile localfile
 

How do I find the amount of free space on my hard drive?

 Open System Monitor from Dash and select the Filesystems tab.enter image description here

 Or alternatively open a Terminal and type:
    df -h


-------------------------------------------------------------------------


How to kill a process running on particular port in Linux?











Use the command
 netstat -plten |grep java
used grep java as tomcat uses java as their processes.
It will show the list of processes with port number and process id
tcp6       0      0 :::8080                 :::*                    LISTEN      
1000       30070621    16085/java
the number before /java is a process id. Now use kill command to kill the process
kill -9 16085
-9 implies the process will be killed forcefully.
https://stackoverflow.com/questions/11583562/how-to-kill-a-process-running-on-particular-port-in-linux





How do disable user list on login screen? (Prompt for username and password) Ubuntu

down voteaccepted
Create a folder in the /etc/lightdm/ folder called lightdm.conf.d:
sudo mkdir -p /etc/lightdm/lightdm.conf.d
Next, create a file and call it 10-ubuntu.conf:
sudo gedit /etc/lightdm/lightdm.conf.d/10-ubuntu.conf
and add the following lines to it:
[SeatDefaults]
user-session=ubuntu
greeter-show-manual-login=true    
greeter-hide-users=true    
allow-guest=false
Change the line user-session= to whatever desktop you are using, like if you are using Xubuntu, change it to user-session=xubuntu.
After these lines are added, reboot host, and you should see login instead of the user list:
enter image description here
curtesy:









https://askubuntu.com/questions/731425/how-do-disable-user-list-on-login-screen-prompt-for-username-and-password-ubu
 
 
----------------------------------------------------------------------------------------------
 
 

Problem after update: blue screen with only the mouse cursor

Doing the below steps fixed the problem in my machine:

* press ctrl+alt+f1 and login as root in the tty1
* cd /usr/lib/*arch-name*/gdk-pixbuf-2.0/
* find *some-version-number*/loaders/ > ~/pixbuf-files
  *(not the pkg-version,try ls cmd,only one dir would list out)*
* vim ~/pixbuf-files and delete 1st line
* cat ~/pixbuf-files | xargs -n1  gdk-pixbuf-query-loaders > *the-version-number-in-step-3*/loaders.cache 
* reboot
 
in my case:
* press ctrl+alt+f1 and login as root in the tty1
* cd /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/
* find 2.10.0/loaders/ > ~/pixbuf-files
* vim ~/pixbuf-files and delete 1st line
* cat ~/pixbuf-files | xargs -n1  gdk-pixbuf-query-loaders > 2.10.0/loaders.cache 
* reboot

 https://askubuntu.com/questions/435623/problem-after-update-blue-screen-with-only-the-mouse-cursor

 

Installing Broadcom Wireless Drivers in hp laptops

WIFI enable command in Ubuntu
 
 
sudo apt-get purge bcmwl-kernel-source
sudo apt-get install bcmwl-kernel-source 
 
Make sure your wireless adapter is not disabled. You can check it by running:
rfkill list
 
To enable wireless adapters, run:

sudo rfkill unblock wifi
 
https://askubuntu.com/questions/55868/installing-broadcom-wireless-drivers 
 
 
----------------------------------------------------------------------------------------------
 
 
SOLUTION for the following error
 
#apt-get update
 
Aborted (core dumped)
Reading package lists... Done
E: Problem executing scripts APT::Update::Post-Invoke-Success 'if /usr/bin/test -w /var/cache/app-info -a -e /usr/bin/appstreamcli; then appstreamcli refresh > /dev/null; fi'
E: Sub-process returned an error code
 
 
Solution:
 
Remove libappstream3 with the CLI command
sudo apt-get remove libappstream3
or
sudo apt remove libappstream3
Afterwards, apt update should work fine again.
Source: https://forum.siduction.org/index.php?topic=6174.0

-----------------------------------------------------------------------------------

SOLUTION for the following error



"/dev/sda2 contains a file system with errors, checked forced.
Inodes that were part of a corrupte orphan linked list found.
/dev/sda2/ UNEXPECTED INCONSISTENCY: RUN fsck MANUALLY.
(i.e. without -a or -p options)
fsck exited with status code 4
the root filesystem on /edv/sda2 requires a manual fsck
Busybox v1.22.1 (Ubuntu 1:1.22.0-15ubuntu1) built in shell (ash)
Enter 'help' for a list of built-in commands.
(initramfs)
" -- 

solution

        fsck -fy /dev/sda2

after completion

reboot
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------
 
 
Error:
                      
I am trying to access Windows share in Ubuntu 16.04 using GUI.
It is giving error like this
 




 
enter image description here 
 
 
 
 
 
 
 
 
 
Solution:
 
 
Happened to me and found this solution here: https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/1617107
TL;DR:
you need the gvfs packages listed there.
For me, the gvfs-backends was missing so do: sudo apt install gvfs-backends
logged out, logged in, and it works.




---------------------------------------------------------------------------------------


How to make WiFi signal stronger on Ubuntu 16.04 LTS with Realtek RTL8723BE?

Run in terminal
sudo tee /etc/modprobe.d/rtl8723be.conf <<< "options rtl8723be ant_sel=1"
This will create a config file to make the setting permanent.
https://askubuntu.com/questions/872931/how-to-make-wifi-signal-stronger-on-ubuntu-16-04-lts-with-realtek-rtl8723be

How do I extract login history?

You can try the last command:
last john 
 
It prints out the login/out history of user john. Whereas running just
last
 
prints out the login/out history of all users.
 or
/var/log/auth.log
That contains a lot more than just plain logins (sudo calls, etc) but logins are in there too. It's protected so you'll need to be root to read it:
sudo less /var/log/auth.log

 UBUNTU Version Update 16.04 to 18.04

 

sudo apt update
sudo apt upgrade
 
 
sudo ufw allow 1022/tcp comment 'Temp open port ssh tcp port 1022 for upgrade'
 
sudo apt dist-upgrade
sudo do-release-upgrade
 
 
courtesy:https://www.cyberciti.biz/faq/how-to-upgrade-ubuntu-16-04-to-18-04-lts-using-terminal/ 

 Installing new Desktop in ubuntu

 

running a different desktop. Flashback

Code:
sudo apt-get install gnome-session-flashback
Reboot and at the login window click on the icon and choose 'flashback (metacity)'

 

Configure Static IP address on ubuntu 20.04 Server

In this example we will set a static IP address on the Ubuntu 20.04 server to 192.168.1.202/24 with default gateway to 192.168.1.1 and DNS servers 8.8.8.88.8.4.4192.168.1.1.

  1. Locate and edit with administrative privileges the /etc/netplan/50-cloud-init.yaml file with the following configuration. Update your desired static IP address, DNS server and gateway where appropriate:
    # This file is generated from information provided by
    # the datasource.  Changes to it will not persist across an instance.
    # To disable cloud-init's network configuration capabilities, write a file
    # /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg with the following:
    # network: {config: disabled}
    network:
        ethernets:
            enp0s3:
                dhcp4: false
                addresses: [192.168.1.202/24]
                gateway4: 192.168.1.1
                nameservers:
                  addresses: [8.8.8.8,8.8.4.4,192.168.1.1]
        version: 2
    
    Save the file.
    Configure static IP address on Ubuntu 20.04 Server
    Configure static IP address on Ubuntu 20.04 Server
  2. To apply the new Netplan changes execute:
    $ sudo netplan apply
    
    Alternatively, if you run into some issues run:
    $ sudo netplan --debug apply
  3. Confirm your new static IP address by using the ip linux command:
  4. $ ip a
    
    Check current IP address
    Check current IP address
Courtesy:https://linuxconfig.org/how-to-configure-static-ip-address-on-ubuntu-20-04-focal-fossa-desktop-server

Ubuntu 20.04 Audio issue

sudo alsamixer open and increase volume



start by running this as root or with sudo:

du -cha --max-depth=1 / | grep -E "M|G"

du -cha --max-depth=1 /var | grep -E "M|G"

Courtesy:https://askubuntu.com/questions/911865/no-more-disk-space-how-can-i-find-what-is-taking-up-the-space

Disable wifi in ubuntu

Using ip Command
The ip command is a versatile way to manage network interfaces. It allows us to control various aspects of network management from the command line. Notably, sudo privileges are also necessary for the ip command to control network interfaces.

Let’s disable Wi-Fi from the Linux command line using the ip command.

First, we list all available network interfaces:

$ ip link show
...
3: wlo1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DORMANT group default qlen 1000
link/ether d0:c5:d3:3d:22:cf brd ff:ff:ff:ff:ff:ff
altname wlp3s0
...

Next, we look for the name of the Wi-Fi interface from the output of ip link show above. It usually starts with wl. For example, in our case the Wi-Fi interface name is wlo1.

Once we’ve got the interface name, we can disable it using the down option:

$ sudo ip link set wlo1 down

Here, we can replace wlo1 with the interface name of our Wi-Fi interface. This command disables the given Wi-Fi interface.

Notably, this command shuts down the interface. Usually, this has the same effect as unplugging the cable from the connected device. It’s still possible for the system to use the IP address for internal communications or to receive packets sent to it from other interfaces since the configuration hasn’t been removed.

In the same way, we can re-enable the Wi-Fi interface using the up option:

$ sudo ip link set wlo1 up

Consequently, this command brings up the specified Wi-Fi interface.


courtesy: https://www.baeldung.com/linux/disable-wireless-network

 

#Auto Start #XAMPP at Startup in #Ubuntu Linux

Auto Start XAMPP at Startup in Ubuntu Linux
sudo nano /etc/systemd/system/xampp.service

[Unit]
Description=XAMPP

[Service]
ExecStart=/opt/lampp/lampp start
ExecStop=/opt/lampp/lampp stop
Type=forking

[Install]
WantedBy=multi-user.target

sudo systemctl start xampp-service
sudo systemctl enable xampp-service

 Courtesy:https://www.youtube.com/watch?v=-R0M1wYitzs

 

 

 Setting the JAVA_HOME Environment Variable


Many programs written using Java use the JAVA_HOME environment variable to determine the Java installation location.

To set this environment variable, first determine where Java is installed. Use the update-alternatives command:

    sudo update-alternatives --config java

This command shows each installation of Java along with its installation path:

Output
There are 2 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                         Priority   Status
------------------------------------------------------------
  0            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      auto mode
  1            /usr/lib/jvm/java-11-openjdk-amd64/bin/java   1111      manual mode
* 2            /usr/lib/jvm/java-11-oracle/bin/java          1091      manual mode

Press <enter> to keep the current choice[*], or type selection number:

In this case the installation paths are as follows:

    OpenJDK 11 is located at /usr/lib/jvm/java-11-openjdk-amd64/bin/java.
    Oracle Java is located at /usr/lib/jvm/java-11-oracle/jre/bin/java.

Copy the path from your preferred installation. Then open /etc/environment using nano or your favorite text editor:

    sudo nano /etc/environment

At the end of this file, add the following line, making sure to replace the highlighted path with your own copied path, but do not include the bin/ portion of the path:
/etc/environment

JAVA_HOME="/usr/lib/jvm/java-11-openjdk-amd64"

Modifying this file will set the JAVA_HOME path for all users on your system.

Save the file and exit the editor.

Now reload this file to apply the changes to your current session:

    source /etc/environment

Verify that the environment variable is set:

    echo $JAVA_HOME

You’ll see the path you just set:

Output
/usr/lib/jvm/java-11-openjdk-amd64

Other users will need to execute the command source /etc/environment or log out and log back in to apply this setting.

Courtesty: https://www.digitalocean.com/community/tutorials/how-to-install-java-with-apt-on-ubuntu-18-04

 

Comments

Popular posts from this blog