What is the advantage of using sudo apt-get autoremove over a cleaner app? I'm not sure what sudo apt-get autoremove does, but have read that you should use this command to remove any unnecessary packages.

One of the processes I saw was to use sudo apt-get autoremove and then use something like BleachBit to remove temp files etc.

Can you explain what sudo apt-get autoremove actually does and is there any advantages of using this command over something like BleachBit or Ubuntu Tweak janitor by themselves?

what sudo apt-get autoremove actually does

Whenever you install an application (using apt-get) the system will also install the software that this application depends on. It is common in Ubuntu/Linux that applications share the same libraries. When you remove the application the dependency will stay on your system.
So apt-get autoremove will remove those dependencies that were installed with applications and are no longer used by anything else on the system.

is there any advantages of using this command over something like Bleachbit or Ubuntu Tweak janitor?

Bleachbit or Ubuntu Tweak janitor are graphical interfaces.
sudo apt-get autoremove is a command

Using one option does not exclude the other: I would assume BB and UTJ use  sudo apt-get autoremove (in some sort of way) to remove dependencies. So it is not a question of "any advantages." It is a matter of preference: are you a command line type of person or are you a GUI type of person?
By the way: deborphan is another tool to clean your system.

One minor addition: Since 14.04 you may actually write apt autoremove to remove packages that were automatically installed to satisfy dependencies for other packages and are now no longer needed as dependencies.

These two commands are equivalent:

apt autoremove
apt-get autoremove


HP LaserJet AllInOne, scan does not work If I try to scan (xsane or simple-scan) I get this output:

Device URI: hpaio:/net/HP_LaserJet_MFP_M129-M134?hostname=hp-drucker

I was told that this device has great linux support ... See https://hardwarerecs.stackexchange.com/questions/8323/small-printerscanner-with-very-good-support-for-ubuntu

MIB search path: /home/guettli/.snmp/mibs:/usr/share/snmp/mibs:/usr/share/snmp/mibs/iana:/usr/share/snmp/mibs/ietf:/usr/share/mibs/site:/usr/share/snmp/mibs:/usr/share/mibs/iana:/usr/share/mibs/ietf:/usr/share/mibs/netsnmp
Cannot find module (SNMPv2-MIB): At line 0 in (none)
Cannot find module (IF-MIB): At line 0 in (none)
Cannot find module (IP-MIB): At line 0 in (none)
Cannot find module (TCP-MIB): At line 0 in (none)
Cannot find module (UDP-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-MIB): At line 0 in (none)
Cannot find module (NOTIFICATION-LOG-MIB): At line 0 in (none)
Cannot find module (DISMAN-EVENT-MIB): At line 0 in (none)
Cannot find module (DISMAN-SCHEDULE-MIB): At line 0 in (none)
Cannot find module (HOST-RESOURCES-TYPES): At line 0 in (none)
Cannot find module (MTA-MIB): At line 0 in (none)
Cannot find module (NETWORK-SERVICES-MIB): At line 0 in (none)
Cannot find module (SNMPv2-TC): At line 15 in /usr/share/snmp/mibs/UCD-DISKIO-MIB.txt
Cannot find module (SNMPv2-SMI): At line 34 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Cannot find module (SNMPv2-TC): At line 37 in /usr/share/snmp/mibs/UCD-SNMP-MIB.txt
Did not find 'enterprises' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt)
Did not find 'DisplayString' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt)
Did not find 'TruthValue' in module #-1 (/usr/share/snmp/mibs/UCD-SNMP-MIB.txt)
.... (cut)

After updateing snmp packages I get this error now:

===> hp-scan

HP Linux Imaging and Printing System (ver. 3.16.11)
Scan Utility ver. 2.2

Copyright (c) 2001-15 HP Development Company, LP
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to distribute it
under certain conditions. See COPYING file for more details.

warning: No destinations specified. Adding 'file' destination by default.
Using device hpaio:/net/HP_LaserJet_MFP_M129-M134?hostname=NPIBC8C62.local
Opening connection to device...
error: SANE: Error during device I/O (code=9)

