Saturday, April 28, 2018

Detect and mount devices

129 down vote
Solution 1: Try the Disks program (if you run Ubuntu with a GUI).
(check that the gnome-disk-utility package is installed) (make sure that udisk2 package is installed)
Hit SUPERA to open the Application Lens and type Disks in the Search Applications field.
(SUPER is probably the key with the Windows icon.)
In Disks you can play with the automount options.
For example:
Disks Program
You have to click on the little icon with the two gears and choose 'Edit Mount Options'.
Mount Options
Solution 2: Using the CLI (for a headless installation)
Step 1. Check the blockdevices and the file systems that are assigned to those block devices.
lsblk
lsblk
Here you see the blokdevice sdb with partition /sdb1. But it's not mounted. There's no file assigned to it.
Step 2. What kind of device is sdb?
sudo lshw 
or
sudo lshw | less
lshw
So the USB stick - the block device /sdb - has the logical name /dev/sdb. And the FAT32 filesystem on that stick has the logical name /dev/sdb1.
Step 3. Mounting the USB-stick
We will mount /dev/sdb1 to /media/usbstick
sudo mkdir /media/usbstick

sudo mount -t vfat /dev/sdb1 /media/usbstick 
Read the manpage of mount for other options.
Step 4. Did it work?
lsblk
lsblk 2
Yes, we can see that the filesystem on the USB stick is mounted to /media/usbstick
Addendum : if there are no logical names like /dev/sdb, you should first create them. See this information about setting up and controling loop devices with the losetup command

Sunday, January 7, 2018

How to install a deb file

When you use apt to install a package, internally it uses dpkg. When you install a package using apt, it first creates a list of all the dependencies and downloads it from the repository.
Once the download is finished it calls dpkg to install all those files, satisfying all the dependencies.
So if you have a .deb file:
  • You can install it using sudo dpkg -i /path/to/deb/file followed by sudo apt-get install -f.
  • You can install it using sudo apt install ./name.deb (or /path/to/package/name.deb).
    With old apt-get versions you must first move your deb file to /var/cache/apt/archives/ directory. For both, after executing this command, it will automatically download its dependencies.
  • Install gdebi and open your .deb file using it (Right-click -> Open with). It will install your .deb package with all its dependencies.
    (Note: APT maintains the package index which is a database of available packages available in repo defined in /etc/apt/sources.list file and in the /etc/apt/sources.list.d directory. All these methods will fail to satisfy the software dependency if the dependencies required by the deb is not present in the package index.)

Why to use sudo apt-get install -f after sudo dpkg -i /path/to/deb/file (mentioned in first method). From man apt-get
 -f, --fix-broken
           Fix; attempt to correct a system with broken dependencies in place.
When dpkg install a package and package dependency is not satisfied, it leaves the package in unconfigured state and that package is considered as broken.
sudo apt-get install -f command tries to fix this broken package by installing the missing dependency.

Saturday, January 6, 2018

Installing WineHQ packages on Ubuntu

