Saturday, December 19, 2015

Fixing a Broken yaourt and pacman on Arch linux, building package


My Arch system was not updated for quiet a while, the package manager was giving me trouble and failing.

Then i proceeded to recompile my yaourt package installer from scratch.
Here's how I went about my  job..

Note: Do not elevate to root user

wiz@Arch-DOC:~$ git clone https://aur.archlinux.org/yaourt.git
Cloning into 'yaourt'...
remote: Counting objects: 22, done.
remote: Compressing objects: 100% (19/19), done.
remote: Total 22 (delta 8), reused 17 (delta 3)
Unpacking objects: 100% (22/22), done.
Checking connectivity... done.
wiz@Arch-DOC:~$ cd yaourt/
wiz@Arch-DOC:~/yaourt$ ls
PKGBUILD
wiz@Arch-DOC:~/yaourt$ pwd
/home/wiz/yaourt


Now go on to building the package:

See some output for yourself..

wiz@Arch-DOC:~/yaourt$ makepkg -si
==> Making package: yaourt 1.8.1-1 (Sun Apr  3 18:27:56 IST 2016)
==> Checking runtime dependencies...
==> Checking buildtime dependencies...
==> Retrieving sources...
  -> Downloading yaourt-1.8.1.tar.xz...
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   595    0   595    0     0    553      0 --:--:--  0:00:01 --:--:--   554
100  102k  100  102k    0     0  29670      0  0:00:03  0:00:03 --:--:-- 47559
==> Validating source files with sha256sums...
    yaourt-1.8.1.tar.xz ... Passed
==> Extracting sources...
  -> Extracting yaourt-1.8.1.tar.xz with bsdtar
==> Starting build()...
    GEN yaourt.sh
    GEN pacdiffviewer.sh
    GEN yaourtrc
    GEN lib/util.sh
    GEN lib/pkgbuild.sh
    GEN lib/pacman.sh
    GEN lib/abs.sh
==> Entering fakeroot environment...
==> Starting package()...
/usr/bin/env install -d /home/wiz/yaourt/pkg/yaourt/usr/bin
/usr/bin/env install -d /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -d /home/wiz/yaourt/pkg/yaourt/etc
/usr/bin/env install -d /home/wiz/yaourt/pkg/yaourt/usr/share/bash-completion/completions
/usr/bin/env install -d /home/wiz/yaourt/pkg/yaourt/usr/share/man/man{5,8}
# Scripts
/usr/bin/env install -m755 yaourt.sh /home/wiz/yaourt/pkg/yaourt/usr/bin/yaourt
/usr/bin/env install -m755 pacdiffviewer.sh /home/wiz/yaourt/pkg/yaourt/usr/bin/pacdiffviewer
# Configuration
/usr/bin/env install -m644 yaourtrc /home/wiz/yaourt/pkg/yaourt/etc/yaourtrc
/usr/bin/env install -m644 bashcompletion /home/wiz/yaourt/pkg/yaourt/usr/share/bash-completion/completions/yaourt
# Libs
/usr/bin/env install -m644 lib/alpm_backup.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/alpm_query.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/alpm_stats.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/abs.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/aur.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/util.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/io.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/pacman.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/pkgbuild.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
/usr/bin/env install -m644 lib/misc.sh /home/wiz/yaourt/pkg/yaourt/usr/lib/yaourt
# Man
/usr/bin/env install -m644 man/*.5 /home/wiz/yaourt/pkg/yaourt/usr/share/man/man5
/usr/bin/env install -m644 man/*.8 /home/wiz/yaourt/pkg/yaourt/usr/share/man/man8
# Locales
test -x /usr/bin/msgfmt && for file in po/*/*.po; \
do \
  package=$(echo $file | /bin/sed -e 's#po/\([^/]\+\).*#\1#'); \
  lang=$(echo $file | /bin/sed -e 's#.*/\([^/]\+\).po#\1#'); \
  /usr/bin/env install -d /home/wiz/yaourt/pkg/yaourt/usr/share/locale/$lang/LC_MESSAGES; \
  /usr/bin/msgfmt -o /home/wiz/yaourt/pkg/yaourt/usr/share/locale/$lang/LC_MESSAGES/$package.mo $file; \
done
==> Tidying install...
  -> Removing libtool files...
  -> Purging unwanted files...
  -> Removing static library files...
  -> Stripping unneeded symbols from binaries and libraries...
  -> Compressing man and info pages...
==> Checking for packaging issue...
==> Creating package "yaourt"...
  -> Generating .PKGINFO file...
  -> Generating .BUILDINFO file...
  -> Generating .MTREE file...
  -> Compressing package...
==> Leaving fakeroot environment.
==> Finished making: yaourt 1.8.1-1 (Sun Apr  3 18:28:02 IST 2016)
==> Installing package yaourt with pacman -U...
loading packages...
resolving dependencies...
looking for conflicting packages...

Packages (1) yaourt-1.8.1-1