Still no scanning possible :-(

The somewhat brute-force answer is that you had installed at some point snmp on your system, and it has not been entirely removed.  The easiest fix for this will be re-installation of snmp:

Open a terminal, and enter the command

sudo apt update
sudo apt install snmp snmp-mibs-downloader

After having fixed the snmp issues, the I/O error 9 referenced by hp-scan seems to indicate tht it may not be fully installed  - see https://bugzilla.redhat.com/show_bug.cgi?id=1347231

To fix this, enter the command

sudo apt install --reinstall hplip

According to the man page

hp-scan [DEVICE_URI|PRINTER_NAME] [MODE] [OPTIONS]

To specify a device-URI:
    -d<device-uri> or --device=<device-uri>
To specify a CUPS printer:
    -p<printer> or --printer=<printer>

Note that you need to specify the URI for hp-scan

Configuration of Sane is also required


How to restart X Window Server from command line? How can I restart X Window Server from the command line?

I'd really like to be able to restart my GUI without having to do a full system reboot.

NOTE: This will forcefully quit all graphical programs, you'll lose any unsaved work, and you'll be logged out. Non-graphical programs will not be affected.

TL;DR: on systems with systemd (Ubuntu 15.04 and newer)

sudo systemctl restart display-manager

This will restart the appropriate display manager service (lightdm till 17.04, gdm3 after, sddm in Kubuntu, etc.). You can replace display-manager with lightdm, gdm3, sddm, etc. if needed, but this should be enough.

For other Ubuntu versions, first find which display manager your ubuntu is having with following command:

cat /etc/X11/default-display-manager

Than depending on what display manager, you can use one of the following commands:

Default Ubuntu (with LightDM)

sudo systemctl restart lightdm

Gnome (with GDM)

sudo systemctl restart gdm

KDE (with KDM)

sudo systemctl restart kdm

Note: From 12.10 to 15.04, Kubuntu also uses LightDM.
For MDM (e.g. for Mint Cinnamon)

sudo systemctl restart mdm

Since ubuntu 9.04 Ctrl+Alt+Backspace is disabled, however you can now type Alt gr + Print Screen + K.

http://www.sudo-juice.com/ubuntu-11-10-restart-x-shortcut/


Chromecast "Audio" not found by pulseaudio-dlna on 16.04 I have a brand spanking new Chromecast Audio.  I can cast to it from my Android phone using cast-enable apps like Spotify and Pandora.  I can also cast to it from my Android phone using the awesome AirAudio app.

I can cast to the Chromecast Audio from Ubuntu 16.04 using either (A) Chrome's google cast plugin; or (B) mkchromecast.  But the former is inconvenient (no media key support) and the latter seems to have huge latency issues (around 27 seconds) -- and it is also seems to require WiFi as opposed to allowing an ethernet connection.

What I can't do, is find the Chromecast Audio using pulseaudio-dlna.  Pulseaudio-dlna simply does not see the Chromecast at all.  This is unexpected because the pulseaudio-dlna does find my AVR receiver and my DirecTV receiver.  And as noted above, other Ubuntu apps can find the Chromecast Audio.  After reading the usage notes for pulseaudio-dlna, I checked for a firewall issue -- but the Ubuntu 16.04 computer does not have the firewall on.

Any ideas what is going wrong here?

(I tried posting an issue on the pulseaudio-dlna github page, but those are not generally answered.)

I was able to resolve this issue by resetting the router that was between my primary router and the computers that were failing to connect to the Chromecast Audio with pulseaudio-dlna.  Some setting in the router (other than firewall) must have conflicted with pulseaudio-dlna.

That said, there is something in pulseaudo-dlna that operates differently than Google Chrome's casting plug-in and mkchromecast.  Both of those worked under the old router setup.

Also, it may be notable that mkchromecast did not work with pulseaudio-dlna installed.  So there may be more than one conflict.

[My primary problem now is major lag that seems to grow from about 2 seconds at the start of listening to Pandora/Pithos, to about 25 seconds after about an hour of listening.]

I resolved the issue on this link a bug report and stopping the Linux firewall.


Error message; [IP]in-addr.arpa has no PTR record: I'm trying to figure out how to find the hostnames of computers on the LAN network. I put in the known address of a computer, but I'm getting an error I don't understand.

michaelsavich@noranetserver:~$ host 10.1.10.10
10.10.1.10.in-addr.arpa has no PTR record

Both computers are on the same LAN, so the issue isn't with port forwarding or anything. For the record, the computer I ran host on was running Ubuntu Server 14.04 LTS, and 10.1.10.10 should belong to a MacBook.

I would use nmap to do ping scanning (as root) e.g.

sudo nmap -sP 192.168.1.*

If nmap is not installed, just press Ctrl+Alt+T on your keyboard to open Terminal. When it opens, run the command(s) below:

sudo apt-get install nmap

How about try to listing all out first, in terminal:

arp -a

from that, maybe you can figure out which names is which.
Hope this can help too.
(How to find a computer name in a LAN from the IP address?)


Kernel module compilation error I am getting an error, whenever I am trying to compile the module, as below:

sudo make

make -C /lib/modules/5.3.0-45-generic/build -I m=/home/shakti/Drivers/hello_param modules
make[1]: Entering directory '/usr/src/linux-headers-5.3.0-45-generic'
make[2]: *** No rule to make target 'arch/x86/tools/relocs_32.c', needed by 'arch/x86/tools/relocs_32.o'.  Stop.
arch/x86/Makefile:232: recipe for target 'archscripts' failed
make[1]: *** [archscripts] Error 2
make[1]: Leaving directory '/usr/src/linux-headers-5.3.0-45-generic'
Makefile:6: recipe for target 'all' failed
make: *** [all] Error 2

Help me out Please .
I have tried so many options.

i386 headers required:
sudo apt-get install linux-headers-*(kernel version)*:i386

Example:
sudo apt-get install linux-headers-5.4.0-42:i386


How can I securely erase a hard drive? I'm planning on selling a USB external hard drive that currently contains an old Ubuntu installation with stored passwords and banking information.

How can I securely erase the drive before selling it?

Securely erasing a storage device

There's a command-line utility called shred, which overwrites data in a file or a whole device with random bits, making it nearly impossible to recover.

First of all, you need to identify the name of the device.

This might be something like /dev/sdb or /dev/hdb (but not like /dev/sdb1, that's a partition). You can use sudo fdisk -l to list all connected storage devices, and find your external hard drive there.

N.B. Make sure it is the correct device, picking the wrong device will wipe it.

Unmount all currently mounted partitions on that device, if any.
Then run the following, replacing /dev/sdX with the name of your device:

sudo shred -v /dev/sdX

This will overwrite all the blocks on the device with random data three times, the -v flag is for verbose and will print the current progress.

You can add the option -nN to only do this N times, to save time on large capacity devices. This might take a while, depending on the size of your external hard drive (I think it takes twenty minutes or so for my 4 GB flash drive).

You can also set all bits to zero after the last iteration by adding the option -z, I prefer to do this.

sudo shred -v -n1 -z /dev/sdX

After this, you would have to repartition the device. The easiest way is to install GParted and use it:

sudo apt-get install gparted
gksu gparted

Choose your device in the upper-right corner list. Then select Device -> Create partition table to create a partition table on the device.

Then add a single partition that uses all of the unallocated space on the device, choosing fat32 as the file system. Apply the changes by click the Apply button (the green checkmark) in the toolbar.

Tips

Read the manpage for shred online or by typing man shred in the terminal.
Beware that some parts of your disk will not be erased - use the drive firmware "SECURE ERASE" command, such as via hdparm, to properly clean off a disk.

Go root and

dd if=/dev/random of=/dev/(your usb drive device here); dd if=/dev/zero of=/dev/(your usb drive device here)

Be certain you've got the right drive!


How do I upgrade from x86 to x64 without losing settings? Is there an easy way to upgrade the system to x64 from x86 without losing settings and having to repartition etc?

You can just perform an x86-64 install over the top of your existing i386 install.  There's no need to reformat or repartition - the Ubuntu installer has supported keeping the contents of /home and (most of) /etc (and other data directories) for a couple of releases now.

That will get you most of the way there; you'll keep all your configuration, but you won't have the same software installed.

To do that, the guide from this answer should work:

Before installing the x86-64 version, dump a list of your currently installed packages by running dpkg --get-selections > ~/installed-software in a terminal.
After installing, restore the list of installed packages by running sudo dpkg --set-selections < ~/installed-software followed by sudo apt-get -f install.  There will probably be some packages that can't be installed, as there are some i386 packages without x86-64 counterparts - libc6-686, the 686-optimised libc is the common example.

James is right.

As x86 and x64 are different architectures you can't just upgrade directly from one to another without wiping the root partition and re-installing the system.

One thing you can (and MUST) do is having directories where you store settings and files (usually /home/yourusername) set up in a separate partition, as this allows you to format your system without losing important settings, like your e-mail accounts' Evolution/Thunderbird configuration, or any other type of files.

If you do the same for /usr/bin (for example), then it also backups all files under this directory in a system format.


vi shortcut to delete "until the next X character" I understand that vi has shortcut keys to delete characters, words and lines with various options.

However, I could not find this:

delete from the cursor to the next specified character

For example, I might type du" expecting the editor to "delete until the next " character is found"

The closest I know is d9w where 9 is the number of words to delete.

Does anyone know if this is possible?

Use dtc, where c is any character, e.g. for you, you want dt"

This will delete upto but not including c.

If you had:

delete until exclamation point!

And the cursor was at the first space and you typed dt!, you would get:

delete!

Also dfc.

This will delete upto and including c.

Using df! on the same example above would give you:

delete

Just about any "motion" can be used for the d, c, y and similar commands.

I suggest use delete with pattern,
d/<pattern>
d is action delete
/ is vim searching sign
for example, the following is a MySQL connection string. I want to change to the password redhat to new one
root:redhat@tcp(localhost:3306)/?parseTime=True
In command mode , I click w(skip to next word), the cursor move to ":", click w again will move the cursor to first char r of password redhat. now click d/@ will delete the any characters until @ that in this case will remove the redhat. d/@tcp is better if the string has more than one @, the pattern more paticular is more precise.


How can I prevent Windows 10 from corrupting the ext4 superblock every time? I have a pc with dual-boot Ubuntu/Windows since more than 5 years.
The last working configuration was : windows 10 and Ubuntu 16.04 LTS.

I install Ubuntu 16.10 on the Linux partition and have some problems:

If I only boot on Linux, no problems, it works fine.
If I boot windows, no problem, windows works fine.
If I boot Linux after windows, I have a superblock error and drop to busybox.

If I restore the superblock with

fsck.ext4 -p -b 884736 -B 4096 /dev/sda5

I can boot Linux but after another boot to Windows the same problems reoccurs.

Of course I have tried solutions found:

chkdsk and testdisk while on windows.
I remove the extended partition and let the Linux installer recreate them.
Create by and, the extended partion + ext4 and swap and select these partition during the install process.

The partition table (fdisk -lu):

Disk /dev/sda: 298,1 GiB, 320072933376 bytes, 625142448 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x6bb7527c

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1            2048  22783999  22781952  10,9G  7 HPFS/NTFS/exFAT
/dev/sda2  *     22784000  22988799    204800   100M  7 HPFS/NTFS/exFAT
/dev/sda3        22988800 375246847 352258048   168G  7 HPFS/NTFS/exFAT
/dev/sda4       375246848 625141759 249894912 119,2G  f W95 Ext'd (LBA)
/dev/sda5       383440896 617844735 234403840 111,8G 83 Linux
/dev/sda6       617846784 625141759   7294976   3,5G 82 Linux swap / Solaris

I did some more tests without success:

I removed the Linux extended partition
I extended the windows partition to the full disk
I launched a chkdsk /F /R on this new windows partition → after a couple of hours all is good
I reinstalled Ubuntu 16.10 and let the install program resize the disk and create the ext4 and swap part.
I boot Linux → no problem
I boot windows → no problem (I reach the windows menu that let me choose between Windows and Linux, I choose Windows)
I boot Linux: same problem again (superblock error)

Update :
the exact superblock error :

fsck.ext4: Superblock checksum does not match superblock while trying to open /dev/sda5

To repair it :

fsck.ext4 -p -b 884736 -B 4096 /dev/sda5

works fine, but after a Windows boot, the problem is there again ...

Update 2 :
From W10, I can mount the linux ext4 partition with the W10 ext2 tool. It works fine, I can see the files.  But after that, same problem, when I boot on Linux: superblock errors.

Of course if I just boot W10 (no login) and reboot linux, the problem is there too.

The problem was present with W10 1511, I've upgraded to W10 1607 : same problem

I saw that I was not alone on earth with this problem, but I did not see any solution.

update2 :
I removed the linux and swap partition and create a new partition from windows.
Then  I reinstalled Ubuntu 16.10 => same problem again

update 3: The beginning of solution
I have perhaps found a solution.
When loggued in windows :
With the command diskpart, when the linux volume is set offline
there is no more problem when I boot linux.

I now have to find how to set the volume offline automaticaly (regedit ?)

I have done some research and it seems that since ext2fsprogs 1.43 (Ubuntu 16.10), the 64bit and the metadata_csum features are enabled when a new ext4 filesystem is created. I did a fresh install of Ubuntu 16.10, but before installing, I started into the USB live session and removed the 64bit and metadata_csum features for ext4 from /etc/mke2fs.conf. After this I ran the installer out of the this live session and now I can start Windows 10 without corrupting my ext4 partitions (you have to reformat your ext4 partitions during the installation of Ubuntu 16.10).

The problem is related to ext2fsd which obviously does not support the 64bit feature and/or metadata_csum feature. It is sufficient to have ext2fsd installed to corrupt your ext4 partitions. No need for them to be mounted in Windows.

You can check if these features are enabled with the following command:

sudo tune2fs -l /dev/[sdXX]

where [sdXX] stands for the ext4-partition in question.

Superblock on Ubuntu Partition is being corrupted by Windows 10 Block Level Backup service.  Disable through control panel.


Can't install Kmymoney in 16.04 After upgrading to Ubuntu 16.04 kmymoney was removed, now cannot be re-installed.

I've tried from Ubuntu software centre and terminal with sudo apt-get install but I get this. How do I proceed to
install? I need to access my accounts.

The following packages have unmet dependencies.
 kmymoney : Depends: kde-runtime (> 4:4.10) but it is not going to be installed
Depends: libkabc4 (>= 4:4.4.4) but it is not going to be installed
Depends: libkfile4 (>= 4:4.4.4) but it is not going to be installed
Depends: libkhtml5 (>= 4:4.4.4) but it is not going to be installed
Depends: libkio5 (>= 4:4.4.4) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
howard@coaching:~$

Run the following commands in terminal:

sudo apt-get update
sudo apt-get install kmymoney

control + alt + T  to open terminal


Chromium not starting on Ubuntu 20.04 I am running Ubuntu 20.04 x86_64 and using chromium installed with snap:
$ snap list
Name               Version          Rev   Tracking       Publisher   Notes
chromium           84.0.4147.89     1229  latest/stable  canonical✓  -
core18             20200707         1880  latest/stable  canonical✓  base
gtk-common-themes  0.1-36-gc75f853  1506  latest/stable  canonical✓  -
snapd              2.45.2           8542  latest/stable  canonical✓  snapd

It all seems up-to-date, but chromium can not start. If I launch it, it aborts the execution. In both /var/log/syslog and /var/log/kern.log, the following line is generated:
kernel: [ 1590.847960] traps: chrome[5324] trap int3 ip:557cd4d7b152 sp:7fffde23a9c0 error:0 in chrome[557cd1a59000+7234000]

Also, in /var/log/apport.log, for each execution attempt, this line appears:
ERROR: apport (pid 5556) Thu Jul 16 10:32:47 2020: host pid 5324 crashed in a separate mount namespace, ignoring

What could it be the problem?

Note that the program is chromium, but despite this, the log lines automatically report the name chrome, for reasons I do not know (maybe because chromium is anyway based on chrome).

Update: when launched from a terminal, according to a suggestion in an answer, I get:
$ chromium-browser --disable-extensions
[11036:11036:0716/152514.953429:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
WARNING: Kernel has no file descriptor comparison support: Operation not permitted
Trace/breakpoint trap (core dumped)

With chromium --disable-extensions, the message is the same.

Update 2:
$ chromium-browser --disable-gpu --disable-software-rasterizer
MESA-LOADER: failed to retrieve device information
MESA-LOADER: failed to open i915 (search paths /snap/chromium/1229/usr/lib/x86_64-linux-gnu/dri)
failed to load driver: i915
MESA-LOADER: failed to open kms_swrast (search paths /snap/chromium/1229/usr/lib/x86_64-linux-gnu/dri)
failed to load driver: kms_swrast
MESA-LOADER: failed to open swrast (search paths /snap/chromium/1229/usr/lib/x86_64-linux-gnu/dri)
failed to load swrast driver
Trace/breakpoint trap (core dumped)

and the same with chromium --disable-gpu --disable-software-rasterizer. I did not intentionally install any graphic driver, so I guess I'm using the default ones shipped with Ubuntu 20.04. I use the CPU integrated graphic card, CPU is Intel Core i5 4670.
I also tried to run chromium-browser --disable-gpu --disable-software-rasterizer after export MESA_GLSL_CACHE_DISABLE=true, but the error messages are the same as above.

I just got this problem, seemingly out of the blue. Turns out I may be related to a problem I already reported about fonts not loading in the Chromium Snap.
I found the following workaround :
# first close all instances of chromium
sudo rm /var/cache/fontconfig/*
rm ~/.cache/fontconfig/*
sudo fc-cache -r -v
rm -rf ~/snap/chromium/common/.cache/fontconfig/
chromium-browser

This set of commands is a workaround for a problem I already reported here :
[chromium] File chooser is not displaying font

This doesn't answer the question as such but may help someone... Tripped over this at work on my dell laptop after installing windows fonts and the workaround posited by Antoine regarding fonts solved the issue.
https://bugs.launchpad.net/ubuntu/+source/chromium-browser/+bug/1864365/comments/33
However just tried the same fix on my Intel NUC and I get this
Gtk-Message: 10:31:24.401: Failed to load module "canberra-gtk-module"
Gtk-Message: 10:31:24.402: Failed to load module "canberra-gtk-module"
[10624:10624:0100/000000.486036:ERROR:sandbox_linux.cc(374)] InitializeSandbox() called with multiple threads in process gpu-process.
Trace/breakpoint trap (core dumped)

I tried this
$ sudo apt install libcanberra-gtk-module libcanberra-gtk3-module
and a restart but still get the same error.
$ lshw -c video | grep driver
returns i915. So I'm guessing the driver might be the issue here as well as the fonts?
Confirmed that removing the windows fonts I installed solves the issue.
Anyway hope this helps someone.
M


Failing to upgrade to linux-image-3.0.0-26-generic When I try to upgrade linux-image-3.0.0-26-generic I get following problems:

dpkg-deb (subprocess): data: internal bzip2 read error: 'DATA_ERROR'
dpkg-deb: error: subprocess <decompress> returned error exit status 2
dpkg: error processing /var/cache/apt/archives/linux-image-3.0.0-26-generic_3.0.0-26.42_amd64.deb (--unpack):
 short read on buffer copy for backend dpkg-deb during `./lib/modules/3.0.0-26-generic/kernel/drivers/scsi/fnic/fnic.ko'
No apport report written because MaxReports is reached already
                                                              Examining /etc/kernel/postrm.d .
run-parts: executing /etc/kernel/postrm.d/initramfs-tools 3.0.0-26-generic /boot/vmlinuz-3.0.0-26-generic
run-parts: executing /etc/kernel/postrm.d/zz-update-grub 3.0.0-26-generic /boot/vmlinuz-3.0.0-26-generic
Errors were encountered while processing:
 /var/cache/apt/archives/linux-image-3.0.0-26-generic_3.0.0-26.42_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)
A package failed to install.  Trying to recover:

dpkg: dependency problems prevent configuration of linux-image-generic:
 linux-image-generic depends on linux-image-3.0.0-26-generic; however:
  Package linux-image-3.0.0-26-generic is not installed.

I don't know why this happens to me; earlier upgrades always worked without problems.

Does anybody know how to fix this?

I think the .deb package is corrupt, see this article for further explanation.

Solution:

apt-get clean # clears out the local repository of retrieved package files

try this
sudo apt-get install linux-image-TABTAB

it will show you all the possible kernel image which will support your system


Why not permit read access for all in /var/log? There are many log files in /var/log that I do not have permission to read with my normal user.  I have to use sudo to add read permission first.  It's getting annoying, especially having to repeat the same thing on different machines.

Is there a good reason for this?

The /var/log files contain logged data, http://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/var.html , important to note-
"/var/log/wtmp, which logs all logins and logouts into the system"
"/var/log/messages, where all kernel and system program message are usually stored"

These areas contain tons of detailed information about your system, and if even read by an outside service, could be used to compromise your whole system. I would advise not to change the permissions on this folder.

The permissions are set like this for security purposes on servers and production machines. If you are just using a personal desktop or laptop that's not hosting anything to the outside world, then it probably doesn't matter.

If you feel like diddling with the permissions, then you can always try a chmod -R 666 on the log directory, although I'm not sure if this will break anything when it comes to the log writers needing specific permissions on the files, or if the permissions will not change when the logging software decides to change the logs. However, I still think the best way to view the files is with a

sudo less filename

It's only one little extra sudo.


I'm unable to install Gnome in Ubuntu 16.04 This is what comes up when I try to install Gnome via Terminal:

ansh@Ansh-HP-Notebook:~$ sudo apt update
[sudo] password for ansh:

E: Could not get lock /var/lib/apt/lists/lock - open (11: Resource temporarily unavailable)
E: Unable to lock directory /var/lib/apt/lists/
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 using it?

ansh@Ansh-HP-Notebook:~$ sudo apt install ubuntu-gnome-desktop

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 using it?

This should be used as last resort. If you use this carelessly, you can end up with a broken system
remove the lock :
sudo rm  /var/lib/dpkg/lock

configure dpkg :
sudo dpkg --configure -a

update your apt-get :
sudo apt-get update --fix-missing


.desktop file running sh script "There was an error launching the application." I have a .desktop file:

[Desktop Entry]
Type=Application
Terminal=true
Name=RunMe
Exec=run.sh

When I double click the .desktop file, I get There was an error launching the application.

my run.sh is:

#!/bin/sh
xulrunner-sdk/bin/xulrunner-stub --app xulrunner-sdk/bin/application.ini 2>~log.log

Double clicking on run.sh and clicking run runs the application fine. Both run.sh and my .desktop are executable.

What do I need to change in my desktop file to make this work?

To figure out what exactly is the error as you asked

  What do I need to change in my desktop file to make this work?

After a lot of research, I found that you can indeed validate your desktop file with this command

desktop-file-validate your-file-here.desktop

This was the hidden command I was trying to find since hours. This, Saved my day :-)

This command will show you warning and errors wherever you have gone wrong.
Credits : ubuntuforums

Put your script, (the orig. one) in a bin directory in your PATH if not already.
Rename the script & lose the extension, eg, run1
edit your .desktop to reflect new name, eg. Exec=run1


What to do when Ctrl-C won't kill running job? Sometimes, processes ignore the SIGINT signal sent by Ctrl-C in Bash. For instance, man and vi. Assuming you don't want to google or read the manual on how to exit the running process, is there any key sequence that will always work (without leaving the terminal)?

Send the SIGQUIT signal with Ctrl+\.

.. $ sleep 10
^\Quit

→ This is equivalent to kill -3 pid. Programs run in user-space don't ignore sigquit.

There is also a set of Magic SysRq keyboard shortcuts. One of the more interesting ones is this: Alt+SysRq+k. It kills every process on the current virtual console. If one of your ttys is completely and utterly broken, this can be used to go back. On the tty running X.org, it can be used to kill X without mercy.

The SysRq key is, on most keyboards, the same as the Print Key. On my notebook, it can be invoked using the Fn key; I.e. Alt→Fn→Print→k in that order.

Here are some of the basic process management shortcuts:

Ctrl+Z: pause a
process (plus bg to resume in the background, fg to raise to foreground)
Ctrl+C: politely ask the process to
shut down now
Ctrl+\: mercilessly kill the process that is
currently in the foreground
Alt+SysRq+s: Write data to disk (always do this before killing anything important)
Alt+SysRq+s, k: mercilessly kill all current
processes on a given virtual console
Alt+SysRq+s, b: mercilessly reboot without unmounting,
Alt+SysRq+r, e, i, s, u, b: Safely reboot even if the system is utterly broken,

Note: Ctrl+Z, in contrast to Ctrl+C and Ctrl+\, also works for man, vi, less, and the like.

When in doubt, the follwing procedure will almost always work:

~$ sleep 10
^Z
[5]+  Stopped              sleep 10
~$ ps
  PID TTY          TIME CMD
 4804 pts/0    00:00:00 bash
 6207 pts/0    00:00:00 sleep
 6208 pts/0    00:00:00 ps
~$ kill -9 6207
[5]+  Killed                  sleep 10
~$

^Z of course indicates that Ctrl+Z has been pressed.

For a more in-depth look at Shells and Terminals, also see my answers on:

What are shells?
Why is a virtual terminal "virtual", and what/why/where is the "real" terminal?

Try Ctrl+Alt+Backspace

If you are using ubuntu 10.04 you wanna enable this key to work.

To enable Control-Alt-Backspace

Goto System-->Preferences-->Keyboard

Select the Layouts tab and click on the Layout Options.

Select Key sequence to kill the X server and enable Control + Alt +Backspace.

Note:

Pressing Ctrl-Alt-Backspace will restart your X server.


Installing nvidia drivers on 18.04 all. I'm trying to fix my system so I can install the nvidia drivers but it seems to get stuck for some reason. I have tried manually removing the downloaded files from

/var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_i386.deb
/var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_amd64.deb

... in order to let them download again but to no avail. Have anyone tried installing those drivers on 18.04 lately?

~$ sudo apt --fix-broken install
[sudo] password for jarl:
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following packages were automatically installed and are no longer required:
  lib32gcc1 libc6-i386
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
  libnvidia-gl-390 libnvidia-gl-390:i386
The following NEW packages will be installed
  libnvidia-gl-390 libnvidia-gl-390:i386
0 to upgrade, 2 to newly install, 0 to remove and 4 not to upgrade.
3 not fully installed or removed.
Need to get 0 B/29,1 MB of archives.
After this operation, 147 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
(Reading database ... 214344 files and directories currently installed.)
Preparing to unpack .../libnvidia-gl-390_390.48-0ubuntu3_i386.deb ...
diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340
dpkg-divert: error: mismatch on package
  when removing 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 by libnvidia-gl-390'
  found 'diversion of /usr/lib/i386-linux-gnu/libGL.so.1 to /usr/lib/i386-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_i386.deb (--unpack):
 new libnvidia-gl-390:i386 package pre-installation script subprocess returned error exit status 2
Preparing to unpack .../libnvidia-gl-390_390.48-0ubuntu3_amd64.deb ...
diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340
dpkg-divert: error: mismatch on package
  when removing 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 by libnvidia-gl-390'
  found 'diversion of /usr/lib/x86_64-linux-gnu/libGL.so.1 to /usr/lib/x86_64-linux-gnu/libGL.so.1.distrib by nvidia-340'
dpkg: error processing archive /var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_amd64.deb (--unpack):
 new libnvidia-gl-390:amd64 package pre-installation script subprocess returned error exit status 2
Errors were encountered while processing:
 /var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_i386.deb
 /var/cache/apt/archives/libnvidia-gl-390_390.48-0ubuntu3_amd64.deb
E: Sub-process /usr/bin/dpkg returned an error code (1)

Found this command on ubuntu forums, worked very well with me:

Run:

LC_MESSAGES=C dpkg-divert --list '*nvidia-340*' | sed -nre 's/^diversion of (.*) to .*/\1/p' | xargs -rd'\n' -n1 -- sudo dpkg-divert --remove
sudo apt --fix-broken install

The first command will remove all the diverted packages from nvidia-340. If you have other nvidia version "diverting" change it; read the error code to know which version is diverting.

Source: https://ubuntuforums.org/showthread.php?t=2388026&p=13761809#post13761809
kudos to stutteringp0et2 :)

as per:
https://forums.developer.nvidia.com/t/problem-with-apt-and-nvidia-440-on-ubuntu-20-04/115281/4
It worked for me to 'fix' the broken deb (you can get the broken deb name if you run the update from the commandline eg. with aptitude)
sudo dpkg -i --force-overwrite /var/cache/apt/archives/libnvidia-extra-455_455.45.01-0ubuntu1_amd64.deb

After that, you can continue to fix other broken installs or just upgrade normally again


How To Restart Sudo Service in Ubuntu 18+ From "Do we need to reboot after adding an user to sudoers?", it is apparent that restarting Sudo Service is necessary, or reboot. However the recommended way, which works for Ubuntu 14.04, is no longer working for Ubuntu 18+:

$ sudo service sudo restart
Failed to restart sudo.service: Unit sudo.service is masked.

Solution?

masked services are when the systemd unit files are linked to /dev/null/ You can see the sudo.service

$ systemctl status sudo.service
● sudo.service
   Loaded: masked (/dev/null; bad)
   Active: inactive (dead)

$ ls -l /lib/systemd/system/sudo.service
lrwxrwxrwx 1 root root 9 Jan 18  2018 /lib/systemd/system/sudo.service -> /dev/null

Some services are used within systemd, and not actual daemons with processes that run in the background. For example, you cannot start/stop halt.service. But if you place your scripts in /usr/lib/systemd/system-shutdown/, they will be run before the system is halted or rebooted.

Sudo Usage

You don't need to reboot to use sudo. Simply add users and your settings to the Sudoers file.

I know it's late but I wanted to give my two cents to newbs like me. I also thought the change wasn't working, it was just silly of me that I thought you didn't need to type sudo anymore after the first one for however long timeout in sudoers is set for (default 15 min). In other words you have to keep typing sudo before any relevant command, it just doesn't ask you for password anymore.


Ubuntu 16.04 lags in VM So, first of all, I'm new to Linux. I am using Ubuntu with windows 8.1 in virtual box. Updated. Even my host (windows) starts to hang whenever I start the machine. I seriously want to use Ubuntu. And also i can't take screenshots either. They're always blank.

I've also installed guest editions, done sudo apt-get update and what not.

System's RAM-8 GB
RAM allocated-2 GB
CPU intel(R) core(TM) i5-5250U@ 1.60GHz

You have a poor processor for run a virtual machine with Ubuntu. Unity will take a lot of resources that your system can't handle efficiently. I recommend to use Lubuntu in your case. Or even better, do a dual boot. But be aware of install Ubuntu with Unity. Install Xubuntu, or Lubuntu. First of all, try booting a live USB or live DVD to try the *buntu distro that fits better to your system specs, after this, you can decide if dual boot, or run in a virtual machine.

To install Guest Addtitions, insert the Guest Additions CD from the devices menu. Then, search the mounted media and enter the folder, you will see a file named like "VBoxLinuxAdditions.run". From a console, run:

sudo sh ./VBoxLinuxAdditions.run

If it fails, install:

sudo apt-get install gcc
sudo apt-get intall build-essential

The installation will give you some information about other packages and related information about a possible failure.

Regards.

Go to Settings >> Proseccors then change CPU amount to 2 (or more) CPUs.


Moonlight not working on firefox or chromium - Ubuntu 11.04 I'm trying to watch my sky films but I need silverlight of course. I have tried downloading moonlight 4 on Chromium - says: cannot unzip package so does not finish download
In the latest Firefox of course it's not compatible (yet?)

I'm new to Ubuntu,I can follow instructions

Is there anyway I can get around this?

Moonlight 4.0 is compatible with Firefox 12.0 (Latest stable release for Ubuntu). To install follow these steps:

Open Firefox and visit Moonlight download page
Select your the architecture of you system (32bit or 64bit)
Click on download button, Firefox will show you a confirmation box click allow.

Click on "Install Now" on the installation dialog box.

Upon completion of download click on restart. That's it!

After restart you'll see Silverlight plug-in listed under installed plug-ins.

Move the .mozilla folder from- /home/your user name/.mozilla to a different name like mozilla_old.

Then try installing the moonlight again.

Caution : deleting .mozilla will remove everthing. I mean your addons and bookmarks.


How to change Thunderbird's display time to 24h format? Currently Thunderbird displays time in AM/PM mode.

How can I change it to 24h mode?

UPDATE 1:

$ locale |grep LC_TIME
LC_TIME="en_US.UTF-8"

Ok, solved it:

1) Make sure you have the locale you need, can't say which you specifically need but when you know you create it like this (using en_DK.utf8)

sudo locale-gen en_DK.utf8

2) To make sure this locale is in effect for thunderbird you add it to the script that starts thunderbird, so first find that script:

2a) find the right script

which thunderbird

In my case: /usr/bin/thunderbird

2b) add locale to the script (I use the editor geany):

gksudo geany /usr/bin/thunderbird

Add this in the beginning of the script (I just put at the very beginning):

LC_ALL="en_DK.utf8"
export LC_ALL

Just want to add this:

https://help.ubuntu.com/community/Locale

EDIT: as pointed out by pl1nk A better solution would be to NOT touch the /usr/bin/thunderbird script and instead create the script '/usr/local/bin/thunderbird' with this content

#!/bin/sh
LC_ALL="en_DK.utf8"
export LC_ALL
/usr/bin/thunderbird $@

make sure it's executable

sudo chmod a+x /usr/local/bin/thunderbird

Then check if it's being used to start thunderbird:

which thunderbird

should respond with this:

/usr/local/bin/thunderbird

Now thunderbird can be started as before.

There is a simple solution for the time and date format issues - a newer plugin works for Thunderbird 60+ that allows full customization of the time and date formats. It's called "Enhanced Date Formatter" and is in the list of extensions inside Thunderbird. Just fire up Thunderbird and search for it, install it, and customize however you want.


How to listen to Hong Kong RTHK Radio with Lubuntu? I want to listen to RTHK with Lubuntu 13.10   Firefox 26.0.