If you have previously installed a Wine package from another repository, please remove it and any packages that depend on it (e.g., wine-mono, wine-gecko, winetricks) before attempting to install the WineHQ packages, as they may cause dependency conflicts.
If your system is 64 bit, enable 32 bit architecture (if you haven't already):
sudo dpkg --add-architecture i386 
Add the repository:
wget -nc https://dl.winehq.org/wine-builds/Release.key
sudo apt-key add Release.key
sudo apt-add-repository https://dl.winehq.org/wine-builds/ubuntu/
Dialog-warning.svg On Linux Mint 17.x, the last line should be the following:
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ trusty main'
Dialog-warning.svg On Linux Mint 18.x, the last line should be the following:
sudo apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'
Update packages:
sudo apt-get update
Then install one of the following packages:
Stable branch
sudo apt-get install --install-recommends winehq-stable
Development branch
sudo apt-get install --install-recommends winehq-devel
Staging branch
sudo apt-get install --install-recommends winehq-staging
If apt-get complains about missing dependencies, install them, then repeat the last two steps (update and install).

If you have previously used the distro packages, you will notice some differences in the WineHQ ones:
  • Files are installed to /opt/wine-devel.
  • Menu items are not created for Wine's builtin programs (winecfg, etc.), and if you are upgrading from a distro package that had added them, they will be removed. You can recreate them yourself using your menu editor.
  • Binfmt_misc registration is not added. Consult your distro's documentation for update-binfmts if you wish to do this manually.
  • WineHQ does not at present package wine-gecko or wine-mono. When creating a new wine prefix, you will be asked if you want to download those components. For best compatibility, it is recommended to click Yes here. If the download doesn't work for you, please follow the instructions on the Gecko and Mono wiki pages to install them manually.

Installing without Internet

To install Wine on an Ubuntu machine without internet access, you must have access to a second Ubuntu machine (or VM) with an internet connection to download the Wine .deb package and its dependencies.
The procedure goes like this: On the machine with internet, add the WineHQ PPA, then cache just the necessary packages without actually extracting them:
sudo add-apt-repository ppa:wine/wine-builds
sudo apt-get update
Then cache just the packages necessary for installing wine, without extracting them:
sudo apt-get clean
sudo apt-get --download-only install winehq-devel
sudo apt-get --download-only dist-upgrade
Copy all of the .deb files in /var/cache/apt/archives to a USB stick:
cp -R /var/cache/apt/archives/ /media/usb-drive/deb-pkgs/
Finally, on the machine without internet, install all of the packages from the flash drive:
cd /media/usb-drive/deb-pkgs
sudo dpkg -i *.deb
The same instructions can also be used for an offline installation of the `winehq-staging` packages.

Compiling WoW64

Ubuntu's implementation of Multiarch is still incomplete, so for now you can't simply install 32-bit and 64-bit libraries alongside each other. If you're on a 64-bit system, you'll have to create an isolated environment for installing and building with 32-bit dependencies. See Building Biarch Wine On Ubuntu for detailed instructions for Ubuntu using LXC, and Building Wine for general information.


Nhuoc diem cua cac repo cua Ubuntu

Tai qua cham
Giai phap:
add them repo khac ma tai phan mem

Google in Linux Mint

Why isn't Google included by default in Linux Mint?

Amongst commercial search engines, only the ones which share with Linux Mint the revenue Linux Mint users generate for them are included by default.

How can I add Google to Linux Mint?

Click here to add Google to your search engines.

Will Google be included by default in future releases of Linux Mint?

Yes, eventually all search engines will share the revenue our users generate for them and be included by default in Linux Mint. The process just takes time.

Sunday, November 5, 2017

APT (Debian)

The Advanced Package Tool, or APT, is a free software user interface that works with core libraries to handle the installation and removal of software on the Debian, Slackware and other Linux distributions.[3] APT simplifies the process of managing software on Unix-like computer systems by automating the retrieval, configuration and installation of software packages, either from precompiled files or by compiling source code.[3]
APT was originally designed as a front-end for dpkg to work with Debian's .deb packages, but it has since been modified to also work with the RPM Package Manager system via APT-RPM.[4] The Fink project has ported APT to Mac OS X for some of its own package management tasks,[5] and APT is also available in OpenSolaris.

Contents

Usage

There has been an apt program since version 1.0; apt is a collection of tools distributed in a package named apt. A significant part of apt is defined in a C++ library of functions; apt also includes command-line programs for dealing with packages, which use the library. Three such programs are apt, apt-get and apt-cache. They are commonly used in examples of apt because they are simple and ubiquitous. The apt package is of "important" priority in all current Debian releases, and is therefore installed in a default Debian installation. Apt can be considered a front-end to dpkg, friendlier than the older dselect front-end. While dpkg performs actions on individual packages, apt tools manage relations (especially dependencies) between them, as well as sourcing and management of higher-level versioning decisions (release tracking and version pinning).
APT is often hailed as one of Debian's best features,[6][7][8][9] which Debian developers attribute to the strict quality controls in Debian's policy.[10][11]
A major feature in APT is the way it calls dpkg — it does topological sorting of the list of packages to be installed or removed and calls dpkg in the best possible sequence. In some cases, it utilizes the --force options in dpkg. However, it only does this when it is unable to calculate how to avoid the reason dpkg requires the action to be forced.

Installing software

The user indicates one or more packages to be installed. Each package name is phrased as just the name portion of the package, not a fully qualified filename (for instance, in a Debian system, libc6 would be the argument provided, not libc6_1.9.6-2.deb). Notably, apt automatically gets and installs packages upon which the indicated package depends (if necessary). This was an original distinguishing characteristic of apt-based package management systems, as it avoided installation failure due to missing dependencies, a type of dependency hell.
Another such distinction is remote repository retrieval of packages. apt uses location configuration file (/etc/apt/sources.list) to locate the desired packages, which might be available on the network or a removable storage medium, for example, and retrieve them, and also obtain information about available (but not installed) packages.
apt provides other command options to override decisions made by apt-get's conflict resolution system. One option is to force a particular version of a package. This can downgrade a package and render dependent software inoperable, so the user must be careful.
Finally, the apt_preferences mechanism allows the user to create an alternative installation policy for individual packages.
The user can specify packages by POSIX regular expression.

apt-get

apt-get is the command line package management tool supplied with the Debian package apt. APT searches its cached list of packages and lists the dependencies that must be installed or updated.
Triggers are the treatment of deferred actions.
APT retrieves, configures and installs the dependencies automatically.

Update, upgrade and dist-upgrade

Other commands used in apt-get:
  • update is used to resynchronize the package index files from their sources. The lists of available packages are fetched from the location(s) specified in /etc/apt/sources.list. For example, when using a Debian archive, this command retrieves and scans the Packages.gz files, so that information about new and updated packages is available.
  • upgrade is used to install the newest versions of all packages currently installed on the system from the sources enumerated in /etc/apt/sources.list. Packages currently installed with new versions available are retrieved and upgraded; under no circumstances are currently installed packages removed, or packages not already installed retrieved and installed. New versions of currently installed packages that cannot be upgraded without changing the install status of another package will be left at their current version.
  • dist-upgrade, in addition to performing the function of upgrade, also intelligently handles changing dependencies with new versions of packages; apt-get has a "smart" conflict resolution system, and it will attempt to upgrade the most important packages at the expense of less important ones if necessary. The /etc/apt/sources.list file contains a list of locations from which to retrieve desired package files.[12] aptitude has a smarter dist-upgrade feature called full-upgrade.[13]

apt-file

apt-file is a command to find which package includes a specific file, or to list all files included in a package. It is packaged separately from the main APT utilities.
Example to find a package:
$ apt-file update         # Fetch the files installed by the packages in local cache

$ apt-file find vmlinuz   # Find all packages providing a filename vmlinuz
linux-image-4.8.0-17-generic: /boot/vmlinuz-4.8.0-17-generic
linux-image-4.8.0-17-lowlatency: /boot/vmlinuz-4.8.0-17-lowlatency
linux-image-4.8.0-19-generic: /boot/vmlinuz-4.8.0-19-generic
linux-image-4.8.0-19-lowlatency: /boot/vmlinuz-4.8.0-19-lowlatency
linux-signed-image-4.8.0-17-generic: /usr/lib/linux/vmlinuz-4.8.0-17-generic.efi.signature
linux-signed-image-4.8.0-17-lowlatency: /usr/lib/linux/vmlinuz-4.8.0-17-lowlatency.efi.signature
linux-signed-image-4.8.0-19-generic: /usr/lib/linux/vmlinuz-4.8.0-19-generic.efi.signature
linux-signed-image-4.8.0-19-lowlatency: /usr/lib/linux/vmlinuz-4.8.0-19-lowlatency.efi.signature
ltsp-client-core: /usr/share/ltsp/cleanup.d/50-vmlinuz
needrestart: /usr/lib/needrestart/vmlinuz-get-version

$ apt-file find /boot/vmlinuz-4.8.0-17-generic  # Find also from a full path
linux-image-4.8.0-17-generic: /boot/vmlinuz-4.8.0-17-generic

$ dpkg -S vmlinuz                               # dpkg is an alternative listing less packages
linux-image-4.8.0-16-generic: /boot/vmlinuz-4.8.0-16-generic
linux-image-4.8.0-17-generic: /boot/vmlinuz-4.8.0-17-generic
linux-image-4.8.0-11-generic: /boot/vmlinuz-4.8.0-11-generic
linux-image-4.4.0-9136-generic: /boot/vmlinuz-4.4.0-9136-generic
linux-image-4.8.0-19-generic: /boot/vmlinuz-4.8.0-19-generic

Configuration and files

/etc/apt has the apt configuration folders and files.
apt-config is the APT Configuration Query program.[14] apt-config dump shows the configuration.[15]

Files

  • /etc/apt/sources.list: Locations to fetch packages from.
  • /etc/apt/sources.list.d/: Additional source list fragments.
  • /etc/apt/apt.conf: APT configuration file.
  • /etc/apt/apt.conf.d/: APT configuration file fragments.
  • /etc/apt/preferences: version preferences file. This is where you would specify "pinning", i.e. a preference to get certain packages from a separate source or from a different version of a distribution.
  • /var/cache/apt/archives/: storage area for retrieved package files.
  • /var/cache/apt/archives/partial/: storage area for package files in transit.
  • /var/lib/apt/lists/: storage area for state information for each package resource specified in sources.list
  • /var/lib/apt/lists/partial/: storage area for state information in transit.

Sources

APT relies on the concept of repositories in order to find software and resolve dependencies. For apt, a repository is a directory containing packages along with an index file. This can be specified as a networked or CDROM location. The Debian project keeps a central repository of over 25,000 software packages ready for download and installation.
Any number of additional repositories can be added to APT's sources.list configuration file (/etc/apt/sources.list) and then be queried by APT. Graphical front-ends often allow modifying sources.list more simply (apt-setup). Once a package repository has been specified (like during the system installation), packages in that repository can be installed without specifying a source and will be kept up-to-date automatically.
In addition to network repositories, compact discs and other storage media (USB keydrive, hard disks...) can be used as well, using apt-cdrom[16] or adding file:/[17] to the source list file. Apt-cdrom can specify a different folder than a cd-rom, using the -d option (i.e. a hard disk or a USB keydrive). The Debian CDs available for download contain Debian repositories. This allows non-networked machines to be upgraded. Also one can use apt-zip.
Problems may appear when several sources offer the same package(s). Systems that have such possibly conflicting sources can use APT pinning to control which sources should be preferred.

APT pinning

The APT pinning feature allows administrators to force APT to choose particular versions of packages which may be available in different versions from different repositories. This allows administrators to ensure that packages are not upgraded to versions which may conflict with other packages on the system, or that have not been sufficiently tested for unwelcome changes.
In order to do this, the pins in APT's preferences file (/etc/apt/preferences) must be modified,[18] although graphical front-ends often make pinning simpler.

Front-ends

Synaptic Package Manager is one of the front-ends available for APT
Several other front-ends to APT exist, which provide more advanced installation functions and more intuitive interfaces. These include:
APT front-ends can:
  • Search for new packages.
  • Upgrade packages.
  • Install or remove packages.
  • Upgrade the whole system to a new release.
APT front-ends can list the dependencies of packages being installed or upgraded, ask the administrator if packages recommended or suggested by newly installed packages should be installed too, automatically install dependencies and perform other operations on the system such as removing obsolete files and packages.

History

The original effort that led to the apt-get program was the dselect replacement project known by its codename deity.[24] This project was commissioned by Brian White, the Debian Release Manager at the time. The very first functional version of apt-get was called dpkg-get and was only intended to be a test program for the core library functions that would underpin the new UI.[25]
Much of the original development of APT was done on IRC, so records have been lost. The 'Deity Creation Team' mailing list archives include only the major highlights.
The Deity name was abandoned as the official name for the project due to concerns over the religious nature of the name. The APT name was eventually decided after considerable internal and public discussion. Ultimately the name was proposed on IRC, accepted and then finalized on the mailing lists.[26]
APT was introduced in 1998 and original test builds were circulated on IRC. The first Debian version that included it was Debian 2.1, released on 9 March 1999.[27]
In the end the original goal of the Deity project of replacing the dselect user interface (UI) was a failure. Work on the UI portion of the project was abandoned (the UI directories were removed from the CVS system) after the first public release of apt-get. The response to APT as a dselect method and a command line utility was so great and positive that all development efforts focused on maintaining and improving the tool. It was not until much later that several independent people built UIs on top of libapt-pkg.
Eventually, a new team picked up the project, began to build new features and released version 0.6 of APT which introduced the Secure APT feature, using strong cryptographic signing to authenticate the package repositories.[28]

dpkg

dpkg is the software at the base of the package management system in the free operating system Debian and its numerous derivatives. dpkg is used to install, remove, and provide information about .deb packages.
dpkg (Debian Package) itself is a low level tool. APT (Advanced Packaging Tool), a higher level tool, is more commonly used than dpkg as it can fetch packages from remote locations and deal with complex package relations, such as dependency resolution. Frontends for APT like aptitude (ncurses) and synaptic (GTK+) are used for their friendlier interfaces.
The Debian package "dpkg" provides the dpkg program, as well as several other programs necessary for run-time functioning of the packaging system, including dpkg-deb, dpkg-split, dpkg-query, dpkg-statoverride, dpkg-divert and dpkg-trigger.[5] It also includes the programs such as update-alternatives and start-stop-daemon. The install-info program used to be included as well, but was later removed[6] as it is now developed and distributed separately.[7] The Debian package "dpkg-dev" includes the numerous build tools described below.

Contents

History

dpkg was originally created by Ian Murdock in January of 1994 as a Shell script,[1] Matt Welsh, Carl Streeter and Ian Murdock then rewrote it in Perl,[8] and then later the main part was rewritten in C by Ian Jackson in 1994.[9][10] The name dpkg was originally the short for "Debian package", but the meaning of that phrase has evolved significantly, as dpkg the software is orthogonal to the deb package format as well as the Debian Policy Manual which defines how Debian packages behave in Debian.

Example use

To install a .deb package:
dpkg -i filename.deb
where filename.deb is the name of the Debian package (such as pkgname_0.00-1_amd64.deb).
The list of installed packages can be obtained with:
dpkg -l [optional pattern]
To remove an installed package:
dpkg -r packagename

Development tools

dpkg-dev contains a series of development tools required to unpack, build and upload Debian source packages.[11] These include:
  • dpkg-source packs and unpacks the source files of a Debian package.
  • dpkg-gencontrol reads the information from an unpacked Debian tree source and generates a binary package control package, creating an entry for this in Debian/files.
  • dpkg-shlibdeps calculates the dependencies of runs with respect to libraries.
  • dpkg-genchanges reads the information from an unpacked Debian tree source that once constructed creates a control file (.changes).
  • dpkg-buildpackage is a control script that can be used to construct the package automatically.
  • dpkg-distaddfile adds a file input to debian/files.
  • dpkg-parsechangelog reads the changes file (changelog) of an unpacked Debian tree source and creates a conveniently prepared output with the information for those changes.

Database

The dpkg database is located under /var/lib/dpkg; the "status" file contains the list of installed software on the current system. There is no information about repositories in this database.[12]