Total Installed Size:  0.77 MiB
Net Upgrade Size:      0.45 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                                 [########################################################] 100%
(1/1) checking package integrity                                                               [########################################################] 100%
(1/1) loading package files                                                                    [########################################################] 100%
(1/1) checking for file conflicts                                                              [########################################################] 100%
(1/1) checking available disk space                                                            [########################################################] 100%
:: Processing package changes...
(1/1) upgrading yaourt                                                                         [########################################################] 100%

Now we have a fully rebuilt yaourt installer. lets try to take the system for a Up sync ride now, will be now exiting out of the sourcecode directory.

wiz@Arch-DOC:~/yaourt$ cd ..


Now the time to upgrade the system, get yourself a cup of your favorite drink and chill out while the system syncs upto date.

Its working this time around.. Fancy some output for yourself..

wiz@Arch-DOC:~$ sudo pacman -Syyu
:: Synchronizing package databases...
 core                                                                 121.2 KiB   122K/s 00:01 [########################################################] 100%
 extra                                                               1743.3 KiB   124K/s 00:14 [########################################################] 100%
 community                                                              3.4 MiB   123K/s 00:28 [########################################################] 100%
:: Starting full system upgrade...
:: Replace dnsutils with extra/bind-tools? [Y/n] y
:: Replace thttpd with community/sthttpd? [Y/n] y
:: Replace virtualbox-guest-modules with community/virtualbox-guest-dkms? [Y/n] y
:: Replace virtualbox-host-modules with community/virtualbox-host-dkms? [Y/n] y
resolving dependencies...
looking for conflicting packages...
warning: dependency cycle detected:
warning: harfbuzz will be installed before its freetype2 dependency

Packages (498) aalib-1.4rc5-11  accountsservice-0.6.40-2  adwaita-icon-theme-3.18.0-1  alsa-lib-1.1.0-1  alsa-utils-1.1.0-2  aspell-0.60.6.1-4
               at-spi2-atk-2.18.1-1  at-spi2-core-2.18.3-1  atk-2.18.0-1  atkmm-2.24.2-2  augeas-1.4.0-1  avahi-0.6.32-2  awesome-3.5.9-1  banshee-2.6.2-8
               bash-4.3.042-4  bind-tools-9.10.3.P4-1  binutils-2.26-3  bluez-5.38-3  bluez-hid2hci-5.38-3  bluez-libs-5.38-3  bluez-utils-5.38-3
               boost-libs-1.60.0-2  bzr-2.7.0-1  bzrtp-1.0.3-1  ca-certificates-mozilla-3.23-3  cairo-1.14.6-1  cairomm-1.12.0-2  cantarell-fonts-1:0.0.24-1
               ceph-0.94.5-3  chromaprint-1.3.1-1  chromium-49.0.2623.110-1  cinnamon-menus-2.8.0-1  cinnamon-translations-2.8.3-1  cjs-2.8.0-2
               clucene-2.3.3.4-9  cogl-1.22.0-1  colord-1.2.12-1  coreutils-8.25-1  cryptsetup-1.7.1-1  cups-filters-1.8.3-1  curl-7.48.0-1  darkhttpd-1.12-1
               db-5.3.28-3  dbus-1.10.8-1  dbus-glib-0.106-1  dcadec-0.2.0-1  device-mapper-2.02.148-1  dhcpcd-6.10.1-1  dialog-1:1.3_20160209-1
               dkms-2.2.0.3+git151023-9  dnsutils-9.9.2.P2-2 [removal]  dosfstools-3.0.28-1  dropbear-2016.72-1  e2fsprogs-1.42.13-1  elfutils-0.165-1
               enca-1.18-1  enchant-1.6.0-7  expat-2.1.1-1  farstream-0.2.7-1  fcgi-2.4.0-11  ffmpeg-1:3.0-1  file-5.25-1  filesystem-2015.09-1
               findutils-4.6.0-1  firefox-45.0.1-1  firefox-i18n-hi-in-45.0.1-1  firefox-i18n-te-45.0.1-1  flac-1.3.1-3  flex-2.6.0-2  fontconfig-2.11.94-1
               freetype2-2.6.3-1  fribidi-0.19.7-1  fuse-2.9.5-1  gawk-4.1.3-1  gc-7.4.2-4  gcc-5.3.0-5  gcc-libs-5.3.0-5  gcr-3.18.0-1  gd-2.1.1-3
               gdk-pixbuf2-2.32.3-1  geany-1.27-1  geoclue2-2.4.3-1  geocode-glib-3.18.2-1  geoip-1.6.6-2  geoip-database-20160301-2  gettext-0.19.7-1
               ghostscript-9.19-1  giflib-5.1.2-1  glew-1.13.0-1  glib-networking-2.46.1-1  glib2-2.46.2-4  glibc-2.23-1  glibmm-2.46.3-1  glu-9.0.0-4
               gmp-6.1.0-3  gnome-menus-3.13.3-2  gnupg-2.1.11-1  gnutls-3.4.10-1  gobject-introspection-1.46.0-1  gobject-introspection-runtime-1.46.0-1
               gparted-0.25.0-1  gperftools-2.4-2  gpgme-1.6.0-2  gpm-1.20.7-6  graphene-1.2.10-1  graphite-1:1.3.8-1  grep-2.24-1  groff-1.22.3-6
               grub-1:2.02.beta2-6  gsettings-desktop-schemas-3.18.1-1  gsfonts-20150811-1  gsm-1.0.14-1  gst-plugins-bad-1.6.3-6  gst-plugins-base-1.6.3-1
               gst-plugins-base-libs-1.6.3-1  gst-plugins-good-1.6.3-1  gstreamer-1.6.3-1  gstreamer0.10-bad-0.10.23-14  gstreamer0.10-bad-plugins-0.10.23-14
               gstreamer0.10-good-0.10.31-10  gstreamer0.10-good-plugins-0.10.31-10  gtk-sharp-2-2.12.29-1  gtk-update-icon-cache-3.18.9-1  gtk2-2.24.30-1
               gtk3-3.18.9-1  gtkmm-2.24.4-2  guile-2.0.11-3  gvfs-1.26.3-1  gvfs-mtp-1.26.3-1  harfbuzz-1.2.4-1  harfbuzz-icu-1.2.4-1
               hicolor-icon-theme-0.15-1  hspell-1.3-1  hunspell-1.3.4-1  hwids-20160306-1  iana-etc-20160314-1  icu-56.1-2  idesk-0.7.5-7  inetutils-1.9.4-2
               iproute2-4.4.0-1  iputils-20150815.1c59920-3  iso-codes-3.67-1  iw-4.3-1  jack-0.124.1-6  jasper-1.900.1-14  js-24.2.0-3  js17-17.0.0-3
               json-glib-1.0.4-1  kbd-2.0.3-1  kde-dev-scripts-15.12.3-1  kmod-22-1  krb5-1.13.2-3  ladspa-1.13-6  lame-3.99.5-3  ldb-1.1.26-1  ldns-1.6.17-4
               less-481-2  leveldb-1.18-2  libabw-0.1.1-2  libass-0.13.2-1  libassuan-2.4.2-1  libbluray-0.9.2-1  libbsd-0.8.2-2  libburn-1.4.2.pl01-1
               libcaca-0.99.beta19-1  libcap-2.25-1  libcap-ng-0.7.7-1  libcdio-0.93-3  libcdr-0.1.2-1  libcmis-0.5.1-1  libcroco-0.6.11-1  libcups-2.1.3-1
               libdatrie-0.2.10-1  libdbus-1.10.8-1  libdrm-2.4.67-2  libdvdnav-5.0.3-1  libdvdread-5.0.4-1  libe-book-0.1.2-4  libedit-20150325_3.1-2
               libelf-0.165-1  libepoxy-1.3.1-1  libetonyek-0.1.6-1  libevdev-1.4.6-1  libevent-2.0.22-2  libexttextcat-3.4.4-1  libfbclient-2.5.5.26952-1
               libgcrypt-1.6.5-1  libgdm-3.18.2-1  libgme-0.6.0-5  libgpg-error-1.21-1  libgphoto2-2.5.9-1  libgsystem-2015.2-1  libgudev-230-1
               libgusb-0.2.9-1  libgxps-0.2.3.2-1  libibus-1.5.13-1  libical-2.0.0-2  libidn-1.32-1  libimobiledevice-1.2.0-3  libinput-1.2.2-1
               libisofs-1.4.2-1  libixion-0.11.0-2  libjpeg-turbo-1.4.2-2  liblangtag-0.5.8-2  libldap-2.4.44-1  libmariadbclient-10.1.13-1
               libmm-glib-1.4.14-1  libmodplug-0.8.8.5-2  libmp4v2-2.0.0-4  libmpcdec-1:0.1+r475-1  libmspub-0.1.2-4  libmtp-1.1.11-1  libmwaw-0.3.6-2
               libnice-0.1.13-1  libnl-3.2.27-1  libnm-glib-1.0.12-1  libnotify-0.7.6-2  libodfgen-0.1.6-1  libofa-0.9.3-6  liborcus-0.11.0-1
               libpagemaker-0.0.3-1  libpaper-1.1.24-9  libpcap-1.7.4-1  libpipeline-1.4.1-1  libplist-1.12-4  libpng-1.6.21-1  libproxy-0.4.12-1
               libpulse-8.0-3  libpurple-2.10.12-1  libraw1394-2.1.1-1  libreoffice-fresh-5.1.1-3  libreoffice-fresh-hi-5.1.1-1  libreoffice-fresh-te-5.1.1-1
               librevenge-0.0.4-1  librsvg-2:2.40.15-1  libseccomp-2.2.3-1  libsecret-0.18.5-1  libshout-1:2.4.1-2  libsigc++-2.8.0-1  libsndfile-1.0.26-1
               libsoup-2.52.2-1  libsoxr-0.1.2-1  libsrtp-1:1.5.4-1  libssh-0.7.3-1  libssh2-1.7.0-2  libsynaptics-0.14.6c-7  libsystemd-229-3
               libtasn1-4.7-1  libthai-0.1.24-1  libtiff-4.0.6-2  libtirpc-1.0.1-2  libtool-2.4.6-4  libtracker-sparql-1.6.1-3  libunistring-0.9.6-1
               libunwind-1.1-3  libusb-1.0.20-1  libutil-linux-2.27.1-1  libva-1.7.0-1  libvdpau-1.1.1-2  libvirt-1.3.2-3  libvisio-0.1.5-1
               libvisual-0.4.0-6  libvoikko-4.0.2-1  libvpx-1.5.0-4  libwacom-0.18-1  libwbclient-4.4.0-1  libwebp-0.5.0-1  libwpd-0.10.1-1  libwpg-0.3.1-1
               libwps-0.4.3-1  libx264-2:148.20160103-1  libxcb-1.11.1-1  libxi-1.7.6-1  libxkbcommon-0.6.0-1  libxml2-2.9.3-1  libxslt-1.1.28-4
               lightdm-1:1.18.0-1  lighttpd-1.4.39-2  linux-4.4.5-1  linux-api-headers-4.4.1-1  linux-firmware-20160113.40e9ae8-1  llvm-libs-3.7.1-1
               lm_sensors-3.4.0-1  logrotate-3.9.1-1  lsof-4.89-1  lua-5.3.2-1  lvm2-2.02.148-1  lxdm-0.5.3-2  lxinput-0.3.5-1  lxrandr-0.3.1-1  lz4-131-1
               make-4.1-3  man-db-2.7.5-1  man-pages-4.05-1  mbedtls-2.2.1-1  mdadm-3.4-1  media-player-info-22-2  mediastreamer-2.12.1-4  mesa-11.1.2-1
               mesa-libgl-11.1.2-1  mjpegtools-2.1.0-2  mkinitcpio-19-1  mkinitcpio-busybox-1.24.1-1  mobile-broadband-provider-info-20151214-1
               mono-4.4.0.40-2  mpfr-3.1.4-1  mpg123-1.22.4-1  musicbrainz-2.1.5-7  mutagen-1.31-1  namcap-3.2.6-1  nano-2.5.3-1  nautilus-sendto-3.8.3-1
               ncurses-6.0-4  neon-0.30.1-2  netcf-0.2.8-3  netctl-1.11-1  nettle-3.2-1  nspr-4.12-1  nss-3.23-3  ntfs-3g-2016.2.22-1  ntp-4.2.8.p6-3
               numactl-2.0.11-1  openal-1.17.2-2  openresolv-3.7.2-1  openssh-7.2p2-1  openssl-1.0.2.g-3  opera-36.0.2130.46-1  opus-1.1.2-1  orc-0.4.25-1
               ortp-0.25.0-1  os-prober-1.71-1  p11-kit-0.23.2-1  pam-1.2.1-3  pango-1.39.0-1  pangomm-2.38.1-2  parted-3.2-3  pciutils-3.4.1-1  pcre-8.38-3
               perl-5.22.1-2  perl-uri-1.71-1  pidgin-2.10.12-1  pinentry-0.9.7-1  pixman-0.34.0-1  pkg-config-0.29.1-1  polkit-0.113-4  poppler-0.41.0-1
               poppler-glib-0.41.0-1  postfix-3.1.0-3  postgresql-libs-9.5.2-1  privoxy-3.0.24-2  procps-ng-3.3.11-2  protobuf-2.6.1-2  protobuf-c-1.2.1-2
               psmisc-22.21-3  putty-0.66-1  pyalpm-0.8-1  pygobject-devel-3.18.2-1  pygobject2-devel-2.28.6-12  pygtk-2.24.0-6  python-3.5.1-2
               python-dbus-1.2.4-1  python-dbus-common-1.2.4-1  python-pyelftools-0.23-2  python-xdg-0.25-3  python2-2.7.11-3  python2-atspi-2.18.0-1
               python2-beaker-1.8.0-1  python2-gobject-3.18.2-1  python2-gobject2-2.28.6-12  python2-lxml-3.6.0-1  python2-mako-1.0.4-1
               python2-markupsafe-0.23-3  python2-packaging-16.6-1  python2-pam-0.1.4-3  python2-pexpect-4.0.1-2  python2-pillow-3.1.1-1
               python2-ptyprocess-0.5.1-1  python2-pyinotify-0.9.6-2  python2-pyparsing-2.1.1-1  python2-setuptools-1:20.6.7-1  python2-six-1.10.0-1
               python2-xdg-0.25-3  raptor-2.0.15-3  readline-6.3.008-3  redland-1:1.0.17-3  rest-0.7.93-1  rsync-3.1.2-1  rtmpdump-1:2.4.r96.fa8646d-2
               ruby-2.3.0-2  run-parts-4.7-1  s-nail-14.8.8-1  samba-4.4.0-1  sane-1.0.25-1  schroedinger-1.0.11-3  sg3_utils-1.42-1  shared-mime-info-1.5-1
               smbclient-4.4.0-1  smbnetfs-0.6.0-2  snappy-1.1.3-2  soundtouch-1.9.0-3  speech-dispatcher-0.8.3-6  speexdsp-1.2rc3-2  sqlite-3.11.1-1
               sqlite-doc-3.11.1-1  sthttpd-2.27.0-1  sudo-1.8.16-1  supertuxkart-0.9.1-2  syslinux-6.03-5  systemd-229-3  systemd-sysvcompat-229-3
               taglib-1.10-3  talloc-2.1.6-1  tdb-1.3.8-1  tevent-0.9.28-1  texinfo-6.1-1  thin-provisioning-tools-0.6.1-2  thttpd-2.26-4 [removal]
               tor-0.2.7.6-3  ttf-dejavu-2.35-1  ttf-liberation-2.00.1-6  tzdata-2016c-1  udisks2-2.1.7-1  unzip-6.0-11  util-linux-2.27.1-1
               v4l-utils-1.10.0-1  vi-1:070224-2  vid.stab-1.1-1  videoproto-2.3.3-1  vim-7.4.1639-1  vim-runtime-7.4.1639-1  virtualbox-5.0.16-3
               virtualbox-guest-dkms-5.0.16-3  virtualbox-guest-iso-5.0.16-1  virtualbox-guest-modules-4.3.28-1 [removal]  virtualbox-guest-utils-5.0.16-3
               virtualbox-host-dkms-5.0.16-3  virtualbox-host-modules-4.3.28-1 [removal]  vte-0.28.2-7  vte-common-0.42.5-1  wavpack-4.75.2-1
               wayland-1.10.0-1  webfs-1.21-12  webkitgtk2-2.4.10-1  wget-1.17.1-1  wpa_supplicant-1:2.5-3  x265-1.9-1  xcb-proto-1.11-2  xdg-utils-1.1.1-1
               xdm-archlinux-0.5-3  xf86-input-evdev-2.10.1-3  xf86-input-joystick-1.6.2-6  xf86-input-keyboard-1.8.1-2  xf86-input-mouse-1.9.1-2
               xf86-input-synaptics-1.8.3-2  xf86-input-vmmouse-13.1.0-2  xf86-input-void-1.4.1-2  xf86-video-ark-0.7.5-7  xf86-video-ati-1:7.6.1-1
               xf86-video-dummy-0.3.7-5  xf86-video-fbdev-0.4.4-5  xf86-video-glint-1.2.8-7  xf86-video-i128-1.3.6-7
               xf86-video-intel-1:2.99.917+587+gc186d4d-1  xf86-video-mach64-6.9.5-2  xf86-video-neomagic-1.2.9-2  xf86-video-nouveau-1.0.12-1
               xf86-video-nv-2.1.20-7  xf86-video-openchrome-0.3.3-6  xf86-video-r128-6.10.1-1  xf86-video-savage-2.3.8-2  xf86-video-siliconmotion-1.7.8-2
               xf86-video-sis-0.10.8-2  xf86-video-tdfx-1.4.5-7  xf86-video-trident-1.3.7-2  xf86-video-vesa-2.3.4-2  xf86-video-vmware-13.1.0-3
               xf86-video-voodoo-1.2.5-7  xfconf-4.12.0-2  xfsprogs-4.3.0-1  xkeyboard-config-2.17-2  xorg-server-1.18.2-4  xorg-server-common-1.18.2-4
               xorg-server-xdmx-1.18.2-4  xorg-server-xwayland-1.18.2-4  xorg-xdm-1.1.11-6  xorg-xinit-1.3.4-4  xorg-xinput-1.6.2-1  xorg-xkbcomp-1.3.1-1
               xorg-xrandr-1.5.0-1  xorg-xrdb-1.1.0-2  xproto-7.0.28-1  xterm-324-1  xvidcore-1.3.4-1  xz-5.2.2-1  zip-3.0-7  zita-alsa-pcmi-0.2.0-3
               zita-resampler-1.3.0-5  zlib-1.2.8-4

Total Download Size:   1243.15 MiB
Total Installed Size:  4106.63 MiB
Net Upgrade Size:       560.98 MiB

:: Proceed with installation? [Y/n] y

---Truncating the output---

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

Thus I completed rebuilding the yaourt and was able to fix the package manager

Tuesday, June 2, 2015

enable synaptics tapping on Gnome in Archlinux

Before proceeding with tweaking the touchpad, lets search for touchpad packages are available for us in the repository..

wiz@Arch-DOC:~$ sudo pacman -Ss touchpad
extra/xf86-input-synaptics 1.8.1-1 (xorg-drivers xorg) [installed]
    Synaptics driver for notebook touchpads
community/gpointing-device-settings 1.5.1-5
    GUI tool for setting pointing device such as TrackPoint or Touchpad
community/kcm-touchpad 1.1-1
    KCM, daemon and applet for touchpad
community/libsynaptics 0.14.6c-6
    Library for accessing synaptics touchpads


Im on Gnome and my touch pad doesn't seem to do what I intend it to behave,
Now it took quiet a bit of time finding the corresponding packages..
Lets fetch and install the gpointing-device-settings

wiz@Arch-DOC:~$ sudo pacman -S community/gpointing-device-settings
resolving dependencies...
looking for inter-conflicts...

Packages (1): gpointing-device-settings-1.5.1-5

Total Download Size:    0.05 MiB
Total Installed Size:   0.36 MiB

:: Proceed with installation? [Y/n]
:: Retrieving packages ...
 gpointing-device-se...    55.6 KiB  89.2K/s 00:01 [######################] 100%
(1/1) checking keys in keyring                     [######################] 100%
(1/1) checking package integrity                   [######################] 100%
(1/1) loading package files                        [######################] 100%
(1/1) checking for file conflicts                  [######################] 100%
(1/1) checking available disk space                [######################] 100%
(1/1) installing gpointing-device-settings         [######################] 100%
wiz@Arch-DOC:~$

Voila !, the touch pad works seamlessly

HTH

Some cool tricks with AWK and CUT

This following script prints out the sum of the disk utilization of total directories

[root@Arch-DOC ~]# du -sh /home/wiz/
184G    /home/wiz

[root@Arch-DOC ~]# du -sh /home/wiz/* | egrep  '[0-9]G'
2.5G    /home/wiz/Docs
6.9G    /home/wiz/Documents
19G    /home/wiz/Downloads
19G    /home/wiz/ISO IMAGES
5.3G    /home/wiz/Music
59G    /home/wiz/r-drive
45G    /home/wiz/Videos
18G    /home/wiz/VirtualBox VMs

[root@Arch-DOC ~]# du -sh /home/wiz/* | egrep  '[0-9]G'  | awk '{print $1}' | cut -d'G' -f1| awk '{sum+=$1} END {print sum}'
174.7

Thus we can find the sum of the spaces of each individual directory utilization.

Renaming multiple files with extensions

Simple for loop is described as follows to bulk renaming files


[root@Arch-DOC test]# touch {a..z}

[root@Arch-DOC test]# for i in *; do mv $i $i.txt; done

a.txt  c.txt  e.txt  g.txt  i.txt  k.txt  m.txt  o.txt  q.txt  s.txt  u.txt  w.txt  y.txt
b.txt  d.txt  f.txt  h.txt  j.txt  l.txt  n.txt  p.txt  r.txt  t.txt  v.txt  x.txt  z.txt


[root@Arch-DOC test]# for i in *.txt; do sh -c "mv $i `echo $i| cut -d'.' -f1 `" ; done

[root@Arch-DOC test]# ls
a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z


[root@Arch-DOC test]# for i in *; do sh -c "mv $i `echo $i| cut -d'.' -f1`.pdf" ; done

[root@Arch-DOC test]# ls
a.pdf  c.pdf  e.pdf  g.pdf  i.pdf  k.pdf  m.pdf  o.pdf  q.pdf  s.pdf  u.pdf  w.pdf  y.pdf
b.pdf  d.pdf  f.pdf  h.pdf  j.pdf  l.pdf  n.pdf  p.pdf  r.pdf  t.pdf  v.pdf  x.pdf  z.pdf



Finding the list of Directories Recursively on your Linux Machine.

First of Lets create some directories..

[root@Arch-DOC test]# mkdir Dir{1..10}

[root@Arch-DOC test]# mkdir Dir1/dir1{a..z}
[root@Arch-DOC test]# mkdir Dir2/dir2{a..z}

Now we shall also create some more sub-directories under dir2.
[root@Arch-DOC test]# mkdir Dir2/dir2a/sub-sub-dir2a{1..10}

and also lets create some sample files..

[root@Arch-DOC test]# touch files{1..10}

Lets see what we have got..

[root@Arch-DOC test]# ls
Dir1  Dir10  Dir2  Dir3  Dir4  Dir5  Dir6  Dir7  Dir8  Dir9  files1  files10  files2  files3  files4  files5  files6  files7  files8  files9

Now that the directories and Sub-directories have been created. Lets run some commands to test it out.

[root@Arch-DOC test]# find ./ -maxdepth 1 -type d
./
./Dir7
./Dir9
./Dir8
./Dir4
./Dir5
./Dir2
./Dir10
./Dir1
./Dir3
./Dir6

[root@Arch-DOC test]#  ls -d */
Dir1/  Dir10/  Dir2/  Dir3/  Dir4/  Dir5/  Dir6/  Dir7/  Dir8/  Dir9/

Similarly, we can go on to the next level directories and get a list of only that particular sib directories.

[root@Arch-DOC test]#  ls -d */*/*
Dir2/dir2a/sub-sub-dir2a1   Dir2/dir2a/sub-sub-dir2a2  Dir2/dir2a/sub-sub-dir2a4  Dir2/dir2a/sub-sub-dir2a6  Dir2/dir2a/sub-sub-dir2a8
Dir2/dir2a/sub-sub-dir2a10  Dir2/dir2a/sub-sub-dir2a3  Dir2/dir2a/sub-sub-dir2a5  Dir2/dir2a/sub-sub-dir2a7  Dir2/dir2a/sub-sub-dir2a9

[root@Arch-DOC test]# find ./ -maxdepth 3 -type d | wc
     73      73    1031

Using Stream-editor and replacing the : with null value on each directory while printing to stdout.
[root@Arch-DOC test]# ls -R | grep ":" | sed -e s/://g | wc
     73      73    1030


HTH

Setingup Wifi on ArchLinux.

Setingup Wifi on ArchLinux.

Before proceeding check for the wireless link status on your device.

[wiz@Arch-DOC ~]# iwconfig
wlp2s0b1  IEEE 802.11bgn  ESSID:off/any 
          Mode:Managed  Access Point: Not-Associated   Tx-Power=19 dBm  
          Retry short limit:7   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
         
lo        no wireless extensions.

enp1s0    no wireless extensions.



[wiz@Arch-DOC ~]# netctl is-enabled wlp2s0b1-myrouter
Failed to get unit file state for netctl@wlp2s0b1\x2dh\x40Ck3r.service: No such file or directory

There's an even simple program called wifi-menu which scans and displays available SSID's in the vicinity.

This creates a profile in the /etc/netctl/ upon successful authentication  connection  with the
 [wiz@Arch-DOC netctl]# cat wlp2s0b1-myrouter
Interface=wlp2s0b1
Connection=wireless
Security=wpa
ESSID=myrouter
IP=dhcp
Key=myp@ssword


[wiz@Arch-DOC ]# netctl start wlp2s0b1-myrouter 

Type iwconfig, and it should listout the active wireless link details.



Now, to enable the wireless interface across restarts/reboots, do the following to ensure it is enabled and loaded

[wiz@Arch-DOC ]# netctl is-enabled wlp2s0b1-myrouter
Failed to get unit file state for netctl@wlp2s0b1\x2dmyrouter.service: No such file or directory

[wiz@Arch-DOC ]# netctl enable wlp2s0b1-myrouter
ln -s '/etc/systemd/system/netctl@wlp2s0b1\x2dmyrouter.service' '/etc/systemd/system/multi-user.target.wants/netctl@wlp2s0b1\x2dmyrouter.service'


[wiz@Arch-DOC ]# netctl is-enabled wlp2s0b1-myrouter
enabled


For more information checkout netctl

Fixing a broked Arch Linux, Upgrading System

This system was earlier broken and not updated for quiet a while, the mirror list was exhausted and no new packages could not be downloaded.

(959/959) checking keys in keyring                                                         [####################################################] 100%
downloading required keys...
error: key "7A4E76095D8A52E4" could not be looked up remotely
error: required key missing from keyring
error: failed to commit transaction (unexpected error)
Errors occurred, no packages were upgraded.


[wiz@Arch-DOC ~]# cat /etc/issue
Arch Linux \r (\l)

[wiz@Arch-DOC ~]# uname -a
Linux Arch-DOC 3.17.6-1-ARCH #1 SMP PREEMPT Sun Dec 7 23:43:32 UTC 2014 x86_64 GNU/Linux


The issue was with the keyrings,  fetched a new key and then completed verifying installing the downloaded packages.


[wiz@Arch-DOC ~]# pacman -Sy archlinux-keyring
:: Synchronizing package databases...
 core is up to date
 extra is up to date
 community is up to date
resolving dependencies...
looking for conflicting packages...

Packages (1) archlinux-keyring-20150523-1

Total Installed Size:  0.67 MiB
Net Upgrade Size:      0.07 MiB

:: Proceed with installation? [Y/n] y
(1/1) checking keys in keyring                                                             [####################################################] 100%
(0/1) checking package integrity                                                           [----------------------------------------------------]   0%
(1/1) checking package integrity                                                           [####################################################] 100%
(1/1) loading package files                                                                [####################################################] 100%
(1/1) checking for file conflicts                                                          [####################################################] 100%
(1/1) checking available disk space                                                        [####################################################] 100%
(1/1) upgrading archlinux-keyring                                                          [####################################################] 100%
==> Appending keys from archlinux.gpg...
gpg: starting migration from earlier GnuPG versions
gpg: porting secret keys from '/etc/pacman.d/gnupg/secring.gpg' to gpg-agent
gpg: migration succeeded
gpg: 3 marginal(s) needed, 1 complete(s) needed, PGP trust model
gpg: depth: 0  valid:   1  signed:   5  trust: 0-, 0q, 0n, 0m, 0f, 1u
gpg: depth: 1  valid:   5  signed:  64  trust: 0-, 0q, 0n, 5m, 0f, 0u
gpg: depth: 2  valid:  64  signed:   6  trust: 64-, 0q, 0n, 0m, 0f, 0u
gpg: next trustdb check due at 2015-06-12
==> Locally signing trusted keys in keyring...
  -> Locally signing key 0E8B644079F599DFC1DDC3973348882F6AC6A4C2...
  -> Locally signing key 684148BB25B49E986A4944C55184252D824B18E8...
  -> Locally signing key 44D4A033AC140143927397D47EFD567D4C7EA887...
  -> Locally signing key 27FFC4769E19F096D41D9265A04F9397CDFD6BB0...
  -> Locally signing key AB19265E5D7D20687D303246BA1DFB64FFF979E7...
==> Importing owner trust values...
==> Disabling revoked keys in keyring...
  -> Disabling key F5A361A3A13554B85E57DDDAAF7EF7873CFD4BB6...
  -> Disabling key 7FA647CD89891DEDC060287BB9113D1ED21E1A55...
  -> Disabling key D4DE5ABDE2A7287644EAC7E36D1A9E70E19DAA50...
  -> Disabling key BC1FBE4D2826A0B51E47ED62E2539214C6C11350...
  -> Disabling key 9515D8A8EAB88E49BB65EDBCE6B456CAF15447D5...
  -> Disabling key 4A8B17E20B88ACA61860009B5CED81B7C2E5C0D2...
  -> Disabling key 63F395DE2D6398BBE458F281F2DBB4931985A992...
  -> Disabling key 0B20CA1931F5DA3A70D0F8D2EA6836E1AB441196...
  -> Disabling key 8F76BEEA0289F9E1D3E229C05F946DED983D4366...
  -> Disabling key 66BD74A036D522F51DD70A3C7F2A16726521E06D...
  -> Disabling key 81D7F8241DB38BC759C80FCE3A726C6170E80477...
  -> Disabling key E7210A59715F6940CF9A4E36A001876699AD6E84...
==> Updating trust database...
gpg: next trustdb check due at 2015-06-12

[wiz@Arch-DOC ~]# pacman -Suy
:: Starting full system upgrade...
:: Replace font-misc-ethiopic with extra/xorg-fonts-misc? [Y/n] y
:: Replace gtk-aurora-engine with community/gtk-engine-aurora? [Y/n] y
:: Replace gtk2-xfce-engine with extra/gtk-xfce-engine? [Y/n] yy
:: Replace gtk3-xfce-engine with extra/gtk-xfce-engine? [Y/n] y
:: Replace kdeadmin-kcron with extra/kcron? [Y/n] y
:: Replace kdebase-katepart with extra/katepart4? [Y/n] y
:: Replace kdebase-konsole with extra/konsole? [Y/n] y
:: Replace kdebase-kwrite with extra/kwrite? [Y/n] y
:: Replace kdeedu-blinken with extra/blinken? [Y/n] y
:: Replace kdeedu-cantor with extra/cantor? [Y/n] y
:: Replace kdeedu-kalgebra with extra/kalgebra? [Y/n] y
:: Replace kdeedu-kanagram with extra/kanagram? [Y/n] y
:: Replace kdeedu-kbruch with extra/kbruch? [Y/n] y
:: Replace kdeedu-kgeography with extra/kgeography? [Y/n] y
:: Replace kdeedu-khangman with extra/khangman? [Y/n] y
:: Replace kdeedu-kig with extra/kig? [Y/n] y
:: Replace kdeedu-kiten with extra/kiten? [Y/n] y
:: Replace kdeedu-klettres with extra/klettres? [Y/n] y
:: Replace kdeedu-kmplot with extra/kmplot? [Y/n] y
:: Replace kdeedu-kstars with extra/kstars? [Y/n] y
:: Replace kdeedu-kturtle with extra/kturtle? [Y/n] y
:: Replace kdeedu-kwordquiz with extra/kwordquiz? [Y/n] y
:: Replace kdeedu-parley with extra/parley? [Y/n] y
:: Replace kdeedu-rocs with extra/rocs? [Y/n] y
:: Replace kdeedu-step with extra/step? [Y/n] y
:: Replace kdegames-bomber with extra/bomber? [Y/n] y
:: Replace kdegames-bovo with extra/bovo? [Y/n] y
:: Replace kdegames-granatier with extra/granatier? [Y/n] y
:: Replace kdegames-kapman with extra/kapman? [Y/n] y
:: Replace kdegames-katomic with extra/katomic? [Y/n] y
:: Replace kdegames-kblackbox with extra/kblackbox? [Y/n] y
:: Replace kdegames-kblocks with extra/kblocks? [Y/n] y
:: Replace kdegames-kbounce with extra/kbounce? [Y/n] y
:: Replace kdegames-kbreakout with extra/kbreakout? [Y/n] y
:: Replace kdegames-kdiamond with extra/kdiamond? [Y/n] y
:: Replace kdegames-kfourinline with extra/kfourinline? [Y/n] y
:: Replace kdegames-killbots with extra/killbots? [Y/n] y
:: Replace kdegames-kjumpingcube with extra/kjumpingcube? [Y/n] y
:: Replace kdegames-klines with extra/klines? [Y/n] y
:: Replace kdegames-kmines with extra/kmines? [Y/n] y
:: Replace kdegames-knetwalk with extra/knetwalk? [Y/n] y
:: Replace kdegames-kollision with extra/kollision? [Y/n] y
:: Replace kdegames-kpatience with extra/kpatience? [Y/n] y
:: Replace kdegames-kshisen with extra/kshisen? [Y/n] y
:: Replace kdegames-ksquares with extra/ksquares? [Y/n] y
:: Replace kdegraphics-gwenview with extra/gwenview? [Y/n] y
:: Replace kdegraphics-kruler with extra/kruler? [Y/n] y
:: Replace kdesdk-dev-scripts with extra/kde-dev-scripts? [Y/n] y
:: Replace kdesdk-kapptemplate with extra/kapptemplate? [Y/n] y
:: Replace kdesdk-kate with extra/kate? [Y/n] y
:: Replace kdesdk-kompare with extra/kompare? [Y/n] y
:: Replace kdesdk-lokalize with extra/lokalize? [Y/n] y
:: Replace kdesdk-okteta with extra/okteta? [Y/n] y
:: Replace kdetoys-kteatime with extra/kteatime? [Y/n] y
:: Replace kdeutils-filelight with extra/filelight? [Y/n] y
:: Replace kdeutils-kcalc with extra/kcalc? [Y/n] y
:: Replace kdeutils-kcharselect with extra/kcharselect? [Y/n] y
:: Replace kdeutils-ktimer with extra/ktimer? [Y/n] y
:: Replace kdeutils-print-manager with extra/print-manager? [Y/n] y
:: Replace kfilemetadata with extra/kfilemetadata4? [Y/n] y
:: Replace libnm-gtk with extra/nm-connection-editor? [Y/n] y
:: Replace lirc-utils with extra/lirc? [Y/n] y
:: Replace mesa-dri with extra/mesa? [Y/n] y
:: Replace signon-qt4 with extra/libsignon-qt4? [Y/n] y
:: Replace xf86-video-modesetting with extra/xorg-server? [Y/n] y
resolving dependencies...
looking for conflicting packages...
:: gtk-xfce-engine and gtk2-xfce-engine are in conflict. Remove gtk2-xfce-engine? [y/N] y
:: kalgebra and kdeedu-analitza are in conflict. Remove kdeedu-analitza? [y/N] y
:: kdeedu-data and libkdeedu are in conflict. Remove libkdeedu? [y/N] y
:: xorg-server and xf86-video-ast are in conflict (X-ABI-VIDEODRV_VERSION). Remove xf86-video-ast? [y/N] y
:: xorg-server and xf86-video-cirrus are in conflict (X-ABI-VIDEODRV_VERSION). Remove xf86-video-cirrus? [y/N] y
:: xorg-server and xf86-video-mga are in conflict (X-ABI-VIDEODRV_VERSION). Remove xf86-video-mga? [y/N] y
:: xorg-server and xf86-video-v4l are in conflict (X-ABI-VIDEODRV_VERSION). Remove xf86-video-v4l? [y/N] y
warning: dependency cycle detected:
warning: bash will be installed before its readline dependency
warning: dependency cycle detected:
warning: freetype2 will be installed before its harfbuzz dependency
warning: dependency cycle detected:
warning: freetype2 will be installed before its harfbuzz dependency

Reboot the OS and logged into new kernel...

[wiz@Arch-DOC boot]# ls -lth
total 25M
drwxr-xr-x 2 root root 4.0K Jun  2 15:33 syslinux
-rw-r--r-- 1 root root  18M Jun  2 15:32 initramfs-linux-fallback.img
-rw-r--r-- 1 root root 3.2M Jun  2 15:32 initramfs-linux.img
-rw-r--r-- 1 root root 4.0M May 22 08:36 vmlinuz-linux
drwxr-xr-x 6 root root 4.0K Dec 28 20:26 grub


[root@Arch-DOC ~]# uname -a
Linux Arch-DOC 4.0.4-2-ARCH #1 SMP PREEMPT Fri May 22 03:05:23 UTC 2015 x86_64 GNU/Linux

Wednesday, March 4, 2015

How to use dd command in linux

wiz@deb-DOC:~$ sudo dd if=/home/wiz/crunchbang-11-20130506-amd64.iso of=/dev/sdb bs=4M; sync
[sudo] password for wiz:
184+1 records in
184+1 records out
774897664 bytes (775 MB) copied, 0.867016 s, 894 MB/s

Saturday, November 22, 2014

Accessing Android Device partition from Linux OS

apt-get install mtpfs libfuse-dev libmad0-dev
And now download the mtpfs debian package from


wiz@cb-DOC:~# apt-cache search -f mtp-tools
Package: mtp-tools
Description-md5: b21df6970cd0c308c870019c053e3080
Description-en: Media Transfer Protocol (MTP) library tools
 libmtp is a library for communicating with MTP aware devices in POSIX
 compliant operating systems.  It implements MTP Basic, the subset
 proposed for standardization.
 .
 The Media Transfer Protocol (commonly referred to as MTP) is a devised
 set of custom extensions to support the transfer of music files on
 USB digital audio players and movie files on USB portable media players.
 .
 This package contains tools for communicating with MTP devices.

Here's what the libraries intend 
wiz@cb-DOC:~# apt-cache search -f libfuse-dev 
Package: libfuse-dev
Description-md5: da11b1a71c864509638e23fbce6723a3
Description-en: Filesystem in Userspace (development)
 Filesystem in Userspace (FUSE) is a simple interface for userspace programs to
 export a virtual filesystem to the Linux kernel. It also aims to provide a
 secure method for non privileged users to create and mount their own filesystem
 implementations.
 .
 This package contains the development files.


Package: libmad0-dev
Description-md5: bf2478178701150aac144fa1b8a3ff5f
Description-en: MPEG audio decoder development library
 MAD is an MPEG audio decoder. It currently only supports the MPEG 1
 standard, but fully implements all three audio layers (Layer I, Layer II,
 and Layer III, the latter often colloquially known as MP3.)
 .
 This is the package you need to develop or compile applications that use MAD.

And we have one more package which is mtpfs filesystem, which can be downloaded from https://packages.debian.org/sid/amd64/mtpfs/download or you can enable the Testing SID repos and you can fetch it from. 
apt-get install mtpfs

wiz@cb-DOC:~# apt-cache search -f mtpfs
Package: jmtpfs
Description-md5: 05e78b7506b9ac6b1d84a446189e832e
Description-en: FUSE based filesystem for accessing MTP devices
 jmtpfs is a FUSE and libmtp-based filesystem for accessing MTP (Media Transfer
 Protocol) devices. It was specifically designed for exchanging files between
 Linux (and Mac OS X) systems and newer Android devices that support MTP but
 not USB Mass Storage.
 .
 The goal is to create a well-behaved filesystem, allowing tools like find and
 rsync to work as expected. To enable certain Android apps to detect and use
 the transferred files, MTP file types are set automatically based on file
 contents using libmagic.

Package: mtpfs
Description-md5: 587c52dadb2cdcd42b55b3a80018a714
Description-en: FUSE filesystem for Media Transfer Protocol devices
 MTPfs is a FUSE filesystem that supports reading and writing from MTP (Media
 Transfer Protocol) devices, such as MP3 players, video players or digital
 cameras.
 .
 In addition to revealing media files on the connected device, MTPfs exposes a
 virtual directory called "/Playlists" which contains the device's playlists as
 m3u files.


mkdir /media/Mi-DOC

username=wiz

usermod -aG fuse $username

wiz@cb-DOC:~$ grep fuse /etc/group
fuse:x:103:wiz


wiz@cb-DOC:~$ mtpfs /media/Mi-DOC
Listing raw device(s)
Device 0 (VID=2717 and PID=0360) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
   Found 1 device(s):
   2717:0360 @ bus 2, dev 5
Attempting to connect device
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
Android device detected, assigning default bug flags
Listing File Information on Device with name: (NULL)

wiz@cb-DOC:~$ ls -ltd /media/Mi-DOC/
drwxrwxrwx 2 wiz wiz 0 Jan  1  1970 /media/Mi-DOC/

Now you can access your phone storage..

After you are done accessing your phone make sure you unmount the directory

fusermount -u /media/Mi-DOC

If not then you may face issues while trying to mount again..

wiz@cb-DOC:~$ mtpfs /media/Mi-DOC
Listing raw device(s)
Device 0 (VID=2717 and PID=0360) is UNKNOWN.
Please report this VID/PID and the device model to the libmtp development team
   Found 1 device(s):
   2717:0360 @ bus 2, dev 4
Attempting to connect device
PTP_ERROR_IO: failed to open session, trying again after resetting USB interface
LIBMTP libusb: Attempt to reset device
Android device detected, assigning default bug flags
Listing File Information on Device with name: (NULL)
fuse: bad mount point `/media/Mi-DOC': Transport endpoint is not connected

This script can be found at https://github.com/rrskris/mtp-mount

Happy Mounting your Android :)