However,  when I went to the above webpage(for example),
Firefox always asks me to select a player for it.
I tried to select mplayer, vlc, Audacious, ...
but it doesn't work.

Is there a way to solve this problem? Please help.

Thank you very much!

install Radiotray and configure the like http://stm.rthk.hk/radio1


Unmet dependencies installing vim or vim-tiny I am trying to install vi and vim

I initially had vi instlled, and could not install vim, then I removed vi, and now I cannot install both.

I watch all threads in internet, that says you should update, uninstall or purge, then reinstall, but none are working.

Here are the logs:

[root@artik ~]# apt-get install vi.tiny
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package vi.tiny
E: Couldn't find any package by glob 'vi.tiny'
E: Couldn't find any package by regex 'vi.tiny'

[root@artik ~]# apt-get install vim
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 vim : Depends: vim-common (= 2:8.1.0788-0york0~16.04) but 2:8.1.0837-0york0~16.04 is to be installed
       Depends: vim-runtime (= 2:8.1.0788-0york0~16.04) but 2:8.1.0837-0york0~16.04 is to be installed
E: Unable to correct problems, you have held broken packages.

now, file /etc/apt/sources.list

[root@artik ~]# cat /etc/apt/sources.list
deb http://ports.ubuntu.com/ubuntu-ports/ xenial main universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial main universe
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-security main universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-security main universe
deb http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main universe
deb-src http://ports.ubuntu.com/ubuntu-ports/ xenial-updates main universe
deb [arch=armhf] https://download.docker.com/linux/ubuntu xenial stable
# deb-src [arch=armhf] https://download.docker.com/linux/ubuntu xenial stable
deb http://archive.ubuntu.com/ubuntu xenial main universe
# deb-src http://archive.ubuntu.com/ubuntu xenial main universe

I am running ubuntu on Artik board

EDIT: Inside /etc/apt/sources.list.d/ I have:

[root@artik ~]# ls /etc/apt/sources.list.d/
artik-e2e-source.list
artik-e2e-source.list.save
artik-platform-artik533s-sources.list
artik-platform-artik533s-sources.list.save
jonathonf-ubuntu-vim-xenial.list
jonathonf-ubuntu-vim-xenial.list.save
nodesource.list
nodesource.list.save

and apt-cache

[root@artik ~]# apt-cache policy vim vim-common
vim:
  Installed: (none)
  Candidate: 2:8.1.0788-0york0~16.04
  Version table:
     2:8.1.0788-0york0~16.04 500
        500 http://ppa.launchpad.net/jonathonf/vim/ubuntu xenial/main armhf Packages
     2:7.4.1689-3ubuntu1.2 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial-security/main armhf Packages
        500 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main armhf Packages
     2:7.4.1689-3ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf Packages
vim-common:
  Installed: (none)
  Candidate: 2:8.1.0837-0york0~16.04
  Version table:
     2:8.1.0837-0york0~16.04 500
        500 http://ppa.launchpad.net/jonathonf/vim/ubuntu xenial/main armhf Packages
        100 /var/lib/dpkg/status
     2:8.1.0788-0york0~16.04 500
        500 http://ppa.launchpad.net/jonathonf/vim/ubuntu xenial/main armhf Packages
     2:7.4.1689-3ubuntu1.2 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial-security/main armhf Packages
        500 http://ports.ubuntu.com/ubuntu-ports xenial-updates/main armhf Packages
     2:7.4.1689-3ubuntu1 500
        500 http://ports.ubuntu.com/ubuntu-ports xenial/main armhf Packages

EDIT 2:

When I do apt-get update I get an error, I don't know if it is important:

Err:7 http://archive.ubuntu.com/ubuntu xenial/main armhf Packages
  404  Not Found [IP: 91.189.88.162 80]

It looks like you didn't run sudo apt-get update.

Additionally, this looks like you have installed a ppa. The ppa should be listed in a file located in /etc/apt/sources.list.d and will not be listed on /etc/apt/sources.list.

Run the following commands:

sudo apt-get update
sudo apt-get install --reinstall vim=2:8.1.0837-0york0~16.04

If this does not work, please let me know and we can investigate to see if you still have the ppa installed. If not, then you may want to reinstall the ppa. If you don't want the ppa, then you will need to clear your apt-cache and do some other stuff to remedy and I can give you further instructions on how to do that if that is needed.

Please post any errors. Thanks!

First, fix your sources.list file because it contains a line that should not be there by running the following command:

sudo sed -i 's/\(deb http...archive\)/#\1/g' /etc/apt/sources.list
sudo apt-get update

If you have removed the ppa, run the following commands:

sudo apt-get clean
sudo apt-get update
sudo apt-get remove vim vim-common vim-runtime
sudo apt-get install vim vim-common vim-runtime

Please post any more errors. Thanks!

E: Unable to locate package vi.tiny
E: Couldn't find any package by glob 'vi.tiny'
E: Couldn't find any package by regex 'vi.tiny'

Is just saying that the package or program vi.tiny doesn't exist in the ubuntu repo's. You might try installing just vi first to see if that works.

# apt-get install vi

As for vim, it sounds like you have some broken packages, aptitude is usually pretty good at fixing issues like this so you might try

# apt-get install aptitude
...
# aptitude install vim


How to create an empty file from command line How can I create an empty file from the command line?

Use the touch command:

The touch utility sets the modification and access times of files to the
current time of day. If the file doesn't exist, it is created with
default permissions.

