Useful snippets #3: dual wallpapers on Awesome window manager

The main configuration file of Awesome wm is ~/.config/awesome/rc.lua. The default function in rc.lua on multihead systems is to install the same, maximized, theme.lua-defined wallpaper to all screens. That is all well, if a) you really want the same wallpaper on all screens, and b) if all of your screens are of the same aspect ratio. But if, for example, your main screen is 16:9 and secondary 4:3, or, like in my case, the secondary screen is in portrait mode, the default function creates a mess.

I didn’t find any example code anywhere, so I had to figure it out for myself. This is the lua code I ended up with:

  1. local function set_d_wallpaper()
  2.     themes_path = gears.filesystem.get_configuration_dir() .. "themes/dualhead/"
  3.     d_wallpaper = themes_path .. "right.jpg"
  4.     gears.wallpaper.maximized(d_wallpaper, 1, true)
  5.     d_wallpaper = themes_path .. "left.jpg"
  6.     gears.wallpaper.maximized(d_wallpaper, 2, true)
  7. end

Insert it after the original set_wallpaper(s)-function in rc.lua. After that, edit the two calls to set_wallpaper() below it to use set_d_wallpaper() instead. In my case, the secondary screen is to the left of the main screen, so adjust the above code accordingly to suit your layout.

Posted in Linux | Tagged , , , | Comments Off on Useful snippets #3: dual wallpapers on Awesome window manager

Useful snippets #2: rc.local support on systemd

Systemd-using Linuxes like Arch Linux does not generally support the old SysV init functions like rc.local. The support is easy to add, though.

Edit /usr/lib/systemd/system/rc-local.service:

  1. [Unit]
  2. Description=/etc/rc.local compatibility
  3.  
  4. [Service]
  5. Type=oneshot
  6. ExecStart=/etc/rc.local
  7. RemainAfterExit=yes
  8.  
  9. [Install]
  10. WantedBy=multi-user.target

Enable it:

systemctl enable rc-local.service

Original source: Raymii

Posted in Linux | Tagged , | Comments Off on Useful snippets #2: rc.local support on systemd

Installing Arch Linux on Raspberry Pi with WiFi-only networking

I made this post primarily for my own reference by combining several tutorials in the net and my own observations into one comprehensive tutorial, but I hope this can be for the benefit of other Arch Linux ARM users, too. Of course this tutorial applies as such only on Raspberry Pi models with WiFi: RPi Zero W, RPi 3A+, RPi 4B and so on.

All these instructions must be run as root from a Linux computer with a SD card reader, Windows is useless here. Replace sdX in the following instructions with the device name for the SD card as it appears on your computer.

  1. Start fdisk to partition the SD card:

    fdisk /dev/sdX
  2. At the fdisk prompt, delete old partitions and create a new one:
    1. Type o. This will clear out any partitions on the drive.
    2. Type p to list partitions. There should be no partitions left.
    3. Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector.
    4. Type t, then c to set the first partition to type W95 FAT32 (LBA).
    5. Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first and last sector.
    6. Write the partition table and exit by typing w.
  3. Create and mount the FAT filesystem:

    mkfs.vfat /dev/sdX1
    mkdir boot
    mount /dev/sdX1 boot
  4. Create and mount the ext4 filesystem:

    mkfs.ext4 /dev/sdX2
    mkdir root
    mount /dev/sdX2 root
  5. The root filesystem versions for different Raspberry Pi models are:
    • ArchLinuxARM-rpi-latest.tar.gz for Zero and old RPis
    • ArchLinuxARM-rpi-2-latest.tar.gz for RPi2s
    • ArchLinuxARM-rpi-3-latest.tar.gz for RPi3s
    • ArchLinuxARM-rpi-4-latest.tar.gz for RPi4s

    Download and extract the correct root filesystem:

    wget http://os.archlinuxarm.org/os/ArchLinuxARM-rpi-latest.tar.gz
    bsdtar -xpf ArchLinuxARM-rpi-latest.tar.gz -C root
    sync
  6. Move boot files to the first partition:

    mv root/boot/* boot
  7. Configure the system for WiFi networking by first editing root/etc/systemd/network/wlan0.network:

    1. [Match]
    2. Name=wlan0
    3.  
    4. [Network]
    5. DHCP=yes
  8. Then, replace SSID and PASS with the relevant ones for your WiFi network in the following wpa_supplicant configuration steps:

    wpa_passphrase "SSID" "PASS" > root/etc/wpa_supplicant/wpa_supplicant-wlan0.conf
    ln -s /usr/lib/systemd/system/wpa_supplicant@.service root/etc/systemd/system/multi-user.target.wants/wpa_supplicant@wlan0.service
  9. Unmount the two partitions:

    umount boot root
  10. Remove the SD card, insert it into the Raspberry Pi, and power on the device.
  11. SSH to the IP address given to the board by your router.
    • Login as the default user alarm with the password alarm.
    • Then su to root. The default root password is root.
  12. Initialize the pacman keyring and populate the Arch Linux ARM package signing keys:

    pacman-key --init
    pacman-key --populate archlinuxarm
  13. The default name resolution does not work with WiFi, so to have a working DNS you need to type in the following (Replace the nameserver IP address with one of your preference, if needed):

    systemctl stop systemd-resolved
    systemctl disable systemd-resolved
    rm /etc/resolv.conf
    echo "nameserver 1.1.1.1" > /etc/resolv.conf
  14. And finally, update the system:

    pacman -Syu
  15. If you install later networkmanager or equivalent, remember to undo step 8 before starting it for the first time to prevent networking issues:

    systemctl stop wpa_supplicant@wlan0.service
    systemctl disable wpa_supplicant@wlan0.service
    rm /etc/wpa_supplicant/wpa_supplicant-wlan0.conf
  16. Last, if you are using a RPi 4B, remember to update its firmware at the earliest possible opportunity to prevent issues with other hardware, please see here.

Now you can continue with normal Arch Linux installation guide!


Original sources: Arch Linux ARM / Ladvien

Posted in Linux | Tagged , , , | Comments Off on Installing Arch Linux on Raspberry Pi with WiFi-only networking

A new domain name and a new theme

Got a long overdue proper domain name for this site instead of relying on a dynamic DNS service. The new URL is:

figuregeek.eu

Please update your bookmarks!

Also, I had to change the theme. The previous “Pixiv Custom”-theme looked really nice, but it was an old, practically abandoned theme released in 2011 and never updated since; consequently it didn’t scale for mobile devices at all, and it wasn’t compatible with PHP 7, so it stopped partially working after I upgraded the server from PHP 5 to PHP 7. So here we are with a new, more minimalist theme… It’s a heavily modified “Twenty Ten”-theme. It may still need a bit more work, I’ll edit it when I have more time.

Posted in Linux | Tagged , , | Comments Off on A new domain name and a new theme

ALI PROJECT

Posti toi tänään kaksi uutta (ei uusinta, mutta minulle uutta) levyä ALI PROJECT’ilta:
Reijou Bara Zukan” (令嬢薔薇図鑑) ja “Violetta Operetta

AliProject

ALI PROJECT:

  • Laulu: Arika Takarano (宝野アリカ) – The Queen of Gothic Lolita
    (ikää 52v ja näyttää ja kuulostaa paremmalta kuin useimmat 30v nuoremmat…!)
  • Musiikki: Mikiya Katakura (片倉三起也)
  • Animesarjojen musiikkia: mm .hack//Roots, Rozen Maiden ja Another
Posted in Music | Tagged , , , | Comments Off on ALI PROJECT