Friday, September 28, 2018

mount /tmp on tmpfs? compile and runtime tmpfs overloads

I located (via yaourt) a large wine client -- a few hundred megabytes and half an hour to compile on an older laptop. But two wine compilation problems appeared during the install: 1) wine doesn't compile because its PGP key is unrecognized by yaourt, 2) wine doesn't compile because the system runs out of available RAM.

First the PGP problem: when the PGP rejection error notice is generated, one can see the key in the notice. Users can then copy it and add it to their keyring. The reason for the confusion is that yaourt relies on the user's personal key ring, which is a different key ring than pacman's dedicated keyring. So accept the key into your personal gpg ring...then restart the install and yaourt will accept the app.
$ gpg --recv-key [key]
...or you can examine the key owner's information with --fingerprint [key].

memory

Now we have the application, we have several ways to check the memory parameters.
$ free
total used free shared buff/cache available
Mem: 2034884 330740 1301548 45624 402596 1512420
Swap: 50426196 0 50426196

$ swapon
NAME TYPE SIZE USED PRIO
/dev/sda2 partition 48.1G 0B -2

$ df
Filesystem 1K-blocks Used Available Use% Mounted on
dev 1010468 0 1010468 0% /dev
run 1017440 592 1016848 1% /run
/dev/sda1 258030980 27348180 217575600 12% /
tmpfs 1017440 2972 1014468 1% /dev/shm
tmpfs 1017440 0 1017440 0% /sys/fs/cgroup
tmpfs 1017440 8 1017432 1% /tmp
tmpfs 203488 0 203488 0% /run/user/1000

$ cat /etc/fstab
/dev/sda1 / ext3 rw,relatime,block_validity,barrier,user_xattr,acl 0 1

/dev/sda2 none swap defaults,pri=-2 0 0

Where do these additional entries not in fstab originate? Can they be controlled? It appears we need some strategy for our tmpfs to go onto swap space once RAM is full so that the system doesn't lockup.

memory during compiling

During application compiling, tmpfs is used for parking files spawned or used by make. The tmpfs space is in RAM, viewable inside /tmp, and it allows compilations to progress quickly. However, compiling larger applications can require so much /tmp space, that RAM becomes filled. Once RAM is nearly full, make aborts complaining of a lack of space. Although tmpfs is supposed to overflow into SWAP space it does not. How can we compile these larger programs?

As noted, /tmp naturally resides in RAM. At the expense of 1) time, perhaps 25% longer compilation, and 2) the risk of thrashing one's hard drive, one can mount their /tmp directory on the hard disk. The important thing then is to refer this directory back to RAM after compiling the project. /var/tmp is the answer, but how to get it to connect with RAM?
# nano /etc/fstab
tmpfs /tmp tmpfs size=25G 0 0
This is all that's necessary. Checking...
$ df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1016196 5752 1010444 1% /dev/shm
tmpfs 26214400 8 26214392 1% /tmp
Now we can compile wine. We still have /dev/shm for regular RAM, but with spillover into 25G HDD swap if needed. Since I won't need this regularly, I will comment it from /etc/fstab once I compile wine.



Tuesday, September 25, 2018

[solved] more hdmi sound hijinx