Example:

touch newfile

In general, creating any regular1 file on Linux involves  open(2) ,openat(2), and creat(2) system calls (and specifically with O_CREAT flags). That means if you call any command-line utility that does these system calls, you can create a new empty file.
Most commonly new filename is created with something like this:

touch /tmp/new_file
: > /tmp/new_file
true > /tmp/new_file
> /tmp/new_file ( bash shell only )

touch is a standalone utility. Its original purpose is to update the access and modification time of a file, however if the file does not exist - it will be created. Note also that a filename - is treated specially, so if you do want to create a file that is named literally -, you'll have to enclose that into single or double quotes.
By contrast, > is a shell redirection operator for stdout stream.  The > operator  specifically calls the openat() system call with  O_WRONLY|O_CREAT|O_TRUNC  flags. That means, if the filename does not exist - it will be created, and if it does - the data will be truncated (and therefore gone, so > should be used with care). In most shells nowadays true or : is a built-in , so  doing : > /tmp/new_file is going to be more efficient, although marginally compared to touch /tmp/new_file.
But of course it does not stop there. As mentioned, anything that can perform open(), openat() and, create() syscalls will create a file. Hence, we can do:

true|dd of=/tmp/newfile
truncate --size 0 /tmp/new_filename.txt
cp /dev/null /tmp/null_file
true|tee /tmp/some_other_file
mktemp or tempfile ( for creating temporary files that do not need to exist between reboots !)

Of course, all the above mentioned utilities do not exclusively create files. But they perform the necessary syscall and that allows us to adapt the commands.

Of course, at the level of programming or scripting we may want to create a file as well, especially for efficiency purposes (because calling external commands such as touch from a Perl script or Python will require additional resources).
Python one-liner:
$ python -c 'import sys,os;f=sys.argv[1];os.utime(f,None) if os.path.exists(f) else open(f,"a").close' myfile.txt

We can make it shorter with this:
$ python -c 'import sys,os;f=sys.argv[1];'$'\n''with open(f,"a"): os.utime(f,None)' mysecondfile.txt

And in Perl:
$ perl -e 'open(my $fh,">","/tmp/perlfile")'

1 Other types of files such as hard/soft links,character or block special devices, directory,named pipes, or sockets require entirely different syscalls.


Apt-get not found error on ubuntu 16 I was running few commands and suddenly my apt-get command stopped working, reporting command not found error.

Kindly help. I am blocked due to this.

I tried commands from this answer - askubuntu question for unmet dependencies

"Command not found" is the common response for a command you're not authorized to use.  In this case, apt-get is a system command, and requires root privilege; you should type sudo apt-get and whatever you're trying to install, remove, etc.  You'll be prompted for your user password, and assuming your'e on the sudoers list, the command will then execute with root privilege.


network manager says "device not managed" I used to be able to share my network connection by editing the Auto Eth0 to share with other computers in the Ipv4 section and now I upgraded my laptop to 11.10 .

Now are there no wired connections in the network manager. When I click my connections applet at the top of the tray it also says wired device not managed!

when I type ifconfig -a

daniella@daniella-1001HA:~$ ifconfig -a
eth0      Link encap:Ethernet  HWaddr 90:e6:ba:83:d6:fc
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
          Interrupt:45

eth0:avahi Link encap:Ethernet  HWaddr 90:e6:ba:83:d6:fc
          inet addr:169.254.13.40  Bcast:169.254.255.255  Mask:255.255.0.0
          UP BROADCAST MULTICAST  MTU:1500  Metric:1
          Interrupt:45

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

wlan0     Link encap:Ethernet  HWaddr 00:25:d3:90:43:41
          inet addr:192.168.0.6  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::225:d3ff:fe90:4341/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:12881 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12867 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:8851081 (8.8 MB)  TX bytes:2343199 (2.3 MB)

wired device not managed

Most probably your interface appears in /etc/network/interfaces. By default, NetworkManager does not manage interfaces that appear in /etc/network/interfaces. You can change this behaviour.

To do this - in a terminal:

sudo nano /etc/NetworkManager/NetworkManager.conf

change the line managed=false to managed=true

Save, stop and start network manager:

sudo service network-manager restart

Alternatively, you can remove the interface from /etc/network/interfaces.

backup the current interfaces file:

sudo cp /etc/network/interfaces /etc/network_interfaces_backup

Then open the file:

sudo nano /etc/network/interfaces

Delete everything in that file and copy and paste the following:

auto lo
iface lo inet loopback

Save, stop and start network manager:

sudo service network-manager restart

Double check in network manager (click on the indicator) that you have Enabled Networking ticked and you should also force deletion of old "wired connections" and selecting the new wired connection shown in the network manager indicator.

In 11.10 you can go to System Settings and you should see a Network Icon. Run that utility and you should see tabs for your network devices, wired and wireless. Each tab has a slider that allows you to switch the device off. Or in your case switch eth0 or wired connection 1, as it is now called, on. May be. At least check that it not switched to off.

regards.


Possible to run applications from the cloud? When installing Ubuntu, I made the partition really small. I would like to know if applications like vlc or Clementine be installed and run from the cloud?

You may run a full Ubuntu desktop in the cloud, however multimedia apps will suffer because of network latency and throughput

http://cloud.ubuntu.com/2010/11/show-off-ubuntu-desktop-on-cloud/

I have been able to run some applications from a dropbox share before (I can't see why you couldn't do the same with UbuntuOne). I did this for an experiment but it did work, albeit slow!

For example, if you have your dropbox share linked to ~/dropbox and you wanted to free up space, you could do this by moving your main vlc /usr/share/vlc directory to you dropbox and create a symbolic link back to your /usr/share directory.

eg: sudo ln -s /home/youruser/dropbox/vlc /usr/share/

But at the end of the day, I think this isn't a great solution and you would probably be far better off running some of the apps off a usb stick if storage is an issue.


How to download youtube videos as a best quality audio mp3 using youtube-dl I want to download YouTube videos as mp3 files in its best quality. The below code helps to download youtube videos as m4a but not us mp3

youtube-dl -f bestaudio --audio-quality 0 --audio-format mp3 https://www.youtube.com/playlist?list=PLYRruMbyFRcBVdVN8v4FNkIKkXvL-bZn_

can you tell me how to use bestaudio parameter to download YouTube video as mp3

From man youtube-dl:

-x, --extract-audio                  Convert video files to audio-only files (requires ffmpeg or avconv and ffprobe or avprobe)
    --audio-format FORMAT            Specify audio format: "best", "aac", "vorbis", "mp3", "m4a", "opus", or "wav"; "best" by default
    --audio-quality QUALITY          Specify ffmpeg/avconv audio quality, insert a value between 0 (better) and 9 (worse) for VBR or a specific bitrate like 128K (default

So your command could be:

youtube-dl -f bestaudio --extract-audio --audio-format mp3 --audio-quality 0 <Video-URL>

The --audio-quality 0 uses the highest encoding quality but can increase your file size unnecessarily. The default is 5 and might be a better choice depending on the source quality.

So, if quality and file size matter to you, you should avoid re-encoding and stay with Youtube's native music formats:

youtube-dl -f bestaudio[ext=m4a] --embed-thumbnail --add-metadata <Video-URL>

resulting in an m4a file or

youtube-dl -f bestaudio --extract-audio --embed-thumbnail --add-metadata <Video-URL>

probably resulting in an ogg file.

You can list the available format with

youtube-dl -F <Video-URL>

It is also worth noting other pieces out of man youtube-dl (a online copy can be found here):

(For those thinking TL;DR, just read the 4th paragraph, and you can use youtube-dl -x URL as it should download the best quality anyway :)

Also youtube-dl -f bestaudio URL works in my experience! However with both these options most of the time you will need convert to MP3 using ffmpeg or similar - since you are already editing the file you can also tag it (use the old ID3 version for most device compatibility!).

  FORMAT SELECTION

  By  default  youtube-dl tries to download the best quality, but sometimes you may want to download other format.  The simplest case is requesting a specific  format, for example -f 22. You can get the list of available formats using --list-formats, you can also use a file extension (currently  it  supports  aac,  m4a, mp3, mp4, ogg, wav, webm) or the special names best, bestvideo, bestaudio and worst.

  If  you  want  to  download  multiple  videos  and  they don't have the same formats available, you can specify the order of preference using slashes, as in-f 22/17/18.  You can also filter the video results by putting a condition in brackets, as in -f "best[height=720]" (or -f
  "[filesize>10M]").   This  works for  filesize,  height,  width, tbr, abr, vbr, asr, and fps and the comparisons <, <=, >, >=, =, != and for ext, codec, vcodec, container, and protocol and the comparisons =, != .  Formats for which the value is not known are excluded unless you put a question mark (?) after the operator.  You can combine  format  filters,  so  -f "[height <=? 720][tbr>500]" selects up to 720p videos (or videos where the height is not known) with a bitrate of at least 500 KBit/s.

  Use commas to download multiple formats, such as -f 136/137/mp4/bestvideo,140/m4a/bestaudio.  You can merge the video and
  audio of two formats into a single
         file using -f <video-format>+<audio-format> (requires ffmpeg or avconv), for example -f bestvideo+bestaudio.

  Since the end of April 2015 and version 2015.04.26 youtube-dl uses -f bestvideo+bestaudio/best as default format selection (see #5447, #5456).  If ffmpeg or avconv are installed this results in downloading bestvideo and bestaudio separately and muxing them together into a single file giving  the  best  overall  quality  available. Otherwise  it  falls  back to best and results in downloading best available quality served as a single file. best is also needed for videos that don't come from YouTube because they don't provide the audio and video in two different files. If you want to only download some  dash  formats (for  example  if  you  are not interested in getting videos with a resolution higher than 1080p), you can add -f bestvideo[height<=?1080]+bestaudio/best to your configuration file.  Note that if you use youtube-dl to stream to stdout (and most likely to pipe it to your media player then), i.e. you  explicitly specify  output  template  as  -o -, youtube-dl still uses -f best format selection in order to start content delivery immediately to your player and not to wait until bestvideo and bestaudio are downloaded and muxed.

  If you want to preserve the old format selection behavior (prior to youtube-dl 2015.04.26), i.e.  you want to download best
  available quality  media  served  as a single file, you should explicitly specify your choice with -f best.  You may want to add it to the configuration file (#configuration) in order not to type it every time you run youtube-dl.

  ...

  Can you please put the -b option back?

  Most people asking this question are not aware that youtube-dl now defaults to downloading the highest available quality as reported by YouTube, which  will be 1080p or 720p in some cases, so you no longer need the -b option.  For some specific videos, maybe YouTube does not report them to be available in a specific high quality format you're interested in.  In that case, simply request it with the -f option and youtube-dl will try to download it.

Youtube (probably as it is supposed to be a video playing site) also apparently compresses the audio (see here) down to 120~KBs, which is quite low but for the most part seems OK.

To compare download videos, you can query the downloaded video/audio tracks (you may need to use avprobe instead of ffprobe) to see which is best:

$ ffprobe -hide_banner output-output-loads-of-options.webm
Input #0, matroska,webm, from 'output-output-loads-of-options.webm':
  Metadata:
    encoder         : google
  Duration: 00:04:02.63, start: 0.000000, bitrate: 118 kb/s
    Stream #0:0(eng): Audio: vorbis, 44100 Hz, stereo, fltp (default)
$ ffprobe -hide_banner output_with_just_-x.ogg

Input #0, ogg, from 'output_with_just_-x':
  Duration: 00:04:02.65, start: 0.000000, bitrate: 117 kb/s
    Stream #0:0(eng): Audio: vorbis, 44100 Hz, stereo, fltp, 128 kb/s
    Metadata:
      LANGUAGE        : eng
      ENCODER         : Lavf56.4.101


Can no longer run gnome-terminal Ubuntu 17.10 (X.Org), GNOME 3.26.2.

I suddenly began having this problem when I try to run gnome-terminal, I can't figure out what caused this:

main19@system19:~$ gnome-terminal

Error constructing proxy for org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName for org.gnome.Terminal: Timeout was reached

This causes gnome-terminal not to start. I have tried looking online, everyone says it is a locale problem, here is my locale output:

main19@system19:~$ locale

LANG=en_US.UTF-8
LANGUAGE=
LC_CTYPE="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_COLLATE="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_PAPER="en_US.UTF-8"
LC_NAME="en_US.UTF-8"
LC_ADDRESS="en_US.UTF-8"
LC_TELEPHONE="en_US.UTF-8"
LC_MEASUREMENT="en_US.UTF-8"
LC_IDENTIFICATION="en_US.UTF-8"
LC_ALL=

Output of localectl:

System Locale: LANG=en_US.UTF-8
VC Keymap: us
X11 Layout: us
X11 Model: pc105+inet
X11 Options: terminate:ctrl_alt_bksp

I have run out of ideas, if anyone can provide help with this that would be great.

I ended up refreshing my HOME directory, cleaning out all kinds of old "junk" from it, paying special attention to cleaning out the .config directory.  I also created a new user so I could get a fresh copy of the .bashrc and .profile files.  This appears to have solved this (and another) problem.

Quickest fix: open a prompt using Alt-F2 and run the following line:

dconf reset -f /org/gnome/terminal/legacy/profiles:/

This cleans out all the gnome-terminal profiles. The problem might be caused by old profiles within gnome-terminal, that have unfinished command lines or invalid preferences.

(And try rebooting your system...)

Update:
Your problem persists over reboots, yet only in gnome-terminal. I think that means the problem should be somewhere in your configuration files for gnome-terminal.
To find out if it's just in your profile: try logging in as root using sudo -i.
Try gsettings list-recursively | grep -i term for clues.
Are there any clues in you .profile of .bashrc?


How do I create a Debian branch for my project on Launchpad? I have a project on Launchpad that consists of a single branch (trunk). I would like to create a second branch that contains the Debian packaging for the project (with the intent of creating a build recipe that merges it into the main branch before building).

I've done this before by just pushing a local branch to lp:~me/project_name/debian. However, this stacks the branch with trunk, which I don't want (it becomes impossible to delete trunk without deleting the Debian packaging branch - a restriction that has caused problems before).

What is the proper way to do this?

You'll need to create a new, clean branch with bzr init, then copy your files into it.  Then bzr add, commit and push from the new branch.

If you just want to nest the "debian" subdirectory with packaging info, use a build recipe pointing to trunk source branch in LP and add a "nest-part" line to add packaging info as it's described in:
https://help.launchpad.net/Packaging/SourceBuilds/Recipes

Something like this:

# bzr-builder format 0.3 deb-version 1.0+{revno}
lp:bzr-source-branch
nest-part packaging lp:~some-person/some-project/trunk-with-packaging debian debian

If the source branch has no compilation/build errors, your nested debian info will take care of packaging.


MegaSync client requires libcrypto++9 So, I was trying to install the sync client for Mega (http://mega.nz) on my Ubuntu 15.10 install. Yes, I know it's pre-release, but here is my question:
When i install the .dep file, I get that

Errors were encountered while processing:
 megasync
dpkg: dependency problems prevent configuration of megasync:
 megasync depends on libcrypto++9; however:
  Package libcrypto++9 is not installed.

When I then try to install libcrypto++9, I get the following error:

E: Package 'libcrypto++9' has no installation candidate

It then tells me that libcrypto++9v5 replaces it, but installing that doesn't satisfy MegaSync.

A quick Google search reveals that the v5 means "compiled using gcc5". Alas, the library is still the same. Why the new name, and how can I install my .deb file?

For Ubuntu 15.10 (All Versions):

Add this repository to your /etc/apt/sources.list (check here for other versions):

deb https://mega.nz/linux/MEGAsync/xUbuntu_15.10/ ./

Get/Add the key:

wget -O - https://mega.nz/linux/MEGAsync/xUbuntu_15.10/Release.key | sudo apt-key add -

Update: sudo apt-get update

Install MEGASync:

sudo apt-get install megasync

For Nautilus plugin:

sudo apt-get install nautilus-megasync

None of the solutions I found in the web worked so I tried the following:
I downloaded libcrypto++9 from here, and installed it as a .deb.
http://archive.ubuntu.com/ubuntu/pool/universe/libc/libcrypto++/libcrypto++9_5.6.1-6_amd64.deb
The same for libc6 from:
http://ftp.br.debian.org/debian/pool/main/g/glibc/libc6_2.31-4_amd64.deb
Then I downloaded libqt5gui5-gles_5.15.1+dfsg-2_amd64.deb from
http://ftp.br.debian.org/debian/pool/main/q/qtbase-opensource-src-gles/libqt5gui5-gles_5.15.1+dfsg-2_amd64.deb
You should do it with any package that is missing in your own configuration. I recomend this website to find them: https://pkgs.org/


How to set up Ubuntu as wireless accesspoint? How can I set up my WiFi to be used as wireless access point on Ubuntu Server?

I have a local Ubuntu Server, it has a wireless card in it (802.11a/b/g/n) and I really want to set it up as an 802.11n access point since my normal access point does not support N.

It needs to work as a switch as well so I can connect and get DHPC through.

Edit: I don't see Network Manager as a good solution since it depends on a lot of X11 packages, and i don't want that on a server.

I found a good thread. It should work in Ubuntu 10.04 no problem. Also it is CLI so it doesn't need any X libs at all. :)

This is a pretty good (if a little outdated [if 2006 is outdated]) article which outlines how to do this from the command line.

http://www.linux.com/archive/feed/55617

Assuming your wireless device works OK you can probably dive right in at the bridging section about halfway down.

Wi-Fi Protected Access version 2 (WPA2) is becoming the de facto standard for securing wireless networks, and a mandatory feature for all new Wi-Fi products certified by the Wi-Fi Alliance. We all know the security weaknesses of its predecessor, WEP; this time they got it right. Here's how to implement the WPA2 protocol on a Linux host and create a secure wireless access point (WAP) for your network.

Most consumer-grade commercial WAPs operate in the same simple manner: they create a bridge between a wired (Ethernet) network interface and a wireless one. That's exactly what we'll do too. The WAP part will be handled by the hostapd daemon, so you must pick a wireless interface it supports. Among the supported NICs are those with Prism 2/2.5/3, Atheros ar521x, and Prism GT/Duette/Indigo chipsets; a list is available on the hostapd homepage, along with links for Linux drivers for each chipset. I have an Atheros AR5212-based PCI card installed on my WAP, which is supported by hostapd. Although any Pentium (or newer) system will work, some PCI wireless cards require PCI 2.2 to operate, so make sure to check your system's motherboard specifications before buying. You will also need an Ethernet interface that's supported by Linux for connecting your WAP to the LAN; most on-board interfaces will work just fine.

My setup is based on Debian Testing (Etch), but any GNU/Linux distribution with a recent 2.6 kernel will work. The kernel must support 802.1d Ethernet Bridging (CONFIG_BRIDGE) and Wireless LAN (CONFIG_NET_RADIO). Most default stock kernels have these features enabled, but if you prefer to build your own kernel, make sure to include these options. The only other packages you need to install, besides hostapd, are bridge-utils and wireless-tools. Major GNU/Linux distributions offer binary packages for all these programs, but if you prefer to build them from source, you can find more information on their homepages.

Before bridging together the two interfaces we must put the wireless interface (in my case ath0; adjust it to match your setup) in hostap or Master mode. Usually this is as simple as running iwconfig ath0 mode Master, but since wlan support in Linux is not yet standardized, some drivers may need additional configuration. If you have an Atheros-based interface you also need to run the following: wlanconfig ath0 destroy; wlanconfig ath0 create wlandev wifi0 wlanmode ap before the iwconfig command. After that, running iwconfig ath0 will return mode:Master, among others.

Now let's create the bridge. We'll assume that the Ethernet interface is eth0:

ifconfig eth0 0.0.0.0 up
ifconfig ath0 0.0.0.0 up
brctl addbr br0
brctl addif br0 eth0
brctl addif br0 ath0

And for stopping the bridge, you should run:

ifconfig br0 down
ifconfig eth0 0.0.0.0 down
ifconfig ath0 0.0.0.0 down
brctl delif br0 eth0
brctl delif br0 ath0
brctl delbr br0

You can optionally give an IP address to the br0 interface if you want to access the WAP host from the network, using for instance SSH. Each distribution offers its own way to configure the network; if you use Debian (or any Debian-based distribution, such as Ubuntu) you can wrap up all the previous commands by simply adding the following to your /etc/network/interfaces file:

auto ath0 br0

iface ath0 inet manual
        pre-up wlanconfig ath0 destroy
        pre-up wlanconfig ath0 create wlandev wifi0 wlanmode ap
        post-down wlanconfig ath0 destroy
        wireless-mode master

iface br0 inet manual
        bridge_ports eth0 ath0

Note that ifupdown handles eth0 automatically, so you don't need a separate stanza for it in /etc/network/interfaces. To verify that the bridge is configured correctly, run brctl show. You should get something like this in return:

bridge name     bridge id               STP enabled     interfaces
br0             8000.00032f2481f0       no              ath0
                                                        eth0

Before starting to mess with hostapd we need a pass phrase for WPA2. As with all passwords, it should be random and thus hard to guess. A nice way to get a random pass phrase is to visit Gibson Research Corp.'s Ultra High Security Password Generator and use the third password it creates – the one titled 63 random alpha-numeric characters (a-z, A-Z, 0-9). Having a passphrase that includes non-alpha-numeric ASCII characters (e.g. !, @, etc.) might be tempting, but some clients -- namely Windows XP -- don't seem to like them.

Now create a new text file named /etc/hostapd/wpa_psk and paste your pass phrase as:

00:00:00:00:00:00 PASSPHRASE

The first part with the zeros means 'match all MAC addresses,' and does exactly that. You can also use different passphrases for each client by appending a new line to the file with each client's MAC address and its passphrase. Make sure that only root has access to that file by running chmod 600 /etc/hostapd/wpa_psk.

Now create a backup of hostapd's main configuration file, /etc/hostapd/hostapd.conf, and keep it as a reference by running mv /etc/hostapd/hostapd.conf /etc/hostapd/hostapd.conf.orig. Create a new hostapd.conf file and paste the following lines into it:

interface=ath0
bridge=br0
driver=madwifi
logger_syslog=-1
logger_syslog_level=2
logger_stdout=-1
logger_stdout_level=2
debug=0
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
ssid=My_Secure_WLAN
#macaddr_acl=1
#accept_mac_file=/etc/hostapd/accept
auth_algs=3
eapol_key_index_workaround=0
eap_server=0
wpa=3
wpa_psk_file=/etc/hostapd/wpa_psk
wpa_key_mgmt=WPA-PSK
wpa_pairwise=CCMP
stakey=0

Replace the parts in italics with information that matches your setup. If you want to allow only specific clients to connect, remove the # character from the two lines above and copy the MAC addresses of those clients to /etc/hostapd/accept, and make this file accessible only by root (chmod 600). For more information about the options used, read the comments in the backup file you created previously (hostapd.conf.orig).

Start the hostapd daemon (/etc/init.d/hostapd start) and check /var/log/daemon.log to verify that it works. If the daemon does not come up, increase the debug level (option debug= in hostapd.conf) to 4 and try again.

Now if you scan for available wireless networks from a client, you should see your ESSID. To connect to the WAP from a Linux client, you need to install wpa_supplicant and create a configuration file, wpa_supplicant.conf (in Debian, installed in /etc/wpa_supplicant/) like the following:

update_config=1
ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
eapol_version=1
ap_scan=1
fast_reauth=1

network={
        ssid="My_Secure_WLAN"
        proto=RSN
        key_mgmt=WPA-PSK
        pairwise=CCMP
        group=CCMP
        psk="PASSPHRASE"
        priority=5
}

Again replace the parts in italics to match your setup and run wpa_supplicant -i eth1 -D wext -c /etc/wpa_supplicant/wpa_supplicant.conf (replacing eth1 with your wlan interface name and wext with the appropriate driver for your card; run wpa_supplicant without any options for more information). This command starts wpa_supplicant in the foreground and tries to connect to the WAP. If the output looks like the following, you're all set:

Trying to associate with 00:11:22:33:44:55 (SSID='My_Secure_WLAN' freq=0 MHz)
Associated with 00:11:22:33:44:55
WPA: Key negotiation completed with 00:11:22:33:44:55 [PTK=CCMP GTK=CCMP]
CTRL-EVENT-CONNECTED - Connection to 00:11:22:33:44:55 completed (auth) [id=0 id_str=]

Give a static IP address to your wireless interface (or run a DHCP client) and try to ping a host inside your LAN to verify that the connection works.

Congratulations, you've just built yourself a highly customizable wireless access point. Although this setup is ideal for home or small office usage, you need something more robust in the enterprise, with authentication with a RADIUS server, or even better, a VPN.


How to access a shared folder in VirtualBox? I followed the steps for sharing folders between Windows 7 and Ubuntu in VirtualBox.

Despite that the folder appears with a X sign and gives me the following message when a try to open it:

  The folder content could not be displayed

When I choose Shared Folder from the VirtualBox Device menu, the following warning is displayed:

  On the system page, you have assigned more than 50% of your computer's memory (2.93 GB) to the virtual machine...

How can I successfully share folders between Windows and Ubuntu using VirtualBox?

Access to shared folders in Virtual Box
Command line
By default, VirtualBox shared folders are created with read/write permission for the guest. This can be done from the command line on the host with:
VBoxManage sharedfolder add "VM name" --name sharename --hostpath "C:\test"

By adding the option --readonly we can restrict these for read-only access. Use the --transient option if you only want the shares to appear in the present session but not persistent for following sessions. There are some limitations for shared folders (see this question for details). If prerequisites are met we may mount these shared folders manually by running the following commands in the guest:
mkdir /home/<user>/vboxshare
sudo mount -t vboxsf -o uid=1000,gid=1000 sharename /home/<user>/vboxshare

Of course, we can also use different mount options to mount as read/only or mount with read access only to root.
Auto-Mount through Virtual Box Manager
In case we enabled auto-mounting on creating a shared folder from the Virtual Box Manager those shared folders will automatically be mounted in the guest with mount point /media/sf_<name_of_folder>. To have access to these folders users in the guest need to be a member of the group vboxsf.
sudo usermod -aG vboxsf userName

The guest will need to restart to have the  new group added.
Source and further reading: Virtual Box User Manual

Late to the party, but here is the solution that worked well for me:

Make sure that you have Guest Additions installed

And all the necessary packages: linux-headers, build-essential, gcc, make...

Add Shared folder

In VirtualBox Manager select your Virtual Machine (VM)
Settings >> Shared Folders >> Add new shared folder
Folder path: path to the folder to be shared with your VM
Folder name: name of the shared folder to be displayed in your VM
Tick the Auto-mount option, so that it automatically mounts the folder on VM startup

After adding a shared folder, your folder appears in your VM as sf_<folder_name>

Problem is that you cannot access it unless you are logged in as root user

Give permissions to the shared folder. Open terminal (Ctrl+Alt+T) and enter these commands:
sudo usermod -a -G vboxsf <username>
sudo chown -R <username>:users /media/sf_<folder_name>

where <username> - your user name, <folder_name> - shared folder name
What these commands do is:

adds a user to vboxsf group
changes the ownership of the shared folder (it's all files and subdirectories) to the user

Restart your VM


What is "umask" and how does it work? I believe that umask is something that controls file permissions, but do not fully understand it.

After running umask 0644 in a terminal, I cannot read the files I create with the command-line text editor nano. I noticed that the permissions of that file are set to 0022 instead of the default 0755.

How does umask work? I thought I could just remove the each digit in the umask from 0777, 7 - 6 = 1 and 7 - 4 = 3, so I expect the permissions to be 0133, but apparently, this is not the case.

What is umask exactly? Explain it to me like I was a "Linux noob"
How do I calculate with umask?
What are use cases for umask?

The umask acts as a set of permissions that applications cannot set on files. It's a file mode creation mask for processes and cannot be set for directories itself. Most applications would not create files with execute permissions set, so they would have a default of 666, which is then modified by the umask.

As you have set the umask to remove the read/write bits for the owner and the read bits for others, a default such as 777 in applications would result in the file permissions being 133. This would mean that you (and others) could execute the file, and others would be able to write to it.

If you want to make files not be read/write/execute by anyone but the owner, you should use a umask like 077 to turn off those permissions for the group & others.

In contrast, a umask of 000 will make newly created directories readable, writable and descendible for everyone (the permissions will be 777). Such a umask is highly insecure and you should never set the umask to 000.

The default umask on Ubuntu was 022 which means that newly created files are readable by everyone, but only writable by the owner:

user@computer:~$ touch new-file-name
user@computer:~$ ls -dl new-file-name
-rw-r--r-- 1 user user 0 Apr  1 19:15 new-file-name

Starting in Ubuntu Oneiric (11.10) the default umask was relaxed to 002, which expands write-access to the owner's group:

user@computer:~$ touch new-file-name
user@computer:~$ ls -dl new-file-name
-rw-rw-r-- 1 user user 0 Apr  1 19:15 new-file-name

Viewing and modifying umask

To view your current umask setting, open a terminal and run the command:

umask

To change the umask setting of the current shell to something else, say 077, run:

umask 077

To test whether this setting works or not, you can create a new file (file permissions of an existing file won't be affected) and show information about the file, run:

user@computer:~$ touch new-file-name
user@computer:~$ ls -dl new-file-name
-rw------- 1 user user 0 Apr  1 19:14 new-file-name

The umask setting is inherited by processes started from the same shell. For example, start the text editor GEdit by executing gedit in the terminal and save a file using gedit. You'll notice that the newly created file is affected by the same umask setting as in the terminal.

Use case: multi-user system

If you are on a system that's shared by multiple users, it's desired that others cannot read files in your home directory. For that, a umask is very useful. Edit ~/.profile and add a new line with:

umask 007

You need to re-login for this umask change in ~/.profile to take effect. Next, you need to change existing file permissions of files in your home directory by removing the read, write and execute bit for the world. Open a terminal and execute:

chmod -R o-rwx ~

If you want this umask setting be applied to all users on the system, you could edit the system-wide profile file at /etc/profile.

Basic concept:

If you are like most humans and don't understand what the heck "octal umasks are calculated via the bitwise AND of the unary complement of the argument using bitwise NOT" means, here's my simple explanation:

First of all, think about what a "mask" is. A mask blocks something. Think of masking tape. In this case, umask is like masking tape to block/disable permissions when creating a new file or dir.

The default permissions when creating a new dir is octal 777 (111 111 111), and a new file is octal 666 (110 110 110). We set the umask to block/disable certain permissions.

A mask bit of 1 means to block/disable that permission (put masking tape over that bit).
A mask bit of 0 will allow the permission to pass through (no masking tape over that bit).

So an octal 022 (000 010 010) mask means to disable group write and others write, and allow all other permissions to pass through.

Calculation:

Here is an example calculation for a new file (default 666 permission) with a 022 umask:

  perm mask result
----------------------------
u 1    0    1 (pass through)
  1    0    1 (pass through)
  0    0    0 (pass through)
----------------------------
g 1    0    1 (pass through)
  1    1    0 (disable)
  0    0    0 (pass through)
----------------------------
o 1    0    1 (pass through)
  1    1    0 (disable)
  0    0    0 (pass through)

So that's how you end up with the result of 644 when you create a new file.

Easier way:

But if inverse mask calculations just confuse you, there is an easier way using symbolic umask notation. When you use this method, then you are just specifying the pass-through bits instead of the mask bits.

umask u=rwx,g=rx,o=rx means allow pass through for user rwx, group rx, other rx. Which implies disable group w, others w. If you run this command then check umask, you will get 022.
umask u=rwx,g=,o= means allow pass through for user rwx. Which implies disable all access for group and others. If you run this command then check umask, you will get 077.

Bonus calculation:

If you actually want to understand what "octal umasks are calculated via the bitwise AND of the unary complement of the argument using bitwise NOT" means, here's some logic tables that can help demonstrate. Remember, a mask bit 1 means disable, 0 means pass through.

perm mask result
----------------
0    1    0     (mask 1 always disables)
1    1    0     (mask 1 always disables)
0    0    0     (mask 0 passes through)
1    0    1     (mask 0 passes through)

If you make the table with NOT(mask), now it's just a simple AND logic table!

perm NOT(mask) result
---------------------
0    0         0     (mask 1 always disables)
1    0         0     (mask 1 always disables)
0    1         0     (mask 0 passes through)
1    1         1     (mask 0 passes through)

So the formula for it is: result = perm AND (NOT mask)


[Manual shortcut]Bad interpreter I downloaded 64-bit(it's compatible with my system etc.) Sublime Text from their official website,extracted tar file and opened new folder.There wasn't install file but executable did.I created symbolic link() to /usr/bin by typing following line in terminal:
sudo ln -s [path of original] /usr/bin/stext  (here stext is my arbitrary name for link).
 Everything works ok(I checked this executable works fine), but after I created desktop shortcut manually(via text editor) and allowed execution by typing:

sudo chmod +x Sublime Text Editor.desktop

I had following problem:
(I also tried this with sudo) ./Subline Text Editor.desktop
it tells me bad interpreter:such file or directory doesn't exists
Now here is what I entered at .desktop file:

#!usr/bin/env xdg-open

[Desktop Entry]
Exec=/usr/bin/stext
Version=1.0
Type=application
Icon=/home/pc/Downloads/sublime_text_3/Icon/256x256/sublime-text.png
Name=Sublime Text Editor
Terminal=false
Categories=Application

Now, maybe I changed order of instructions or what?I assume that problem is (like it says) at the first line: bad interpreter instruction. I know that first line is important to tell program which interpreter should be used, but anyone knows which one is appropriate for this task?

So, I emphasize that editor works, but I wish shortcut on Desktop and to completely figure out how to create it MANUALLY.

You did it wrong.

The correct desktop file Subline_Text_Editor.desktop should contain only last lines:

[Desktop Entry]
Exec=/usr/bin/stext
Version=1.0
Type=Application
Icon=/home/pc/Downloads/sublime_text_3/Icon/256x256/sublime-text.png
Name=Sublime Text Editor
Terminal=false
Categories=Application

There is no need to have header line (#!usr/bin/env xdg-open in your case).

You do not need sudo to make it executable.

Problem fixed!
1)  Instead of Type=application  there should be Type=Application
2)  We can not run .desktop file from terminal.

(.desktop file :line 1: [Desktop: command not found) helped me so much.
@N0rbert That for last lines isn't true, I checked it: Name of .desktop file: "S T E.desktop" (with spaces), name inside code: "Sublime Text Editor"-this worked. But anyway, thank you for help.


Trying to install Ubuntu 16.04 LTS on a Toshiba Satellite laptop with Windows 10 I'm trying to install Ubuntu on my Toshiba Satellite U940-103 laptop. It came with Windows 8 pre-installed and I then upgraded it to Windoes 8.1 and finally Windows 10. I tried mounting the .iso downloaded on this page on two different usb drives using both rufus and UUI but i always got stuck on the third step of this guide. I would choose the first option: "erase disk and install Ubuntu" but I get automatically redirected to the "something else" page from the "second step" and I can't do anything even on this page. I don't care for dual boot. I'd like to completely remove Windows from the computer and install Ubuntu.

I mounted the .iso file on the USB drives on another computer with Windows 7, I don't know if that may be the problem.

Thanks.

Make sure your computer is booting in UEFI mode. Most computers have it set by default, but some come with legacy mode selected. You can check in the BIOS of your computer.
When you get to the menu where you choose what to do, make sure you do choose "Something else". From this menu, delete all the partitions on your hard drive, and make one EXT4 and select the mount point as /
Then click on next. It will tell you that you have not created any swap, but it should be fine, especially if you have a decent amount of RAM. Then just proceed with the installation as normal.


How do I install Chromium from the command line? I have already tried using the Ubuntu Software Center, but it won't install the Chromium browser. How can I install it using the terminal?

You can type in the terminal:

sudo apt-get install chromium-browser

For new users who are just starting out with Ubuntu and want to install Google Chrome browser, here’s the quickest way to do it. There are many ways to install Google Chrome in Ubuntu. Some prefer going directly to Google Chrome download page and getting the deb installer.

Others prefer to install it via PPA from the Chromium build. I prefer downloading it via the command line using wget command and installing it. The command line method is the quickest and this is what this post is about to show you.

As you may already know, Google Chrome has gone from nothing to one of the most popular web browsers. In fact, it’s my favorite web browser.  I started with Internet Explorer, then moved to Firefox and I've finally switched to Google Chrome.

I am not telling you to switch, but if you want Chrome in Ubuntu, then go and get it.

To get started with Chrome, you have few options. First you can use Firefox and go to Chrome download page and download a copy there. If you’re not comfortable with using the command line, you may want to use this method.

For users who are comfortable using the command line console, use the commands below to download Google Chrome.

cd /tmp

The 64-bit version can be downloaded using this link.

wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb

Google Chrome no longer supports 32-bit.

After downloading it, run the commands below to install it.

sudo dpkg -i google-chrome-stable_current_amd64.deb; sudo apt-get -f install

That's it! After installing, go to Unity Dash and search for Chrome and launch it.

Enjoy!


17.10 printscreen snipping tool In previous versions (with unity) I could do Shift+PrtScr and copy the partial screenshot into clipboard without saving to file first.

Is there a way to enable a similar functionality in 17.10?

Also, can I make it ask for saving location instead of saving always into ~/pictures?

You can check it out from Settings:

Device > keyboard > keyboard shortcuts > screenshots

You can copy it to clipboard without saving using Ctrl+Alt+PrtScr

Try Spectacle   It works....

  Spectacle Spectacle is a simple application for capturing desktop
  screenshots. It can capture images of the entire desktop, a single
  monitor, the currently active window, the window currently under the
  mouse, or a rectangular region of the screen. The images can then be
  printed, sent to other applications for manipulation, or quickly be
  saved as-is.

See image


Bluetooth headset with poor sound quality on Ubuntu I've bought a Philips SHB4000 headset (phone+mic) wireless (bluetooth) and It has a good quality when I pair it with my phone or PC Windows but when I pair it with the same PC on Ubuntu (14.10 64 bits) the sound quality goes down.

I've been googling about but I haven't found any convincing answer.

Tks in advance!
....

Solution: Go into sound settings, then see what the SHB4000 is using. If it uses HSP/HFP change to A2DP.

I am running Ubuntu 16.04 and experienced the same problem with my JBL E65BTNC headphones where changing to A2DP didn't stick. I used most of @56ka's answer but I didn't need the part where you need to set:

MultiProfile = multiple

In fact, when I did this, neither A2DP nor HSP/HFP was available. The device was listed as an output device but the sound did not come through (i.e. when I tried to test the device in Sound Settings, nothing happened). When I commented the MultiProfile option out and restarted the bluetooth service, everything worked.


Ubuntu 20.04.2 LTS won’t boot on Raspberry Pi 4 So I’ve recently bought a Raspberry Pi 4 model B with 4Gb of RAM. I used the raspberry Imager to install Ubuntu server 20.04.2 LTS on my 64GB SD card. When I plug the power in, nothing happens I just get a constant red light and nothing on my screen. I’ve tried re-installing Ubuntu but it didn’t change anything. Please help.

I was just able to get the 32 bit version to work using this article:
https://linuxhint.com/install-ubuntu-desktop-20-04-lts-on-raspberry-pi-4/
Instead of creating the wpa_supplicant file I updated using Ethernet.


Does using 2 OSs affect CPU speed? I have windows 7 already installed on my laptop and I would like to know if installing ubuntu as well would affect my processor's speed. Here are the specs for the processor: http://ark.intel.com/products/53442/Intel-Core-i3-2370M-Processor-(3M-Cache-2_40-GHz). The laptop came with 4GB of memory and a 500GB HD.

No. You will only be able to run one OS at the time... Your CPU will be just fine. I'm currently dual booting my Centrino dual- core with no problems at all.

This all only counts if your not using VMWare or other Virtual machines... Running two OSs with the second OS running in a VM will certainly affect your CPU speed...

The only way for your CPU speed to change is if you are use software to overclock your processor in widows, but you appear to be using a laptop, so you can't overclock  anyway, there can be a minor impact on hard drive performance


Error message "sudo: unable to resolve host (none)" When I run sudo the terminal is stuck for a few seconds and then outputs an error message. My terminal looks like this:

ubuntu@(none):~$ sudo true
sudo: unable to resolve host (none)

What can I do to solve it?

Two things to check (assuming your machine is called my-machine, you can change this as appropriate):

That the /etc/hostname file contains just the name of the machine.
That /etc/hosts has an entry for localhost. It should have something like:

 127.0.0.1    localhost.localdomain localhost
 127.0.1.1    my-machine

If either of these files aren't correct (since you can't sudo), you may have to reboot the machine into recovery mode and make the modifications, then reboot to your usual environment.

I had the same problem. I solved it by editing the /etc/hosts and /etc/hostname files... on the /etc/hosts file, just edit the top part as shown below.

#vi /etc/hosts
    127.0.0.1   localhost
    127.0.1.1   localhost  myhostname

#vi /etc/hostname
    myhostname


VLC is set to open the folders (Home, desktop, documents etc) in the Places menu. How to reset this? So I downloaded something with Kget and somehow set all the folders in the Places menu to open in VLC rather than in the default file manager. How do I clear this?

You are probably seeing this bug. You need to open Nautilus, right click on a folder, and go to the Open With Other Application... in the right click menu and set it back to File Browser

Don't forget to make sure the checkbox for "Remember this application for folder files" is checked!

Try to reset VLC settings, press Alt+F2 on your keyboard and execute the vlc --reset-config command.


File format problem, libreoffice writer is odt format, but i need .pdf, .doc, .docx, .rtf and .txt files format i need writer formats .pdf, .doc, .docx, .rtf and .txt files only. But in ubuntu 14.04 there is Libreoffice writer that comes with ODT format. So, I am not able to upload my resume in ODT format on online portal likes:- shine.com, Naukri.com, etc.

Need file format .pdf, .doc, .docx, .rtf and .txt files only to
upload resume

On online portal they do not accept documents in ODT format by libraoffice writer, so i am looking for word writer which comes with .pdf, .doc, .docx, .rtf and .txt files format.

Open the ODT file, you can then go to File > Save As (or 'Save as copy'), you can save to those formats and others:

You can also use 'Export to' and 'Export to PDF' to export to PDF and other formats.

For more information, you can use Help > 'libreoffice help' (or just press F1) - or use the online help (e.g. Save As, Export, Export PDF)

You can also use a command in terminal or a script to convert documents with libreoffice:

libreoffice --headless --convert-to <FORMAT> /<path>/<to>/<file>

where

libreoffice is the command for libreoffice (or probably libreoffice writer in this case) - this probably could be libreoffice4.2, libreoffice-writer, or soffice depending on how libreoffice was installed
--headless means it won't launch the libreoffice GUI.
--convert-to <FORMAT> - where <FORMAT> is the format you want to convert to, like pdf, docx etc
/<path>/<to>/<file> - file to convert - e.g. ~/Desktop/Untitled\ 1.odt or "/home/wilf/Desktop/Untitled 1.odt".

For more info on this run libreoffice --help or man libreoffice.

You could use office online, a service Microsoft provides. You can use word, excel etc.

Microsoft Office Online

You will need a Microsoft account

how to set up a Microsoft account