Whichever card is running the HDMI must be set as the default inside alsa, no matter whether or not there are secondary issues with pulseaudio. Your order of business when finding that, say, YouTube videos no longer have sound, or VLC is without audio, are
  • ye olde verify audio is unmuted in alsamixer (while you're in alsamixer, why not check your card for annoying "automute", and disable it. Select it and use the "+" or "-" keys to toggle it)
  • check sound with a specific command to the hardware card. If this doesn't work, go into a subroutine of verifying HDMI. For example, this MUST work, if this is the named card and HDMI channel
    $ aplay -D plughw:1,7 /usr/share/sounds/alsa/Front_Center.wav
  • assuming the above works, then the wrong default card is likely being assigned, so that YouTube is, say, attempting to play through [default] motherboard audio, instead of an HDMI authorized sound card. This means, particularly after an software update, doing the thing you've done for years now...
    # nano /usr/share/alsa/alsa.conf
    @hooks [
    {
    func load
    files [
    {
    @func concat
    strings [
    { @func datadir }
    "/alsa.conf.d/"
    ]
    }
    ]
    errors false
    }
    ]
    ... and then further down in the file change the defaults...
    # nano /usr/share/alsa/alsa.conf
    defaults.ctl.card 1 #default 0
    defaults.pcm.card 1 #default 0
    defaults.pcm.device 7 #default 0

Saturday, September 15, 2018

post boot startup scripts

Going into "X", there are ways to run startups for various GUI applications. But what about at boot time? GRUB/LILO's job is only to initialize the kernel and the system: booting apps are not the way to, say, run an app that connects to wifi or runs a cron job. How to do? My ugly solution is a text rc.local file, added with a second step of creating and attaching a systemd service. Prior to systemd, in less complicated Linux years, we could create text app init files inside /etc/init.d/.

/etc/rc.local

There are more elegant ways (eg. as argued here) to connect to the web at startup, but let's use web connection as an easy rc.local example app, then pick your own application(s) to put into rc.local.

# nano /etc/rc.local
#!/bin/bash
echo "router connect"
wpa_supplicant -iwlan0 -Dwext -B -c /etc/wpasupplicant/wpa_supplicant.conf
exit 0

# chmod 755 /etc/rc.local
... or some like to just "+x" it.

/etc/systemd/system/rc-local.service


Next, create a systemd service file to call rc.local. As well noted here, the file must include a "wanted by" line.

# nano /etc/systemd/system/rc-local.service
[Unit]
Description=/etc/rc.local Compatibility
ConditionPathExists=/etc/rc.local

[Service]
Type=forking
ExecStart=/etc/rc.local start
TimeoutSec=0
StandardOutput=tty
RemainAfterExit=yes
SysVStartPriority=99

[Install]
WantedBy=multi-user.target
... and then enable the service in systemd...
# systemctl enable rc-local.service

The next time the system boots, it subsequently runs the rc.local file and connects to the router.

[solved] chk files

Sometimes after plugging a USB key into a microsoft product, you'll get weird CHK extension files, possibly in cryptic "FOUND" directories, that Microsoft is attempting to "recover" off the drive. To see what they've recovered often requires a hex dump reader. The simplest one I've found is the gnome ghex reader, easily installable in Arch with (obviously)
# pacman -S ghex

[unsolved] boot problems after upgrade

I had some kind of problem with mkinitcpio during a long overdue upgrade on my uncle's system. It was dropping out on the udev early hook with an error that it couldn't determine the file system type. Commands such as blkid, fsck will all be clean, and so you know it's in GRUB or the mkinitcpio, or possibly the kernel line or some other related issue.
# set
You should see some line like BOOT_IMAGE /boot/vmlinuz-linux

fix (3hrs)

Fresh reinstall. See this post. Your only problem is if the Arch install is through password-protected WiFi instead of ethernet. You'll have to HAND COPY your wpa_supplicant.conf into the installation machine prior to pacstrap, since there is no way to mount an inserted USB into the machine prior to pacstrap, yet WiFi must be on prior to pacstrap. It's a double bind, not unheard of during Arch installations. Said otherwise, there's no legal mount for the USB in the ramdisk.

no fix (20hrs)

Unfortunately, to match the system you're fixing, you'll have to download the latest core arch install ISO to access GRUB. The reason is not that GRUB cannot find the linux kernel, you see it found it right away. The re
linux line parameters "bootparam" man page is 50% helpful, more here , and not listed "rootfstype=ext2"
kernel modules
grub modules (grub manual)
initramfs (mkinitcpio) modules
running early hook [udev]
starting version 239
running hook [udev]
ERROR:device '' not found. Skipping fsck
mounting '' on real root
mount: /new_root: no filesystem type specified.
You are now being dropped into an emergency shell.
sh: can't access tty;job control turned off
udev hooks early hooks
multiple kernel options in Grub

Press "e" on the large 2 line Grub menu to see the params inside the grub. And then, if you want the rescue prompt, go to F2.
grub>

hahah... of course!
"There are different types of hooks [earlyhook, hook, latehook, cleanuphook]. Apart from that it should be in order."
uname -r and mkinitcpio -M, display the same information, the running kernel. However, after updating, the kernel mkinitcpio compiles with is the newer version, so it displays an error.

possibly gold plate post